Example usage for javax.xml.bind JAXBElement JAXBElement

List of usage examples for javax.xml.bind JAXBElement JAXBElement

Introduction

In this page you can find the example usage for javax.xml.bind JAXBElement JAXBElement.

Prototype

public JAXBElement(QName name, Class<T> declaredType, T value) 

Source Link

Document

Construct an xml element instance.

Usage

From source file:org.openhie.openempi.openpixpdq.v3.util.HL7ReceiverTransforms.java

public static MCCIMT000200UV01Receiver createMCCIMT000200UV01Receiver(String OID) {
    MCCIMT000200UV01Receiver receiver = new MCCIMT000200UV01Receiver();

    // Check the input parameter
    if (OID == null) {
        OID = "";
    }//from  w  w  w  . j  av a2 s .c om

    receiver.setTypeCode(CommunicationFunctionType.RCV);

    MCCIMT000200UV01Device receiverDevice = new MCCIMT000200UV01Device();
    receiverDevice.setDeterminerCode(HL7Constants.RECEIVER_DETERMINER_CODE);
    receiverDevice.setClassCode(EntityClassDevice.DEV);
    log.debug("Setting receiver application to 1.2.345.678.999");
    receiverDevice.getId().add(HL7DataTransformHelper.IIFactory("1.2.345.678.999"));

    MCCIMT000200UV01Agent agent = new MCCIMT000200UV01Agent();
    MCCIMT000200UV01Organization org = new MCCIMT000200UV01Organization();
    org.setClassCode(HL7Constants.ORG_CLASS_CODE);
    org.setDeterminerCode(HL7Constants.RECEIVER_DETERMINER_CODE);
    II id = HL7DataTransformHelper.IIFactory(OID);
    org.getId().add(id);

    javax.xml.namespace.QName xmlqnameorg = new javax.xml.namespace.QName("urn:hl7-org:v3",
            "representedOrganization");
    JAXBElement<MCCIMT000200UV01Organization> orgElem = new JAXBElement<MCCIMT000200UV01Organization>(
            xmlqnameorg, MCCIMT000200UV01Organization.class, org);
    agent.setRepresentedOrganization(orgElem);
    agent.getClassCode().add(HL7Constants.AGENT_CLASS_CODE);

    javax.xml.namespace.QName xmlqnameagent = new javax.xml.namespace.QName("urn:hl7-org:v3", "asAgent");
    JAXBElement<MCCIMT000200UV01Agent> agentElem = new JAXBElement<MCCIMT000200UV01Agent>(xmlqnameagent,
            MCCIMT000200UV01Agent.class, agent);

    receiverDevice.setAsAgent(agentElem);

    receiver.setDevice(receiverDevice);

    return receiver;
}

From source file:org.openhie.openempi.openpixpdq.v3.util.HL7ReceiverTransforms.java

public static MCCIMT000200UV01Receiver createMCCIMT000200UV01Receiver(String applicationOid,
        String facilityOid) {//from w w  w.j  a  v  a  2  s.  c  om
    MCCIMT000200UV01Receiver receiver = new MCCIMT000200UV01Receiver();

    // Check the input parameters
    if (facilityOid == null) {
        facilityOid = "";
    }
    if (applicationOid == null) {
        applicationOid = "";
    }

    receiver.setTypeCode(CommunicationFunctionType.RCV);

    MCCIMT000200UV01Device receiverDevice = new MCCIMT000200UV01Device();
    receiverDevice.setDeterminerCode(HL7Constants.RECEIVER_DETERMINER_CODE);
    receiverDevice.setClassCode(EntityClassDevice.DEV);
    log.debug("Setting receiver application to " + applicationOid);
    receiverDevice.getId().add(HL7DataTransformHelper.IIFactory(applicationOid));

    if (facilityOid != null && facilityOid.length() > 0) {
        MCCIMT000200UV01Agent agent = new MCCIMT000200UV01Agent();
        MCCIMT000200UV01Organization org = new MCCIMT000200UV01Organization();
        org.setClassCode(HL7Constants.ORG_CLASS_CODE);
        org.setDeterminerCode(HL7Constants.RECEIVER_DETERMINER_CODE);
        II id = HL7DataTransformHelper.IIFactory(facilityOid);
        org.getId().add(id);

        javax.xml.namespace.QName xmlqnameorg = new javax.xml.namespace.QName("urn:hl7-org:v3",
                "representedOrganization");
        JAXBElement<MCCIMT000200UV01Organization> orgElem = new JAXBElement<MCCIMT000200UV01Organization>(
                xmlqnameorg, MCCIMT000200UV01Organization.class, org);
        agent.setRepresentedOrganization(orgElem);
        agent.getClassCode().add(HL7Constants.AGENT_CLASS_CODE);

        javax.xml.namespace.QName xmlqnameagent = new javax.xml.namespace.QName("urn:hl7-org:v3", "asAgent");
        JAXBElement<MCCIMT000200UV01Agent> agentElem = new JAXBElement<MCCIMT000200UV01Agent>(xmlqnameagent,
                MCCIMT000200UV01Agent.class, agent);

        receiverDevice.setAsAgent(agentElem);
    }

    receiver.setDevice(receiverDevice);

    return receiver;
}

