Search in sources :

Example 1 with SlotType1

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

the class DirectDocumentUtils method makeSlot.

public static SlotType1 makeSlot(SlotType1Enum slotTypeEnum, SimplePerson person) {
    SlotType1 slot = new SlotType1();
    ValueListType values = new ValueListType();
    List<String> vals = values.getValue();
    slot.setName(slotTypeEnum.getName());
    slot.setValueList(values);
    // <rim:Value>PID-3|pid1^^^domain</rim:Value>
    StringBuffer pid3 = new StringBuffer("PID-3|");
    pid3.append(person.getLocalId() != null ? person.getLocalId() : "");
    pid3.append("^^^&");
    pid3.append(person.getLocalOrg() != null ? person.getLocalOrg() : "");
    pid3.append("&ISO");
    vals.add(pid3.toString());
    // <rim:Value>PID-5|Doe^John^Middle^^</rim:Value>
    StringBuffer pid5 = new StringBuffer("PID-5|");
    pid5.append(person.getLastName() != null ? person.getLastName() : "");
    pid5.append("^");
    pid5.append(person.getFirstName() != null ? person.getFirstName() : "");
    pid5.append("^");
    pid5.append(person.getMiddleName() != null ? person.getMiddleName() : "");
    pid5.append("^^");
    vals.add(pid5.toString());
    // <rim:Value>PID-7|19560527</rim:Value>
    StringBuffer pid7 = new StringBuffer("PID-7|");
    pid7.append(person.getBirthDateTime() != null ? person.getBirthDateTime() : "");
    vals.add(pid7.toString());
    // <rim:Value>PID-8|M</rim:Value>
    StringBuffer pid8 = new StringBuffer("PID-8|");
    pid8.append(person.getGenderCode() != null ? person.getGenderCode() : "");
    vals.add(pid8.toString());
    // <rim:Value>PID-11|100 Main St^^Metropolis^Il^44130^USA</rim:Value>
    StringBuffer pid11 = new StringBuffer("PID-11|");
    pid11.append(person.getStreetAddress1() != null ? person.getStreetAddress1() : "");
    pid11.append("^^");
    pid11.append(person.getCity() != null ? person.getCity() : "");
    pid11.append("^");
    pid11.append(person.getState() != null ? person.getState() : "");
    pid11.append("^");
    pid11.append(person.getZipCode() != null ? person.getZipCode() : "");
    pid11.append("^");
    pid11.append(person.getCountry() != null ? person.getCountry() : "");
    vals.add(pid11.toString());
    return slot;
}
Also used : SlotType1(oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1) ValueListType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ValueListType)

Example 2 with SlotType1

use of oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1 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 SlotType1

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

the class DirectDocumentUtils method makeSlot.

public static SlotType1 makeSlot(SlotType1Enum slotTypeEnum, List<String> values) {
    SlotType1 slot = new SlotType1();
    ValueListType valueListType = new ValueListType();
    List<String> vals = valueListType.getValue();
    slot.setName(slotTypeEnum.getName());
    slot.setValueList(valueListType);
    vals.addAll(values);
    return slot;
}
Also used : SlotType1(oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1) ValueListType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ValueListType)

Example 4 with SlotType1

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

the class RegistryPackageWebConverterTest method getFirstExtrinsicObject.

