Search in sources :

Example 1 with RegistryPackageType

use of oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryPackageType in project nhin-d by DirectProject.

the class DirectDocuments method getSubmitObjectsRequest.

/**
     * Get the metadata represented as a SubmitObjectsRequest object.
     */
public SubmitObjectsRequest getSubmitObjectsRequest() {
    RegistryPackageType registryPackageType = submissionSet.generateRegistryPackageType();
    ClassificationType classificationType = submissionSet.generateClassificationType();
    QName qname = null;
    // Generate ExtrinsicObjectType objects for each document
    qname = new QName(SubmitObjectsRequestEnum.EXTRINSIC_OBJECT.getNamespaceUri(), SubmitObjectsRequestEnum.EXTRINSIC_OBJECT.getName());
    List<JAXBElement<ExtrinsicObjectType>> jaxb_extrinsicObjectTypes = new ArrayList<JAXBElement<ExtrinsicObjectType>>();
    for (DirectDocument2 document : documents) {
        ExtrinsicObjectType extrinsicObjectType = document.getMetadata().generateExtrinsicObjectType();
        JAXBElement<ExtrinsicObjectType> jaxb_extrinsicObjectType = new JAXBElement<ExtrinsicObjectType>(qname, ExtrinsicObjectType.class, extrinsicObjectType);
        jaxb_extrinsicObjectTypes.add(jaxb_extrinsicObjectType);
    }
    // Generate the RegistryPakageType (SubmissionSet) for the group of
    // documents
    qname = new QName(SubmitObjectsRequestEnum.REGISTRY_PACKAGE.getNamespaceUri(), SubmitObjectsRequestEnum.REGISTRY_PACKAGE.getName());
    JAXBElement<RegistryPackageType> jaxb_registryPackageType = new JAXBElement<RegistryPackageType>(qname, RegistryPackageType.class, registryPackageType);
    // Generate the ClassificationType object
    qname = new QName(SubmitObjectsRequestEnum.CLASSIFICATION.getNamespaceUri(), SubmitObjectsRequestEnum.CLASSIFICATION.getName());
    JAXBElement<ClassificationType> jaxb_classificationType = new JAXBElement<ClassificationType>(qname, ClassificationType.class, classificationType);
    // Generate AssociationType1 objects for each document
    qname = new QName(SubmitObjectsRequestEnum.ASSOCIATION.getNamespaceUri(), SubmitObjectsRequestEnum.ASSOCIATION.getName());
    List<JAXBElement<AssociationType1>> jaxb_associationType1s = new ArrayList<JAXBElement<AssociationType1>>();
    for (DirectDocument2 document : documents) {
        AssociationType1 associationType = submissionSet.generateAssociationType(document.getMetadata().getId(), document.getMetadata().getSubmissionSetStatus());
        JAXBElement<AssociationType1> jaxb_AssociationType1 = new JAXBElement<AssociationType1>(qname, AssociationType1.class, associationType);
        jaxb_associationType1s.add(jaxb_AssociationType1);
    }
    SubmitObjectsRequest submitObjectsRequest = new SubmitObjectsRequest();
    RegistryObjectListType registryObjectListType = new RegistryObjectListType();
    List<JAXBElement<? extends IdentifiableType>> elements = registryObjectListType.getIdentifiable();
    elements.addAll(jaxb_extrinsicObjectTypes);
    elements.add(jaxb_registryPackageType);
    elements.add(jaxb_classificationType);
    elements.addAll(jaxb_associationType1s);
    submitObjectsRequest.setRegistryObjectList(registryObjectListType);
    return submitObjectsRequest;
}
Also used : RegistryObjectListType(oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectListType) IdentifiableType(oasis.names.tc.ebxml_regrep.xsd.rim._3.IdentifiableType) RegistryPackageType(oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryPackageType) QName(javax.xml.namespace.QName) ArrayList(java.util.ArrayList) AssociationType1(oasis.names.tc.ebxml_regrep.xsd.rim._3.AssociationType1) ExtrinsicObjectType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ExtrinsicObjectType) JAXBElement(javax.xml.bind.JAXBElement) ClassificationType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ClassificationType) SubmitObjectsRequest(oasis.names.tc.ebxml_regrep.xsd.lcm._3.SubmitObjectsRequest)

Example 2 with RegistryPackageType

use of oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryPackageType in project nhin-d by DirectProject.

the class DirectDocuments method setValues.