From source file:org.openhie.openempi.openpixpdq.v3.util.HL7ReceiverTransforms.java

public static MCCIMT000100UV01Receiver createMCCIMT000100UV01Receiver(String applicationOid,
        String facilityOid) {//from w w w.  ja  va 2  s.  c om
    MCCIMT000100UV01Receiver receiver = new MCCIMT000100UV01Receiver();

    receiver.setTypeCode(CommunicationFunctionType.RCV);

    MCCIMT000100UV01Device receiverDevice = new MCCIMT000100UV01Device();
    receiverDevice.setDeterminerCode(HL7Constants.RECEIVER_DETERMINER_CODE);
    receiverDevice.setClassCode(EntityClassDevice.DEV);
    log.debug("Setting receiver application to " + applicationOid);
    receiverDevice.getId().add(HL7DataTransformHelper.IIFactory(applicationOid));

    MCCIMT000100UV01Agent agent = new MCCIMT000100UV01Agent();
    MCCIMT000100UV01Organization org = new MCCIMT000100UV01Organization();
    org.setClassCode(HL7Constants.ORG_CLASS_CODE);
    org.setDeterminerCode(HL7Constants.RECEIVER_DETERMINER_CODE);
    II id = HL7DataTransformHelper.IIFactory(facilityOid);
    org.getId().add(id);

    javax.xml.namespace.QName xmlqnameorg = new javax.xml.namespace.QName("urn:hl7-org:v3",
            "representedOrganization");
    JAXBElement<MCCIMT000100UV01Organization> orgElem = new JAXBElement<MCCIMT000100UV01Organization>(
            xmlqnameorg, MCCIMT000100UV01Organization.class, org);
    agent.setRepresentedOrganization(orgElem);
    agent.getClassCode().add(HL7Constants.AGENT_CLASS_CODE);

    javax.xml.namespace.QName xmlqnameagent = new javax.xml.namespace.QName("urn:hl7-org:v3", "asAgent");
    JAXBElement<MCCIMT000100UV01Agent> agentElem = new JAXBElement<MCCIMT000100UV01Agent>(xmlqnameagent,
            MCCIMT000100UV01Agent.class, agent);

    receiverDevice.setAsAgent(agentElem);

    receiver.setDevice(receiverDevice);

    return receiver;
}

From source file:org.openhie.openempi.openpixpdq.v3.util.HL7ReceiverTransforms.java

public static MCCIMT000300UV01Receiver createMCCIMT000300UV01Receiver(String receiverAppOid,
        String receiverFacilityOid) {
    MCCIMT000300UV01Receiver receiver = new MCCIMT000300UV01Receiver();

    receiver.setTypeCode(CommunicationFunctionType.RCV);

    MCCIMT000300UV01Device receiverDevice = new MCCIMT000300UV01Device();
    receiverDevice.setDeterminerCode(HL7Constants.RECEIVER_DETERMINER_CODE);
    receiverDevice.setClassCode(EntityClassDevice.DEV);
    log.debug("Setting receiver application to " + receiverAppOid);
    receiverDevice.getId().add(HL7DataTransformHelper.IIFactory(receiverAppOid));

    MCCIMT000300UV01Agent agent = new MCCIMT000300UV01Agent();
    MCCIMT000300UV01Organization org = new MCCIMT000300UV01Organization();
    org.setClassCode(HL7Constants.ORG_CLASS_CODE);
    org.setDeterminerCode(HL7Constants.RECEIVER_DETERMINER_CODE);
    II id = HL7DataTransformHelper.IIFactory(receiverFacilityOid);
    org.getId().add(id);// w w  w.jav  a 2  s.  c om

    if (Utilities.isNotNullish(receiverFacilityOid)) {
        javax.xml.namespace.QName xmlqnameorg = new javax.xml.namespace.QName("urn:hl7-org:v3",
                "representedOrganization");
        JAXBElement<MCCIMT000300UV01Organization> orgElem = new JAXBElement<MCCIMT000300UV01Organization>(
                xmlqnameorg, MCCIMT000300UV01Organization.class, org);
        agent.setRepresentedOrganization(orgElem);
        agent.getClassCode().add(HL7Constants.AGENT_CLASS_CODE);

        javax.xml.namespace.QName xmlqnameagent = new javax.xml.namespace.QName("urn:hl7-org:v3", "asAgent");
        JAXBElement<MCCIMT000300UV01Agent> agentElem = new JAXBElement<MCCIMT000300UV01Agent>(xmlqnameagent,
                MCCIMT000300UV01Agent.class, agent);

        receiverDevice.setAsAgent(agentElem);
    }
    receiver.setDevice(receiverDevice);

    return receiver;
}