private ExtrinsicObjectType getFirstExtrinsicObject() {
    ExtrinsicObjectType extrinsicObject = RIM_FACTORY.createExtrinsicObjectType();
    // set default values
    extrinsicObject.setMimeType(extrinsicObject.getMimeType());
    extrinsicObject.setIsOpaque(extrinsicObject.isIsOpaque());
    extrinsicObject.setId("urn:registry:node");
    extrinsicObject.setObjectType("urn:registry:federation:node");
    extrinsicObject.getSlot().add(stHelper.create("liveDate", "2015-11-01T06:15:30-07:00", "xs:dateTime"));
    extrinsicObject.getSlot().add(stHelper.create("dataStartDate", "2015-11-01T13:15:30Z", "xs:dateTime"));
    extrinsicObject.getSlot().add(stHelper.create("dataEndDate", "2015-12-01T23:01:40Z", "xs:dateTime"));
    extrinsicObject.getSlot().add(stHelper.create("lastUpdated", "2016-01-26T17:16:34.996Z", "xs:dateTime"));
    extrinsicObject.getSlot().add(stHelper.create("links", "https://some/link/to/my/repo", "xs:string"));
    SlotType1 locationSlot = stHelper.create("location", (String) null, "urn:ogc:def:dataType:ISO-19107:2003:GM_Point");
    PointType point = GML_FACTORY.createPointType();
    point.setSrsDimension(BigInteger.valueOf(2));
    point.setSrsName("urn:ogc:def:crs:EPSG::4326");
    DirectPositionType directPosition = GML_FACTORY.createDirectPositionType();
    directPosition.getValue().add(112.267472);
    directPosition.getValue().add(33.467944);
    point.setPos(directPosition);
    ValueListType valueList = WRS_FACTORY.createValueListType();
    AnyValueType anyValue = WRS_FACTORY.createAnyValueType();
    anyValue.getContent().add(GML_FACTORY.createPoint(point));
    valueList.getAnyValue().add(anyValue);
    locationSlot.setValueList(RIM_FACTORY.createValueList(valueList));
    extrinsicObject.getSlot().add(locationSlot);
    SlotType1 boundsSlot = stHelper.create("bounds", (String) null, "urn:ogc:def:dataType:ISO-19107:2003:GM_Envelope");
    EnvelopeType bounds = GML_FACTORY.createEnvelopeType();
    bounds.setSrsName("urn:ogc:def:crs:EPSG::4326");
    directPosition = GML_FACTORY.createDirectPositionType();
    directPosition.getValue().add(112.267472);
    directPosition.getValue().add(33.467944);
    bounds.setUpperCorner(directPosition);
    directPosition = GML_FACTORY.createDirectPositionType();
    directPosition.getValue().add(110.267472);
    directPosition.getValue().add(30.467944);
    bounds.setLowerCorner(directPosition);
    valueList = WRS_FACTORY.createValueListType();
    anyValue = WRS_FACTORY.createAnyValueType();
    anyValue.getContent().add(GML_FACTORY.createEnvelope(bounds));
    valueList.getAnyValue().add(anyValue);
    boundsSlot.setValueList(RIM_FACTORY.createValueList(valueList));
    extrinsicObject.getSlot().add(boundsSlot);
    extrinsicObject.getSlot().add(stHelper.create("region", "USA", "urn:ogc:def:ebRIM-ClassificationScheme:UNSD:GlobalRegions"));
    List<String> values = new ArrayList<>();
    values.add("youtube");
    values.add("myCamera");
    extrinsicObject.getSlot().add(stHelper.create("inputDataSources", values, "xs:string"));
    values = new ArrayList<>();
    values.add("video");
    values.add("sensor");
    extrinsicObject.getSlot().add(stHelper.create("dataTypes", values, "xs:string"));
    extrinsicObject.getSlot().add(stHelper.create("securityLevel", "role=guest", "xs:string"));
    extrinsicObject.setName(istHelper.create("Node Name"));
    extrinsicObject.setDescription(istHelper.create("A little something describing this node in less than 1024 characters"));
    extrinsicObject.setVersionInfo(getVersionInfo("2.9.x"));
    ClassificationType classification = RIM_FACTORY.createClassificationType();
    classification.setId("urn:classification:id0");
    classification.setClassifiedObject("classifiedObjectId");
    extrinsicObject.getClassification().add(classification);
    return extrinsicObject;
}
Also used : EnvelopeType(net.opengis.gml.v_3_1_1.EnvelopeType) SlotType1(oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1) DirectPositionType(net.opengis.gml.v_3_1_1.DirectPositionType) ValueListType(net.opengis.cat.wrs.v_1_0_2.ValueListType) ArrayList(java.util.ArrayList) ExtrinsicObjectType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ExtrinsicObjectType) PointType(net.opengis.gml.v_3_1_1.PointType) AnyValueType(net.opengis.cat.wrs.v_1_0_2.AnyValueType) ClassificationType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ClassificationType)

Example 5 with SlotType1

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

the class SlotTypeHelper method getNameSlotMapDuplicateSlotNamesAllowed.

/**
     * This is a convenience method that will iterate through the List of SlotType1 provided and return a mapping of SlotType1 name to a List of SlotType1s
     * * If multiple slots share the same name they will be added to the list
     *
     * @param slots the list of SlotType1s to be mapped, null returns empty map
     * @return a mapping of SlotType1 name to List of SlotType1
     */
public Map<String, List<SlotType1>> getNameSlotMapDuplicateSlotNamesAllowed(List<SlotType1> slots) {
    Map<String, List<SlotType1>> slotMap = new HashMap<>();
    if (CollectionUtils.isNotEmpty(slots)) {
        for (SlotType1 slot : slots) {
            slotMap.putIfAbsent(slot.getName(), new ArrayList<>());
            slotMap.get(slot.getName()).add(slot);
        }
    }
    return slotMap;
}
Also used : SlotType1(oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) List(java.util.List)

Aggregations

SlotType1 (oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1)23 ArrayList (java.util.ArrayList)8 Test (org.junit.Test)7 List (java.util.List)6 HashMap (java.util.HashMap)5 ExtrinsicObjectType (oasis.names.tc.ebxml_regrep.xsd.rim._3.ExtrinsicObjectType)5 ValueListType (oasis.names.tc.ebxml_regrep.xsd.rim._3.ValueListType)5 JAXBElement (javax.xml.bind.JAXBElement)4 Map (java.util.Map)3 AnyValueType (net.opengis.cat.wrs.v_1_0_2.AnyValueType)3 ValueListType (net.opengis.cat.wrs.v_1_0_2.ValueListType)3 DirectPositionType (net.opengis.gml.v_3_1_1.DirectPositionType)3 EnvelopeType (net.opengis.gml.v_3_1_1.EnvelopeType)3 PointType (net.opengis.gml.v_3_1_1.PointType)3 ClassificationType (oasis.names.tc.ebxml_regrep.xsd.rim._3.ClassificationType)3 RegistryObjectType (oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectType)3 OffsetDateTime (java.time.OffsetDateTime)2 Collectors (java.util.stream.Collectors)2 RegistryPackageType (oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryPackageType)2 ServiceBindingType (oasis.names.tc.ebxml_regrep.xsd.rim._3.ServiceBindingType)2