Package br.gov.serpro.ouvidoria.controller.aprendizado

Examples of br.gov.serpro.ouvidoria.controller.aprendizado.BoletimCtrl


        request.setAttribute("titulo", request.getParameter("titulo"));
        request.setAttribute("texto", texto);

        // Recupera lista de boletins publicados
        BoletimCtrl defaultCtrl = new BoletimCtrl(getDaoFactory());

        Orgao org = this.getOrgao(request);
       
        List results = defaultCtrl.list(org, Boolean.TRUE);

        request.setAttribute("lstBoletins", results);       
        // Diretório do órgão para os boletins
        request.setAttribute("diretorio", this.getOrgao(request)
                .getConfiguracoes().getNomeDiretorioOrgao());       
View Full Code Here


  public ActionForward listar(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response)
      throws Exception {

    BoletimCtrl boletimCtrl = new BoletimCtrl(getDaoFactory());

    Boletim boletim = boletimCtrl.get(new Long(request
        .getParameter("idBoletim")));

    if (boletim == null) {
      request.setAttribute("zero", "true");
      return mapping.findForward("listar");
View Full Code Here

  public ActionForward distribuir(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response)
      throws Exception {

    HistoricoEnvioCtrl defaultCtrl = new HistoricoEnvioCtrl(getDaoFactory());
    BoletimCtrl boletimCtrl = new BoletimCtrl(getDaoFactory());

    HistoricoEnvio itemHistorico = new HistoricoEnvio();
    // Recupera o Funcionário logado
    Long funcionarioId = (Long) request.getSession().getAttribute(
        Constants.PA_FUNCIONARIO);

    FuncionarioCtrl funcionarioCtrl = new FuncionarioCtrl(getDaoFactory());

    Funcionario funcionario = (Funcionario) funcionarioCtrl
        .get(funcionarioId);
    Boletim boletim = boletimCtrl.get(new Long(request
        .getParameter("idBoletim")));

    itemHistorico.setListaEmails(request.getParameter("listaEmails"));
    itemHistorico.setFuncionario(funcionario);
    itemHistorico.setBoletim(boletim);
    itemHistorico.setDataEnvio(new Timestamp(System.currentTimeMillis()));

    String listaBCC = "";
    StringTokenizer st = new StringTokenizer(
        itemHistorico.getListaEmails(), ";");
    while (st.hasMoreTokens()) {
      listaBCC += st.nextToken().trim() + ";";
    }

    // retira o último ";"
    listaBCC = listaBCC.substring(0, listaBCC.length() - 1);

    String strCaminhoBoletim = boletimCtrl.getParametrosGerais()
        .getDiretorioContextoAplicacao()
        + this.getOrgao(request).getConfiguracoes()
            .getNomeDiretorioOrgao()
        + "/boletins/boletim_"
        + request.getParameter("idBoletim") + ".html";
   
    String domain = request.getScheme() + "://" + request.getServerName()
        + ":" + request.getServerPort() + "/";

    String urlBoletim = domain
        + this.getOrgao(request).getConfiguracoes()
            .getNomeDiretorioOrgao() + "/boletins/boletim_"
        + request.getParameter("idBoletim") + ".html";

    String htmlText = "<p>Caso n&atilde;o consiga vizualizar o boletim, utilize o endere&ccedil;o: <a href=\""
        + urlBoletim
        + "\" target=\"boletim\">"
        + urlBoletim
        + "</a></p><br>";

    try {
      FileInputStream file = new FileInputStream(strCaminhoBoletim);
      DataInputStream in = new DataInputStream(file);
      byte[] b = new byte[in.available()];
      in.readFully(b);
      in.close();

      final String result = new String(b, 0, b.length, "ISO-8859-15");

      htmlText += result
          + "<br><br><center>MENSAGEM AUTOM&Aacute;TICA: N&atilde;o responda &agrave; esta mensagem. "
          + "Se desejar entrar em contato, acesse novamente o sistema.</center><BR>";

      if (Utilitario.enviarEmail(boletimCtrl.getParametrosGerais()
          .getServidorSMTP(), this.getOrgao(request)
          .getConfiguracoes().getRemetenteEmail(), this.getOrgao(
          request).getConfiguracoes().getRemetenteEmail(), "",
          listaBCC, "Boletim: " + boletim.getNome(), htmlText)) {
        defaultCtrl.save(itemHistorico);
View Full Code Here

    public ActionForward listar(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {

        DynaActionForm _form = (DynaActionForm) form;
        BoletimCtrl defaultCtrl = new BoletimCtrl(getDaoFactory());

        Orgao org = this.getOrgao(request);
       
        List results = defaultCtrl.obterBoletinsFiltro(Utilitario
                .trataPlic(_form.getString("txtBusca")), _form
                .getString("txtPeriodoIni"), _form.getString("txtPeriodoFim"),
                org);

        request.setAttribute("listar", results);
View Full Code Here

        Boletim object = null;
        if (id == null || id.trim().length() == 0) {
            object = new Boletim();
        } else {
            BoletimCtrl defaultCtrl = new BoletimCtrl(getDaoFactory());
            object = defaultCtrl.get(new Long(id));
        }

        request.setAttribute("diretorio", this.getOrgao(request)
                .getConfiguracoes().getNomeDiretorioOrgao());
        request.setAttribute("object", object);
View Full Code Here

        final String cabecalho = request.getParameter("cabecalho");
        final String grafico = request.getParameter("grafico");
        final String tabela = request.getParameter("tabela");

        BoletimCtrl defaultCtrl = new BoletimCtrl(getDaoFactory());

        if (nome == null || nome.trim().length() == 0) {
            msgs.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(
                    "error.atualizarBoletim.nome"));
        }

        Integer num = null;
        try {
            if (numero != null && numero.trim().length() > 0) {
                num = new Integer(numero);
            } else {
                msgs.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(
                        "error.atualizarBoletim.numero"));
            }
        } catch (NumberFormatException nfe) {
            msgs.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(
                    "error.atualizarBoletim.numero"));
        }

        if (area == null || area.trim().length() == 0) {
            msgs.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(
                    "error.atualizarBoletim.area"));
        }

        if (telefone == null || telefone.trim().length() == 0) {
            msgs.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(
                    "error.atualizarBoletim.telefone"));
        }

        if (conteudo == null || conteudo.trim().length() == 0) {
            msgs.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(
                    "error.atualizarBoletim.conteudo"));
        }

        if (num != null
                && defaultCtrl.existeNumeroCadastrado(getOrgao(request), num)) {
            msgs.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(
                    "error.atualizarBoletim.chaveDuplicada"));
        }

        Boolean possuiCabecalho = Boolean.TRUE;
        if (cabecalho == null) {
            possuiCabecalho = Boolean.FALSE;
        }

        Boolean possuiGrafico = Boolean.TRUE;
        if (grafico == null) {
            possuiGrafico = Boolean.FALSE;
        }

        Boolean possuiTabela = Boolean.TRUE;
        if (tabela == null) {
            possuiTabela = Boolean.FALSE;
        }

