Search in sources :

Example 1 with TextNavigation

use of org.odftoolkit.odfdom.incubator.search.TextNavigation in project LAMSADE-tools by LAntoine.

the class PRESGenerator method main.

/**
	 * Create a PRES document
	 *
	 * @param source
	 * @param target
	 * @throws Exception
	 */
public static void main(String[] args) throws Exception {
    OdfTextDocument textdoc = OdfTextDocument.loadDocument("com/github/lamsadetools/setCoordinates/Premier_test_template.odt");
    /* Creation of search for every word needed to be replaced */
    TextNavigation searchN;
    TextNavigation searchP;
    TextNavigation searchG;
    TextNavigation searchE;
    TextNavigation searchT;
    searchN = new TextNavigation("NOMR", textdoc);
    searchP = new TextNavigation("PRENOMR", textdoc);
    searchG = new TextNavigation("GRADER", textdoc);
    searchE = new TextNavigation("TEMPSPARTIELLER", textdoc);
    searchT = new TextNavigation("TEMPSPLEINR", textdoc);
    /* Verify all the word and replace them by the value */
    while (searchN.hasNext()) {
    // TextSelection item = (TextSelection) searchN.nextSelection();
    // item.replaceWith("Test");
    }
    while (searchP.hasNext()) {
    // TextSelection item = (TextSelection) searchP.nextSelection();
    // item.replaceWith("Test");
    }
    while (searchG.hasNext()) {
    // TextSelection item = (TextSelection) searchG.nextSelection();
    // item.replaceWith("Test");
    }
    while (searchE.hasNext()) {
    // TextSelection item = (TextSelection) searchE.nextSelection();
    // item.replaceWith("Test");
    }
    while (searchT.hasNext()) {
    // TextSelection item = (TextSelection) searchT.nextSelection();
    // item.replaceWith("Test");
    }
}
Also used : OdfTextDocument(org.odftoolkit.odfdom.doc.OdfTextDocument) TextNavigation(org.odftoolkit.odfdom.incubator.search.TextNavigation)

Example 2 with TextNavigation

use of org.odftoolkit.odfdom.incubator.search.TextNavigation in project trainning by fernandotomasio.

the class PLN006ODF method makeReport.

