List of usage examples for org.apache.commons.lang3 StringUtils equalsIgnoreCase
public static boolean equalsIgnoreCase(final CharSequence str1, final CharSequence str2)
Compares two CharSequences, returning true if they represent equal sequences of characters, ignoring case.
null s are handled without exceptions.
From source file:com.glaf.dts.bean.TransformBean.java
public boolean transformQueryToTable(String queryId) { logger.debug("----------------------transformQueryToTable---------"); boolean result = true; QueryDefinition queryDefinition = getQueryDefinitionService().getQueryDefinition(queryId); String tableName = queryDefinition.getTargetTableName(); if (StringUtils.isNotEmpty(tableName)) { tableName = tableName.toLowerCase(); if (StringUtils.startsWith(tableName, "mx_") || StringUtils.startsWith(tableName, "sys_") || StringUtils.startsWith(tableName, "act_") || StringUtils.startsWith(tableName, "jbpm_")) { return false; }/*from w w w. ja v a 2 s . com*/ MxTransformManager manager = new MxTransformManager(); TableDefinition tableDefinition = null; if (!StringUtils.equalsIgnoreCase(queryDefinition.getRotatingFlag(), "R2C")) { try { tableDefinition = manager.toTableDefinition(queryDefinition); tableDefinition.setTableName(tableName); tableDefinition.setType("DTS"); tableDefinition.setNodeId(queryDefinition.getNodeId()); TransformTable tbl = new TransformTable(); tbl.createOrAlterTable(tableDefinition); } catch (Exception ex) { ex.printStackTrace(); logger.error(ex); } } Long databaseId = queryDefinition.getDatabaseId(); TransformTable transformTable = new TransformTable(); try { Database db = getDatabaseService().getDatabaseById(databaseId); if (db != null) { transformTable.transformQueryToTable(tableName, queryDefinition.getId(), db.getName()); } else { transformTable.transformQueryToTable(tableName, queryDefinition.getId(), Environment.DEFAULT_SYSTEM_NAME); } } catch (Exception ex) { result = false; ex.printStackTrace(); logger.error(ex); } } return result; }
From source file:com.nridge.core.base.io.xml.RelationshipXML.java
/** * Parses an XML DOM element and loads it into a relationship. * * @param anElement DOM element.//from ww w . j ava 2 s. c o m * * @throws java.io.IOException I/O related exception. */ @Override public void load(Element anElement) throws IOException { Node nodeItem; Attr nodeAttr; Element nodeElement; DataBagXML dataBagXML; DocumentXML documentXML; String nodeName, nodeValue; mRelationship.reset(); String attrValue = anElement.getAttribute("type"); if (StringUtils.isEmpty(attrValue)) throw new IOException("Relationship is missing type attribute."); mRelationship.setType(attrValue); NamedNodeMap namedNodeMap = anElement.getAttributes(); int attrCount = namedNodeMap.getLength(); for (int attrOffset = 0; attrOffset < attrCount; attrOffset++) { nodeAttr = (Attr) namedNodeMap.item(attrOffset); nodeName = nodeAttr.getNodeName(); nodeValue = nodeAttr.getNodeValue(); if (StringUtils.isNotEmpty(nodeValue)) { if ((!StringUtils.equalsIgnoreCase(nodeName, "type"))) mRelationship.addFeature(nodeName, nodeValue); } } NodeList nodeList = anElement.getChildNodes(); for (int i = 0; i < nodeList.getLength(); i++) { nodeItem = nodeList.item(i); if (nodeItem.getNodeType() != Node.ELEMENT_NODE) continue; nodeName = nodeItem.getNodeName(); if (nodeName.equalsIgnoreCase(IO.XML_PROPERTIES_NODE_NAME)) { nodeElement = (Element) nodeItem; dataBagXML = new DataBagXML(); dataBagXML.load(nodeElement); mRelationship.setBag(dataBagXML.getBag()); } else { nodeElement = (Element) nodeItem; documentXML = new DocumentXML(); documentXML.load(nodeElement); mRelationship.add(documentXML.getDocument()); } } }
From source file:com.ottogroup.bi.spqr.node.resource.pipeline.MicroPipelineResource.java
/** * Creates or updates a pipeline for the given identifier and {@link MicroPipelineConfiguration} * @param pipelineId/*from w ww . j a va 2s.co m*/ * @param configuration * @return */ @Produces(value = "application/json") @Timed(name = "pipeline-instantiation") @PUT @Path("{pipelineId}") public MicroPipelineInstantiationResponse updatePipeline(@PathParam("pipelineId") final String pipelineId, final MicroPipelineConfiguration configuration) { if (StringUtils.isBlank(pipelineId)) return new MicroPipelineInstantiationResponse(pipelineId, MicroPipelineValidationResult.MISSING_CONFIGURATION, ERROR_MSG_PIPELINE_ID_MISSING); if (configuration == null) return new MicroPipelineInstantiationResponse(pipelineId, MicroPipelineValidationResult.MISSING_CONFIGURATION, ERROR_MSG_PIPELINE_CONFIGURATION_MISSING); if (!StringUtils.equalsIgnoreCase(StringUtils.trim(pipelineId), configuration.getId())) return new MicroPipelineInstantiationResponse(pipelineId, MicroPipelineValidationResult.PIPELINE_INITIALIZATION_FAILED, ERROR_MSG_PIPELINE_IDS_DIFFER); try { // shutdown running instance of pipeline if (this.microPipelineManager.hasPipeline(pipelineId)) { this.microPipelineManager.shutdownPipeline(pipelineId); } String id = this.microPipelineManager.executePipeline(configuration); return new MicroPipelineInstantiationResponse(id, MicroPipelineValidationResult.OK, ""); } catch (RequiredInputMissingException e) { return new MicroPipelineInstantiationResponse(pipelineId, MicroPipelineValidationResult.MISSING_CONFIGURATION, e.getMessage()); } catch (QueueInitializationFailedException e) { return new MicroPipelineInstantiationResponse(pipelineId, MicroPipelineValidationResult.QUEUE_INITIALIZATION_FAILED, e.getMessage()); } catch (ComponentInitializationFailedException e) { return new MicroPipelineInstantiationResponse(pipelineId, MicroPipelineValidationResult.COMPONENT_INITIALIZATION_FAILED, e.getMessage()); } catch (PipelineInstantiationFailedException e) { return new MicroPipelineInstantiationResponse(pipelineId, MicroPipelineValidationResult.PIPELINE_INITIALIZATION_FAILED, e.getMessage()); } catch (NonUniqueIdentifierException e) { return new MicroPipelineInstantiationResponse(pipelineId, MicroPipelineValidationResult.NON_UNIQUE_PIPELINE_ID, e.getMessage()); } catch (Exception e) { return new MicroPipelineInstantiationResponse(pipelineId, MicroPipelineValidationResult.TECHNICAL_ERROR, e.getMessage()); } }
From source file:com.adobe.acs.commons.dam.impl.AssetsFolderPropertiesSupport.java
/** * Gateway method the Filter uses to determine if the request is a candidate for processing by Assets Folder Properties Support. * These checks should be fast and fail broadest and fastest first. * * @param request the request// w ww.j a v a2 s. c o m * @return true if Assets Folder Properties Support should process this request. */ @SuppressWarnings("squid:S3923") protected boolean accepts(SlingHttpServletRequest request) { if (!StringUtils.equalsIgnoreCase(POST_METHOD, request.getMethod())) { // Only POST methods are processed return false; } else if (!DAM_FOLDER_SHARE_OPERATION.equals(request.getParameter(OPERATION))) { // Only requests with :operation=dam.share.folder are processed return false; } else if (!StringUtils.startsWith(request.getResource().getPath(), DAM_PATH_PREFIX)) { // Only requests under /content/dam are processed return false; } else if (!request.getResource().isResourceType(JcrResourceConstants.NT_SLING_FOLDER) && !request.getResource().isResourceType(JcrResourceConstants.NT_SLING_ORDERED_FOLDER)) { // Only requests to sling:Folders or sling:Ordered folders are processed return false; } // If the above checks do not fail, treat as a valid request return true; }
From source file:com.mnxfst.stream.pipeline.PipelineElement.java
/** * Evaluates the referenced property to a boolean value * @param propertyName// w ww .j a v a 2 s . com * @param defaultValue * @return */ protected boolean getBooleanProperty(final String propertyName, final boolean defaultValue) { String value = pipelineElementConfiguration.getSettings().get(propertyName); if (StringUtils.isNotBlank(value)) { if (StringUtils.equalsIgnoreCase("true", value)) return true; return false; } return defaultValue; }
From source file:com.github.binlee1990.spider.movie.spider.MovieCrawler.java
private void addFilmRegionList(Document doc, Film film) { Elements keyElements = doc.select(".fm-minfo dt"); Elements valueElements = doc.select(".fm-minfo dd"); if (CollectionUtils.isNotEmpty(keyElements) && CollectionUtils.isNotEmpty(valueElements)) { int keyI = 0; for (; keyI < keyElements.size(); keyI++) { Element keyElement = keyElements.get(keyI); Element valueElement = valueElements.get(keyI); if (null != keyElement && null != valueElement) { String key = StringUtils.trimToEmpty(keyElement.text().toString()); if (StringUtils.isNotBlank(key)) { String value = StringUtils.trimToEmpty(valueElement.text().toString()); if (StringUtils.equalsIgnoreCase(key, "") && StringUtils.isNotBlank(value)) { List<String> regionList = SLASH_SPLITTER.splitToList(value); if (CollectionUtils.isNotEmpty(regionList)) { regionList.forEach(region -> { EnumRegion queryRegion = new EnumRegion(); queryRegion.setUrlRegion(region); EnumRegion enumRegion = enumRegionMapper .queryEnumRegionByEnumRegion(queryRegion); if (null != enumRegion) { FilmRegion filmRegion = new FilmRegion(); filmRegion.setFilmCode(film.getCode()); filmRegion.setRegionId(enumRegion.getId()); Date now = new Date(); filmRegion.setCreateTime(now); filmRegion.setUpdateTime(now); filmRegionMapper.insertSelective(filmRegion); }//from w ww . jav a2 s .co m }); } break; } } } } } }
From source file:com.dominion.salud.mpr.ws.rest.MPRMessagesRESTHandlerService.java
@ResponseBody @RequestMapping(value = "/receiveMessages", method = RequestMethod.POST, produces = "application/json") public ResponseEntity<String> receiveMessages(@RequestBody(required = true) String message) { logger.info("RECIBIENDO MENSAJE ENTRANTE"); logger.info(message);// w ww. j a va2 s .c o m ACK ack = null; AbstractParser parser = null; Message hl7message = null; String cod_centro = ""; try { message = StringUtils.replace(message, "\n", "\r"); if (StringUtils.isBlank(message)) { //Validaciones previas throw new HL7Exception("No se ha indicado un mensaje entrante: [" + message + "]"); } //Deternima el formato del mensaje logger.debug(" Determinando el formato del mensaje y el parseador a emplear"); if (EncodingDetector.isEr7Encoded(message)) { parser = new ER7Parser(); logger.debug(" Formato del mensaje ER7 y parseador [" + parser.getClass() + "] aceptados"); } else { throw new HL7Exception("Formato de mensaje no reconocido. El formato soportado es ER7"); } logger.debug(" Formato del mensaje y parseador determinados correctamente"); //Parseado del mensaje logger.debug(" Parseando mensaje [" + parser.getClass() + "]"); hl7message = parser.parse(message); logger.debug(" Mensaje parseado correctamente [" + hl7message.getClass() + "]"); //Validaciones del MPR logger.debug(" Validando el mensaje"); MSH msh = (MSH) hl7message.get("MSH"); if (StringUtils.isBlank(msh.getMessageControlID().getValue())) { //MSH.10 throw new HL7Exception( "No se ha indicado el identificador de mensaje (MSH-10: Message Control ID)"); } if (hl7message.getClass() == ZDS_O13.class) { //DISPENSACIONES ZDS_O13 zds_o13 = (ZDS_O13) hl7message; PID pid = zds_o13.getPATIENT().getPID(); PV1 pv1 = zds_o13.getPATIENT().getPATIENT_VISIT().getPV1(); Integer nhc = null; String cipa = null; for (int i = 0; i < pid.getPatientIdentifierList().length; i++) { // PID.3 - PatientIdentifierList if (StringUtils.equalsIgnoreCase( pid.getPatientIdentifierList(i).getIdentifierTypeCode().getValue(), "PI")) { if (StringUtils.isNotBlank(pid.getPatientIdentifierList(i).getIDNumber().getValue())) { try { nhc = NumberUtils .createInteger(pid.getPatientIdentifierList(i).getIDNumber().getValue()); } catch (Exception e) { logger.warn("El NHC no es correcto (PID-3.1: Patient Identifier List [PI])"); } } } else if (StringUtils.equalsIgnoreCase( pid.getPatientIdentifierList(i).getIdentifierTypeCode().getValue(), "CIPA")) { if (StringUtils.isNotBlank(pid.getPatientIdentifierList(i).getIDNumber().getValue())) { cipa = pid.getPatientIdentifierList(i).getIDNumber().getValue(); } else { logger.warn("El CIPA no es correcto (PID-3.1: Patient Identifier List [CIPA])"); } } } if (nhc == null && StringUtils.isBlank(cipa)) { throw new HL7Exception( "No se ha indicado el NHC (PID-3.1: Patient Identifier List [PI]) ni el CIPA (PID-3.1: Patient Identifier List [CIPA])"); } //PV1.2 - Clase de Paciente if (StringUtils.isNotBlank(pv1.getPatientClass().getValue())) { //PV1.2 - Clase de Paciente if (StringUtils.equals(pv1.getPatientClass().getValue(), "O")) { //Outpatient if (StringUtils.isBlank(pv1.getPatientType().getValue())) { //PV1.18 - Tipo de Paciente throw new HL7Exception("No se ha indicado el tipo de paciente (PV1-18: Patient Type)"); } } } else { throw new HL7Exception("No se ha indicado la clase de paciente (PV1-2: Patient Class)"); } //PV1.19.1 - Codigo de Episodio if (StringUtils.isBlank(pv1.getVisitNumber().getIDNumber().getValue())) { throw new HL7Exception("No se ha indicado el episodio del paciente (PV1.19: Visit Number)"); } List<ZDS_O13_ORDER> zds_o13_orders = zds_o13.getORDERAll(); for (ZDS_O13_ORDER zds_o13_order : zds_o13_orders) { ORC orc = zds_o13_order.getORC(); TQ1 tq1 = zds_o13_order.getTIMING().getTQ1(); RXD rxd = zds_o13_order.getRXD(); Z01 z01 = zds_o13_order.getZ01(); //ORC.21.10 - OrganizationIdentifier if (StringUtils .isBlank(orc.getOrderingFacilityName(0).getOrganizationIdentifier().getValue())) { //ORC.21.10 throw new HL7Exception( "No se ha indicado el centro de origen (ORC-21.10: OrganizationIdentifier)"); } else { cod_centro = orc.getOrderingFacilityName(0).getOrganizationIdentifier().getValue(); } //ORC.2.1 - Codigo de Prescripcion if (StringUtils.isBlank(orc.getPlacerOrderNumber().getEntityIdentifier().getValue())) { throw new HL7Exception( "No se ha indicado el identificador de la prescripcion (ORC-2.1: Placer Order Number)"); } //ORC.3.1 - Codigo de Dispensacion if (StringUtils.isBlank(orc.getFillerOrderNumber().getEntityIdentifier().getValue())) { throw new HL7Exception( "No se ha indicado el identificador de la dispensacion (ORC-3.1: Filler Order Number)"); } //ORC.10 - Medico Prescriptor if (StringUtils.isBlank(orc.getEnteredBy(0).getIDNumber().getValue())) { //ORC.10.1 throw new HL7Exception( "No se ha indicado el codigo del medico prescriptor (ORC-10.1: Entered By)"); } if (StringUtils.isBlank(orc.getEnteredBy(0).getGivenName().getValue())) { //ORC.10.3 throw new HL7Exception( "No se ha indicado el nombre del medico prescriptor (ORC-10.3: Entered By)"); } if (StringUtils.isBlank(orc.getEnteredBy(0).getFamilyName().getSurname().getValue())) { //ORC.10.2.1 throw new HL7Exception( "No se ha indicado el apellido del medico prescriptor (ORC-10.2.1: Entered By)"); } //RXD.2.1 - DispenseGiveCode (Codigo Nacional de la Marca) if (StringUtils.isBlank(rxd.getDispenseGiveCode().getIdentifier().getValue())) { //RXD.2.1 throw new HL7Exception( "No se ha indicado el codigo nacional de la marca (RXD-2.1: DispenseGiveCode)"); } //RXD.2.2 - DispenseGiveCode (Descripcion de la Marca) if (StringUtils.isBlank(rxd.getDispenseGiveCode().getText().getValue())) { //RXD.2.2 throw new HL7Exception( "No se ha indicado la descripcion de la marca (RXD-2.2: DispenseGiveCode)"); } //RXD.3 - Fecha de la Dispensacion if (StringUtils.isBlank(rxd.getDateTimeDispensed().getTime().getValue())) { throw new HL7Exception( "No se ha indicado la fecha de la dispensacion (RXD-3: Date/Time Dispensed)"); } //RXD.4 - ActualDispenseAmount (Unidades Dispensadas en Forma Farmaceutica) if (StringUtils.isNotBlank(rxd.getActualDispenseAmount().getValue())) { //RXD.4 try { NumberUtils.createDouble(rxd.getActualDispenseAmount().getValue()); } catch (Exception e) { throw new HL7Exception("Las unidades dispensadas no son correctas [" + rxd.getActualDispenseAmount().getValue() + "] (RXD-4: ActualDispenseAmount)"); } } else { throw new HL7Exception( "No se han indicado las unidades dispensadas (RXD-4: ActualDispenseAmount)"); } //TQ1.7 - Fecha de Inicio de la Prescripcion if (StringUtils.isBlank(tq1.getStartDateTime().getTime().getValue())) { throw new HL7Exception( "No se ha indicado la fecha de inicio de la prescripcion (TQ1-7: Start Date/Time)"); } //Z01.9 - Dosis Prescrita en Unidad de Medida if (StringUtils.isNotBlank(z01.getDosisPrescrita().getValue())) { //Z01.9 try { NumberUtils.createDouble(z01.getDosisPrescrita().getValue()); } catch (Exception e) { throw new HL7Exception( "La dosis prescrita no es correcta [" + z01.getDosisPrescrita().getValue() + "] (Z01-9: Dosis Prescrita en Unidad de Medida)"); } } else { throw new HL7Exception( "No se ha indicado dosis prescrita (Z01-9: Dosis Prescrita en Unidad de Medida)"); } } } else if (hl7message.getClass() == ZMP_O09.class) { //PRESCRIPCIONES (razon fin) ZMP_O09 zmp_o09 = (ZMP_O09) hl7message; PID pid = zmp_o09.getPATIENT().getPID(); PV1 pv1 = zmp_o09.getPATIENT().getPATIENT_VISIT().getPV1(); //PID.3 - Identificadores del paciente (NHC) y (CIPA) Integer nhc = null; String cipa = null; for (int i = 0; i < pid.getPatientIdentifierList().length; i++) { // PID.3 - PatientIdentifierList if (StringUtils.equalsIgnoreCase( pid.getPatientIdentifierList(i).getIdentifierTypeCode().getValue(), "PI")) { if (StringUtils.isNotBlank(pid.getPatientIdentifierList(i).getIDNumber().getValue())) { try { nhc = NumberUtils .createInteger(pid.getPatientIdentifierList(i).getIDNumber().getValue()); } catch (Exception e) { throw new HL7Exception("El NHC no es correcto (PID-3.1: Patient Identifier List)"); } } else { throw new HL7Exception("No se ha indicado el NHC (PID-3.1: Patient Identifier List)"); } } else if (StringUtils.equalsIgnoreCase( pid.getPatientIdentifierList(i).getIdentifierTypeCode().getValue(), "CIPA")) { if (StringUtils.isBlank(pid.getPatientIdentifierList(i).getIDNumber().getValue())) { throw new HL7Exception("El CIPA no es correcto (PID-3.1: Patient Identifier List)"); } else { cipa = pid.getPatientIdentifierList(i).getIDNumber().getValue(); } } } if (nhc == null) { throw new HL7Exception("No se ha indicado el NHC (PID-3.1: Patient Identifier List)"); } if (StringUtils.isBlank(cipa)) { throw new HL7Exception("No se ha indicado el CIPA (PID-3.1: Patient Identifier List)"); } //PV1.2 - Clase de Paciente if (StringUtils.isNotBlank(pv1.getPatientClass().getValue())) { //PV1.2 - Clase de Paciente if (StringUtils.equals(pv1.getPatientClass().getValue(), "O")) { //Outpatient if (StringUtils.isBlank(pv1.getPatientType().getValue())) { //PV1.18 - Tipo de Paciente throw new HL7Exception("No se ha indicado el tipo de paciente (PV1-18: Patient Type)"); } } } else { throw new HL7Exception("No se ha indicado la clase de paciente (PV1-2: Patient Class)"); } //PV1.19.1 - Codigo de Episodio if (StringUtils.isBlank(pv1.getVisitNumber().getIDNumber().getValue())) { throw new HL7Exception("No se ha indicado el episodio del paciente (PV1.19: Visit Number)"); } List<ZMP_O09_ORDER> zmp_o09_orders = zmp_o09.getORDERAll(); for (ZMP_O09_ORDER zmp_o09_order : zmp_o09_orders) { ORC orc = zmp_o09_order.getORC(); Z01 z01 = zmp_o09_order.getZ01(); TQ1 tq1 = zmp_o09_order.getTIMING().getTQ1(); RXC rxc = zmp_o09_order.getCOMPONENT().getRXC(); //ORC.21.10 - OrganizationIdentifier if (StringUtils .isBlank(orc.getOrderingFacilityName(0).getOrganizationIdentifier().getValue())) { //ORC.21.10 throw new HL7Exception( "No se ha indicado el centro de origen (ORC-21.10: OrganizationIdentifier)"); } else { cod_centro = orc.getOrderingFacilityName(0).getOrganizationIdentifier().getValue(); } //ORC.2.1 - Codigo de Prescripcion if (StringUtils.isBlank(orc.getPlacerOrderNumber().getEntityIdentifier().getValue())) { throw new HL7Exception( "No se ha indicado el identificador de la prescripcion (ORC-2.1: Placer Order Number)"); } //ORC.10 - Medico Prescriptor if (StringUtils.isBlank(orc.getEnteredBy(0).getIDNumber().getValue())) { //ORC.10.1 throw new HL7Exception( "No se ha indicado el codigo del medico prescriptor (ORC-10.1: Entered By)"); } if (StringUtils.isBlank(orc.getEnteredBy(0).getGivenName().getValue())) { //ORC.10.3 throw new HL7Exception( "No se ha indicado el nombre del medico prescriptor (ORC-10.3: Entered By)"); } if (StringUtils.isBlank(orc.getEnteredBy(0).getFamilyName().getSurname().getValue())) { //ORC.10.2.1 throw new HL7Exception( "No se ha indicado el apellido del medico prescriptor (ORC-10.2.1: Entered By)"); } //RXC.2.1 - DispenseGiveCode (Codigo Nacional de la Marca) if (StringUtils.isBlank(rxc.getComponentCode().getIdentifier().getValue())) { //RXC.2.1 throw new HL7Exception( "No se ha indicado el codigo nacional de la marca (RXC-2.1: ComponentCode)"); } //RXC.2.2 - DispenseGiveCode (Descripcion de la Marca) if (StringUtils.isBlank(rxc.getComponentCode().getText().getValue())) { //RXC.2.2 throw new HL7Exception("No se ha indicado la descripcion de la marca (RXC-2.2: Text)"); } //TQ1.7 - Fecha de Inicio de la Prescripcion if (StringUtils.isBlank(tq1.getStartDateTime().getTime().getValue())) { throw new HL7Exception( "No se ha indicado la fecha de inicio de la prescripcion (TQ1-7: Start date/time)"); } //TQ1.8 - Fecha de Fin de la Prescripcion if (StringUtils.isBlank(tq1.getEndDateTime().getTime().getValue())) { throw new HL7Exception( "No se ha indicado la fecha de fin de la prescripcion (TQ1-8: End date/time)"); } //Z01.9 - Dosis Prescrita en Unidad de Medida if (StringUtils.isNotBlank(z01.getDosisPrescrita().getValue())) { //Z01.9 try { NumberUtils.createDouble(z01.getDosisPrescrita().getValue()); } catch (Exception e) { throw new HL7Exception( "La dosis prescrita no es correcta [" + z01.getDosisPrescrita().getValue() + "] (Z01-9: Dosis Prescrita en Unidad de Medida)"); } } else { throw new HL7Exception( "No se ha indicado dosis prescrita (Z01-9: Dosis Prescrita en Unidad de Medida)"); } } } else if (hl7message.getClass() == ZFN_M13.class) { //RESPUESTAS DE EVALUACIONES ZFN_M13 zfn_m13 = (ZFN_M13) hl7message; ZFA zfa = zfn_m13.getACUERDO().getZFA(); //ZFA.1.1 - MasterIdentifier if (StringUtils.isBlank(zfa.getMasterIdentifier().getAlternateIdentifier().getValue())) { //ZFA.1.1 throw new HL7Exception("No se ha indicado el codigo de acuerdo (ZFA.1.1: AlternateIdentifier)"); } //ZFA.2.1 - Master file application identifier if (StringUtils.isBlank(zfa.getMasterFileApplicationIdentifier().getNamespaceID().getValue())) { //ZFA.2.1 throw new HL7Exception("No se ha indicado el centro de origen (ZFA.2.1: NamespaceID)"); } else { cod_centro = zfa.getMasterFileApplicationIdentifier().getNamespaceID().getValue(); } } else if (hl7message.getClass() == RAS_O17.class) { //RESPUESTAS DE EVALUACIONES RAS_O17 ras_o17 = (RAS_O17) hl7message; PID pid = ras_o17.getPATIENT().getPID(); PV1 pv1 = ras_o17.getPATIENT().getPATIENT_VISIT().getPV1(); //PID.3 - Identificadores del paciente (NHC) y (CIPA) Integer nhc = null; String cipa = null; for (int i = 0; i < pid.getPatientIdentifierList().length; i++) { // PID.3 - PatientIdentifierList if (StringUtils.equalsIgnoreCase( pid.getPatientIdentifierList(i).getIdentifierTypeCode().getValue(), "PI")) { if (StringUtils.isNotBlank(pid.getPatientIdentifierList(i).getIDNumber().getValue())) { try { nhc = NumberUtils .createInteger(pid.getPatientIdentifierList(i).getIDNumber().getValue()); } catch (Exception e) { throw new HL7Exception("El NHC no es correcto (PID-3.1: Patient Identifier List)"); } } else { throw new HL7Exception("No se ha indicado el NHC (PID-3.1: Patient Identifier List)"); } } else if (StringUtils.equalsIgnoreCase( pid.getPatientIdentifierList(i).getIdentifierTypeCode().getValue(), "CIPA")) { if (StringUtils.isBlank(pid.getPatientIdentifierList(i).getIDNumber().getValue())) { throw new HL7Exception("El CIPA no es correcto (PID-3.1: Patient Identifier List)"); } else { cipa = pid.getPatientIdentifierList(i).getIDNumber().getValue(); } } } if (nhc == null) { throw new HL7Exception("No se ha indicado el NHC (PID-3.1: Patient Identifier List)"); } if (StringUtils.isBlank(cipa)) { throw new HL7Exception("No se ha indicado el CIPA (PID-3.1: Patient Identifier List)"); } //PV1.2 - Clase de Paciente if (StringUtils.isNotBlank(pv1.getPatientClass().getValue())) { //PV1.2 - Clase de Paciente if (StringUtils.equals(pv1.getPatientClass().getValue(), "O")) { //Outpatient if (StringUtils.isBlank(pv1.getPatientType().getValue())) { //PV1.18 - Tipo de Paciente throw new HL7Exception("No se ha indicado el tipo de paciente (PV1-18: Patient Type)"); } } } else { throw new HL7Exception("No se ha indicado la clase de paciente (PV1-2: Patient Class)"); } //PV1.19.1 - Codigo de Episodio if (StringUtils.isBlank(pv1.getVisitNumber().getIDNumber().getValue())) { throw new HL7Exception("No se ha indicado el episodio del paciente (PV1.19: Visit Number)"); } List<RAS_O17_ORDER> ras_o17_orders = ras_o17.getORDERAll(); for (RAS_O17_ORDER ras_o17_order : ras_o17_orders) { ORC orc = ras_o17_order.getORC(); TQ1 tq1 = ras_o17_order.getTIMING().getTQ1(); RXO rxo = ras_o17_order.getORDER_DETAIL().getRXO(); RXA rxa = ras_o17_order.getADMINISTRATION().getRXA(); //ORC.21.10 - OrganizationIdentifier if (StringUtils .isBlank(orc.getOrderingFacilityName(0).getOrganizationIdentifier().getValue())) { //ORC.21.10 throw new HL7Exception( "No se ha indicado el centro de origen (ORC-21.10: OrganizationIdentifier)"); } else { cod_centro = orc.getOrderingFacilityName(0).getOrganizationIdentifier().getValue(); } //ORC.2.1 - Codigo de Prescripcion if (StringUtils.isBlank(orc.getPlacerOrderNumber().getEntityIdentifier().getValue())) { throw new HL7Exception( "No se ha indicado el identificador de la prescripcion (ORC-2.1: Placer Order Number)"); } //ORC.3.1 - Codigo de Administracion if (StringUtils.isBlank(orc.getFillerOrderNumber().getEntityIdentifier().getValue())) { throw new HL7Exception( "No se ha indicado el identificador de la administracion (ORC-3.1: Filler Order Number)"); } //ORC.10 - Medico Prescriptor if (StringUtils.isBlank(orc.getEnteredBy(0).getIDNumber().getValue())) { //ORC.10.1 throw new HL7Exception( "No se ha indicado el codigo del medico prescriptor (ORC-10.1: Entered By)"); } if (StringUtils.isBlank(orc.getEnteredBy(0).getGivenName().getValue())) { //ORC.10.3 throw new HL7Exception( "No se ha indicado el nombre del medico prescriptor (ORC-10.3: Entered By)"); } if (StringUtils.isBlank(orc.getEnteredBy(0).getFamilyName().getSurname().getValue())) { //ORC.10.2.1 throw new HL7Exception( "No se ha indicado el apellido del medico prescriptor (ORC-10.2.1: Entered By)"); } //TQ1.7 - Fecha de Inicio de la Prescripcion if (StringUtils.isBlank(tq1.getStartDateTime().getTime().getValue())) { throw new HL7Exception( "No se ha indicado la fecha de inicio de la prescripcion (TQ1-7: Start date/time)"); } //RXA.3 - Fecha de la Administracion if (StringUtils.isBlank(rxa.getDateTimeStartOfAdministration().getTime().getValue())) { throw new HL7Exception( "No se ha indicado la fecha de la adminsitracion (RXA-3: Start date/time)"); } //RXA.5 - Marca if (StringUtils.isBlank(rxa.getAdministeredCode().getIdentifier().getValue())) { //RXA.5.1 throw new HL7Exception( "No se ha indicado el codigo nacional de la marca (RXA-5.1: AdministeredCode)"); } //RXA.6 - Dosis Administrada en Forma Farmaceutica if (StringUtils.isNotBlank(rxa.getAdministeredAmount().getValue())) { //RXA.6 try { NumberUtils.createDouble(rxa.getAdministeredAmount().getValue()); } catch (Exception e) { throw new HL7Exception("La dosis administrada no es correcta [" + rxa.getAdministeredAmount().getValue() + "] (ZRA-6: Dosis Administrada en Forma Farmaceutica)"); } } else { throw new HL7Exception( "No se ha indicado dosis administrada (RXA-6: Dosis Administrada en Forma Farmaceutica)"); } //RXO.2 - Dosis Prescrita en Unidad de Medida if (StringUtils.isNotBlank(rxo.getRequestedGiveAmountMinimum().getValue())) { //RXO.2 try { NumberUtils.createDouble(rxo.getRequestedGiveAmountMinimum().getValue()); } catch (Exception e) { throw new HL7Exception("La dosis prescrita no es correcta [" + rxo.getRequestedGiveAmountMinimum().getValue() + "] (RXO-2: Dosis Prescrita en Unidad de Medida)"); } } else { throw new HL7Exception( "No se ha indicado dosis prescrita (RXO-2: Dosis Prescrita en Unidad de Medida)"); } } } else { throw new HL7Exception("No se reconoce el tipo de mensaje (MSH.9 - Message Type)"); } // Validacion del codigo de centro Centros centros = new Centros(); centros.setCodCentro(cod_centro); try { centros = centrosService.findByCodCentro(centros); } catch (Exception e) { throw new HL7Exception( "No se reconoce el codigo de centro " + cod_centro + " (" + e.getMessage() + ")"); } logger.debug(" Almacenando el mensaje en BUZON_IN"); BuzonIn buzonIn = new BuzonIn(); buzonIn.setCentros(centros); buzonIn.setIdMensaje(msh.getMessageControlID().getValue()); //MSH.10 buzonIn.setMensaje(message); buzonIn.setFechaIn(new Date()); buzonIn.setEstado(AbstractIntegracionEntity.MENSAJE_NO_PROCESADO); buzonIn.setTipo(hl7message.getName()); buzonInService.save(buzonIn); logger.debug(" Mensaje almacenado en BUZON_IN correctamente"); ack = parser.generateACK(hl7message); } catch (Exception e) { try { logger.error("SE HAN PRODUCIDO ERRORES: " + e.toString()); if (e.getCause() != null && e.getCause().getClass() == ConstraintViolationException.class) { ack = parser.generateNACK(hl7message, "El mensaje con MSH.10: " + ((MSH) hl7message.get("MSH")).getMessageControlID().getValue() + " ya se encuentra en el sistema"); } else { ack = parser.generateNACK(hl7message, e.getMessage()); } } catch (Exception ex) { logger.error("SE HAN PRODUCIDO ERRORES: " + ex.toString()); ack = parser.generateNACK(hl7message, ex.getMessage() != null ? ex.getMessage() : ex.toString()); } } //Generar la respuesta String response; try { response = ack.encode(); } catch (Exception e) { logger.error("No se ha podido generar la respuesta: " + e.toString() + "\rGenerando respuesta tipo"); response = "MSH|^~\\&|MPR|mpr-ws|||" + DateFormatUtils.formatUTC(System.currentTimeMillis(), "yyyyMMddHHmmss") + "||ACK|" + System.currentTimeMillis() + "|P|2.5\r" + "MSA|AE\r" + "ERR||||E|||NO SE HA PODIDO GENERAR UNA RESPUESTA: " + e.getMessage() != null ? e.getMessage() : e.toString() + "\r"; } logger.debug(" Respuesta a generar: "); logger.debug(response); logger.info("RECEPCION DEL MENSAJE FINALIZADA"); return new ResponseEntity(response, HttpStatus.OK); }
From source file:com.glaf.dts.util.XmlReader.java
protected void readField(Element elem, ColumnDefinition field) { List<?> attrs = elem.attributes(); if (attrs != null && !attrs.isEmpty()) { Map<String, Object> dataMap = new java.util.HashMap<String, Object>(); Iterator<?> iter = attrs.iterator(); while (iter.hasNext()) { Attribute attr = (Attribute) iter.next(); dataMap.put(attr.getName(), attr.getStringValue()); field.addProperty(attr.getName(), attr.getStringValue()); }/*from w ww .j a v a2 s.c o m*/ Tools.populate(field, dataMap); } field.setName(elem.attributeValue("name")); field.setType(elem.attributeValue("type")); field.setColumnName(elem.attributeValue("column")); field.setTitle(elem.attributeValue("title")); field.setValueExpression(elem.attributeValue("valueExpression")); /** * */ if ("true".equals(elem.attributeValue("required"))) { field.setRequired(true); } String length = elem.attributeValue("length"); if (StringUtils.isNotEmpty(length) && StringUtils.isNumeric(length)) { field.setLength(Integer.parseInt(length)); } String nullable = elem.attributeValue("nullable"); if (StringUtils.isNotEmpty(nullable)) { if (StringUtils.equalsIgnoreCase(nullable, "true")) { field.setNullable(true); field.setNullableField("true"); } else { field.setNullable(false); field.setNullableField("false"); } } String position = elem.attributeValue("position"); if (StringUtils.isNotEmpty(position) && StringUtils.isNumeric(position)) { field.setPosition(Integer.parseInt(position)); } String precision = elem.attributeValue("precision"); if (StringUtils.isNotEmpty(precision) && StringUtils.isNumeric(precision)) { field.setPrecision(Integer.parseInt(precision)); } }
From source file:ke.co.tawi.babblesms.server.servlet.admin.Login.java
/** * Checks to see that the captcha generated by the person and the captcha * submitted are equal. Case is ignored. * * @param systemCaptcha/* w ww . ja v a 2s. com*/ * @param userCaptchath * @return boolean */ private boolean validateCaptcha(String encodedSystemCaptcha, String userCaptcha) { boolean valid = false; String decodedHiddenCaptcha = ""; try { decodedHiddenCaptcha = textEncryptor.decrypt(URLDecoder.decode(encodedSystemCaptcha, "UTF-8")); } catch (UnsupportedEncodingException e) { logger.error("UnsupportedEncodingException while validating administrator captcha."); logger.error(ExceptionUtils.getStackTrace(e)); } if (StringUtils.equalsIgnoreCase(decodedHiddenCaptcha, userCaptcha)) { valid = true; } return valid; }
From source file:com.glaf.core.service.impl.MxDataModelServiceImpl.java
public DataModel getDataModelByBusinessKey(String tableName, String businessKey) { List<ColumnDefinition> cols = tableDefinitionService.getColumnDefinitionsByTableName(tableName); if (cols != null && !cols.isEmpty()) { for (ColumnDefinition col : cols) { if (StringUtils.equalsIgnoreCase(col.getColumnName(), "BUSINESSKEY_")) { TableModel tableModel = new TableModel(); tableModel.setTableName(tableName); ColumnModel cm = new ColumnModel(); cm.setColumnName("BUSINESSKEY_"); cm.setJavaType(col.getJavaType()); cm.setStringValue(businessKey); cm.setValue(businessKey); tableModel.setIdColumn(cm); Map<String, Object> dataMap = tableDataMapper.getTableDataByPrimaryKey(tableModel); if (dataMap != null && !dataMap.isEmpty()) { DataModelEntity model = this.populate(dataMap); return model; }//from w w w . ja va 2 s .com } } } return null; }