From source file:org.openhie.openempi.openpixpdq.v3.util.HL7SenderTransforms.java

public static MCCIMT000200UV01Sender createMCCIMT000200UV01Sender(String OID) {
    MCCIMT000200UV01Sender sender = new MCCIMT000200UV01Sender();

    // Check the input parameter
    if (OID == null) {
        OID = "";
    }//from www  .ja  va  2  s.  c  om

    sender.setTypeCode(CommunicationFunctionType.SND);

    MCCIMT000200UV01Device senderDevice = new MCCIMT000200UV01Device();
    senderDevice.setDeterminerCode(HL7Constants.SENDER_DETERMINER_CODE);
    senderDevice.setClassCode(EntityClassDevice.DEV);
    log.debug("Setting sender OID to 1.2.345.678.999");
    senderDevice.getId().add(HL7DataTransformHelper.IIFactory("1.2.345.678.999"));

    MCCIMT000200UV01Agent agent = new MCCIMT000200UV01Agent();
    MCCIMT000200UV01Organization org = new MCCIMT000200UV01Organization();
    org.setClassCode(HL7Constants.ORG_CLASS_CODE);
    org.setDeterminerCode(HL7Constants.SENDER_DETERMINER_CODE);
    II id = HL7DataTransformHelper.IIFactory(OID);
    org.getId().add(id);

    javax.xml.namespace.QName xmlqnameorg = new javax.xml.namespace.QName("urn:hl7-org:v3",
            "representedOrganization");
    JAXBElement<MCCIMT000200UV01Organization> orgElem = new JAXBElement<MCCIMT000200UV01Organization>(
            xmlqnameorg, MCCIMT000200UV01Organization.class, org);
    agent.setRepresentedOrganization(orgElem);
    agent.getClassCode().add(HL7Constants.AGENT_CLASS_CODE);

    javax.xml.namespace.QName xmlqnameagent = new javax.xml.namespace.QName("urn:hl7-org:v3", "asAgent");
    JAXBElement<MCCIMT000200UV01Agent> agentElem = new JAXBElement<MCCIMT000200UV01Agent>(xmlqnameagent,
            MCCIMT000200UV01Agent.class, agent);

    senderDevice.setAsAgent(agentElem);

    sender.setDevice(senderDevice);

    return sender;
}

From source file:org.openhie.openempi.openpixpdq.v3.util.HL7SenderTransforms.java

