/** * {@inheritDoc } */ public boolean isEmpty() throws HL7Exception { return data.isEmpty(); }
/** * {@inheritDoc } */ public boolean isEmpty() throws HL7Exception { return data.isEmpty(); }
/** * @see ca.uhn.hl7v2.model.Segment#isEmpty() */ public boolean isEmpty() throws HL7Exception { for (int i = 1; i <= numFields(); i++) { Type[] types = getField(i); for (Type type : types) { if (!type.isEmpty()) return false; } } return true; }
@Override public boolean isEmpty() throws HL7Exception { for (Type type : getComponents()) { if (!type.isEmpty()) return false; } return super.isEmpty(); // for the ExtraComponents }
/** * @see ca.uhn.hl7v2.model.Segment#isEmpty() */ public boolean isEmpty() throws HL7Exception { for (int i = 1; i <= numFields(); i++) { Type[] types = getField(i); for (Type type : types) { if (!type.isEmpty()) return false; } } return true; }
@Override public boolean isEmpty() throws HL7Exception { for (Type type : getComponents()) { if (!type.isEmpty()) return false; } return super.isEmpty(); // for the ExtraComponents }
protected List<HL7Exception> doTestComponent(Type type, Component profile, String profileID, boolean theValidateChildren) throws ProfileException, HL7Exception { List<HL7Exception> exList = new ArrayList<HL7Exception>(); exList.addAll(testType(type, profile, null, profileID)); // test children if (profile.getSubComponents() > 0 && !profile.getUsage().equals("X") && (!type.isEmpty())) { if (Composite.class.isAssignableFrom(type.getClass())) { Composite comp = (Composite) type; if (theValidateChildren) { for (int i = 1; i <= profile.getSubComponents(); i++) { SubComponent childProfile = profile.getSubComponent(i); try { Type child = comp.getComponent(i - 1); exList.addAll(testType(child, childProfile, null, profileID)); } catch (DataTypeException de) { exList.add(new ProfileNotHL7CompliantException( "More subcomponents in profile than allowed in message: " + de.getMessage())); } } } checkExtraComponents(comp, profile.getSubComponents(), exList); } else { exList.add(new ProfileNotFollowedException("A component has primitive type " + type.getClass().getName() + " but the profile defines subcomponents")); } } return exList; }
/** * Checks a segment against a list of allowed fields (ie those mentioned in the profile with * usage other than X). Returns a list of exceptions representing field that appear but are not * supposed to. * * @param allowedFields an array of Integers containing field #s of allowed fields */ protected void checkForExtraFields(Segment segment, List<Integer> allowedFields, List<HL7Exception> exList) throws ProfileException { for (int i = 1; i <= segment.numFields(); i++) { if (!allowedFields.contains(i)) { try { Type[] reps = segment.getField(i); for (Type rep : reps) { if (!rep.isEmpty()) { HL7Exception e = new XElementPresentException("Field " + i + " in " + segment.getName() + " appears in the message but not in the profile"); exList.add(e); } } } catch (HL7Exception he) { throw new ProfileException("Problem testing against profile", he); } } } }
protected List<HL7Exception> doTestComponent(Type type, Component profile, String profileID, boolean theValidateChildren) throws ProfileException, HL7Exception { List<HL7Exception> exList = new ArrayList<HL7Exception>(); exList.addAll(testType(type, profile, null, profileID)); // test children if (profile.getSubComponents() > 0 && !profile.getUsage().equals("X") && (!type.isEmpty())) { if (Composite.class.isAssignableFrom(type.getClass())) { Composite comp = (Composite) type; if (theValidateChildren) { for (int i = 1; i <= profile.getSubComponents(); i++) { SubComponent childProfile = profile.getSubComponent(i); try { Type child = comp.getComponent(i - 1); exList.addAll(testType(child, childProfile, null, profileID)); } catch (DataTypeException de) { exList.add(new ProfileNotHL7CompliantException( "More subcomponents in profile than allowed in message: " + de.getMessage())); } } } checkExtraComponents(comp, profile.getSubComponents(), exList); } else { exList.add(new ProfileNotFollowedException("A component has primitive type " + type.getClass().getName() + " but the profile defines subcomponents")); } } return exList; }
/** * Checks a segment against a list of allowed fields (ie those mentioned in the profile with * usage other than X). Returns a list of exceptions representing field that appear but are not * supposed to. * * @param allowedFields an array of Integers containing field #s of allowed fields */ protected void checkForExtraFields(Segment segment, List<Integer> allowedFields, List<HL7Exception> exList) throws ProfileException { for (int i = 1; i <= segment.numFields(); i++) { if (!allowedFields.contains(i)) { try { Type[] reps = segment.getField(i); for (Type rep : reps) { if (!rep.isEmpty()) { HL7Exception e = new XElementPresentException("Field " + i + " in " + segment.getName() + " appears in the message but not in the profile"); exList.add(e); } } } catch (HL7Exception he) { throw new ProfileException("Problem testing against profile", he); } } } }
List<Type> instancesWithContent = new ArrayList<Type>(); for (Type instance : instances) { if (!instance.isEmpty()) instancesWithContent.add(instance);
List<Type> instancesWithContent = new ArrayList<Type>(); for (Type instance : instances) { if (!instance.isEmpty()) instancesWithContent.add(instance);