private StaticDef parseStaticProfile(Element elem) throws ProfileException { StaticDef message = new StaticDef(); message.setMsgType(elem.getAttribute("MsgType")); message.setEventType(elem.getAttribute("EventType")); message.setMsgStructID(elem.getAttribute("MsgStructID")); message.setOrderControl(elem.getAttribute("OrderControl")); message.setEventDesc(elem.getAttribute("EventDesc")); message.setIdentifier(elem.getAttribute("Identifier")); message.setRole(elem.getAttribute("Role")); Element md = getFirstElementByTagName("MetaData", elem); if (md != null) message.setMetaData(parseMetaData(md)); message.setImpNote(getValueOfFirstElement("ImpNote", elem)); message.setDescription(getValueOfFirstElement("Description", elem)); message.setReference(getValueOfFirstElement("Reference", elem)); parseChildren(message, elem); return message; }
protected void checkEventType(String evType, StaticDef profile, List<HL7Exception> exList) throws HL7Exception { if (!evType.equals(profile.getEventType()) && !profile.getEventType().equalsIgnoreCase("ALL")) { HL7Exception e = new ProfileNotFollowedException("Event type " + evType + " doesn't match profile type of " + profile.getEventType()); exList.add(e); } }
protected void checkMessageStructure(String msgStruct, StaticDef profile, List<HL7Exception> exList) { if (msgStruct == null || !msgStruct.equals(profile.getMsgStructID())) { HL7Exception e = new ProfileNotFollowedException("Message structure " + msgStruct + " doesn't match profile type of " + profile.getMsgStructID()); exList.add(e); } }
protected void checkMessageType(String msgType, StaticDef profile, List<HL7Exception> exList) throws HL7Exception { if (!msgType.equals(profile.getMsgType())) { HL7Exception e = new ProfileNotFollowedException("Message type " + msgType + " doesn't match profile type of " + profile.getMsgType()); exList.add(e); } }
/** * @see Validator#validate */ public HL7Exception[] validate(Message message, StaticDef profile) throws ProfileException, HL7Exception { List<HL7Exception> exList = new ArrayList<HL7Exception>(); Terser t = new Terser(message); checkMessageType(t.get("/MSH-9-1"), profile, exList); checkEventType(t.get("/MSH-9-2"), profile, exList); checkMessageStructure(t.get("/MSH-9-3"), profile, exList); exList.addAll(doTestGroup(message, profile, profile.getIdentifier(), validateChildren)); return exList.toArray(new HL7Exception[exList.size()]); }
protected void checkMessageType(String msgType, StaticDef profile, List<HL7Exception> exList) throws HL7Exception { if (!msgType.equals(profile.getMsgType())) { HL7Exception e = new ProfileNotFollowedException("Message type " + msgType + " doesn't match profile type of " + profile.getMsgType()); exList.add(e); } }
/** * @see Validator#validate */ public HL7Exception[] validate(Message message, StaticDef profile) throws ProfileException, HL7Exception { List<HL7Exception> exList = new ArrayList<HL7Exception>(); Terser t = new Terser(message); checkMessageType(t.get("/MSH-9-1"), profile, exList); checkEventType(t.get("/MSH-9-2"), profile, exList); checkMessageStructure(t.get("/MSH-9-3"), profile, exList); exList.addAll(doTestGroup(message, profile, profile.getIdentifier(), validateChildren)); return exList.toArray(new HL7Exception[exList.size()]); }
private StaticDef parseStaticProfile(Element elem) throws ProfileException { StaticDef message = new StaticDef(); message.setMsgType(elem.getAttribute("MsgType")); message.setEventType(elem.getAttribute("EventType")); message.setMsgStructID(elem.getAttribute("MsgStructID")); message.setOrderControl(elem.getAttribute("OrderControl")); message.setEventDesc(elem.getAttribute("EventDesc")); message.setIdentifier(elem.getAttribute("Identifier")); message.setRole(elem.getAttribute("Role")); Element md = getFirstElementByTagName("MetaData", elem); if (md != null) message.setMetaData(parseMetaData(md)); message.setImpNote(getValueOfFirstElement("ImpNote", elem)); message.setDescription(getValueOfFirstElement("Description", elem)); message.setReference(getValueOfFirstElement("Reference", elem)); parseChildren(message, elem); return message; }
protected void checkEventType(String evType, StaticDef profile, List<HL7Exception> exList) throws HL7Exception { if (!evType.equals(profile.getEventType()) && !profile.getEventType().equalsIgnoreCase("ALL")) { HL7Exception e = new ProfileNotFollowedException("Event type " + evType + " doesn't match profile type of " + profile.getEventType()); exList.add(e); } }
protected void checkMessageStructure(String msgStruct, StaticDef profile, List<HL7Exception> exList) { if (msgStruct == null || !msgStruct.equals(profile.getMsgStructID())) { HL7Exception e = new ProfileNotFollowedException("Message structure " + msgStruct + " doesn't match profile type of " + profile.getMsgStructID()); exList.add(e); } }