public static MCCIMT000200UV01Sender createMCCIMT000200UV01Sender(String applicationOid, String facilityOid) {
    MCCIMT000200UV01Sender sender = new MCCIMT000200UV01Sender();

    // Check the input parameters
    if (facilityOid == null) {
        facilityOid = "";
    }/*from   ww w .j  av  a 2 s . c  o  m*/
    if (applicationOid == null) {
        applicationOid = "";
    }

    sender.setTypeCode(CommunicationFunctionType.SND);

    MCCIMT000200UV01Device senderDevice = new MCCIMT000200UV01Device();
    senderDevice.setDeterminerCode(HL7Constants.SENDER_DETERMINER_CODE);
    senderDevice.setClassCode(EntityClassDevice.DEV);
    log.debug("Setting sender OID to " + applicationOid);
    senderDevice.getId().add(HL7DataTransformHelper.IIFactory(applicationOid));

    if (facilityOid != null && facilityOid.length() > 0) {
        MCCIMT000200UV01Agent agent = new MCCIMT000200UV01Agent();
        MCCIMT000200UV01Organization org = new MCCIMT000200UV01Organization();
        org.setClassCode(HL7Constants.ORG_CLASS_CODE);
        org.setDeterminerCode(HL7Constants.SENDER_DETERMINER_CODE);
        II id = HL7DataTransformHelper.IIFactory(facilityOid);
        org.getId().add(id);

        javax.xml.namespace.QName xmlqnameorg = new javax.xml.namespace.QName("urn:hl7-org:v3",
                "representedOrganization");
        JAXBElement<MCCIMT000200UV01Organization> orgElem = new JAXBElement<MCCIMT000200UV01Organization>(
                xmlqnameorg, MCCIMT000200UV01Organization.class, org);
        agent.setRepresentedOrganization(orgElem);
        agent.getClassCode().add(HL7Constants.AGENT_CLASS_CODE);

        javax.xml.namespace.QName xmlqnameagent = new javax.xml.namespace.QName("urn:hl7-org:v3", "asAgent");
        JAXBElement<MCCIMT000200UV01Agent> agentElem = new JAXBElement<MCCIMT000200UV01Agent>(xmlqnameagent,
                MCCIMT000200UV01Agent.class, agent);

        senderDevice.setAsAgent(agentElem);
    }

    sender.setDevice(senderDevice);

    return sender;
}

From source file:org.openhie.openempi.openpixpdq.v3.util.HL7SenderTransforms.java

public static MCCIMT000100UV01Sender createMCCIMT000100UV01Sender(String applicationOid, String facilityOid) {
    MCCIMT000100UV01Sender sender = new MCCIMT000100UV01Sender();

    sender.setTypeCode(CommunicationFunctionType.SND);

    MCCIMT000100UV01Device senderDevice = new MCCIMT000100UV01Device();
    senderDevice.setDeterminerCode(HL7Constants.SENDER_DETERMINER_CODE);
    senderDevice.setClassCode(EntityClassDevice.DEV);
    log.debug("Setting sender OID to " + applicationOid);
    senderDevice.getId().add(HL7DataTransformHelper.IIFactory(applicationOid));

    MCCIMT000100UV01Agent agent = new MCCIMT000100UV01Agent();
    MCCIMT000100UV01Organization org = new MCCIMT000100UV01Organization();
    org.setClassCode(HL7Constants.ORG_CLASS_CODE);
    org.setDeterminerCode(HL7Constants.SENDER_DETERMINER_CODE);
    II id = HL7DataTransformHelper.IIFactory(facilityOid);
    org.getId().add(id);//from ww  w . ja v a  2  s  .  c  om

    javax.xml.namespace.QName xmlqnameorg = new javax.xml.namespace.QName("urn:hl7-org:v3",
            "representedOrganization");
    JAXBElement<MCCIMT000100UV01Organization> orgElem = new JAXBElement<MCCIMT000100UV01Organization>(
            xmlqnameorg, MCCIMT000100UV01Organization.class, org);
    agent.setRepresentedOrganization(orgElem);
    agent.getClassCode().add(HL7Constants.AGENT_CLASS_CODE);

    javax.xml.namespace.QName xmlqnameagent = new javax.xml.namespace.QName("urn:hl7-org:v3", "asAgent");
    JAXBElement<MCCIMT000100UV01Agent> agentElem = new JAXBElement<MCCIMT000100UV01Agent>(xmlqnameagent,
            MCCIMT000100UV01Agent.class, agent);

    senderDevice.setAsAgent(agentElem);

    sender.setDevice(senderDevice);

    return sender;
}

From source file:org.openhie.openempi.openpixpdq.v3.util.HL7SenderTransforms.java