public void setValues(SubmitObjectsRequest submitObjectsRequest) throws MetadataException {
    RegistryObjectListType rol = submitObjectsRequest.getRegistryObjectList();
    List<JAXBElement<? extends IdentifiableType>> elements = rol.getIdentifiable();
    for (JAXBElement<? extends IdentifiableType> element : elements) {
        if (element.getValue() instanceof oasis.names.tc.ebxml_regrep.xsd.rim._3.ExtrinsicObjectType) {
            ExtrinsicObjectType eot = (ExtrinsicObjectType) element.getValue();
            DirectDocument2 document = new DirectDocument2();
            DirectDocument2.Metadata metadata = document.getMetadata();
            metadata.setValues(eot);
            documents.add(document);
        } else if (element.getValue() instanceof oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryPackageType) {
            RegistryPackageType rpt = (RegistryPackageType) element.getValue();
            SubmissionSet submissionSet = new SubmissionSet();
            submissionSet.setValues(rpt);
            this.submissionSet = submissionSet;
        } else if (element.getValue() instanceof oasis.names.tc.ebxml_regrep.xsd.rim._3.ClassificationType) {
        // Empty in example
        }
    }
    for (JAXBElement<? extends IdentifiableType> element : elements) {
        if (element.getValue() instanceof oasis.names.tc.ebxml_regrep.xsd.rim._3.AssociationType1) {
            AssociationType1 at = (AssociationType1) element.getValue();
            for (SlotType1 slot : at.getSlot()) {
                if (SlotType1Enum.SUBMISSION_SET_STATUS.matches(slot.getName())) {
                    if (slotNotEmpty(slot)) {
                        getDocumentById(at.getTargetObject()).getMetadata().setSubmissionSetStatus(slot.getName());
                    }
                }
            }
        }
    }
}
Also used : RegistryObjectListType(oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectListType) IdentifiableType(oasis.names.tc.ebxml_regrep.xsd.rim._3.IdentifiableType) RegistryPackageType(oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryPackageType) RegistryPackageType(oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryPackageType) AssociationType1(oasis.names.tc.ebxml_regrep.xsd.rim._3.AssociationType1) ExtrinsicObjectType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ExtrinsicObjectType) JAXBElement(javax.xml.bind.JAXBElement) ClassificationType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ClassificationType) SlotType1(oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1)

Example 3 with RegistryPackageType

use of oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryPackageType in project nhin-d by DirectProject.

the class DefaultXdmXdsTransformerTest method testGetDocId_SubmitObjectsRequest.

/**
     * Test the getDocId(SubmitObjectsRequest) method.
     */
public void testGetDocId_SubmitObjectsRequest() {
    DefaultXdmXdsTransformer transformer = new DefaultXdmXdsTransformer();
    QName qname = null;
    String output = null;
    SubmitObjectsRequest input = null;
    ExternalIdentifierType eit = null;
    RegistryObjectListType registryObject = null;
    RegistryPackageType registryPackageType = null;
    ExtrinsicObjectType extrinsicObjectType = null;
    List<ExternalIdentifierType> externalIdentifiers = null;
    JAXBElement<ExtrinsicObjectType> jaxbExtrinsicObject = null;
    JAXBElement<RegistryPackageType> jaxbRegistryPackageTypeObject = null;
    List<JAXBElement<? extends IdentifiableType>> identifiableList = null;
    registryObject = new RegistryObjectListType();
    identifiableList = registryObject.getIdentifiable();
    eit = new ExternalIdentifierType();
    eit.setIdentificationScheme("urn:uuid:2e82c1f6-a085-4c72-9da3-8640a32e42ab");
    eit.setValue("eitValue");
    extrinsicObjectType = new ExtrinsicObjectType();
    externalIdentifiers = extrinsicObjectType.getExternalIdentifier();
    externalIdentifiers.add(eit);
    qname = new QName("urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0", "ExtrinsicObject");
    jaxbExtrinsicObject = new JAXBElement<ExtrinsicObjectType>(qname, ExtrinsicObjectType.class, extrinsicObjectType);
    registryPackageType = new RegistryPackageType();
    qname = new QName("urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0", "RegistryPackage");
    jaxbRegistryPackageTypeObject = new JAXBElement<RegistryPackageType>(qname, RegistryPackageType.class, registryPackageType);
    identifiableList.add(jaxbRegistryPackageTypeObject);
    identifiableList.add(jaxbExtrinsicObject);
    input = new SubmitObjectsRequest();
    input.setRegistryObjectList(registryObject);
    output = transformer.getDocId(input);
    assertEquals("Output does not match expected", "eitValue", output);
    registryObject = new RegistryObjectListType();
    input = new SubmitObjectsRequest();
    input.setRegistryObjectList(registryObject);
    output = transformer.getDocId(input);
    assertEquals("Output does not match expected", null, output);
}
Also used : RegistryObjectListType(oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectListType) IdentifiableType(oasis.names.tc.ebxml_regrep.xsd.rim._3.IdentifiableType) QName(javax.xml.namespace.QName) RegistryPackageType(oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryPackageType) ExtrinsicObjectType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ExtrinsicObjectType) ExternalIdentifierType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ExternalIdentifierType) JAXBElement(javax.xml.bind.JAXBElement) SubmitObjectsRequest(oasis.names.tc.ebxml_regrep.xsd.lcm._3.SubmitObjectsRequest) DefaultXdmXdsTransformer(org.nhindirect.xd.transform.impl.DefaultXdmXdsTransformer)