//      Recupera o Funcionário logado
        Funcionario funcionario = (Funcionario) this.getFuncionario(request)
     
        Boletim boletim = defaultCtrl.gerar(getOrgao(request), funcionario,
                nome, num, area, telefone, conteudo, possuiCabecalho,
                possuiGrafico, possuiTabela);

        request.getSession().setAttribute(Constants.BOLETIM, boletim);       
       
View Full Code Here

            HttpServletRequest request, HttpServletResponse response)
            throws DaoException {

        ActionMessages msgs = new ActionMessages();

        BoletimCtrl defaultCtrl = new BoletimCtrl(getDaoFactory());

        Boletim boletim = (Boletim) request.getSession().getAttribute(
                Constants.BOLETIM);

        boolean erroLogica = false;
        try {
            defaultCtrl.save(boletim);

            final String html = request.getParameter("htmlBoletim");
            final String imgUrl = (String) request.getSession().getAttribute(
                    Constants.IMAGE_CHART);
            final String contextUrl = request.getContextPath();
           
            try {
                final String domain = request.getScheme()
                        + "://"
                                .concat(request.getServerName())
                                .concat(":")
                                .concat(String.valueOf(request.getServerPort()));
                 
                final TransientSessionStorage storage = new TransientSessionStorage();
                storage.init(this.getServlet().getServletContext());

                final String imgUrls = imgUrl;

                final int posI = imgUrls.indexOf("?") + 5;
                final int posF = imgUrls.indexOf("&", posI);

                final String imgId = imgUrls.substring(posI, posF);

                final ChartImage chartImages = storage.getChartImage(imgId,
                        request);

                defaultCtrl.criaArquivoBoletim(getOrgao(request), boletim,
                        html, chartImages.getBytes(), domain, contextUrl);

            } catch (CewolfException e1) {
                erroLogica = true;
                msgs.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(
View Full Code Here

            HttpServletRequest request, HttpServletResponse response)
            throws DaoException {

        DynaActionForm _form = (DynaActionForm) form;

        BoletimCtrl defaultCtrl = new BoletimCtrl(getDaoFactory());

        ActionMessages msgs = new ActionMessages();

        Boletim boletim = defaultCtrl.get(new Long(request.getParameter("id")));

        //Se estava true e virou false
        if (boletim.getPublicar().booleanValue()
                && _form.getString("publicar").length() == 0) {
            defaultCtrl.publicar(boletim.getId(), Boolean.FALSE);
        }

        //Se estava false e virou true
        if (!boletim.getPublicar().booleanValue()
                && _form.getString("publicar").compareToIgnoreCase("true") == 0) {
            defaultCtrl.publicar(boletim.getId(), Boolean.TRUE);
        }

        boletim = defaultCtrl.get(new Long(request.getParameter("id")));
        request.setAttribute("diretorio", this.getOrgao(request)
                .getConfiguracoes().getNomeDiretorioOrgao());
        request.setAttribute("object", boletim);
        request.setAttribute("function", request.getParameter("function"));
View Full Code Here

TOP

Related Classes of br.gov.serpro.ouvidoria.controller.aprendizado.BoletimCtrl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.