public ValidationException[] apply(Message msg) { List<ValidationException> exceptions = new ArrayList<ValidationException>(); for (Iterator<Structure> iter = ReadOnlyMessageIterator .createPopulatedStructureIterator(msg, GenericSegment.class); iter.hasNext();) { String segmentName = iter.next().getName(); ValidationException ve = new ValidationException("Found unknown segment: " + segmentName); Location location = new Location().withSegmentName(segmentName); ve.setLocation(location); exceptions.add(ve); } return exceptions.toArray(new ValidationException[exceptions.size()]); }
public ValidationException[] apply(Message msg) { List<ValidationException> exceptions = new ArrayList<ValidationException>(); for (Iterator<Structure> iter = ReadOnlyMessageIterator .createPopulatedStructureIterator(msg, GenericSegment.class); iter.hasNext();) { String segmentName = iter.next().getName(); ValidationException ve = new ValidationException("Found unknown segment: " + segmentName); Location location = new Location().withSegmentName(segmentName); ve.setLocation(location); exceptions.add(ve); } return exceptions.toArray(new ValidationException[exceptions.size()]); }
protected ValidationException[] failed(Exception e, Location location) { if (e instanceof ValidationException) return new ValidationException[] { (ValidationException) e }; ValidationException ve = new ValidationException(e.getMessage(), e, severity); ve.setError(getErrorCode()); ve.setLocation(location); return new ValidationException[] { ve }; }
protected ValidationException[] failed(Exception e, Location location) { if (e instanceof ValidationException) return new ValidationException[] { (ValidationException) e }; ValidationException ve = new ValidationException(e.getMessage(), e, severity); ve.setError(getErrorCode()); ve.setLocation(location); return new ValidationException[] { ve }; }
public ValidationException[] apply(Message msg) { List<ValidationException> exceptions = new ArrayList<ValidationException>(); ValidationException ve = new ValidationException("Invalid version: " + msg.getVersion()); Location location = new Location() .withSegmentName("MSH") .withField(12); ve.setLocation(location); ve.setError(ErrorCode.UNSUPPORTED_VERSION_ID); exceptions.add(ve); return exceptions.toArray(new ValidationException[exceptions.size()]); }
public ValidationException[] apply(Message msg) { List<ValidationException> exceptions = new ArrayList<ValidationException>(); ValidationException ve = new ValidationException("Invalid version: " + msg.getVersion()); Location location = new Location() .withSegmentName("MSH") .withField(12); ve.setLocation(location); ve.setError(ErrorCode.UNSUPPORTED_VERSION_ID); exceptions.add(ve); return exceptions.toArray(new ValidationException[exceptions.size()]); }
protected ValidationException[] failed(String msg, Location location) { ValidationException ve = new ValidationException(msg, severity); ve.setError(getErrorCode()); ve.setLocation(location); return new ValidationException[] { ve }; }
protected ValidationException[] failed(String msg, Location location) { ValidationException ve = new ValidationException(msg, severity); ve.setError(getErrorCode()); ve.setLocation(location); return new ValidationException[] { ve }; }
private void testPrimitive(Primitive p, ValidationExceptionHandler<R> handler, Location l) { List<PrimitiveTypeRule> rules = new ArrayList<PrimitiveTypeRule>(); Message m = p.getMessage(); if (getValidationContext() != null) { rules.addAll(getValidationContext().getPrimitiveRules(m.getVersion(), p.getName(), p)); } for (PrimitiveTypeRule rule : rules) { ValidationException[] exceptions = rule.apply(p.getValue()); for (ValidationException ve : exceptions) { ve.setLocation(l); } if (exceptions.length > 0) { handler.onExceptions(exceptions); } } }
private void testPrimitive(Primitive p, ValidationExceptionHandler<R> handler, Location l) { List<PrimitiveTypeRule> rules = new ArrayList<PrimitiveTypeRule>(); Message m = p.getMessage(); if (getValidationContext() != null) { rules.addAll(getValidationContext().getPrimitiveRules(m.getVersion(), p.getName(), p)); } for (PrimitiveTypeRule rule : rules) { ValidationException[] exceptions = rule.apply(p.getValue()); for (ValidationException ve : exceptions) { ve.setLocation(l); } if (exceptions.length > 0) { handler.onExceptions(exceptions); } } }
public static ValidationException fromHL7Exception(HL7Exception e) { ValidationException ve = new ValidationException(e.getMessageWithoutLocation(), e); ve.setErrorCode(e.getErrorCode()); ve.setLocation(e.getLocation()); ve.setSeverity(e.getSeverity()); return ve; }
public static ValidationException fromHL7Exception(HL7Exception e) { ValidationException ve = new ValidationException(e.getMessageWithoutLocation(), e); ve.setErrorCode(e.getErrorCode()); ve.setLocation(e.getLocation()); ve.setSeverity(e.getSeverity()); return ve; }