Example 4 with RegistryPackageType

use of oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryPackageType in project ddf by codice.

the class RegistryPackageWebConverterTest method testEmptyRegistryPackage.

@Test
public void testEmptyRegistryPackage() throws Exception {
    Map<String, Object> emptyRegistryMap = new HashMap<>();
    RegistryPackageTypeConverter rptConverter = new RegistryPackageTypeConverter();
    Optional<RegistryPackageType> optionalRegistryPackage = rptConverter.convert(emptyRegistryMap);
    RegistryPackageType registryPackage = optionalRegistryPackage.orElse(null);
    assertThat(registryPackage, nullValue());
}
Also used : HashMap(java.util.HashMap) RegistryPackageType(oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryPackageType) RegistryPackageTypeConverter(org.codice.ddf.registry.schemabindings.converter.type.RegistryPackageTypeConverter) Test(org.junit.Test)

Example 5 with RegistryPackageType

use of oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryPackageType in project ddf by codice.

the class RegistryPackageTypeHelper method populateLists.

private void populateLists() {
    serviceBindings.clear();
    services.clear();
    extrinsicObjects.clear();
    organizations.clear();
    persons.clear();
    associations.clear();
    if (registryPackageType == null) {
        return;
    }
    if (registryPackageType.isSetRegistryObjectList()) {
        RegistryObjectListType registryObjectList = registryPackageType.getRegistryObjectList();
        for (JAXBElement<? extends IdentifiableType> identifiableType : registryObjectList.getIdentifiable()) {
            RegistryObjectType registryObject = (RegistryObjectType) identifiableType.getValue();
            if (registryObject instanceof ExtrinsicObjectType) {
                extrinsicObjects.add((ExtrinsicObjectType) registryObject);
            } else if (registryObject instanceof ServiceType) {
                ServiceType service = (ServiceType) registryObject;
                services.add(service);
                serviceBindings.addAll(service.getServiceBinding());
            } else if (registryObject instanceof OrganizationType) {
                organizations.add((OrganizationType) registryObject);
            } else if (registryObject instanceof PersonType) {
                persons.add((PersonType) registryObject);
            } else if (registryObject instanceof AssociationType1) {
                associations.add((AssociationType1) registryObject);
            }
        }
    }
}
Also used : RegistryObjectListType(oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectListType) ServiceType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ServiceType) AssociationType1(oasis.names.tc.ebxml_regrep.xsd.rim._3.AssociationType1) ExtrinsicObjectType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ExtrinsicObjectType) PersonType(oasis.names.tc.ebxml_regrep.xsd.rim._3.PersonType) OrganizationType(oasis.names.tc.ebxml_regrep.xsd.rim._3.OrganizationType) RegistryObjectType(oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectType)

Aggregations

RegistryPackageType (oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryPackageType)46 Test (org.junit.Test)26 Metacard (ddf.catalog.data.Metacard)16 InputStream (java.io.InputStream)12 RegistryObjectListType (oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectListType)11 ArrayList (java.util.ArrayList)9 JAXBElement (javax.xml.bind.JAXBElement)9 ExtrinsicObjectType (oasis.names.tc.ebxml_regrep.xsd.rim._3.ExtrinsicObjectType)9 AttributeImpl (ddf.catalog.data.impl.AttributeImpl)7 HashMap (java.util.HashMap)5 IOException (java.io.IOException)4 Map (java.util.Map)4 AssociationType1 (oasis.names.tc.ebxml_regrep.xsd.rim._3.AssociationType1)4 OrganizationType (oasis.names.tc.ebxml_regrep.xsd.rim._3.OrganizationType)4 PersonType (oasis.names.tc.ebxml_regrep.xsd.rim._3.PersonType)4 RegistryObjectType (oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectType)4 ParserConfigurator (org.codice.ddf.parser.ParserConfigurator)4 FederationAdminException (org.codice.ddf.registry.federationadmin.service.internal.FederationAdminException)4 QueryRequest (ddf.catalog.operation.QueryRequest)3 QueryResponse (ddf.catalog.operation.QueryResponse)3