List of usage examples for org.apache.commons.lang3 StringUtils replace
public static String replace(final String text, final String searchString, final String replacement)
Replaces all occurrences of a String within another String.
A null reference passed to this method is a no-op.
StringUtils.replace(null, *, *) = null StringUtils.replace("", *, *) = "" StringUtils.replace("any", null, *) = "any" StringUtils.replace("any", *, null) = "any" StringUtils.replace("any", "", *) = "any" StringUtils.replace("aba", "a", null) = "aba" StringUtils.replace("aba", "a", "") = "b" StringUtils.replace("aba", "a", "z") = "zbz"
From source file:com.jayway.restassured.internal.http.URIBuilder.java
public static String encode(final String content, final String encoding) { try {/* ww w. ja va 2 s .c o m*/ String encoded = URLEncoder.encode(content, encoding != null ? encoding : Charset.defaultCharset().toString()); // We replace spaces encoded as "+" to %20 because some server (such as Scalatra) doesn't decode "+" correctly. encoded = StringUtils.replace(encoded, PLUS, PERCENTAGE_20); return encoded; } catch (UnsupportedEncodingException problem) { throw new IllegalArgumentException(problem); } }
From source file:com.sonicle.webtop.core.sdk.ServiceManifest.java
/** * Converts the package name into its path representation. * (eg. com.sonicle.webtop.mail -> com/sonicle/webtop/mail) * @return The value.//from ww w . ja va 2 s. c o m */ public String getJarPath() { return StringUtils.lowerCase(StringUtils.replace(getPackageName(), ".", "/")); }
From source file:com.sonicle.webtop.core.sdk.ServiceManifest.java
/** * Converts the js package name into its path representation. * (eg. Sonicle.webtop.mail -> sonicle/webtop/mail) * @return The value.//from w ww . j a va2 s. c om */ public String getJsPath() { return StringUtils.lowerCase(StringUtils.replace(getJsPackageName(), ".", "/")); }
From source file:com.tealcube.minecraft.bukkit.mythicdrops.items.MythicDropBuilder.java
private List<String> randomVariableReplace(List<String> list) { List<String> newList = new ArrayList<>(); for (String s : list) { Matcher matcher = PERCENTAGE_PATTERN.matcher(s); while (matcher.find()) { String check = matcher.group(); String replacedCheck = StringUtils.replace(StringUtils.replace(check, "%rand", ""), "%", ""); List<String> split = Splitter.on(DASH_PATTERN).omitEmptyStrings().trimResults() .splitToList(replacedCheck); LOGGER.debug(String.format("%s | %s | %s", s, check, split.toString())); int first = NumberUtils.toInt(split.get(0)); int second = NumberUtils.toInt(split.get(1)); int min = Math.min(first, second); int max = Math.max(first, second); int random = (int) Math.round((Math.random() * (max - min) + min)); newList.add(s.replace(check, String.valueOf(random))); }/*from w w w . j av a 2s. c o m*/ if (s.contains("%rand")) { continue; } newList.add(s); } return newList; }
From source file:com.gargoylesoftware.htmlunit.WebTestCase.java
/** * Generates an instrumented HTML file in the temporary dir to easily make a manual test in a real browser. * The file is generated only if the system property {@link #PROPERTY_GENERATE_TESTPAGES} is set. * @param content the content of the HTML page * @param expectedAlerts the expected alerts * @throws IOException if writing file fails *///from ww w . j a v a 2 s . c om protected void createTestPageForRealBrowserIfNeeded(final String content, final List<String> expectedAlerts) throws IOException { // save the information to create a test for WebDriver generateTest_content_ = content; generateTest_expectedAlerts_ = expectedAlerts; final Method testMethod = findRunningJUnitTestMethod(); generateTest_testName_ = testMethod.getDeclaringClass().getSimpleName() + "_" + testMethod.getName() + ".html"; if (System.getProperty(PROPERTY_GENERATE_TESTPAGES) != null) { // should be optimized.... // calls to alert() should be replaced by call to custom function String newContent = StringUtils.replace(content, "alert(", "htmlunitReserved_caughtAlert("); final String instrumentationJS = createInstrumentationScript(expectedAlerts); // first version, we assume that there is a <head> and a </body> or a </frameset> if (newContent.indexOf("<head>") > -1) { newContent = StringUtils.replaceOnce(newContent, "<head>", "<head>" + instrumentationJS); } else { newContent = StringUtils.replaceOnce(newContent, "<html>", "<html>\n<head>\n" + instrumentationJS + "\n</head>\n"); } final String endScript = "\n<script>htmlunitReserved_addSummaryAfterOnload();</script>\n"; if (newContent.contains("</body>")) { newContent = StringUtils.replaceOnce(newContent, "</body>", endScript + "</body>"); } else { LOG.info("No test generated: currently only content with a <head> and a </body> is supported"); } final File f = File.createTempFile("TEST" + '_', ".html"); FileUtils.writeStringToFile(f, newContent, "ISO-8859-1"); LOG.info("Test file written: " + f.getAbsolutePath()); } else { if (LOG.isDebugEnabled()) { LOG.debug("System property \"" + PROPERTY_GENERATE_TESTPAGES + "\" not set, don't generate test HTML page for real browser"); } } }
From source file:com.dominion.salud.mpr.negocio.service.acuerdos.impl.AcuCentrosServiceImpl.java
/** * * @param acuCentros/*from w ww .j av a 2 s.co m*/ * @return * @throws ca.uhn.hl7v2.HL7Exception * @throws java.io.IOException */ @Override public ZFN_M13 toHL7(AcuCentros acuCentros) throws HL7Exception, IOException { logger.debug(" Iniciando la generacion del mensaje ZFN_M13"); SimpleDateFormat yyyymmdd = new SimpleDateFormat("yyyyMMdd"); SimpleDateFormat yyyymmddhhmmss = new SimpleDateFormat("yyyyMMddhhmmss"); List<String> resultado = new ArrayList<>(); ZFN_M13 zfn_m13 = new ZFN_M13(); zfn_m13.initQuickstart("ZFN", "M13", "P"); //MSH - Message Header Segment logger.debug(" Generando el segmento MSH - Message Header Segment"); MSH msh = zfn_m13.getMSH(); msh.getSendingApplication().getNamespaceID().setValue("MPR"); //MSH.3.1 msh.getSendingFacility().getNamespaceID().setValue("mpr-ws"); //MSH.4.1 msh.getReceivingApplication().getNamespaceID().setValue("FARMATOOLS"); //MSH.5.1 msh.getReceivingFacility().getNamespaceID().setValue("integraciones"); //MSH.6.1 msh.getDateTimeOfMessage().getTime().setValue(yyyymmddhhmmss.format(new Date())); //MSH.7 msh.getMessageControlID().setValue(new NanoTimeGenerator().getID()); //MSH.10 msh.getVersionID().getVersionID().setValue("2.5"); //MSH.12.1 msh.getAcceptAcknowledgmentType().setValue("AL"); //MSH.15 msh.getApplicationAcknowledgmentType().setValue("ER"); //MSH.16 msh.getCountryCode().setValue("ESP"); //MSH.17 msh.getCharacterSet(0).setValue("UTF-8"); //MSH.18 logger.debug(" " + msh.encode()); //ACUERDO logger.debug(" Generando datos del ACUERDO"); //ZFN_M13_ACUERDO ZFN_M13_ACUERDO zfn_m13_acuerdo = zfn_m13.getACUERDO(); //ZFA - Master file identification (Acuerdos) logger.debug(" Generando el segmento ZFA - Master file identification (Acuerdos)"); ZFA zfa = zfn_m13_acuerdo.getZFA(); zfa.getMasterIdentifier().getIdentifier().setValue(acuCentros.getAcuerdos().getIdAcuerdo().toString()); //ZFA.1.1 zfa.getMasterIdentifier().getText().setValue(acuCentros.getAcuerdos().getTxtNombre()); //ZFA.1.2 zfa.getMasterIdentifier().getAlternateIdentifier().setValue(acuCentros.getAcuerdos().getCodAcuerdo()); //ZFA.1.4 zfa.getMasterIdentifier().getAlternateText() .setValue(StringUtils.replace(acuCentros.getAcuerdos().getTxtDescripcion(), "\n", "<br>")); //ZFA.1.5 zfa.getMasterFileApplicationIdentifier().getNamespaceID().setValue(acuCentros.getCentros().getCodCentro()); //ZFA.2.1 zfa.getMasterFileApplicationIdentifier().getUniversalID().setValue(acuCentros.getCentros().getTxtCentro()); //ZFA.2.2 zfa.getFileLevelEventCode().setValue("REP"); //ZFA.3 zfa.getResponseLevelCode().setValue("AL"); //ZFA.6 logger.debug(" " + zfa.encode()); //ZGA - Master file entry (Acuerdos) logger.debug(" Generando los segmentos ZGA - Master file entry (Acuerdos)"); //ACU_REQUERIDO ZGA zgaAcuRequerido = zfn_m13_acuerdo.getZGA(zfn_m13_acuerdo.getZGAAll().size()); zgaAcuRequerido.getCodigoRegistro().getNamespaceID().setValue(ZGA.ACU_REQUERIDO); //ZGA.1.1 zgaAcuRequerido.getDescripcion() .setValue(StringUtils.isNotBlank(acuCentros.getAcuerdos().getRequerido()) ? acuCentros.getAcuerdos().getRequerido() : "N"); //ZGA.4 logger.debug(" " + ZGA.ACU_REQUERIDO + ": " + zgaAcuRequerido.encode()); //ACU_FEC_BAJA ZGA zgaAcuFecBaja = zfn_m13_acuerdo.getZGA(zfn_m13_acuerdo.getZGAAll().size()); zgaAcuFecBaja.getCodigoRegistro().getNamespaceID().setValue(ZGA.ACU_FECHA_BAJA); //ZGA.1.1 zgaAcuFecBaja.getDescripcion() .setValue(acuCentros.getAcuerdos().getFecBaja() != null ? yyyymmdd.format(acuCentros.getAcuerdos().getFecBaja()) : null); //ZGA.4 logger.debug(" " + ZGA.ACU_FECHA_BAJA + ": " + zgaAcuFecBaja.encode()); //ACU_NUM_DIAS ZGA zgaAcuNumDias = zfn_m13_acuerdo.getZGA(zfn_m13_acuerdo.getZGAAll().size()); zgaAcuNumDias.getCodigoRegistro().getNamespaceID().setValue(ZGA.ACU_NUM_DIAS); //ZGA.1.1 zgaAcuNumDias.getDescripcion() .setValue(acuCentros.getAcuerdos().getNumDias() != null ? acuCentros.getAcuerdos().getNumDias().toString() : "0"); //ZGA.4 logger.debug(" " + ZGA.ACU_NUM_DIAS + ": " + zgaAcuNumDias.encode()); //ACU_NUM_CICLOS ZGA zgaAcuNumCiclos = zfn_m13_acuerdo.getZGA(zfn_m13_acuerdo.getZGAAll().size()); zgaAcuNumCiclos.getCodigoRegistro().getNamespaceID().setValue(ZGA.ACU_NUM_CICLOS); //ZGA.1.1 zgaAcuNumCiclos.getDescripcion() .setValue(acuCentros.getAcuerdos().getNumCiclos() != null ? acuCentros.getAcuerdos().getNumCiclos().toString() : "0"); //ZGA.4 logger.debug(" " + ZGA.ACU_NUM_CICLOS + ": " + zgaAcuNumCiclos.encode()); //ACU_NIVEL ZGA zgaAcuNivel = zfn_m13_acuerdo.getZGA(zfn_m13_acuerdo.getZGAAll().size()); zgaAcuNivel.getCodigoRegistro().getNamespaceID().setValue(ZGA.ACU_NIVEL); //ZGA.1.1 zgaAcuNivel.getDescripcion().setValue( acuCentros.getAcuerdos().getNivel() != null ? acuCentros.getAcuerdos().getNivel().toString() : "0"); //ZGA.4 logger.debug(" " + ZGA.ACU_NIVEL + ": " + zgaAcuNivel.encode()); //ACU_FECHA_INI ZGA zgaAcuFechaIni = zfn_m13_acuerdo.getZGA(zfn_m13_acuerdo.getZGAAll().size()); zgaAcuFechaIni.getCodigoRegistro().getNamespaceID().setValue(ZGA.ACU_FECHA_INI); //ZGA.1.1 zgaAcuFechaIni.getDescripcion() .setValue(acuCentros.getAcuerdos().getFecIniAcuerdo() != null ? yyyymmdd.format(acuCentros.getAcuerdos().getFecIniAcuerdo()) : yyyymmdd.format(new Date())); //ZGA.4 logger.debug(" " + ZGA.ACU_FECHA_INI + ": " + zgaAcuFechaIni.encode()); //ACU_FECHA_FIN ZGA zgaAcuFechaFin = zfn_m13_acuerdo.getZGA(zfn_m13_acuerdo.getZGAAll().size()); zgaAcuFechaFin.getCodigoRegistro().getNamespaceID().setValue(ZGA.ACU_FECHA_FIN); //ZGA.1.1 zgaAcuFechaFin.getDescripcion() .setValue(acuCentros.getAcuerdos().getFecFinAcuerdo() != null ? yyyymmdd.format(acuCentros.getAcuerdos().getFecFinAcuerdo()) : "31/12/9999"); //ZGA.4 logger.debug(" " + ZGA.ACU_FECHA_FIN + ": " + zgaAcuFechaFin.encode()); //ACU_FECHA_INI_TRAT ZGA zgaAcuFechaIniTrat = zfn_m13_acuerdo.getZGA(zfn_m13_acuerdo.getZGAAll().size()); zgaAcuFechaIniTrat.getCodigoRegistro().getNamespaceID().setValue(ZGA.ACU_FECHA_INI_TRAT); //ZGA.1.1 zgaAcuFechaIniTrat.getDescripcion() .setValue(acuCentros.getAcuerdos().getFecIniTrat() != null ? yyyymmdd.format(acuCentros.getAcuerdos().getFecIniTrat()) : null); //ZGA.4 logger.debug(" " + ZGA.ACU_FECHA_INI_TRAT + ": " + zgaAcuFechaIniTrat.encode()); //ACU_FECHA_FIN_TRAT ZGA zgaAcuFechaFinTrat = zfn_m13_acuerdo.getZGA(zfn_m13_acuerdo.getZGAAll().size()); zgaAcuFechaFinTrat.getCodigoRegistro().getNamespaceID().setValue(ZGA.ACU_FECHA_FIN_TRAT); //ZGA.1.1 zgaAcuFechaFinTrat.getDescripcion() .setValue(acuCentros.getAcuerdos().getFecFinTrat() != null ? yyyymmdd.format(acuCentros.getAcuerdos().getFecFinTrat()) : null); //ZGA.4 logger.debug(" " + ZGA.ACU_FECHA_FIN_TRAT + ": " + zgaAcuFechaFinTrat.encode()); //ACU_LABORATORIOS ZGA zgaAcuLaboratorios = zfn_m13_acuerdo.getZGA(zfn_m13_acuerdo.getZGAAll().size()); zgaAcuLaboratorios.getCodigoRegistro().getNamespaceID().setValue(ZGA.ACU_LABORATORIOS); //ZGA.1.1 zgaAcuLaboratorios.getIdentificador() .setValue(acuCentros.getAcuerdos().getLaboratorios().getIdLaboratorio().toString()); //ZGA.2 zgaAcuLaboratorios.getCodigo().setValue(acuCentros.getAcuerdos().getLaboratorios().getCodLaboratorio()); //ZGA.3 zgaAcuLaboratorios.getDescripcion() .setValue(acuCentros.getAcuerdos().getLaboratorios().getTxtLaboratorio()); //ZGA.4 logger.debug(" " + ZGA.ACU_LABORATORIOS + ": " + zgaAcuLaboratorios.encode()); //ACU_SEXOS if (acuCentros.getAcuerdos().getSexos() != null) { ZGA zgaSexos = zfn_m13_acuerdo.getZGA(zfn_m13_acuerdo.getZGAAll().size()); zgaSexos.getCodigoRegistro().getNamespaceID().setValue(ZGA.ACU_SEXOS); //ZGA.1.1 try { List<SexosExt> sexosExts = sexosExtService.findEquivalencia(acuCentros.getCentros(), acuCentros.getAcuerdos().getSexos()); if (sexosExts.size() == 1) { SexosExt sexosExt = sexosExts.get(0); zgaSexos.getIdentificador() .setValue(acuCentros.getAcuerdos().getSexos().getIdSexo().toString()); //ZGA.2 zgaSexos.getCodigo().setValue(sexosExt.getCodSexoExt()); //ZGA.3 zgaSexos.getDescripcion().setValue(sexosExt.getTxtSexoExt()); //ZGA.4 logger.debug(" " + ZGA.ACU_SEXOS + ": " + zgaSexos.encode()); } else if (sexosExts.size() > 1) { logger.error(" Existen multiples equivalencias para el SEXO: " + acuCentros.getAcuerdos().getSexos().toString()); resultado.add("Existen multiples equivalencias para el SEXO: " + acuCentros.getAcuerdos().getSexos().toString()); } } catch (NoExisteEquivalenciaException neee) { logger.error(" No existe equivalencia para el SEXO: " + acuCentros.getAcuerdos().getSexos().toString()); resultado.add( "No existe equivalencia para el SEXO: " + acuCentros.getAcuerdos().getSexos().toString()); } } //ACU_CENTROS ZGA zgaAcuCentros = zfn_m13_acuerdo.getZGA(zfn_m13_acuerdo.getZGAAll().size()); zgaAcuCentros.getCodigoRegistro().getNamespaceID().setValue(ZGA.ACU_CENTROS); //ZGA.1.1 zgaAcuCentros.getCodigoRegistro().getUniversalID().setValue(acuCentros.getIdAcuCentro().toString()); //ZGA.1.2 zgaAcuCentros.getIdentificador().setValue(acuCentros.getCentros().getIdCentro().toString()); //ZGA.2 zgaAcuCentros.getCodigo().setValue(acuCentros.getCentros().getCodCentro()); //ZGA.3 zgaAcuCentros.getDescripcion().setValue(acuCentros.getCentros().getTxtCentro()); //ZGA.4 logger.debug(" " + ZGA.ACU_CENTROS + ": " + zgaAcuCentros.encode()); //ACU_DIAGNOSTICOS List<AcuDiagnosticos> acuDiagnosticoses = acuCentros.getAcuerdos().getAcuDiagnosticoses(); if (acuDiagnosticoses != null && !acuDiagnosticoses.isEmpty()) { Iterator<AcuDiagnosticos> iteratorAcuDiagnosticoses = acuDiagnosticoses.iterator(); while (iteratorAcuDiagnosticoses.hasNext()) { AcuDiagnosticos acuDiagnosticos = iteratorAcuDiagnosticoses.next(); ZGA zgaAcuDiagnosticos = zfn_m13_acuerdo.getZGA(zfn_m13_acuerdo.getZGAAll().size()); zgaAcuDiagnosticos.getCodigoRegistro().getNamespaceID().setValue(ZGA.ACU_DIAGNOSTICOS); //ZGA.1.1 zgaAcuDiagnosticos.getCodigoRegistro().getUniversalID() .setValue(acuDiagnosticos.getIdAcuDiagnostico().toString()); //ZGA.1.2 zgaAcuDiagnosticos.getIdentificador() .setValue(acuDiagnosticos.getDiagnosticos().getIdDiagnostico().toString()); //ZGA.2 zgaAcuDiagnosticos.getCodigo().setValue(acuDiagnosticos.getDiagnosticos().getCodDiagnostico()); //ZGA.3 zgaAcuDiagnosticos.getDescripcion().setValue(acuDiagnosticos.getDiagnosticos().getTxtDiagnostico()); //ZGA.4 logger.debug(" " + ZGA.ACU_DIAGNOSTICOS + ": " + zgaAcuDiagnosticos.encode()); } } //ACU_MARCAS List<AcuMarcas> acuMarcases = acuCentros.getAcuerdos().getAcuMarcases(); if (acuMarcases != null && !acuMarcases.isEmpty()) { Iterator<AcuMarcas> iteratorAcuMarcases = acuMarcases.iterator(); while (iteratorAcuMarcases.hasNext()) { AcuMarcas acuMarcas = iteratorAcuMarcases.next(); ZGA zgaAcuMarcas = zfn_m13_acuerdo.getZGA(zfn_m13_acuerdo.getZGAAll().size()); zgaAcuMarcas.getCodigoRegistro().getNamespaceID().setValue(ZGA.ACU_MARCAS); //ZGA.1.1 zgaAcuMarcas.getCodigoRegistro().getUniversalID().setValue(acuMarcas.getIdAcuMarca().toString()); //ZGA.1.2 zgaAcuMarcas.getIdentificador().setValue(acuMarcas.getMarcas().getIdMarca().toString()); //ZGA.2 zgaAcuMarcas.getCodigo().setValue(acuMarcas.getMarcas().getCodNac()); //ZGA.3 zgaAcuMarcas.getDescripcion().setValue(acuMarcas.getMarcas().getTxtMarca()); //ZGA.4 logger.debug(" " + ZGA.ACU_MARCAS + ": " + zgaAcuMarcas.encode()); } } //ACU_INDICACIONES List<AcuIndicaciones> acuIndicacioneses = acuCentros.getAcuerdos().getAcuIndicacioneses(); if (acuIndicacioneses != null && !acuIndicacioneses.isEmpty()) { Iterator<AcuIndicaciones> iteratorAcuIndicacioneses = acuIndicacioneses.iterator(); while (iteratorAcuIndicacioneses.hasNext()) { AcuIndicaciones acuIndicaciones = iteratorAcuIndicacioneses.next(); try { List<IndicacionesExt> indicacionesExts = indicacionesExtService .findEquivalencia(acuCentros.getCentros(), acuIndicaciones.getIndicaciones()); for (IndicacionesExt indicacionesExt : indicacionesExts) { ZGA zgaAcuIndicaciones = zfn_m13_acuerdo.getZGA(zfn_m13_acuerdo.getZGAAll().size()); zgaAcuIndicaciones.getCodigoRegistro().getNamespaceID().setValue(ZGA.ACU_INDICACIONES); //ZGA.1.1 zgaAcuIndicaciones.getCodigoRegistro().getUniversalID() .setValue(acuIndicaciones.getIdAcuIndicacion().toString()); //ZGA.1.2 zgaAcuIndicaciones.getIdentificador() .setValue(acuIndicaciones.getIndicaciones().getIdIndicacion().toString()); //ZGA.2 zgaAcuIndicaciones.getCodigo().setValue(indicacionesExt.getCodIndicacionExt()); //ZGA.3 zgaAcuIndicaciones.getDescripcion().setValue(indicacionesExt.getTxtIndicacionExt()); //ZGA.4 logger.debug( " " + ZGA.ACU_INDICACIONES + ": " + zgaAcuIndicaciones.encode()); } } catch (NoExisteEquivalenciaException neee) { logger.error(" No existe equivalencia para la INDICACION: " + acuIndicaciones.getIndicaciones().toString()); resultado.add("No existe equivalencia para la INDICACION: " + acuIndicaciones.getIndicaciones().toString()); } } } //ACU_LINEAS_TRAT List<AcuLineasTrat> acuLineasTrats = acuCentros.getAcuerdos().getAcuLineasTrats(); if (acuLineasTrats != null && !acuLineasTrats.isEmpty()) { Iterator<AcuLineasTrat> iteratorAcuLineasTrats = acuLineasTrats.iterator(); while (iteratorAcuLineasTrats.hasNext()) { AcuLineasTrat acuLineasTrat = iteratorAcuLineasTrats.next(); try { List<LineasTratExt> lineasTratExts = lineasTratExtService .findEquivalencia(acuCentros.getCentros(), acuLineasTrat.getLineasTrat()); for (LineasTratExt lineasTratExt : lineasTratExts) { ZGA zgaAcuLineasTrat = zfn_m13_acuerdo.getZGA(zfn_m13_acuerdo.getZGAAll().size()); zgaAcuLineasTrat.getCodigoRegistro().getNamespaceID().setValue(ZGA.ACU_LINEAS_TRAT); //ZGA.1.1 zgaAcuLineasTrat.getCodigoRegistro().getUniversalID() .setValue(acuLineasTrat.getIdAcuLineaTrat().toString()); //ZGA.1.2 zgaAcuLineasTrat.getIdentificador() .setValue(acuLineasTrat.getLineasTrat().getIdLineaTrat().toString()); //ZGA.2 zgaAcuLineasTrat.getCodigo().setValue(lineasTratExt.getCodLineaTratExt()); //ZGA.3 zgaAcuLineasTrat.getDescripcion().setValue(lineasTratExt.getTxtLineaTratExt()); //ZGA.4 logger.debug( " " + ZGA.ACU_LINEAS_TRAT + ": " + zgaAcuLineasTrat.encode()); } } catch (NoExisteEquivalenciaException neee) { logger.error(" No existe equivalencia para la LINEA DE TRATAMIENTO: " + acuLineasTrat.getLineasTrat().toString()); resultado.add("No existe equivalencia para la LINEA DE TRATAMIENTO: " + acuLineasTrat.getLineasTrat().toString()); } } } //ACU_PROGRAMAS List<AcuProgramas> acuProgramases = acuCentros.getAcuerdos().getAcuProgramases(); if (acuProgramases != null && !acuProgramases.isEmpty()) { Iterator<AcuProgramas> iteratorAcuProgramases = acuProgramases.iterator(); while (iteratorAcuProgramases.hasNext()) { AcuProgramas acuProgramas = iteratorAcuProgramases.next(); try { List<ProgramasExt> programasExts = programasExtService.findEquivalencia(acuCentros.getCentros(), acuProgramas.getProgramas()); for (ProgramasExt programasExt : programasExts) { ZGA zgaAcuProgramas = zfn_m13_acuerdo.getZGA(zfn_m13_acuerdo.getZGAAll().size()); zgaAcuProgramas.getCodigoRegistro().getNamespaceID().setValue(ZGA.ACU_PROGRAMAS); //ZGA.1.1 zgaAcuProgramas.getCodigoRegistro().getUniversalID() .setValue(acuProgramas.getIdAcuPrograma().toString()); //ZGA.1.2 zgaAcuProgramas.getIdentificador() .setValue(acuProgramas.getProgramas().getIdPrograma().toString()); //ZGA.2 zgaAcuProgramas.getCodigo().setValue(programasExt.getCodProgramaExt()); //ZGA.3 zgaAcuProgramas.getDescripcion().setValue(programasExt.getTxtProgramaExt()); //ZGA.4 logger.debug(" " + ZGA.ACU_PROGRAMAS + ": " + zgaAcuProgramas.encode()); } } catch (NoExisteEquivalenciaException neee) { logger.error(" No existe equivalencia para el PROGRAMA: " + acuProgramas.getProgramas().toString()); resultado.add( "No existe equivalencia para el PROGRAMA: " + acuProgramas.getProgramas().toString()); } } } //ACU_RAZON_FIN List<AcuRazonFin> acuRazonFins = acuCentros.getAcuerdos().getAcuRazonFins(); if (acuRazonFins != null && !acuRazonFins.isEmpty()) { Iterator<AcuRazonFin> iteratorAcuRazonFins = acuRazonFins.iterator(); while (iteratorAcuRazonFins.hasNext()) { AcuRazonFin acuRazonFin = iteratorAcuRazonFins.next(); try { List<RazonFinExt> razonFinExts = razonFinExtService.findEquivalencia(acuCentros.getCentros(), acuRazonFin.getRazonFin()); for (RazonFinExt razonFinExt : razonFinExts) { ZGA zgaAcuRazonFin = zfn_m13_acuerdo.getZGA(zfn_m13_acuerdo.getZGAAll().size()); zgaAcuRazonFin.getCodigoRegistro().getNamespaceID().setValue(ZGA.ACU_RAZON_FIN); //ZGA.1.1 zgaAcuRazonFin.getCodigoRegistro().getUniversalID() .setValue(acuRazonFin.getIdAcuRazonFin().toString()); //ZGA.1.2 zgaAcuRazonFin.getIdentificador() .setValue(acuRazonFin.getRazonFin().getIdRazonFin().toString()); //ZGA.2 zgaAcuRazonFin.getCodigo().setValue(razonFinExt.getCodRazonFinExt()); //ZGA.3 zgaAcuRazonFin.getDescripcion().setValue(razonFinExt.getTxtRazonFinExt()); //ZGA.4 logger.debug(" " + ZGA.ACU_RAZON_FIN + ": " + zgaAcuRazonFin.encode()); } } catch (NoExisteEquivalenciaException neee) { logger.error(" No existe equivalencia para la RAZON DE FIN DE TRATAMIENTO: " + acuRazonFin.getRazonFin().toString()); resultado.add("No existe equivalencia para la RAZON DE FIN DE TRATAMIENTO: " + acuRazonFin.getRazonFin().toString()); } } } //ACU_EDADES List<AcuEdades> acuEdadeses = acuCentros.getAcuerdos().getAcuEdadeses(); if (acuEdadeses != null && !acuEdadeses.isEmpty()) { Iterator<AcuEdades> iteratorAcuEdadeses = acuEdadeses.iterator(); while (iteratorAcuEdadeses.hasNext()) { AcuEdades acuEdades = iteratorAcuEdadeses.next(); ZGA zgaAcuEdades = zfn_m13_acuerdo.getZGA(zfn_m13_acuerdo.getZGAAll().size()); zgaAcuEdades.getCodigoRegistro().getNamespaceID().setValue(ZGA.ACU_EDADES); //ZGA.1.1 zgaAcuEdades.getCodigoRegistro().getUniversalID().setValue(acuEdades.getIdAcuEdad().toString()); //ZGA.1.2 logger.debug(" " + ZGA.ACU_EDADES + ": " + zgaAcuEdades.encode()); ZCE zceAcuEdadesDesde = zgaAcuEdades .getElementoCodificado(zgaAcuEdades.getElementoCodificadoReps()); //ZGA.5 zceAcuEdadesDesde.getDescripcion() .setValue(acuEdades.getEdadDesde() != null ? acuEdades.getEdadDesde().toString() : "0"); //ZGA.5.3 zceAcuEdadesDesde.getCodigoRegistro().getNamespaceID().setValue(ZGA.ACU_EDAD_DESDE); //ZGA.5.4.1 logger.debug(" " + ZGA.ACU_EDAD_DESDE + ": " + zceAcuEdadesDesde.encode()); ZCE zceAcuEdadesHasta = zgaAcuEdades .getElementoCodificado(zgaAcuEdades.getElementoCodificadoReps()); //ZGA.5 zceAcuEdadesHasta.getDescripcion() .setValue(acuEdades.getEdadHasta() != null ? acuEdades.getEdadHasta().toString() : "0"); //ZGA.5.3 zceAcuEdadesHasta.getCodigoRegistro().getNamespaceID().setValue(ZGA.ACU_EDAD_HASTA); //ZGA.5.4.1 logger.debug(" " + ZGA.ACU_EDAD_HASTA + ": " + zceAcuEdadesHasta.encode()); } } //ACU_PESOS List<AcuPesos> acuPesoses = acuCentros.getAcuerdos().getAcuPesoses(); if (acuPesoses != null && !acuPesoses.isEmpty()) { Iterator<AcuPesos> iteratorAcuPesoses = acuPesoses.iterator(); while (iteratorAcuPesoses.hasNext()) { AcuPesos acuPesos = iteratorAcuPesoses.next(); ZGA zgaAcuPesos = zfn_m13_acuerdo.getZGA(zfn_m13_acuerdo.getZGAAll().size()); zgaAcuPesos.getCodigoRegistro().getNamespaceID().setValue(ZGA.ACU_PESOS); //ZGA.1.1 zgaAcuPesos.getCodigoRegistro().getUniversalID().setValue(acuPesos.getIdAcuPeso().toString()); //ZGA.1.2 logger.debug(" " + ZGA.ACU_PESOS + ": " + zgaAcuPesos.encode()); ZCE zceAcuPesosDesde = zgaAcuPesos.getElementoCodificado(zgaAcuPesos.getElementoCodificadoReps()); //ZGA.5 zceAcuPesosDesde.getDescripcion() .setValue(acuPesos.getPesoDesde() != null ? acuPesos.getPesoDesde().toString() : "0"); //ZGA.5.3 zceAcuPesosDesde.getCodigoRegistro().getNamespaceID().setValue(ZGA.ACU_PESO_DESDE); //ZGA.5.4.1 logger.debug(" " + ZGA.ACU_PESO_DESDE + ": " + zceAcuPesosDesde.encode()); ZCE zceAcuPesosHasta = zgaAcuPesos.getElementoCodificado(zgaAcuPesos.getElementoCodificadoReps()); //ZGA.5 zceAcuPesosHasta.getDescripcion() .setValue(acuPesos.getPesoHasta() != null ? acuPesos.getPesoHasta().toString() : "0"); //ZGA.5.3 zceAcuPesosHasta.getCodigoRegistro().getNamespaceID().setValue(ZGA.ACU_PESO_HASTA); //ZGA.5.4.1 logger.debug(" " + ZGA.ACU_PESO_HASTA + ": " + zceAcuPesosHasta.encode()); } } //ACU_SIT_CLINICAS List<AcuSitClinica> acuSitClinicas = acuCentros.getAcuerdos().getAcuSitClinicas(); if (acuSitClinicas != null && !acuSitClinicas.isEmpty()) { Iterator<AcuSitClinica> iteratorAcuSitClinicas = acuSitClinicas.iterator(); while (iteratorAcuSitClinicas.hasNext()) { AcuSitClinica acuSitClinica = iteratorAcuSitClinicas.next(); try { List<SitClinicaExt> sitClinicaExts = sitClinicaExtService .findEquivalencia(acuCentros.getCentros(), acuSitClinica.getSitClinica()); for (SitClinicaExt sitClinicaExt : sitClinicaExts) { ZGA zgaAcuSitClinica = zfn_m13_acuerdo.getZGA(zfn_m13_acuerdo.getZGAAll().size()); zgaAcuSitClinica.getCodigoRegistro().getNamespaceID().setValue(ZGA.ACU_SIT_CLINICA); //ZGA.1.1 zgaAcuSitClinica.getCodigoRegistro().getUniversalID() .setValue(acuSitClinica.getIdAcuSitClinica().toString()); //ZGA.1.2 zgaAcuSitClinica.getIdentificador() .setValue(acuSitClinica.getSitClinica().getIdSitClinica().toString()); //ZGA.2 zgaAcuSitClinica.getCodigo().setValue(sitClinicaExt.getCodSitClinicaExt()); //ZGA.3 zgaAcuSitClinica.getDescripcion().setValue(sitClinicaExt.getTxtSitClinicaExt()); //ZGA.4 logger.debug( " " + ZGA.ACU_SIT_CLINICA + ": " + zgaAcuSitClinica.encode()); //ACU_VAL_SIT_CLINICA if (acuSitClinica.getAcuValSitClinicas() != null && !acuSitClinica.getAcuValSitClinicas().isEmpty()) { for (AcuValSitClinica acuValSitClinica : acuSitClinica.getAcuValSitClinicas()) { try { List<ValSitClinicaExt> valSitClinicaExts = valSitClinicaExtService .findEquivalencia(acuCentros.getCentros(), acuValSitClinica.getValSitClinica()); for (ValSitClinicaExt valSitClinicaExt : valSitClinicaExts) { ZCE zceAcuValSitClinica = zgaAcuSitClinica.getElementoCodificado( zgaAcuSitClinica.getElementoCodificadoReps()); zceAcuValSitClinica.getIdentificador().setValue(acuValSitClinica .getValSitClinica().getIdValSitClinica().toString()); //ZGA.5.1 zceAcuValSitClinica.getCodigo() .setValue(valSitClinicaExt.getCodValSitClinicaExt()); //ZGA.5.2 zceAcuValSitClinica.getDescripcion() .setValue(valSitClinicaExt.getTxtValSitClinicaExt()); //ZGA.5.3 zceAcuValSitClinica.getCodigoRegistro().getNamespaceID() .setValue(ZGA.ACU_VAL_SIT_CLINICA); //ZGA.5.4.1 zceAcuValSitClinica.getCodigoRegistro().getUniversalID() .setValue(acuValSitClinica.getIdAcuValSitClinica().toString()); //ZGA.5.4.2 logger.debug(" " + ZGA.ACU_VAL_SIT_CLINICA + ": " + zceAcuValSitClinica.encode()); } } catch (NoExisteEquivalenciaException neee) { logger.error( " No existe equivalencia para el VALOR DE LA SITUACION CLINICA DE PARTIDA: " + acuValSitClinica.getValSitClinica().toString()); resultado.add( "No existe equivalencia para el VALOR DE LA SITUACION CLINICA DE PARTIDA: " + acuValSitClinica.getValSitClinica().toString()); } } } } } catch (NoExisteEquivalenciaException neee) { logger.error(" No existe equivalencia para la SITUACION CLINICA DE PARTIDA: " + acuSitClinica.getSitClinica().toString()); resultado.add("No existe equivalencia para la SITUACION CLINICA DE PARTIDA: " + acuSitClinica.getSitClinica().toString()); } } } //ACU_MARCA_BIO List<AcuMarcaBio> acuMarcaBios = acuCentros.getAcuerdos().getAcuMarcaBios(); if (acuMarcaBios != null && !acuMarcaBios.isEmpty()) { Iterator<AcuMarcaBio> iteratorAcuMarcaBios = acuMarcaBios.iterator(); while (iteratorAcuMarcaBios.hasNext()) { AcuMarcaBio acuMarcaBio = iteratorAcuMarcaBios.next(); try { List<MarcaBioExt> marcaBioExts = marcaBioExtService.findEquivalencia(acuCentros.getCentros(), acuMarcaBio.getMarcaBio()); for (MarcaBioExt marcaBioExt : marcaBioExts) { ZGA zgaAcuMarcaBio = zfn_m13_acuerdo.getZGA(zfn_m13_acuerdo.getZGAAll().size()); zgaAcuMarcaBio.getCodigoRegistro().getNamespaceID().setValue(ZGA.ACU_MARCA_BIO); //ZGA.1.1 zgaAcuMarcaBio.getCodigoRegistro().getUniversalID() .setValue(acuMarcaBio.getIdAcuMarcaBio().toString()); //ZGA.1.2 zgaAcuMarcaBio.getIdentificador() .setValue(acuMarcaBio.getMarcaBio().getIdMarcaBio().toString()); //ZGA.2 zgaAcuMarcaBio.getCodigo().setValue(marcaBioExt.getCodMarcaBioExt()); //ZGA.3 zgaAcuMarcaBio.getDescripcion().setValue(marcaBioExt.getTxtMarcaBioExt()); //ZGA.4 logger.debug(" " + ZGA.ACU_MARCA_BIO + ": " + zgaAcuMarcaBio.encode()); //ACU_VAL_MARCA_BIO if (acuMarcaBio.getAcuValMarcaBios() != null && !acuMarcaBio.getAcuValMarcaBios().isEmpty()) { for (AcuValMarcaBio acuValMarcaBio : acuMarcaBio.getAcuValMarcaBios()) { try { List<ValMarcaBioExt> valMarcaBioExts = valMarcaBioExtService.findEquivalencia( acuCentros.getCentros(), acuValMarcaBio.getValMarcaBio()); for (ValMarcaBioExt valMarcaBioExt : valMarcaBioExts) { ZCE zceAcuValMarcaBio = zgaAcuMarcaBio .getElementoCodificado(zgaAcuMarcaBio.getElementoCodificadoReps()); zceAcuValMarcaBio.getIdentificador().setValue( acuValMarcaBio.getValMarcaBio().getIdValMarcaBio().toString()); //ZGA.5.1 zceAcuValMarcaBio.getCodigo() .setValue(valMarcaBioExt.getCodValMarcaBioExt()); //ZGA.5.2 zceAcuValMarcaBio.getDescripcion() .setValue(valMarcaBioExt.getTxtValMarcaBioExt()); //ZGA.5.3 zceAcuValMarcaBio.getCodigoRegistro().getNamespaceID() .setValue(ZGA.ACU_VAL_MARCA_BIO); //ZGA.5.4.1 zceAcuValMarcaBio.getCodigoRegistro().getUniversalID() .setValue(acuValMarcaBio.getIdAcuValMarcaBio().toString()); //ZGA.5.4.2 logger.debug(" " + ZGA.ACU_VAL_MARCA_BIO + ": " + zceAcuValMarcaBio.encode()); } } catch (NoExisteEquivalenciaException neee) { logger.error( " No existe equivalencia para el VALOR DEL MARCADOR BIOLOGICO: " + acuValMarcaBio.getValMarcaBio().toString()); resultado.add("No existe equivalencia para el VALOR DEL MARCADOR BIOLOGICO: " + acuValMarcaBio.getValMarcaBio().toString()); } } } } } catch (NoExisteEquivalenciaException neee) { logger.error(" No existe equivalencia para el MARCADOR BIOLOGICO: " + acuMarcaBio.getMarcaBio().toString()); resultado.add("No existe equivalencia para el MARCADOR BIOLOGICO: " + acuMarcaBio.getMarcaBio().toString()); } } } logger.debug(" Datos del ACUERDO generados CORRECTAMENTE"); //EVALUACIONES List<AcuEvaluaciones> acuEvaluacioneses = acuCentros.getAcuerdos().getAcuEvaluacioneses(); if (acuEvaluacioneses != null && !acuEvaluacioneses.isEmpty()) { logger.debug(" Generando datos de las EVALUACIONES"); Iterator<AcuEvaluaciones> iteradorAcuEvaluacioneses = acuEvaluacioneses.iterator(); while (iteradorAcuEvaluacioneses.hasNext()) { AcuEvaluaciones acuEvaluaciones = iteradorAcuEvaluacioneses.next(); //ZFN_M13_EVALUACIONES ZFN_M13_EVALUACIONES zfn_m13_evaluaciones = zfn_m13_acuerdo .getEVALUACIONES(zfn_m13_acuerdo.getEVALUACIONESReps()); //ZFE - Master file identification (Evaluaciones) logger.debug( " Generando el segmento ZFE - Master file identification (Evaluaciones)"); ZFE zfeAcuEvaluaciones = zfn_m13_evaluaciones.getZFE(); zfeAcuEvaluaciones.getMasterIdentifier().getIdentifier() .setValue(acuEvaluaciones.getIdAcuEvaluacion().toString()); //ZFE.1 zfeAcuEvaluaciones.getFileLevelEventCode().setValue("REP"); //ZFA.3 zfeAcuEvaluaciones.getResponseLevelCode().setValue("AL"); //ZFA.6 logger.debug(" " + zfeAcuEvaluaciones.encode()); //ZGE - Master file entry (Evaluaciones) logger.debug(" Generando los segmentos ZGE - Master file entry (Evaluaciones)"); //ACU_EVAL_REQUERIDO ZGE zgeAcuEvalRequerido = zfn_m13_evaluaciones.getZGE(zfn_m13_evaluaciones.getZGEReps()); zgeAcuEvalRequerido.getCodigoRegistro().getNamespaceID().setValue(ZGE.ACU_EVAL_REQUERIDO); //ZGE.1.1 zgeAcuEvalRequerido.getDescripcion() .setValue(StringUtils.isNotBlank(acuEvaluaciones.getRequerido()) ? acuEvaluaciones.getRequerido() : "N"); //ZGE.4 logger.debug(" " + ZGE.ACU_EVAL_REQUERIDO + ": " + zgeAcuEvalRequerido.encode()); //ACU_EVAL_MAXIMO ZGE zgeAcuEvalMaximo = zfn_m13_evaluaciones.getZGE(zfn_m13_evaluaciones.getZGEReps()); zgeAcuEvalMaximo.getCodigoRegistro().getNamespaceID().setValue(ZGE.ACU_EVAL_MAXIMO); //ZGE.1.1 zgeAcuEvalMaximo.getDescripcion().setValue( acuEvaluaciones.getMaximo() != null ? acuEvaluaciones.getMaximo().toString() : "0"); //ZGE.4 logger.debug(" " + ZGE.ACU_EVAL_MAXIMO + ": " + zgeAcuEvalMaximo.encode()); //ACU_EVAL_NUM_DIAS ZGE zgeAcuEvalNumDias = zfn_m13_evaluaciones.getZGE(zfn_m13_evaluaciones.getZGEReps()); zgeAcuEvalNumDias.getCodigoRegistro().getNamespaceID().setValue(ZGE.ACU_EVAL_NUM_DIAS); //ZGE.1.1 zgeAcuEvalNumDias.getDescripcion().setValue( acuEvaluaciones.getNumDias() != null ? acuEvaluaciones.getNumDias().toString() : "0"); //ZGE.4 logger.debug(" " + ZGE.ACU_EVAL_NUM_DIAS + ": " + zgeAcuEvalNumDias.encode()); //ACU_EVAL_NUM_CICLOS ZGE zgeAcuEvalNumCiclos = zfn_m13_evaluaciones.getZGE(zfn_m13_evaluaciones.getZGEReps()); zgeAcuEvalNumCiclos.getCodigoRegistro().getNamespaceID().setValue(ZGE.ACU_EVAL_NUM_CICLOS); //ZGE.1.1 zgeAcuEvalNumCiclos.getDescripcion().setValue( acuEvaluaciones.getNumCiclos() != null ? acuEvaluaciones.getNumCiclos().toString() : "0"); //ZGE.4 logger.debug( " " + ZGE.ACU_EVAL_NUM_CICLOS + ": " + zgeAcuEvalNumCiclos.encode()); //ACU_EVAL_MEDIDAS ZGE zgeAcuEvalMedidas = zfn_m13_evaluaciones.getZGE(zfn_m13_evaluaciones.getZGEReps()); zgeAcuEvalMedidas.getCodigoRegistro().getNamespaceID().setValue(ZGE.ACU_EVAL_MEDIDAS); //ZGE.1.1 try { List<EvalMedidasExt> evalMedidasExts = evalMedidasExtService .findEquivalencia(acuCentros.getCentros(), acuEvaluaciones.getEvalMedidas()); if (evalMedidasExts.size() == 1) { EvalMedidasExt evalMedidasExt = evalMedidasExts.get(0); zgeAcuEvalMedidas.getIdentificador() .setValue(acuEvaluaciones.getEvalMedidas().getIdEvalMedida().toString()); //ZGE.2 zgeAcuEvalMedidas.getCodigo().setValue(evalMedidasExt.getCodEvalMedidaExt()); //ZGE.3 zgeAcuEvalMedidas.getDescripcion().setValue(evalMedidasExt.getTxtEvalMedidaExt()); //ZGE.4 logger.debug( " " + ZGE.ACU_EVAL_MEDIDAS + ": " + zgeAcuEvalMedidas.encode()); } else if (evalMedidasExts.size() > 1) { logger.error( " Existen multiples equivalencias para la MEDIDA DE EVALUACION: " + acuEvaluaciones.getEvalMedidas().toString()); resultado.add("Existen multiples equivalencias para la MEDIDA DE EVALUACION: " + acuEvaluaciones.getEvalMedidas().toString()); } } catch (NoExisteEquivalenciaException neee) { logger.error(" No existe equivalencia para la MEDIDA DE EVALUACION: " + acuEvaluaciones.getEvalMedidas().toString()); resultado.add("No existe equivalencia para la MEDIDA DE EVALUACION: " + acuEvaluaciones.getEvalMedidas().toString()); } List<AcuEvalDatos> acuEvalDatoses = acuEvaluaciones.getAcuEvalDatoses(); if (acuEvalDatoses != null && !acuEvalDatoses.isEmpty()) { Iterator<AcuEvalDatos> iteradorAcuEvalDatoses = acuEvalDatoses.iterator(); while (iteradorAcuEvalDatoses.hasNext()) { AcuEvalDatos acuEvalDatos = iteradorAcuEvalDatoses.next(); try { List<EvalDatosExt> evalDatosExts = evalDatosExtService .findEquivalencia(acuCentros.getCentros(), acuEvalDatos.getEvalDatos()); for (EvalDatosExt evalDatosExt : evalDatosExts) { ZGE zgeAcuEvalDatos = zfn_m13_evaluaciones .getZGE(zfn_m13_evaluaciones.getZGEReps()); zgeAcuEvalDatos.getCodigoRegistro().getNamespaceID().setValue(ZGE.ACU_EVAL_DATOS); //ZGE.1.1 zgeAcuEvalDatos.getCodigoRegistro().getUniversalID() .setValue(acuEvalDatos.getIdAcuEvalDato().toString()); //ZGE.1.2 zgeAcuEvalDatos.getIdentificador() .setValue(acuEvalDatos.getEvalDatos().getIdEvalDato().toString()); //ZGE.2 zgeAcuEvalDatos.getCodigo().setValue(evalDatosExt.getCodEvalDatoExt()); //ZGE.3 zgeAcuEvalDatos.getDescripcion().setValue(evalDatosExt.getTxtEvalDatoExt()); //ZGE.4 logger.debug(" " + ZGE.ACU_EVAL_DATOS + ": " + zgeAcuEvalDatos.encode()); //ACU_EVAL_VAL_DATOS if (acuEvalDatos.getAcuEvalValDatoses() != null && !acuEvalDatos.getAcuEvalValDatoses().isEmpty()) { for (AcuEvalValDatos acuEvalValDatos : acuEvalDatos.getAcuEvalValDatoses()) { try { List<EvalValDatosExt> evalValDatosExts = evalValDatosExtService .findEquivalencia(acuCentros.getCentros(), acuEvalValDatos.getEvalValDatos()); for (EvalValDatosExt evalValDatosExt : evalValDatosExts) { ZCE zceAcuEvalValDatos = zgeAcuEvalDatos.getElementoCodificado( zgeAcuEvalDatos.getElementoCodificadoReps()); zceAcuEvalValDatos.getIdentificador().setValue(acuEvalValDatos .getEvalValDatos().getIdEvalValDato().toString()); //ZCE.1 zceAcuEvalValDatos.getCodigo() .setValue(evalValDatosExt.getCodEvalValDatoExt()); //ZCE.2 zceAcuEvalValDatos.getDescripcion() .setValue(evalValDatosExt.getTxtEvalValDatoExt()); //ZCE.3 zceAcuEvalValDatos.getCodigoRegistro().getNamespaceID() .setValue(ZGE.ACU_EVAL_VAL_DATOS); //ZCE.4.1 zceAcuEvalValDatos.getCodigoRegistro().getUniversalID() .setValue(acuEvalValDatos.getIdAcuEvalValDato().toString()); //ZCE.4.2 logger.debug(" " + ZGE.ACU_EVAL_VAL_DATOS + ": " + zceAcuEvalValDatos.encode()); } } catch (NoExisteEquivalenciaException neee) { logger.error( " No existe equivalencia para el VALOR DE DATO DE EVALUACION: " + acuEvalValDatos.getEvalValDatos().toString()); resultado.add( "No existe equivalencia para el VALOR DE DATO DE EVALUACION: " + acuEvalValDatos.getEvalValDatos().toString()); } } } } } catch (NoExisteEquivalenciaException neee) { logger.error(" No existe equivalencia para el DATO DE EVALUACION: " + acuEvalDatos.getEvalDatos().toString()); resultado.add("No existe equivalencia para el DATO DE EVALUACION: " + acuEvalDatos.getEvalDatos().toString()); } } } //ACU_EVAL_FACUL List<AcuEvalFacul> acuEvalFaculs = acuEvaluaciones.getAcuEvalFaculs(); if (acuEvalFaculs != null && !acuEvalFaculs.isEmpty()) { Iterator<AcuEvalFacul> iteradorAcuEvalFaculs = acuEvalFaculs.iterator(); while (iteradorAcuEvalFaculs.hasNext()) { AcuEvalFacul acuEvalFacul = iteradorAcuEvalFaculs.next(); try { List<EvalValFaculExt> evalValFaculExts = evalValFaculExtService .findEquivalencia(acuCentros.getCentros(), acuEvalFacul.getEvalValFacul()); for (EvalValFaculExt evalValFaculExt : evalValFaculExts) { ZGE zgeAcuEvalFacul = zfn_m13_evaluaciones .getZGE(zfn_m13_evaluaciones.getZGEReps()); zgeAcuEvalFacul.getCodigoRegistro().getNamespaceID().setValue(ZGE.ACU_EVAL_FACUL); //ZGE.1.1 zgeAcuEvalFacul.getCodigoRegistro().getUniversalID() .setValue(acuEvalFacul.getIdAcuEvalFacul().toString()); //ZGE.1.2 zgeAcuEvalFacul.getIdentificador() .setValue(acuEvalFacul.getEvalValFacul().getIdEvalValFacul().toString()); //ZGE.2 zgeAcuEvalFacul.getCodigo().setValue(evalValFaculExt.getCodEvalValFaculExt()); //ZGE.3 zgeAcuEvalFacul.getDescripcion().setValue(evalValFaculExt.getTxtEvalValFaculExt()); //ZGE.4 logger.debug(" " + ZGE.ACU_EVAL_FACUL + ": " + zgeAcuEvalFacul.encode()); } } catch (NoExisteEquivalenciaException neee) { logger.error( " No existe equivalencia para la EVALUACION FACULTATIVA: " + acuEvalFacul.getEvalValFacul().toString()); resultado.add("No existe equivalencia para la EVALUACION FACULTATIVA: " + acuEvalFacul.getEvalValFacul().toString()); } } } } logger.debug(" Datos de las EVALUACIONES generados CORRECTAMENTE"); } //RESULTADO GENERAL DEL PROCESADO DEL MOVIMIENTO String mensaje = ""; if (!resultado.isEmpty()) { for (String linea : resultado) { mensaje += " - " + linea + "\n"; } } if (StringUtils.isNotBlank(mensaje)) { throw new HL7Exception(mensaje); } logger.debug(" Finalizando la generacion del mensaje ZFN_M13"); return zfn_m13; }
From source file:com.sonicle.webtop.core.Service.java
public void processLookupTimezones(HttpServletRequest request, HttpServletResponse response, PrintWriter out) { ArrayList<JsSimple> items = new ArrayList<>(); try {/*from w w w. j a va2s . com*/ int off; for (TimeZone tz : WT.getTimezones()) { final String normId = StringUtils.replace(tz.getID(), "_", " "); off = tz.getRawOffset() / 3600000; items.add(new JsSimple(tz.getID(), MessageFormat.format("{0} (GMT{1}{2})", normId, (off < 0) ? "-" : "+", Math.abs(off)))); } new JsonResult("timezones", items, items.size()).printTo(out); } catch (Exception ex) { logger.error("Error in LookupTimezones", ex); new JsonResult(false, "Unable to lookup timezones").printTo(out); } }
From source file:me.ryanhamshire.griefprevention.permission.GPPermissionHandler.java
public static Tristate getFlagOverride(Event event, Location<World> location, GPClaim claim, String flagPermission, Object source, Object target, User user, GPPlayerData playerData, boolean checkWildernessOverride) { if (!claim.getInternalClaimData().allowFlagOverrides()) { return Tristate.UNDEFINED; }//from w w w . java 2 s. co m if (checkWildernessOverride && !claim.isWilderness()) { final Tristate wildernessOverride = getFlagOverride(event, location, (GPClaim) claim.getWilderness(), flagPermission, source, target, user, playerData, false); if (wildernessOverride != Tristate.UNDEFINED) { return wildernessOverride; } } currentEvent = event; eventLocation = location; eventSubject = user; Player player = null; final Subject subject = user != null ? user : GriefPreventionPlugin.GLOBAL_SUBJECT; String targetModPermission = null; String targetMetaPermission = null; if (target != null && source == null) { String targetId = getPermissionIdentifier(target); flagPermission += "." + targetId; } else if (target != null && source != null) { String sourceId = getPermissionIdentifier(source, true); String targetId = getPermissionIdentifier(target); if (!targetId.isEmpty()) { String[] parts = targetId.split(":"); String targetMod = parts[0]; if (!sourceId.isEmpty()) { // move target meta to end of permission Matcher m = PATTERN_META.matcher(targetId); String targetMeta = ""; if (m.find()) { targetMeta = m.group(0); targetId = StringUtils.replace(targetId, targetMeta, ""); } if (!targetMeta.isEmpty()) { targetMetaPermission = flagPermission + "." + StringUtils.replace(targetId, ":", ".") + targetMeta; } targetModPermission = flagPermission + "." + targetMod + ".source." + sourceId + targetMeta; targetModPermission = StringUtils.replace(targetModPermission, ":", "."); flagPermission += "." + targetId + ".source." + sourceId + targetMeta; } else { flagPermission += "." + targetId; } } } flagPermission = StringUtils.replace(flagPermission, ":", "."); if (playerData != null) { playerData.ignoreActiveContexts = true; } Set<Context> contexts = new LinkedHashSet<>(subject.getActiveContexts()); if (playerData != null) { playerData.ignoreActiveContexts = false; } if (claim.isWilderness()) { contexts.add(ClaimContexts.WILDERNESS_OVERRIDE_CONTEXT); player = user instanceof Player ? (Player) user : null; } else if (claim.isAdminClaim()) { contexts.add(ClaimContexts.ADMIN_OVERRIDE_CONTEXT); contexts.add(claim.world.getContext()); } else if (claim.isTown()) { contexts.add(ClaimContexts.TOWN_OVERRIDE_CONTEXT); contexts.add(claim.world.getContext()); } else { contexts.add(ClaimContexts.BASIC_OVERRIDE_CONTEXT); contexts.add(claim.world.getContext()); } Tristate value = subject.getPermissionValue(contexts, flagPermission); if (value != Tristate.UNDEFINED) { if (player != null && claim.isWilderness() && value == Tristate.FALSE) { Text reason = GriefPreventionPlugin.getGlobalConfig().getConfig().bans.getReason(flagPermission); if (reason != null && !reason.isEmpty()) { player.sendMessage(reason); } } return processResult(claim, flagPermission, value, user); } if (targetMetaPermission != null) { value = subject.getPermissionValue(contexts, targetMetaPermission); if (value != Tristate.UNDEFINED) { if (player != null && claim.isWilderness() && value == Tristate.FALSE) { Text reason = GriefPreventionPlugin.getGlobalConfig().getConfig().bans .getReason(targetMetaPermission); if (reason != null && !reason.isEmpty()) { player.sendMessage(reason); } } return processResult(claim, targetMetaPermission, value, user); } } // check target modid if (targetModPermission != null) { value = subject.getPermissionValue(contexts, targetModPermission); if (value != Tristate.UNDEFINED) { if (player != null && claim.isWilderness() && value == Tristate.FALSE) { Text reason = GriefPreventionPlugin.getGlobalConfig().getConfig().bans .getReason(targetModPermission); if (reason != null && !reason.isEmpty()) { player.sendMessage(reason); } } return processResult(claim, targetModPermission, value, user); } } return Tristate.UNDEFINED; }
From source file:mx.itesm.web2mexadl.cluster.ClusterAnalyzer.java
/** * Export the given data into a MexADL architecture document. * /*w ww.j ava 2 s . c om*/ * @param outputDir * @param implementationPackages * @throws IOException * @throws JDOMException */ @SuppressWarnings("unchecked") public static void exportToMexADL(final File outputDir, final StringBuilder... implementationPackages) throws IOException, JDOMException { File outputFile; Document document; String identifier; List<Element> links; String outputContents; XMLOutputter outputter; List<Element> components; List<Element> connectors; List<Element> componentTypes; List<Element> validComponents; StringBuilder implementationPackage; document = ClusterAnalyzer.saxBuilder .build(MvcAnalyzer.class.getResourceAsStream("/mx/itesm/web2mexadl/templates/ClusterTemplate.xml")); components = (List<Element>) ClusterAnalyzer.componentsPath.selectNodes(document); connectors = (List<Element>) ClusterAnalyzer.connectorsPath.selectNodes(document); links = (List<Element>) ClusterAnalyzer.linksPath.selectNodes(document); componentTypes = (List<Element>) ClusterAnalyzer.componentTypesPath.selectNodes(document); // Identify the clusters specified in the implementationPackages validComponents = new ArrayList<Element>(implementationPackages.length); for (int i = 0; i < implementationPackages.length; i++) { for (Element component : components) { if (component.getChild("description", ClusterAnalyzer.XADL_TYPES_NAMESPACE).getValue() .equals("Cluster_" + i)) { validComponents.add(component); } } } // Remove the unused clusters and their associated connectors and links for (Element component : components) { if (!validComponents.contains(component)) { identifier = component.getChild("description", ClusterAnalyzer.XADL_TYPES_NAMESPACE).getValue(); identifier = identifier.substring(identifier.indexOf('_') + 1); // Remove component component.detach(); // Remove component type for (Element type : componentTypes) { if (type.getChild("description", ClusterAnalyzer.XADL_TYPES_NAMESPACE).getValue() .equals("Cluster_" + identifier + "Type")) { type.detach(); break; } } // Remove connector for (Element connector : connectors) { if (connector.getChild("description", ClusterAnalyzer.XADL_TYPES_NAMESPACE).getValue() .equals("Connector_" + identifier)) { connector.detach(); break; } } // Remove links for (Element link : links) { // Input link if (link.getChild("description", ClusterAnalyzer.XADL_TYPES_NAMESPACE).getValue() .equals("in" + identifier)) { link.detach(); } // Output from this component to other ones else if (link.getChild("description", ClusterAnalyzer.XADL_TYPES_NAMESPACE).getValue() .startsWith("out" + identifier)) { link.detach(); } // Output from other components to this one else if (link.getChild("description", ClusterAnalyzer.XADL_TYPES_NAMESPACE).getValue() .startsWith("out") && link.getChild("description", ClusterAnalyzer.XADL_TYPES_NAMESPACE).getValue() .endsWith("-" + identifier)) { link.detach(); } } } } // Write base architecture document outputter = new XMLOutputter(); outputFile = new File(outputDir, "clusteredArchitecture.xml"); FileUtils.deleteQuietly(outputFile); outputter.output(document, new FileWriter(outputFile)); // Update implementation packages outputContents = FileUtils.readFileToString(outputFile, "UTF-8"); for (int i = 0; i < implementationPackages.length; i++) { implementationPackage = implementationPackages[i]; outputContents = StringUtils.replace(outputContents, "<!-- Cluster_" + i + " implementation -->", implementationPackage.toString()); } // Write final architecture document FileUtils.deleteQuietly(outputFile); FileUtils.write(outputFile, outputContents); }
From source file:atg.tools.dynunit.test.util.DBUtils.java
public void executeSQLFile(@NotNull File pFile) { logger.info("Attempting to execute {}", pFile); SQLFileParser parser = new SQLFileParser(); Collection<String> c = parser.parseSQLFile(pFile.getAbsolutePath()); for (String cmd : c) { try {/*from w ww. j av a2 s. co m*/ if ("Oracle".equals(databaseType)) { cmd = StringUtils.replace(cmd, "numeric", "NUMBER"); cmd = StringUtils.replace(cmd, "varchar ", "VARCHAR2 "); cmd = StringUtils.replace(cmd, "varchar(", "VARCHAR2("); cmd = StringUtils.replace(cmd, "binary", "RAW (250)"); } logger.info("Executing {}", cmd); update(cmd); } catch (SQLException e) { logger.catching(e); } } }