org.openhealthexchange.openpixpdq.ihe.audit
Class AuditObjectFactory

java.lang.Object
  extended by org.openhealthexchange.openpixpdq.ihe.audit.AuditObjectFactory

public class AuditObjectFactory
extends java.lang.Object

A class for generating IHE ATNA log messages. The exact format of the messages is described in RFC 3881, Dicomm Supplimental 95 sec A.1.2, and the IHE IT Technical Framework Vol 2 sec. 3.20.

This class is used by the different audit message classes to generate the appropriately formatted XML which is then sent using the configured audit transport. A new factory should be generated for each message you send since the factory maintains internal state to build the messsage.

To use: make a new audit object factory, add the approriate data, call getAuditMessage to get the complete JAXB audit message. This last step will normally be done by the IheAuditTrail base class.

In general, the data required for an appropriately formatted audit are as follows:

  1. Event Identification - what was done (1)
  2. Active Participant Identification - by whom (1 or more)
  3. Network Access Point Identification - initiated from where(paired 1:1 with active participant)
  4. Audit Source Identification - using which server (1)
  5. Participant Object Identification - to what record (0 or more)
Each of the appropritate audit object factory member functions should be called with the required data to load the factory with all the appropriate data. The specifics of which data elements are required for the different possible message types are defined in the above documents.

Basically this class is simply a layer on top of the JAXB generated classes to make building formatted messages much easier. The factory deals with all of the details of getting the correct data in the correct places. It also takes care of generating all of the correct JAXB parts and putting them all together. As such all of the functions throw JAXB exceptions. Please check these as it does internal error checking and throws the exceptions when incorrrect data is sent in. (Or when not enough data is given.)

Version:
1.0 - Nov 13, 2005
Author:
Josh Flachsbart
See Also:
IheAuditTrail

Constructor Summary
AuditObjectFactory(IMessageTransmitter messenger)
          Generates and initializes a blank audit message factory.
 
Method Summary
protected  void addActiveParticipant(com.misyshealthcare.connect.base.audit.ActiveParticipant activeParticipant)
          Adds an active participant for the messages that require it.
protected  void addAuditSourceId(java.lang.String enterpriseSiteID, java.lang.String auditSourceID, java.util.Collection<com.misyshealthcare.connect.base.audit.AuditCodeMappings.AuditSourceType> sourceTypes)
          Generates the source id for this message.
protected  void addParticipantObject(ParticipantObject participantObject)
          Adds a participant object for the messages that require it.
 AuditMessage getAuditMessage()
          Gets the audit message from the properly formatted audit object factory.
 void sendAuditMessage()
          Sends the properly formatted audit object.
protected  void setEventIdType(EventId eventIdType)
          Used to set the type of the event.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AuditObjectFactory

public AuditObjectFactory(IMessageTransmitter messenger)
Generates and initializes a blank audit message factory.

Parameters:
messenger - the IMessageTransmitter
Method Detail

getAuditMessage

public AuditMessage getAuditMessage()
                             throws javax.xml.bind.JAXBException
Gets the audit message from the properly formatted audit object factory.

Please note that to be properly formatted, you need to have added the event id type, at least one active participant and at least one audit source id. Optionally you may have participant object ids, and multiple source ids and multiple active participants.

Please see the documents mentioned in the class description to know which message types require which events.

Returns:
The complete Audit Message ready to be marshalled.
Throws:
javax.xml.bind.JAXBException - if there is a formatting error, e.g. did not call the appropriate add functions.

sendAuditMessage

public void sendAuditMessage()
                      throws javax.xml.bind.JAXBException
Sends the properly formatted audit object.

Please note that to be properly formatted, you need to have added the event id type, at least one active participant and at least one audit source id. Optionally you may have participant object ids, and multiple source ids and multiple active participants.

Please see the documents mentioned in the class description to know which message types require which events.

Throws:
javax.xml.bind.JAXBException - if there is a formatting error, e.g. did not call the appropriate add functions.

addAuditSourceId

protected void addAuditSourceId(java.lang.String enterpriseSiteID,
                                java.lang.String auditSourceID,
                                java.util.Collection<com.misyshealthcare.connect.base.audit.AuditCodeMappings.AuditSourceType> sourceTypes)
                         throws javax.xml.bind.JAXBException
Generates the source id for this message. Should be parameterized from the configuration file.

Throws:
javax.xml.bind.JAXBException - Thrown if the factory is unable to create the ID.

addActiveParticipant

protected void addActiveParticipant(com.misyshealthcare.connect.base.audit.ActiveParticipant activeParticipant)
                             throws javax.xml.bind.JAXBException
Adds an active participant for the messages that require it.

In general there will always be one for the actual machine. In general there will be another for the doctor doing the action of the other machine involved in the case of security audits.

Parameters:
activeParticipant - The active participant to add.
Throws:
javax.xml.bind.JAXBException - If there is an error in the format of the active participant.

addParticipantObject

protected void addParticipantObject(ParticipantObject participantObject)
                             throws javax.xml.bind.JAXBException
Adds a participant object for the messages that require it.

In general there will always be one for the patient when a patient's records are being accessed. In general there will be on for the record when a patient's records are being accessed.

This only takes patients for now. This should probably change in the future.

Parameters:
activeParticipant - The active participant to add.
Throws:
javax.xml.bind.JAXBException - If there is an error in the format of the active participant.

setEventIdType

protected void setEventIdType(EventId eventIdType)
                       throws javax.xml.bind.JAXBException
Used to set the type of the event.

Each event require one and only one event id. The may have a type code, to tell you what type of that event it is, but it is not required and may be null.

Parameters:
eventIdType - A class describing this event.
Throws:
javax.xml.bind.JAXBException - If there is a formatting error in the event id.