/** * Convenience constructor to build archive from an existing queue entry * * @param hl7InQueue queue entry from which archive entry will be constructed */ public HL7InArchive(HL7InQueue hl7InQueue) { setHL7Source(hl7InQueue.getHL7Source()); setHL7SourceKey(hl7InQueue.getHL7SourceKey()); setHL7Data(hl7InQueue.getHL7Data()); setMessageState(HL7Constants.HL7_STATUS_PROCESSED); }
/** * 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); }
/** * Convenience constructor to build queue from a previously erred queue entry * * @param hl7InError erred entry from which queue entry will be constructed */ public HL7InQueue(HL7InError hl7InError) { setHL7Source(hl7InError.getHL7Source()); setHL7SourceKey(hl7InError.getHL7SourceKey()); setHL7Data(hl7InError.getHL7Data()); }
/** * @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()); }
/** * Convenience constructor to help convert a queue item into an exception */ public HL7InError(HL7InQueue hl7InQueue) { setHL7Source(hl7InQueue.getHL7Source()); setHL7SourceKey(hl7InQueue.getHL7SourceKey()); setHL7Data(hl7InQueue.getHL7Data()); }
/** * @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 org.openmrs.hl7.HL7Service#saveHL7InArchive(org.openmrs.hl7.HL7InArchive) */ @Override public HL7InArchive saveHL7InArchive(HL7InArchive hl7InArchive) throws APIException { if (hl7InArchive.getDateCreated() == null) { hl7InArchive.setDateCreated(new Date()); } return dao.saveHL7InArchive(hl7InArchive); }
/** * Transform the next pending HL7 inbound queue entry. If there are no pending items in the * queue, this method simply returns quietly. * * @return true if a queue entry was processed, false if queue was empty */ public boolean processNextHL7InQueue() { boolean entryProcessed = false; HL7Service hl7Service = Context.getHL7Service(); HL7InQueue hl7InQueue = hl7Service.getNextHL7InQueue(); if (hl7InQueue != null) { processHL7InQueue(hl7InQueue); entryProcessed = true; } return entryProcessed; }
/** * @see org.openmrs.OpenmrsObject#getId() * @since 1.5 */ @Override public Integer getId() { return getHL7InErrorId(); }
/** * @see org.openmrs.OpenmrsObject#setId(java.lang.Integer) * @since 1.5 */ @Override public void setId(Integer id) { setHL7InErrorId(id); }
/** * Default Constructor (Uses SchedulerConstants.username and SchedulerConstants.password */ public ProcessHL7InQueueTask() { if (processor == null) { processor = new HL7InQueueProcessor(); } }
/** * @see org.openmrs.OpenmrsObject#getId() * @since 1.5 */ @Override public Integer getId() { return getHL7InQueueId(); }
/** * @see org.openmrs.OpenmrsObject#setId(java.lang.Integer) * @since 1.5 */ @Override public void setId(Integer id) { setHL7InQueueId(id); }
/** * Convenience method for parsing HL7 dates (treated just like a timestamp with only year, * month, and day specified) * * @see org.openmrs.hl7.HL7Util#parseHL7Timestamp(String) * @throws HL7Exception */ public static Date parseHL7Date(String s) throws HL7Exception { return parseHL7Timestamp(s); }
/** * @since 1.5 * @see org.openmrs.OpenmrsObject#getId() */ @Override public Integer getId() { return getHL7SourceId(); }
/** * convenience method to set transfer status and active flag to stop migration */ public static void stopMigration() { transferStatus = Status.STOPPED; setActive(false); }
/** * @see org.openmrs.OpenmrsObject#getId() * @since 1.5 */ @Override public Integer getId() { return getHL7InArchiveId(); }
/** * @see org.openmrs.OpenmrsObject#setId(java.lang.Integer) * @since 1.5 */ @Override public void setId(Integer id) { setHL7InArchiveId(id); }
/** * @since 1.5 * @see org.openmrs.OpenmrsObject#setId(java.lang.Integer) */ @Override public void setId(Integer id) { setHL7SourceId(id); }
private Integer findPatientId(PID pid) throws HL7Exception { Integer patientId = Context.getHL7Service().resolvePatientId(pid); if (patientId == null) { return null; } else { return patientId; } }