static MCCIMT000300UV01Sender createMCCIMT000300UV01Sender(String senderAppOid, String senderFacilityOid) {
    MCCIMT000300UV01Sender sender = new MCCIMT000300UV01Sender();

    sender.setTypeCode(CommunicationFunctionType.SND);

    MCCIMT000300UV01Device senderDevice = new MCCIMT000300UV01Device();
    senderDevice.setDeterminerCode(HL7Constants.SENDER_DETERMINER_CODE);
    senderDevice.setClassCode(EntityClassDevice.DEV);
    log.debug("Setting sender OID to " + senderAppOid);
    senderDevice.getId().add(HL7DataTransformHelper.IIFactory(senderAppOid));

    MCCIMT000300UV01Agent agent = new MCCIMT000300UV01Agent();
    MCCIMT000300UV01Organization org = new MCCIMT000300UV01Organization();
    org.setClassCode(HL7Constants.ORG_CLASS_CODE);
    org.setDeterminerCode(HL7Constants.SENDER_DETERMINER_CODE);
    II id = HL7DataTransformHelper.IIFactory(senderFacilityOid);
    org.getId().add(id);//from  ww w  .ja va2  s .c o  m

    javax.xml.namespace.QName xmlqnameorg = new javax.xml.namespace.QName("urn:hl7-org:v3",
            "representedOrganization");
    JAXBElement<MCCIMT000300UV01Organization> orgElem = new JAXBElement<MCCIMT000300UV01Organization>(
            xmlqnameorg, MCCIMT000300UV01Organization.class, org);
    agent.setRepresentedOrganization(orgElem);
    agent.getClassCode().add(HL7Constants.AGENT_CLASS_CODE);

    javax.xml.namespace.QName xmlqnameagent = new javax.xml.namespace.QName("urn:hl7-org:v3", "asAgent");
    JAXBElement<MCCIMT000300UV01Agent> agentElem = new JAXBElement<MCCIMT000300UV01Agent>(xmlqnameagent,
            MCCIMT000300UV01Agent.class, agent);

    if (Utilities.isNotNullish(senderFacilityOid)) {
        senderDevice.setAsAgent(agentElem);
    }

    sender.setDevice(senderDevice);

    return sender;
}

From source file:org.openhie.openempi.openpixpdq.v3.util.Utilities.java

public static MCCIMT000300UV01Receiver generateMCCIMT00300UV01Receiver(MCCIMT000100UV01Sender sender) {

    MCCIMT000300UV01Receiver receiver = new MCCIMT000300UV01Receiver();
    II oid = null;//  ww  w . ja v a2 s  .  c  o m

    receiver.setTypeCode(CommunicationFunctionType.RCV);

    if (sender.getDevice() != null && sender.getDevice().getAsAgent() != null
            && sender.getDevice().getAsAgent().getValue() != null
            && sender.getDevice().getAsAgent().getValue().getRepresentedOrganization() != null
            && sender.getDevice().getAsAgent().getValue().getRepresentedOrganization().getValue() != null
            && isNotNullish(
                    sender.getDevice().getAsAgent().getValue().getRepresentedOrganization().getValue().getId())
            && sender.getDevice().getAsAgent().getValue().getRepresentedOrganization().getValue().getId()
                    .get(0) != null
            && isNotNullish(sender.getDevice().getAsAgent().getValue().getRepresentedOrganization().getValue()
                    .getId().get(0).getRoot())) {
        oid = sender.getDevice().getAsAgent().getValue().getRepresentedOrganization().getValue().getId().get(0);
    }

    String senderDeviceIdRoot = "1.2.345.678.999";
    if (sender.getDevice() != null && sender.getDevice().getId() != null
            && sender.getDevice().getId().size() > 0 && sender.getDevice().getId().get(0) != null
            && sender.getDevice().getId().get(0).getRoot() != null) {
        senderDeviceIdRoot = sender.getDevice().getId().get(0).getRoot();
    }

    MCCIMT000300UV01Device receiverDevice = new MCCIMT000300UV01Device();
    receiverDevice.setClassCode(EntityClassDevice.DEV);
    receiverDevice.setDeterminerCode(ConversionConstants.ENTITY_DETERMINER_CODE_INSTANCE);
    log.debug("Setting receiver application to " + senderDeviceIdRoot);
    receiverDevice.getId().add(generateHl7Id(senderDeviceIdRoot, null));

    if (oid != null) {
        MCCIMT000300UV01Agent agent = new MCCIMT000300UV01Agent();
        MCCIMT000300UV01Organization org = new MCCIMT000300UV01Organization();
        org.setClassCode(ConversionConstants.ENTITY_CLASS_CODE_ORG);
        org.setDeterminerCode(ConversionConstants.ENTITY_DETERMINER_CODE_INSTANCE);
        org.getId().add(oid);

        javax.xml.namespace.QName xmlqnameorg = new javax.xml.namespace.QName("urn:hl7-org:v3",
                "representedOrganization");
        JAXBElement<MCCIMT000300UV01Organization> orgElem = new JAXBElement<MCCIMT000300UV01Organization>(
                xmlqnameorg, MCCIMT000300UV01Organization.class, org);
        agent.setRepresentedOrganization(orgElem);
        agent.getClassCode().add(ConversionConstants.ROLE_CLASS_AGENT);

        javax.xml.namespace.QName xmlqnameagent = new javax.xml.namespace.QName("urn:hl7-org:v3", "asAgent");
        JAXBElement<MCCIMT000300UV01Agent> agentElem = new JAXBElement<MCCIMT000300UV01Agent>(xmlqnameagent,
                MCCIMT000300UV01Agent.class, agent);

        receiverDevice.setAsAgent(agentElem);
    }
    receiver.setDevice(receiverDevice);
    return receiver;
}

