/** * @see org.openmrs.hl7.HL7Service#saveHL7InQueue(org.openmrs.hl7.HL7InQueue) */ @Override public HL7InQueue saveHL7InQueue(HL7InQueue hl7InQueue) throws APIException { if (hl7InQueue.getDateCreated() == null) { hl7InQueue.setDateCreated(new Date()); } if (hl7InQueue.getMessageState() == null) { hl7InQueue.setMessageState(HL7Constants.HL7_STATUS_PENDING); } return dao.saveHL7InQueue(hl7InQueue); }
/** * Convenience constructor to build queue from a previously deleted queue entry * * @param hl7InArchive deleted entry from which queue entry will be constructed * @since 1.5 */ public HL7InQueue(HL7InArchive hl7InArchive) { setHL7Source(hl7InArchive.getHL7Source()); setHL7SourceKey(hl7InArchive.getHL7SourceKey()); setHL7Data(hl7InArchive.getHL7Data()); setMessageState(HL7Constants.HL7_STATUS_PENDING); }
+ " is already processing. " + ",key=" + hl7InQueue.getHL7SourceKey() + ")"); } else { hl7InQueue.setMessageState(HL7Constants.HL7_STATUS_PROCESSING);
/** * @throws HL7Exception * @see HL7Service#processHL7InQueue(HL7InQueue) */ @Test(expected = HL7Exception.class) public void processHL7InQueue_shouldFailIfGivenInQueueIsAlreadyMarkedAsProcessing() throws HL7Exception { executeDataSet("org/openmrs/hl7/include/ORUTest-initialData.xml"); HL7Service hl7service = Context.getHL7Service(); HL7InQueue queueItem = hl7service.getHL7InQueue(1); queueItem.setMessageState(HL7Constants.HL7_STATUS_PROCESSING); // set this to processing hl7service.processHL7InQueue(queueItem); }
/** * @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()); }
/** * Creates new {@link HL7InQueue} instance from itself * * @return new {@link HL7InQueue} instance */ public HL7InQueue toHL7InQueue() { HL7InQueue result = new HL7InQueue(); result.setHL7Source(getSource()); result.setHL7SourceKey(getSourceKey()); result.setHL7Data(getData()); if (getMessageState() != null) result.setMessageState(getMessageState()); else result.setMessageState(HL7Constants.HL7_STATUS_PENDING); return result; }