/** * @see org.openmrs.hl7.HL7Service#saveHL7Source(org.openmrs.hl7.HL7Source) */ @Override public HL7Source saveHL7Source(HL7Source hl7Source) throws APIException { if (hl7Source.getCreator() == null) { hl7Source.setCreator(Context.getAuthenticatedUser()); } if (hl7Source.getDateCreated() == null) { hl7Source.setDateCreated(new Date()); } return dao.saveHL7Source(hl7Source); }
/** * @since 1.5 * @see org.openmrs.OpenmrsObject#getId() */ @Override public Integer getId() { return getHL7SourceId(); }
@Override public void validateDefaultRepresentation() throws Exception { super.validateDefaultRepresentation(); assertPropEquals("name", getObject().getName()); assertPropEquals("description", getObject().getDescription()); assertPropEquals("retired", getObject().isRetired()); }
/** * @see HL7SourceValidator#validate(Object,Errors) */ @Test public void validate_shouldPassValidationIfFieldLengthsAreCorrect() { HL7Source hl7Source = new HL7Source(); hl7Source.setName("name"); Errors errors = new BindException(hl7Source, "hl7Source"); new HL7SourceValidator().validate(hl7Source, errors); Assert.assertFalse(errors.hasErrors()); }
/** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#newDelegate() */ @Override public HL7Source newDelegate() { return new HL7Source(); }
if (e.getCause() != null && "Could not resolve patient".equals(e.getCause().getMessage()) && !"local".equals(hl7InQueue.getHL7Source().getName()) && "true".equals(Context.getAdministrationService().getGlobalProperty( OpenmrsConstants.GLOBAL_PROPERTY_IGNORE_MISSING_NONLOCAL_PATIENTS, "false"))) {
@Override public String getUuidProperty() { return getObject().getUuid(); }
@Override public void validateFullRepresentation() throws Exception { super.validateFullRepresentation(); assertPropEquals("name", getObject().getName()); assertPropEquals("description", getObject().getDescription()); assertPropEquals("retired", getObject().isRetired()); assertPropPresent("auditInfo"); }
/** * @see HL7SourceValidator#validate(Object,Errors) */ @Test public void validate_shouldFailValidationIfFieldLengthsAreNotCorrect() { HL7Source hl7Source = new HL7Source(); hl7Source .setName("too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text"); Errors errors = new BindException(hl7Source, "hl7Source"); new HL7SourceValidator().validate(hl7Source, errors); Assert.assertTrue(errors.hasFieldErrors("name")); } }
/** * @see HL7Service#saveHL7InQueue(HL7InQueue) */ @Test public void saveHL7InQueue_shouldAddGeneratedUuidIfUuidIsNull() { HL7InQueue hl7 = new HL7InQueue(); hl7.setHL7Data("dummy data"); hl7.setHL7Source(new HL7Source(1)); hl7.setHL7SourceKey("a random key"); hl7.setMessageState(HL7Constants.HL7_STATUS_PROCESSING); Context.getHL7Service().saveHL7InQueue(hl7); Assert.assertNotNull(hl7.getUuid()); }