From source file:org.openhie.openempi.openpixpdq.v3.util.Utilities.java

public static MCCIMT000300UV01Receiver generateMCCIMT00300UV01Receiver(MCCIMT000300UV01Sender sender) {

    MCCIMT000300UV01Receiver receiver = new MCCIMT000300UV01Receiver();
    II oid = null;/*from   w  w  w .  jav a2s  . c o  m*/

    receiver.setTypeCode(CommunicationFunctionType.RCV);

    if (sender.getDevice() != null && sender.getDevice().getAsAgent() != null
            && sender.getDevice().getAsAgent().getValue() != null
            && sender.getDevice().getAsAgent().getValue().getRepresentedOrganization() != null
            && sender.getDevice().getAsAgent().getValue().getRepresentedOrganization().getValue() != null
            && isNotNullish(
                    sender.getDevice().getAsAgent().getValue().getRepresentedOrganization().getValue().getId())
            && sender.getDevice().getAsAgent().getValue().getRepresentedOrganization().getValue().getId()
                    .get(0) != null
            && isNotNullish(sender.getDevice().getAsAgent().getValue().getRepresentedOrganization().getValue()
                    .getId().get(0).getRoot())) {
        oid = sender.getDevice().getAsAgent().getValue().getRepresentedOrganization().getValue().getId().get(0);
    }

    String senderDeviceIdRoot = "1.2.345.678.999";
    if (sender.getDevice() != null && sender.getDevice().getId() != null
            && sender.getDevice().getId().size() > 0 && sender.getDevice().getId().get(0) != null
            && sender.getDevice().getId().get(0).getRoot() != null) {
        senderDeviceIdRoot = sender.getDevice().getId().get(0).getRoot();
    }

    MCCIMT000300UV01Device receiverDevice = new MCCIMT000300UV01Device();
    receiverDevice.setClassCode(EntityClassDevice.DEV);
    receiverDevice.setDeterminerCode(ConversionConstants.ENTITY_DETERMINER_CODE_INSTANCE);
    log.debug("Setting receiver application to " + senderDeviceIdRoot);
    receiverDevice.getId().add(generateHl7Id(senderDeviceIdRoot, null));

    MCCIMT000300UV01Agent agent = new MCCIMT000300UV01Agent();
    MCCIMT000300UV01Organization org = new MCCIMT000300UV01Organization();
    org.setClassCode(ConversionConstants.ENTITY_CLASS_CODE_ORG);
    org.setDeterminerCode(ConversionConstants.ENTITY_DETERMINER_CODE_INSTANCE);
    org.getId().add(oid);

    javax.xml.namespace.QName xmlqnameorg = new javax.xml.namespace.QName("urn:hl7-org:v3",
            "representedOrganization");
    JAXBElement<MCCIMT000300UV01Organization> orgElem = new JAXBElement<MCCIMT000300UV01Organization>(
            xmlqnameorg, MCCIMT000300UV01Organization.class, org);
    agent.setRepresentedOrganization(orgElem);
    agent.getClassCode().add(ConversionConstants.ROLE_CLASS_AGENT);

    javax.xml.namespace.QName xmlqnameagent = new javax.xml.namespace.QName("urn:hl7-org:v3", "asAgent");
    JAXBElement<MCCIMT000300UV01Agent> agentElem = new JAXBElement<MCCIMT000300UV01Agent>(xmlqnameagent,
            MCCIMT000300UV01Agent.class, agent);

    receiverDevice.setAsAgent(agentElem);
    receiver.setDevice(receiverDevice);
    return receiver;
}