@Override
public void makeReport() {
    try {
        PlanningService service = (PlanningService) services.get("planningService");
        Long solicitacaoId = (Long) params.get("solicitacaoId");
        SolicitacaoPlamensDTO solicitacao = service.findSolicitacaoPlamens(solicitacaoId);
        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
        // String path = classLoader.getResource("fic.odt").getPath();
        // 
        odt = OdfTextDocument.loadDocument(classLoader.getResourceAsStream("fic.odt"));
        TextNavigation tipoBrasil;
        tipoBrasil = new TextNavigation("VAR_BR", odt);
        if (tipoBrasil.hasNext()) {
            TextSelection item = (TextSelection) tipoBrasil.getCurrentItem();
            if (solicitacao.getTipo().equals("BRASIL")) {
                item.replaceWith(" X ");
            } else {
                item.replaceWith("   ");
            }
        }
        TextNavigation tipoExterior;
        tipoExterior = new TextNavigation("VAR_EXT", odt);
        if (tipoExterior.hasNext()) {
            TextSelection item = (TextSelection) tipoExterior.getCurrentItem();
            if (solicitacao.getTipo().equals("EXTERIOR")) {
                item.replaceWith(" X ");
            } else {
                item.replaceWith("   ");
            }
        }
        TextNavigation ano;
        ano = new TextNavigation("VARIAVEL_ANO", odt);
        if (ano.hasNext()) {
            TextSelection item = (TextSelection) ano.getCurrentItem();
            item.replaceWith(String.valueOf(solicitacao.getAno()));
        }
        TextNavigation solicitante;
        solicitante = new TextNavigation("VARIAVEL_SOLICITANTE", odt);
        if (solicitante.hasNext()) {
            TextSelection item = (TextSelection) solicitante.getCurrentItem();
            if (solicitacao.getOrganizacaoSolicitante().getSigla() != null) {
                item.replaceWith(solicitacao.getOrganizacaoSolicitante().getSigla().toUpperCase());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation proponente;
        proponente = new TextNavigation("VARIAVEL_PROPONENTE", odt);
        if (proponente.hasNext()) {
            TextSelection item = (TextSelection) proponente.getCurrentItem();
            if (solicitacao.getOrganizacaoProponente() != null) {
                item.replaceWith(solicitacao.getOrganizacaoProponente().getSigla().toUpperCase());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation titulo;
        titulo = new TextNavigation("VARIAVEL_TITULO", odt);
        if (titulo.hasNext()) {
            TextSelection item = (TextSelection) titulo.getCurrentItem();
            if (solicitacao.getCurso() != null) {
                item.replaceWith(solicitacao.getCurso().toUpperCase());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation local;
        local = new TextNavigation("VARIAVEL_LOCAL", odt);
        if (local.hasNext()) {
            TextSelection item = (TextSelection) local.getCurrentItem();
            if (solicitacao.getLocal() != null) {
                item.replaceWith(solicitacao.getLocal().toUpperCase());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation cidade;
        cidade = new TextNavigation("VARIAVEL_CIDADE", odt);
        if (cidade.hasNext()) {
            TextSelection item = (TextSelection) cidade.getCurrentItem();
            if (solicitacao.getCidade() != null) {
                item.replaceWith(solicitacao.getCidade().toUpperCase());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation estado;
        estado = new TextNavigation("VARIAVEL_ESTADO", odt);
        if (estado.hasNext()) {
            TextSelection item = (TextSelection) estado.getCurrentItem();
            if (solicitacao.getEstado() != null) {
                item.replaceWith(solicitacao.getEstado().toUpperCase());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation pais;
        pais = new TextNavigation("VARIAVEL_PAIS", odt);
        if (pais.hasNext()) {
            TextSelection item = (TextSelection) pais.getCurrentItem();
            if (solicitacao.getPais() != null) {
                item.replaceWith(solicitacao.getPais().toUpperCase());
            } else {
                item.replaceWith("");
            }
        }
        // odt.save(os);
        TextNavigation dataInicio;
        dataInicio = new TextNavigation("VARIAVEL_DATA_INICIO", odt);
        String dataInicioField = "NÃO DEFINIDA";
        if (solicitacao.getDataInicioFormatted() != null) {
            dataInicioField = solicitacao.getDataInicioFormatted().toUpperCase();
        }
        if (dataInicio.hasNext()) {
            TextSelection item = (TextSelection) dataInicio.getCurrentItem();
            item.replaceWith(dataInicioField);
        }
        String dataTerminoField = "NÃO DEFINIDA";
        if (solicitacao.getDataTerminoFormatted() != null) {
            dataTerminoField = solicitacao.getDataTerminoFormatted().toUpperCase();
        }
        TextNavigation dataTermino;
        dataTermino = new TextNavigation("VARIAVEL_DATA_TERMINO", odt);
        if (dataTermino.hasNext()) {
            TextSelection item = (TextSelection) dataTermino.getCurrentItem();
            item.replaceWith(dataTerminoField);
        }
        TextNavigation duracao;
        duracao = new TextNavigation("VARIAVEL_DURACAO", odt);
        if (duracao.hasNext()) {
            TextSelection item = (TextSelection) duracao.getCurrentItem();
            item.replaceWith(String.valueOf(solicitacao.getDuracao()) + " dia(s)");
        }
        TextNavigation cargaHoraria;
        cargaHoraria = new TextNavigation("VARIAVEL_CARGA_HORARIA", odt);
        if (cargaHoraria.hasNext()) {
            TextSelection item = (TextSelection) cargaHoraria.getCurrentItem();
            if (solicitacao.getCargaHoraria() != null) {
                item.replaceWith(solicitacao.getCargaHoraria().toUpperCase());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation objetivos;
        objetivos = new TextNavigation("VARIAVEL_OBJETIVOS", odt);
        if (objetivos.hasNext()) {
            TextSelection item = (TextSelection) objetivos.getCurrentItem();
            if (solicitacao.getObjetivos() != null) {
                item.replaceWith(solicitacao.getObjetivos().toUpperCase());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation linhaPesquisa;
        linhaPesquisa = new TextNavigation("VARIAVEL_LINHA_PESQUISA", odt);
        if (linhaPesquisa.hasNext()) {
            TextSelection item = (TextSelection) linhaPesquisa.getCurrentItem();
            if (solicitacao.getAreaPesquisa() != null) {
                item.replaceWith(solicitacao.getAreaPesquisa().toUpperCase());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation existsSimilarSim;
        existsSimilarSim = new TextNavigation("VAR_SS", odt);
        if (existsSimilarSim.hasNext()) {
            TextSelection item = (TextSelection) existsSimilarSim.getCurrentItem();
            if (solicitacao.isExistenteSimilar()) {
                item.replaceWith(" X ");
            } else {
                item.replaceWith("   ");
            }
        }
        TextNavigation existsSimilarNao;
        existsSimilarNao = new TextNavigation("VAR_SN", odt);
        if (existsSimilarNao.hasNext()) {
            TextSelection item = (TextSelection) existsSimilarNao.getCurrentItem();
            if (solicitacao.isExistenteSimilar()) {
                item.replaceWith("   ");
            } else {
                item.replaceWith(" X ");
            }
        }
        TextNavigation similarDescricao;
        similarDescricao = new TextNavigation("VARIAVEL_SIMILAR_DESCRICAO", odt);
        if (similarDescricao.hasNext()) {
            TextSelection item = (TextSelection) similarDescricao.getCurrentItem();
            if (solicitacao.getDescricaoSimilar() != null) {
                item.replaceWith(solicitacao.getDescricaoSimilar().toUpperCase());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation assuntosMinistrados;
        assuntosMinistrados = new TextNavigation("VARIAVEL_ASSUNTOS_MINISTRADOS", odt);
        if (assuntosMinistrados.hasNext()) {
            TextSelection item = (TextSelection) assuntosMinistrados.getCurrentItem();
            if (solicitacao.getAssuntosMinistrados() != null) {
                item.replaceWith(solicitacao.getAssuntosMinistrados().toUpperCase());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation missoesRealizadas;
        missoesRealizadas = new TextNavigation("VARIAVEL_MISSOES_REALIZADAS", odt);
        if (missoesRealizadas.hasNext()) {
            TextSelection item = (TextSelection) missoesRealizadas.getCurrentItem();
            if (solicitacao.getQuantidadeMissoesSemelhantes() != null) {
                item.replaceWith(solicitacao.getQuantidadeMissoesSemelhantes().toUpperCase());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation grauImportanciaImprescindivel;
        grauImportanciaImprescindivel = new TextNavigation("VAR_IMP_I", odt);
        if (grauImportanciaImprescindivel.hasNext()) {
            TextSelection item = (TextSelection) grauImportanciaImprescindivel.getCurrentItem();
            if (solicitacao.getGrauImportancia().equals("IMPRESCINDÍVEL")) {
                item.replaceWith(" X ");
            } else {
                item.replaceWith("   ");
            }
        }
        TextNavigation grauImportanciaNecessario;
        grauImportanciaNecessario = new TextNavigation("VAR_IMP_N", odt);
        if (grauImportanciaNecessario.hasNext()) {
            TextSelection item = (TextSelection) grauImportanciaNecessario.getCurrentItem();
            if (solicitacao.getGrauImportancia().equals("NECESSÁRIO")) {
                item.replaceWith(" X ");
            } else {
                item.replaceWith("   ");
            }
        }
        TextNavigation grauImpotanciaDesejavel;
        grauImpotanciaDesejavel = new TextNavigation("VAR_IMP_D", odt);
        if (grauImpotanciaDesejavel.hasNext()) {
            TextSelection item = (TextSelection) grauImpotanciaDesejavel.getCurrentItem();
            if (solicitacao.getGrauImportancia().equals("DESEJÁVEL")) {
                item.replaceWith(" X ");
            } else {
                item.replaceWith("   ");
            }
        }
        TextNavigation grauImportanciaDescricao;
        grauImportanciaDescricao = new TextNavigation("VARIAVEL_GRAU_IMPORTANCIA", odt);
        if (grauImportanciaDescricao.hasNext()) {
            TextSelection item = (TextSelection) grauImportanciaDescricao.getCurrentItem();
            if (solicitacao.getGrauImportanciaDescricao() != null) {
                item.replaceWith(solicitacao.getGrauImportanciaDescricao().toUpperCase());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation preRequisitos;
        preRequisitos = new TextNavigation("VARIAVEL_PRE_REQUISITOS", odt);
        if (preRequisitos.hasNext()) {
            TextSelection item = (TextSelection) preRequisitos.getCurrentItem();
            if (solicitacao.getPreRequisitos() != null) {
                item.replaceWith(solicitacao.getPreRequisitos().toUpperCase());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation posto;
        posto = new TextNavigation("VARIAVEL_POSTO", odt);
        if (posto.hasNext()) {
            TextSelection item = (TextSelection) posto.getCurrentItem();
            if (solicitacao.getPostoIndicados() != null) {
                item.replaceWith(solicitacao.getPostoIndicados().toUpperCase());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation vagas;
        vagas = new TextNavigation("VARIAVEL_VAGAS", odt);
        if (vagas.hasNext()) {
            TextSelection item = (TextSelection) vagas.getCurrentItem();
            if (solicitacao.getQuantidadeVagas() != null) {
                item.replaceWith(solicitacao.getQuantidadeVagas().toUpperCase());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation destino;
        destino = new TextNavigation("VARIAVEL_DESTINO", odt);
        if (destino.hasNext()) {
            TextSelection item = (TextSelection) destino.getCurrentItem();
            if (solicitacao.getDestinoAposMissao() != null) {
                item.replaceWith(solicitacao.getDestinoAposMissao().toUpperCase());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation funcao;
        funcao = new TextNavigation("VARIAVEL_FUNCAO", odt);
        if (funcao.hasNext()) {
            TextSelection item = (TextSelection) funcao.getCurrentItem();
            if (solicitacao.getFuncaoAposMissao() != null) {
                item.replaceWith(solicitacao.getFuncaoAposMissao().toUpperCase());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation capacitacao;
        capacitacao = new TextNavigation("VARIAVEL_CAPACITACAO", odt);
        if (capacitacao.hasNext()) {
            TextSelection item = (TextSelection) capacitacao.getCurrentItem();
            if (solicitacao.getCapacitacaoDesejada() != null) {
                item.replaceWith(solicitacao.getCapacitacaoDesejada().toUpperCase());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation plano;
        plano = new TextNavigation("VARIAVEL_PLANO_APLICACAO", odt);
        if (plano.hasNext()) {
            TextSelection item = (TextSelection) plano.getCurrentItem();
            if (solicitacao.getPlanoAplicacao() != null) {
                item.replaceWith(solicitacao.getPlanoAplicacao().toUpperCase());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation justificativa;
        justificativa = new TextNavigation("VARIAVEL_JUSTIFICATIVA", odt);
        if (justificativa.hasNext()) {
            TextSelection item = (TextSelection) justificativa.getCurrentItem();
            if (solicitacao.getJustificativa() != null) {
                item.replaceWith(solicitacao.getJustificativa().toUpperCase());
            } else {
                item.replaceWith("");
            }
        }
        // AJUDA DE CUSTO
        TextNavigation ajdBR3;
        ajdBR3 = new TextNavigation("VAR_R_AJD3", odt);
        if (ajdBR3.hasNext()) {
            TextSelection item = (TextSelection) ajdBR3.getCurrentItem();
            if (solicitacao.getTipo().equals("BRASIL") && solicitacao.getAjudaCusto3Formatted() != null) {
                item.replaceWith(solicitacao.getAjudaCusto3Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation adjUS3;
        adjUS3 = new TextNavigation("VAR_U_AJD3", odt);
        if (adjUS3.hasNext()) {
            TextSelection item = (TextSelection) adjUS3.getCurrentItem();
            if (solicitacao.getTipo().equals("EXTERIOR") && solicitacao.getAjudaCusto3Formatted() != null) {
                item.replaceWith(solicitacao.getAjudaCusto3Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation ajdBR2;
        ajdBR2 = new TextNavigation("VAR_R_AJD2", odt);
        if (ajdBR2.hasNext()) {
            TextSelection item = (TextSelection) ajdBR2.getCurrentItem();
            if (solicitacao.getTipo().equals("BRASIL") && solicitacao.getAjudaCusto2Formatted() != null) {
                item.replaceWith(solicitacao.getAjudaCusto2Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation adjUS2;
        adjUS2 = new TextNavigation("VAR_U_AJD2", odt);
        if (adjUS2.hasNext()) {
            TextSelection item = (TextSelection) adjUS2.getCurrentItem();
            if (solicitacao.getTipo().equals("EXTERIOR") && solicitacao.getAjudaCusto2Formatted() != null) {
                item.replaceWith(solicitacao.getAjudaCusto2Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation ajdBR1;
        ajdBR1 = new TextNavigation("VAR_R_AJD1", odt);
        if (ajdBR1.hasNext()) {
            TextSelection item = (TextSelection) ajdBR1.getCurrentItem();
            if (solicitacao.getTipo().equals("BRASIL") && solicitacao.getAjudaCusto1Formatted() != null) {
                item.replaceWith(solicitacao.getAjudaCusto1Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation adjUS1;
        adjUS1 = new TextNavigation("VAR_U_AJD1", odt);
        if (adjUS1.hasNext()) {
            TextSelection item = (TextSelection) adjUS1.getCurrentItem();
            if (solicitacao.getTipo().equals("EXTERIOR") && solicitacao.getAjudaCusto1Formatted() != null) {
                item.replaceWith(solicitacao.getAjudaCusto1Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation ajdBR;
        ajdBR = new TextNavigation("VAR_R_AJD", odt);
        if (ajdBR.hasNext()) {
            TextSelection item = (TextSelection) ajdBR.getCurrentItem();
            if (solicitacao.getTipo().equals("BRASIL") && solicitacao.getAjudaCustoFormatted() != null) {
                item.replaceWith(solicitacao.getAjudaCustoFormatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation adjUS;
        adjUS = new TextNavigation("VAR_U_AJD", odt);
        if (adjUS.hasNext()) {
            TextSelection item = (TextSelection) adjUS.getCurrentItem();
            if (solicitacao.getTipo().equals("EXTERIOR") && solicitacao.getAjudaCustoFormatted() != null) {
                item.replaceWith(solicitacao.getAjudaCustoFormatted());
            } else {
                item.replaceWith("");
            }
        }
        // SALARIO
        TextNavigation salario3BR;
        salario3BR = new TextNavigation("VAR_R_SAL3", odt);
        if (salario3BR.hasNext()) {
            TextSelection item = (TextSelection) salario3BR.getCurrentItem();
            if (solicitacao.getTipo().equals("BRASIL") && solicitacao.getSalario3Formatted() != null) {
                item.replaceWith(solicitacao.getSalario3Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation salarioUS3;
        salarioUS3 = new TextNavigation("VAR_U_SAL3", odt);
        if (salarioUS3.hasNext()) {
            TextSelection item = (TextSelection) salarioUS3.getCurrentItem();
            if (solicitacao.getTipo().equals("EXTERIOR") && solicitacao.getSalario3Formatted() != null) {
                item.replaceWith(solicitacao.getSalario3Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation salario2BR;
        salario2BR = new TextNavigation("VAR_R_SAL2", odt);
        if (salario2BR.hasNext()) {
            TextSelection item = (TextSelection) salario2BR.getCurrentItem();
            if (solicitacao.getTipo().equals("BRASIL") && solicitacao.getSalario2Formatted() != null) {
                item.replaceWith(solicitacao.getSalario2Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation salarioUS2;
        salarioUS2 = new TextNavigation("VAR_U_SAL2" + "", odt);
        if (salarioUS2.hasNext()) {
            TextSelection item = (TextSelection) salarioUS2.getCurrentItem();
            if (solicitacao.getTipo().equals("EXTERIOR") && solicitacao.getSalario2Formatted() != null) {
                item.replaceWith(solicitacao.getSalario2Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation salario1BR;
        salario1BR = new TextNavigation("VAR_R_SAL1", odt);
        if (salario1BR.hasNext()) {
            TextSelection item = (TextSelection) salario1BR.getCurrentItem();
            if (solicitacao.getTipo().equals("BRASIL") && solicitacao.getSalario1Formatted() != null) {
                item.replaceWith(solicitacao.getSalario1Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation salarioUS1;
        salarioUS1 = new TextNavigation("VAR_U_SAL1", odt);
        if (salarioUS1.hasNext()) {
            TextSelection item = (TextSelection) salarioUS1.getCurrentItem();
            if (solicitacao.getTipo().equals("EXTERIOR") && solicitacao.getSalario1Formatted() != null) {
                item.replaceWith(solicitacao.getSalario1Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation salarioBR;
        salarioBR = new TextNavigation("VAR_R_SAL", odt);
        if (salarioBR.hasNext()) {
            TextSelection item = (TextSelection) salarioBR.getCurrentItem();
            if (solicitacao.getTipo().equals("BRASIL") && solicitacao.getSalarioFormatted() != null) {
                item.replaceWith(solicitacao.getSalarioFormatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation salarioUS;
        salarioUS = new TextNavigation("VAR_U_SAL", odt);
        if (salarioUS.hasNext()) {
            TextSelection item = (TextSelection) salarioUS.getCurrentItem();
            if (solicitacao.getTipo().equals("EXTERIOR") && solicitacao.getSalarioFormatted() != null) {
                item.replaceWith(solicitacao.getSalarioFormatted());
            } else {
                item.replaceWith("");
            }
        }
        // MORADIA
        TextNavigation moradia3BR;
        moradia3BR = new TextNavigation("VAR_R_MOR3", odt);
        if (moradia3BR.hasNext()) {
            TextSelection item = (TextSelection) moradia3BR.getCurrentItem();
            if (solicitacao.getTipo().equals("BRASIL") && solicitacao.getAuxilioMoradia3Formatted() != null) {
                item.replaceWith(solicitacao.getAuxilioMoradia3Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation moradiaUS3;
        moradiaUS3 = new TextNavigation("VAR_U_MOR3", odt);
        if (moradiaUS3.hasNext()) {
            TextSelection item = (TextSelection) moradiaUS3.getCurrentItem();
            if (solicitacao.getTipo().equals("EXTERIOR") && solicitacao.getAuxilioMoradia3Formatted() != null) {
                item.replaceWith(solicitacao.getAuxilioMoradia3Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation moradia2BR;
        moradia2BR = new TextNavigation("VAR_R_MOR2", odt);
        if (moradia2BR.hasNext()) {
            TextSelection item = (TextSelection) moradia2BR.getCurrentItem();
            if (solicitacao.getTipo().equals("BRASIL") && solicitacao.getAuxilioMoradia2Formatted() != null) {
                item.replaceWith(solicitacao.getAuxilioMoradia2Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation moradiaUS2;
        moradiaUS2 = new TextNavigation("VAR_U_MOR2" + "", odt);
        if (moradiaUS2.hasNext()) {
            TextSelection item = (TextSelection) moradiaUS2.getCurrentItem();
            if (solicitacao.getTipo().equals("EXTERIOR") && solicitacao.getAuxilioMoradia2Formatted() != null) {
                item.replaceWith(solicitacao.getAuxilioMoradia2Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation moradia1BR;
        moradia1BR = new TextNavigation("VAR_R_MOR1", odt);
        if (moradia1BR.hasNext()) {
            TextSelection item = (TextSelection) moradia1BR.getCurrentItem();
            if (solicitacao.getTipo().equals("BRASIL") && solicitacao.getAuxilioMoradia1Formatted() != null) {
                item.replaceWith(solicitacao.getAuxilioMoradia1Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation moradiaUS1;
        moradiaUS1 = new TextNavigation("VAR_U_MOR1", odt);
        if (moradiaUS1.hasNext()) {
            TextSelection item = (TextSelection) moradiaUS1.getCurrentItem();
            if (solicitacao.getTipo().equals("EXTERIOR") && solicitacao.getAuxilioMoradia1Formatted() != null) {
                item.replaceWith(solicitacao.getAuxilioMoradia1Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation moradiaBR;
        moradiaBR = new TextNavigation("VAR_R_MOR", odt);
        if (moradiaBR.hasNext()) {
            TextSelection item = (TextSelection) moradiaBR.getCurrentItem();
            if (solicitacao.getTipo().equals("BRASIL") && solicitacao.getAuxilioMoradiaFormatted() != null) {
                item.replaceWith(solicitacao.getAuxilioMoradiaFormatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation moradiaUS;
        moradiaUS = new TextNavigation("VAR_U_MOR", odt);
        if (moradiaUS.hasNext()) {
            TextSelection item = (TextSelection) moradiaUS.getCurrentItem();
            if (solicitacao.getTipo().equals("EXTERIOR") && solicitacao.getAuxilioMoradiaFormatted() != null) {
                item.replaceWith(solicitacao.getAuxilioMoradiaFormatted());
            } else {
                item.replaceWith("");
            }
        }
        // BAGAGEM
        TextNavigation bagagem3BR;
        bagagem3BR = new TextNavigation("VAR_R_BAG3", odt);
        if (bagagem3BR.hasNext()) {
            TextSelection item = (TextSelection) bagagem3BR.getCurrentItem();
            if (solicitacao.getTipo().equals("BRASIL") && solicitacao.getBagagem3Formatted() != null) {
                item.replaceWith(solicitacao.getBagagem3Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation bagagemUS3;
        bagagemUS3 = new TextNavigation("VAR_U_BAG3", odt);
        if (bagagemUS3.hasNext()) {
            TextSelection item = (TextSelection) bagagemUS3.getCurrentItem();
            if (solicitacao.getTipo().equals("EXTERIOR") && solicitacao.getBagagem3Formatted() != null) {
                item.replaceWith(solicitacao.getBagagem3Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation bagagem2BR;
        bagagem2BR = new TextNavigation("VAR_R_BAG2", odt);
        if (bagagem2BR.hasNext()) {
            TextSelection item = (TextSelection) bagagem2BR.getCurrentItem();
            if (solicitacao.getTipo().equals("BRASIL") && solicitacao.getBagagem2Formatted() != null) {
                item.replaceWith(solicitacao.getBagagem2Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation bagagemUS2;
        bagagemUS2 = new TextNavigation("VAR_U_BAG2" + "", odt);
        if (bagagemUS2.hasNext()) {
            TextSelection item = (TextSelection) bagagemUS2.getCurrentItem();
            if (solicitacao.getTipo().equals("EXTERIOR") && solicitacao.getBagagem2Formatted() != null) {
                item.replaceWith(solicitacao.getBagagem2Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation bagagem1BR;
        bagagem1BR = new TextNavigation("VAR_R_BAG1", odt);
        if (bagagem1BR.hasNext()) {
            TextSelection item = (TextSelection) bagagem1BR.getCurrentItem();
            if (solicitacao.getTipo().equals("BRASIL") && solicitacao.getBagagem1Formatted() != null) {
                item.replaceWith(solicitacao.getBagagem1Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation bagagemUS1;
        bagagemUS1 = new TextNavigation("VAR_U_BAG1", odt);
        if (bagagemUS1.hasNext()) {
            TextSelection item = (TextSelection) bagagemUS1.getCurrentItem();
            if (solicitacao.getTipo().equals("EXTERIOR") && solicitacao.getBagagem1Formatted() != null) {
                item.replaceWith(solicitacao.getBagagem1Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation bagagemBR;
        bagagemBR = new TextNavigation("VAR_R_BAG", odt);
        if (bagagemBR.hasNext()) {
            TextSelection item = (TextSelection) bagagemBR.getCurrentItem();
            if (solicitacao.getTipo().equals("BRASIL") && solicitacao.getBagagemFormatted() != null) {
                item.replaceWith(solicitacao.getBagagemFormatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation bagagemUS;
        bagagemUS = new TextNavigation("VAR_U_BAG", odt);
        if (bagagemUS.hasNext()) {
            TextSelection item = (TextSelection) bagagemUS.getCurrentItem();
            if (solicitacao.getTipo().equals("EXTERIOR") && solicitacao.getBagagemFormatted() != null) {
                item.replaceWith(solicitacao.getBagagemFormatted());
            } else {
                item.replaceWith("");
            }
        }
        // DIÁRIAS
        TextNavigation diarias3BR;
        diarias3BR = new TextNavigation("VAR_R_DRI3", odt);
        if (diarias3BR.hasNext()) {
            TextSelection item = (TextSelection) diarias3BR.getCurrentItem();
            if (solicitacao.getTipo().equals("BRASIL") && solicitacao.getDiarias3Formatted() != null) {
                item.replaceWith(solicitacao.getDiarias3Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation diariasUS3;
        diariasUS3 = new TextNavigation("VAR_U_DRI3", odt);
        if (diariasUS3.hasNext()) {
            TextSelection item = (TextSelection) diariasUS3.getCurrentItem();
            if (solicitacao.getTipo().equals("EXTERIOR") && solicitacao.getDiarias3Formatted() != null) {
                item.replaceWith(solicitacao.getDiarias3Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation diarias2BR;
        diarias2BR = new TextNavigation("VAR_R_DRI2", odt);
        if (diarias2BR.hasNext()) {
            TextSelection item = (TextSelection) diarias2BR.getCurrentItem();
            if (solicitacao.getTipo().equals("BRASIL") && solicitacao.getDiarias2Formatted() != null) {
                item.replaceWith(solicitacao.getDiarias2Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation diariasUS2;
        diariasUS2 = new TextNavigation("VAR_U_DRI2" + "", odt);
        if (diariasUS2.hasNext()) {
            TextSelection item = (TextSelection) diariasUS2.getCurrentItem();
            if (solicitacao.getTipo().equals("EXTERIOR") && solicitacao.getDiarias2Formatted() != null) {
                item.replaceWith(solicitacao.getDiarias2Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation diarias1BR;
        diarias1BR = new TextNavigation("VAR_R_DRI1", odt);
        if (diarias1BR.hasNext()) {
            TextSelection item = (TextSelection) diarias1BR.getCurrentItem();
            if (solicitacao.getTipo().equals("BRASIL") && solicitacao.getDiarias1Formatted() != null) {
                item.replaceWith(solicitacao.getDiarias1Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation diariasUS1;
        diariasUS1 = new TextNavigation("VAR_U_DRI1", odt);
        if (diariasUS1.hasNext()) {
            TextSelection item = (TextSelection) diariasUS1.getCurrentItem();
            if (solicitacao.getTipo().equals("EXTERIOR") && solicitacao.getDiarias1Formatted() != null) {
                item.replaceWith(solicitacao.getDiarias1Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation diariasBR;
        diariasBR = new TextNavigation("VAR_R_DRI", odt);
        if (diariasBR.hasNext()) {
            TextSelection item = (TextSelection) diariasBR.getCurrentItem();
            if (solicitacao.getTipo().equals("BRASIL") && solicitacao.getDiariasFormatted() != null) {
                item.replaceWith(solicitacao.getDiariasFormatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation diariasUS;
        diariasUS = new TextNavigation("VAR_U_DRI", odt);
        if (diariasUS.hasNext()) {
            TextSelection item = (TextSelection) diariasUS.getCurrentItem();
            if (solicitacao.getTipo().equals("EXTERIOR") && solicitacao.getDiariasFormatted() != null) {
                item.replaceWith(solicitacao.getDiariasFormatted());
            } else {
                item.replaceWith("");
            }
        }
        // TRANSPORTE PESSOAL
        TextNavigation transporte3BR;
        transporte3BR = new TextNavigation("VAR_R_TRP3", odt);
        if (transporte3BR.hasNext()) {
            TextSelection item = (TextSelection) transporte3BR.getCurrentItem();
            if (solicitacao.getTipo().equals("BRASIL") && solicitacao.getTransportePessoal3Formatted() != null) {
                item.replaceWith(solicitacao.getTransportePessoal3Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation transporteUS3;
        transporteUS3 = new TextNavigation("VAR_U_TRP3", odt);
        if (transporteUS3.hasNext()) {
            TextSelection item = (TextSelection) transporteUS3.getCurrentItem();
            if (solicitacao.getTipo().equals("EXTERIOR") && solicitacao.getTransportePessoal3Formatted() != null) {
                item.replaceWith(solicitacao.getTransportePessoal3Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation transporte2BR;
        transporte2BR = new TextNavigation("VAR_R_TRP2", odt);
        if (transporte2BR.hasNext()) {
            TextSelection item = (TextSelection) transporte2BR.getCurrentItem();
            if (solicitacao.getTipo().equals("BRASIL") && solicitacao.getTransportePessoal2Formatted() != null) {
                item.replaceWith(solicitacao.getTransportePessoal2Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation transporteUS2;
        transporteUS2 = new TextNavigation("VAR_U_TRP2" + "", odt);
        if (transporteUS2.hasNext()) {
            TextSelection item = (TextSelection) transporteUS2.getCurrentItem();
            if (solicitacao.getTipo().equals("EXTERIOR") && solicitacao.getTransportePessoal2Formatted() != null) {
                item.replaceWith(solicitacao.getTransportePessoal2Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation tranporte1BR;
        tranporte1BR = new TextNavigation("VAR_R_TRP1", odt);
        if (tranporte1BR.hasNext()) {
            TextSelection item = (TextSelection) tranporte1BR.getCurrentItem();
            if (solicitacao.getTipo().equals("BRASIL") && solicitacao.getTransportePessoal1Formatted() != null) {
                item.replaceWith(solicitacao.getTransportePessoal1Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation transporteUS1;
        transporteUS1 = new TextNavigation("VAR_U_TRP1", odt);
        if (transporteUS1.hasNext()) {
            TextSelection item = (TextSelection) transporteUS1.getCurrentItem();
            if (solicitacao.getTipo().equals("EXTERIOR") && solicitacao.getTransportePessoal1Formatted() != null) {
                item.replaceWith(solicitacao.getTransportePessoal1Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation transporteBR;
        transporteBR = new TextNavigation("VAR_R_TRP", odt);
        if (transporteBR.hasNext()) {
            TextSelection item = (TextSelection) transporteBR.getCurrentItem();
            if (solicitacao.getTipo().equals("BRASIL") && solicitacao.getTransportePessoalFormatted() != null) {
                item.replaceWith(solicitacao.getTransportePessoalFormatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation transporteUS;
        transporteUS = new TextNavigation("VAR_U_TRP", odt);
        if (transporteUS.hasNext()) {
            TextSelection item = (TextSelection) transporteUS.getCurrentItem();
            if (solicitacao.getTipo().equals("EXTERIOR") && solicitacao.getTransportePessoalFormatted() != null) {
                item.replaceWith(solicitacao.getTransportePessoalFormatted());
            } else {
                item.replaceWith("");
            }
        }
        // TRANSPORTE PESSOAL - OUTRAS FONTES
        TextNavigation transporteOutra3BR;
        transporteOutra3BR = new TextNavigation("VAR_R_TRO3", odt);
        if (transporteOutra3BR.hasNext()) {
            TextSelection item = (TextSelection) transporteOutra3BR.getCurrentItem();
            if (solicitacao.getTipo().equals("BRASIL") && solicitacao.getTransportePessoalOutraFonte3Formatted() != null) {
                item.replaceWith(solicitacao.getTransportePessoalOutraFonte3Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation transporteOutraUS3;
        transporteOutraUS3 = new TextNavigation("VAR_U_TRO3", odt);
        if (transporteOutraUS3.hasNext()) {
            TextSelection item = (TextSelection) transporteOutraUS3.getCurrentItem();
            if (solicitacao.getTipo().equals("EXTERIOR") && solicitacao.getTransportePessoalOutraFonte3Formatted() != null) {
                item.replaceWith(solicitacao.getTransportePessoalOutraFonte3Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation transporteOutra2BR;
        transporteOutra2BR = new TextNavigation("VAR_R_TRO2", odt);
        if (transporteOutra2BR.hasNext()) {
            TextSelection item = (TextSelection) transporteOutra2BR.getCurrentItem();
            if (solicitacao.getTipo().equals("BRASIL") && solicitacao.getTransportePessoalOutraFonte2Formatted() != null) {
                item.replaceWith(solicitacao.getTransportePessoalOutraFonte2Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation transporteOutraUS2;
        transporteOutraUS2 = new TextNavigation("VAR_U_TRO2" + "", odt);
        if (transporteOutraUS2.hasNext()) {
            TextSelection item = (TextSelection) transporteOutraUS2.getCurrentItem();
            if (solicitacao.getTipo().equals("EXTERIOR") && solicitacao.getTransportePessoalOutraFonte2Formatted() != null) {
                item.replaceWith(solicitacao.getTransportePessoalOutraFonte2Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation tranporteOutra1BR;
        tranporteOutra1BR = new TextNavigation("VAR_R_TRO1", odt);
        if (tranporteOutra1BR.hasNext()) {
            TextSelection item = (TextSelection) tranporteOutra1BR.getCurrentItem();
            if (solicitacao.getTipo().equals("BRASIL") && solicitacao.getTransportePessoalOutraFonte1Formatted() != null) {
                item.replaceWith(solicitacao.getTransportePessoalOutraFonte1Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation transporteOutraUS1;
        transporteOutraUS1 = new TextNavigation("VAR_U_TRO1", odt);
        if (transporteOutraUS1.hasNext()) {
            TextSelection item = (TextSelection) transporteOutraUS1.getCurrentItem();
            if (solicitacao.getTipo().equals("EXTERIOR") && solicitacao.getTransportePessoalOutraFonte1Formatted() != null) {
                item.replaceWith(solicitacao.getTransportePessoalOutraFonte1Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation transporteOutraBR;
        transporteOutraBR = new TextNavigation("VAR_R_TRO", odt);
        if (transporteOutraBR.hasNext()) {
            TextSelection item = (TextSelection) transporteOutraBR.getCurrentItem();
            if (solicitacao.getTipo().equals("BRASIL") && solicitacao.getTransportePessoalOutraFonteFormatted() != null) {
                item.replaceWith(solicitacao.getTransportePessoalOutraFonteFormatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation transporteOutraUS;
        transporteOutraUS = new TextNavigation("VAR_U_TRO", odt);
        if (transporteOutraUS.hasNext()) {
            TextSelection item = (TextSelection) transporteOutraUS.getCurrentItem();
            if (solicitacao.getTipo().equals("EXTERIOR") && solicitacao.getTransportePessoalOutraFonteFormatted() != null) {
                item.replaceWith(solicitacao.getTransportePessoalOutraFonteFormatted());
            } else {
                item.replaceWith("");
            }
        }
        // CUSTO
        TextNavigation custos3BR;
        custos3BR = new TextNavigation("VAR_R_CUS3", odt);
        if (custos3BR.hasNext()) {
            TextSelection item = (TextSelection) custos3BR.getCurrentItem();
            if (solicitacao.getTipo().equals("BRASIL") && solicitacao.getCustoCurso3Formatted() != null) {
                item.replaceWith(solicitacao.getCustoCurso3Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation custosUS3;
        custosUS3 = new TextNavigation("VAR_U_CUS3", odt);
        if (custosUS3.hasNext()) {
            TextSelection item = (TextSelection) custosUS3.getCurrentItem();
            if (solicitacao.getTipo().equals("EXTERIOR") && solicitacao.getCustoCurso3Formatted() != null) {
                item.replaceWith(solicitacao.getCustoCurso3Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation custos2BR;
        custos2BR = new TextNavigation("VAR_R_CUS2", odt);
        if (custos2BR.hasNext()) {
            TextSelection item = (TextSelection) custos2BR.getCurrentItem();
            if (solicitacao.getTipo().equals("BRASIL") && solicitacao.getCustoCurso2Formatted() != null) {
                item.replaceWith(solicitacao.getCustoCurso2Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation custosUS2;
        custosUS2 = new TextNavigation("VAR_U_CUS2" + "", odt);
        if (custosUS2.hasNext()) {
            TextSelection item = (TextSelection) custosUS2.getCurrentItem();
            if (solicitacao.getTipo().equals("EXTERIOR") && solicitacao.getCustoCurso2Formatted() != null) {
                item.replaceWith(solicitacao.getCustoCurso2Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation custos1BR;
        custos1BR = new TextNavigation("VAR_R_CUS1", odt);
        if (custos1BR.hasNext()) {
            TextSelection item = (TextSelection) custos1BR.getCurrentItem();
            if (solicitacao.getTipo().equals("BRASIL") && solicitacao.getCustoCurso1Formatted() != null) {
                item.replaceWith(solicitacao.getCustoCurso1Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation custosUS1;
        custosUS1 = new TextNavigation("VAR_U_CUS1", odt);
        if (custosUS1.hasNext()) {
            TextSelection item = (TextSelection) custosUS1.getCurrentItem();
            if (solicitacao.getTipo().equals("EXTERIOR") && solicitacao.getCustoCurso1Formatted() != null) {
                item.replaceWith(solicitacao.getCustoCurso1Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation custosBR;
        custosBR = new TextNavigation("VAR_R_CUS", odt);
        if (custosBR.hasNext()) {
            TextSelection item = (TextSelection) custosBR.getCurrentItem();
            if (solicitacao.getTipo().equals("BRASIL") && solicitacao.getCustoCursoFormatted() != null) {
                item.replaceWith(solicitacao.getCustoCursoFormatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation custosUS;
        custosUS = new TextNavigation("VAR_U_CUS", odt);
        if (custosUS.hasNext()) {
            TextSelection item = (TextSelection) custosUS.getCurrentItem();
            if (solicitacao.getTipo().equals("EXTERIOR") && solicitacao.getCustoCursoFormatted() != null) {
                item.replaceWith(solicitacao.getCustoCursoFormatted());
            } else {
                item.replaceWith("");
            }
        }
        // CUSTO TOTAL
        TextNavigation totalAnual3BR;
        totalAnual3BR = new TextNavigation("VAR_R_TTA3", odt);
        if (totalAnual3BR.hasNext()) {
            TextSelection item = (TextSelection) totalAnual3BR.getCurrentItem();
            if (solicitacao.getTipo().equals("BRASIL") && solicitacao.getCustoTotal3Formatted() != null) {
                item.replaceWith(solicitacao.getCustoTotal3Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation totalAnualUS3;
        totalAnualUS3 = new TextNavigation("VAR_U_TTA3", odt);
        if (totalAnualUS3.hasNext()) {
            TextSelection item = (TextSelection) totalAnualUS3.getCurrentItem();
            if (solicitacao.getTipo().equals("EXTERIOR") && solicitacao.getCustoTotal3Formatted() != null) {
                item.replaceWith(solicitacao.getCustoTotal3Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation totalAnual2BR;
        totalAnual2BR = new TextNavigation("VAR_R_TTA2", odt);
        if (totalAnual2BR.hasNext()) {
            TextSelection item = (TextSelection) totalAnual2BR.getCurrentItem();
            if (solicitacao.getTipo().equals("BRASIL") && solicitacao.getCustoTotal2Formatted() != null) {
                item.replaceWith(solicitacao.getCustoTotal2Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation totalAnualUS2;
        totalAnualUS2 = new TextNavigation("VAR_U_TTA2" + "", odt);
        if (totalAnualUS2.hasNext()) {
            TextSelection item = (TextSelection) totalAnualUS2.getCurrentItem();
            if (solicitacao.getTipo().equals("EXTERIOR") && solicitacao.getCustoTotal2Formatted() != null) {
                item.replaceWith(solicitacao.getCustoTotal2Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation totalAnual1BR;
        totalAnual1BR = new TextNavigation("VAR_R_TTA1", odt);
        if (totalAnual1BR.hasNext()) {
            TextSelection item = (TextSelection) totalAnual1BR.getCurrentItem();
            if (solicitacao.getTipo().equals("BRASIL") && solicitacao.getCustoTotal1Formatted() != null) {
                item.replaceWith(solicitacao.getCustoTotal1Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation totalAnualUS1;
        totalAnualUS1 = new TextNavigation("VAR_U_TTA1", odt);
        if (totalAnualUS1.hasNext()) {
            TextSelection item = (TextSelection) totalAnualUS1.getCurrentItem();
            if (solicitacao.getTipo().equals("EXTERIOR") && solicitacao.getCustoTotal1Formatted() != null) {
                item.replaceWith(solicitacao.getCustoTotal1Formatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation totalAnualBR;
        totalAnualBR = new TextNavigation("VAR_R_TTA", odt);
        if (totalAnualBR.hasNext()) {
            TextSelection item = (TextSelection) totalAnualBR.getCurrentItem();
            if (solicitacao.getTipo().equals("BRASIL") && solicitacao.getCustoTotalFormatted() != null) {
                item.replaceWith(solicitacao.getCustoTotalFormatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation totalAnualUS;
        totalAnualUS = new TextNavigation("VAR_U_TTA", odt);
        if (totalAnualUS.hasNext()) {
            TextSelection item = (TextSelection) totalAnualUS.getCurrentItem();
            if (solicitacao.getTipo().equals("EXTERIOR") && solicitacao.getCustoTotalFormatted() != null) {
                item.replaceWith(solicitacao.getCustoTotalFormatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation somatorioBR;
        somatorioBR = new TextNavigation("VAR_R_STT", odt);
        if (somatorioBR.hasNext()) {
            TextSelection item = (TextSelection) somatorioBR.getCurrentItem();
            if (solicitacao.getTipo().equals("BRASIL") && solicitacao.getSomatorioGeralFormatted() != null) {
                item.replaceWith(solicitacao.getSomatorioGeralFormatted());
            } else {
                item.replaceWith("");
            }
        }
        TextNavigation somatorioUS;
        somatorioUS = new TextNavigation("VAR_U_STT", odt);
        if (somatorioUS.hasNext()) {
            TextSelection item = (TextSelection) somatorioUS.getCurrentItem();
            if (solicitacao.getTipo().equals("EXTERIOR") && solicitacao.getSomatorioGeralFormatted() != null) {
                item.replaceWith(solicitacao.getSomatorioGeralFormatted());
            } else {
                item.replaceWith("");
            }
        }
        odt.save(os);
    } catch (Exception ex) {
        Logger.getLogger(PLN006ODF.class.getName()).log(Level.SEVERE, null, ex);
    }
}
Also used : SolicitacaoPlamensDTO(com.tomasio.projects.trainning.dto.SolicitacaoPlamensDTO) PlanningService(com.tomasio.projects.trainning.interfaces.PlanningService) TextSelection(org.odftoolkit.odfdom.incubator.search.TextSelection) TextNavigation(org.odftoolkit.odfdom.incubator.search.TextNavigation)

Example 3 with TextNavigation

use of org.odftoolkit.odfdom.incubator.search.TextNavigation in project trainning by fernandotomasio.

the class EXC018ODF method makeReport.

@Override
public void makeReport() {
    AtividadesEnsinoService atividadesEnsinoService = (AtividadesEnsinoService) services.get("atividadesEnsinoService");
    OrganizationalService organizationalService = (OrganizationalService) services.get("organizationalService");
    Long turmaId = (Long) params.get("turmaId");
    TurmaDTO turma = atividadesEnsinoService.findTurmaEfetiva(turmaId);
    System.out.println(turma.getCurso().getCodigo() + " - " + TEMPLATE_PATH);
    try {
        ClassLoader classLoader = getClass().getClassLoader();
        File file = new File(classLoader.getResource(TEMPLATE_PATH).getFile());
        odt = OdfTextDocument.loadDocument(file);
        TextNavigation slot = new TextNavigation("_NOME_", odt);
        while (slot.hasNext()) {
            TextSelection item = (TextSelection) slot.getCurrentItem();
            item.replaceWith("FERNANDO DE OLIVEIRA TOMASIO");
        }
        odt.save(os);
    } catch (Exception ex) {
        Logger.getLogger(EXC018ODF.class.getName()).log(Level.SEVERE, null, ex);
    }
}
Also used : OrganizationalService(com.tomasio.projects.trainning.interfaces.OrganizationalService) TextSelection(org.odftoolkit.odfdom.incubator.search.TextSelection) TextNavigation(org.odftoolkit.odfdom.incubator.search.TextNavigation) TurmaDTO(com.tomasio.projects.trainning.dto.TurmaDTO) File(java.io.File) AtividadesEnsinoService(com.tomasio.projects.trainning.interfaces.AtividadesEnsinoService)

Aggregations

TextNavigation (org.odftoolkit.odfdom.incubator.search.TextNavigation)3 TextSelection (org.odftoolkit.odfdom.incubator.search.TextSelection)2 SolicitacaoPlamensDTO (com.tomasio.projects.trainning.dto.SolicitacaoPlamensDTO)1 TurmaDTO (com.tomasio.projects.trainning.dto.TurmaDTO)1 AtividadesEnsinoService (com.tomasio.projects.trainning.interfaces.AtividadesEnsinoService)1 OrganizationalService (com.tomasio.projects.trainning.interfaces.OrganizationalService)1 PlanningService (com.tomasio.projects.trainning.interfaces.PlanningService)1 File (java.io.File)1 OdfTextDocument (org.odftoolkit.odfdom.doc.OdfTextDocument)1