Search in sources :

Example 41 with ExtrinsicObjectType

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

the class DirectDocument2Test method testPracticeSettingCode_localized.

/**
     * Test practiceSettingCode_localized.
     * 
     * @throws Exception
     */
public void testPracticeSettingCode_localized() throws Exception {
    DirectDocument2 document = new DirectDocument2();
    DirectDocument2.Metadata metadata = document.getMetadata();
    String value = "input";
    metadata.setPracticeSettingCode(UUID.randomUUID().toString());
    metadata.setPracticeSettingCode_localized(value);
    ExtrinsicObjectType eot = metadata.generateExtrinsicObjectType();
    metadata = new DirectDocument2.Metadata();
    metadata.setValues(eot);
    assertEquals("Output does not match expected", value, metadata.getPracticeSettingCode_localized());
}
Also used : ExtrinsicObjectType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ExtrinsicObjectType)

Example 42 with ExtrinsicObjectType

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

the class RegistryPackageWebConverterTest method getFourthExtrinsicObject.

private ExtrinsicObjectType getFourthExtrinsicObject() {
    ExtrinsicObjectType extrinsicObject = RIM_FACTORY.createExtrinsicObjectType();
    extrinsicObject.setId("urn:service:params:id0");
    extrinsicObject.setMimeType("application/octet-stream");
    extrinsicObject.setIsOpaque(false);
    extrinsicObject.setContentVersionInfo(getVersionInfo("versionName"));
    extrinsicObject.getSlot().add(stHelper.create("parameters", "param1", "xs:string"));
    extrinsicObject.setObjectType("urn:registry:content:collection");
    return extrinsicObject;
}
Also used : ExtrinsicObjectType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ExtrinsicObjectType)

Example 43 with ExtrinsicObjectType

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

the class IdentityNodeInitialization method createIdentityNode.

private void createIdentityNode() throws FederationAdminException {
    String registryPackageId = RegistryConstants.GUID_PREFIX + UUID.randomUUID().toString().replaceAll("-", "");
    LOGGER.info("Creating registry identity node: {} {}", SystemInfo.getSiteName(), registryPackageId);
    RegistryPackageType registryPackage = RIM_FACTORY.createRegistryPackageType();
    registryPackage.setId(registryPackageId);
    registryPackage.setObjectType(RegistryConstants.REGISTRY_NODE_OBJECT_TYPE);
    ExtrinsicObjectType extrinsicObject = RIM_FACTORY.createExtrinsicObjectType();
    extrinsicObject.setObjectType(RegistryConstants.REGISTRY_NODE_OBJECT_TYPE);
    String extrinsicObjectId = RegistryConstants.GUID_PREFIX + UUID.randomUUID().toString().replaceAll("-", "");
    extrinsicObject.setId(extrinsicObjectId);
    String siteName = SystemInfo.getSiteName();
    if (StringUtils.isNotBlank(siteName)) {
        extrinsicObject.setName(internationalStringTypeHelper.create(siteName));
    } else {
        extrinsicObject.setName(internationalStringTypeHelper.create(UNKNOWN_SITE_NAME));
    }
    String home = SystemBaseUrl.getBaseUrl();
    extrinsicObject.setHome(home);
    String version = SystemInfo.getVersion();
    if (StringUtils.isNotBlank(version)) {
        VersionInfoType versionInfo = RIM_FACTORY.createVersionInfoType();
        versionInfo.setVersionName(version);
        extrinsicObject.setVersionInfo(versionInfo);
    }
    OffsetDateTime now = OffsetDateTime.now(ZoneId.of(ZoneOffset.UTC.toString()));
    String rightNow = now.toString();
    SlotType1 lastUpdated = slotTypeHelper.create(RegistryConstants.XML_LAST_UPDATED_NAME, rightNow, DATE_TIME);
    extrinsicObject.getSlot().add(lastUpdated);
    SlotType1 liveDate = slotTypeHelper.create(RegistryConstants.XML_LIVE_DATE_NAME, rightNow, DATE_TIME);
    extrinsicObject.getSlot().add(liveDate);
    if (registryPackage.getRegistryObjectList() == null) {
        registryPackage.setRegistryObjectList(RIM_FACTORY.createRegistryObjectListType());
    }
    registryPackage.getRegistryObjectList().getIdentifiable().add(RIM_FACTORY.createIdentifiable(extrinsicObject));
    Metacard identityMetacard = getRegistryMetacardFromRegistryPackage(registryPackage);
    if (identityMetacard != null) {
        identityMetacard.setAttribute(new AttributeImpl(RegistryObjectMetacardType.REGISTRY_IDENTITY_NODE, true));
        identityMetacard.setAttribute(new AttributeImpl(RegistryObjectMetacardType.REGISTRY_LOCAL_NODE, true));
        System.setProperty(RegistryConstants.REGISTRY_ID_PROPERTY, registryPackageId);
        federationAdminService.addRegistryEntry(identityMetacard);
    }
}
Also used : Metacard(ddf.catalog.data.Metacard) SlotType1(oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1) OffsetDateTime(java.time.OffsetDateTime) RegistryPackageType(oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryPackageType) AttributeImpl(ddf.catalog.data.impl.AttributeImpl) ExtrinsicObjectType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ExtrinsicObjectType) VersionInfoType(oasis.names.tc.ebxml_regrep.xsd.rim._3.VersionInfoType)

Example 44 with ExtrinsicObjectType

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

the class IdentityNodeInitialization method updateIdentityNodeName.

private void updateIdentityNodeName(Metacard metacard) throws FederationAdminException, ParserException {
    RegistryPackageType registryPackage = metacardMarshaller.getRegistryPackageFromMetacard(metacard);
    String siteName = SystemInfo.getSiteName();
    RegistryPackageTypeHelper registryPackageTypeHelper = new RegistryPackageTypeHelper();
    registryPackageTypeHelper.getExtrinsicObjects(registryPackage.getRegistryObjectList()).stream().filter(extrinsicObjectType -> extrinsicObjectType.getObjectType().equals(RegistryConstants.REGISTRY_NODE_OBJECT_TYPE)).findFirst().ifPresent(extrinsicObjectType -> extrinsicObjectType.setName(internationalStringTypeHelper.create(siteName)));
    Metacard identityMetacard = getRegistryMetacardFromRegistryPackage(registryPackage);
    if (identityMetacard != null) {
        federationAdminService.updateRegistryEntry(identityMetacard);
    }
}
Also used : Metacard(ddf.catalog.data.Metacard) RegistryPackageType(oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryPackageType) RegistryPackageTypeHelper(org.codice.ddf.registry.schemabindings.helper.RegistryPackageTypeHelper)

Example 45 with ExtrinsicObjectType

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

the class FederationAdmin method updateDateFields.

private void updateDateFields(RegistryPackageType rpt) {
    ExtrinsicObjectType nodeInfo = null;
    for (JAXBElement identifiable : rpt.getRegistryObjectList().getIdentifiable()) {
        RegistryObjectType registryObject = (RegistryObjectType) identifiable.getValue();
        if (registryObject instanceof ExtrinsicObjectType && RegistryConstants.REGISTRY_NODE_OBJECT_TYPE.equals(registryObject.getObjectType())) {
            nodeInfo = (ExtrinsicObjectType) registryObject;
            break;
        }
    }
    if (nodeInfo != null) {
        boolean liveDateFound = false;
        boolean lastUpdatedFound = false;
        OffsetDateTime now = OffsetDateTime.now(ZoneId.of(ZoneOffset.UTC.toString()));
        String rightNow = now.toString();
        for (SlotType1 slot : nodeInfo.getSlot()) {
            if (slot.getName().equals(RegistryConstants.XML_LIVE_DATE_NAME)) {
                liveDateFound = true;
            } else if (slot.getName().equals(RegistryConstants.XML_LAST_UPDATED_NAME)) {
                ValueListType valueList = EbrimConstants.RIM_FACTORY.createValueListType();
                valueList.getValue().add(rightNow);
                slot.setValueList(EbrimConstants.RIM_FACTORY.createValueList(valueList));
                lastUpdatedFound = true;
            }
        }
        if (!liveDateFound) {
            SlotType1 liveDate = slotHelper.create(RegistryConstants.XML_LIVE_DATE_NAME, rightNow, DATE_TIME);
            nodeInfo.getSlot().add(liveDate);
        }
        if (!lastUpdatedFound) {
            SlotType1 lastUpdated = slotHelper.create(RegistryConstants.XML_LAST_UPDATED_NAME, rightNow, DATE_TIME);
            nodeInfo.getSlot().add(lastUpdated);
        }
    }
}
Also used : SlotType1(oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1) OffsetDateTime(java.time.OffsetDateTime) ValueListType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ValueListType) ExtrinsicObjectType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ExtrinsicObjectType) JAXBElement(javax.xml.bind.JAXBElement) RegistryObjectType(oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectType)

Aggregations

ExtrinsicObjectType (oasis.names.tc.ebxml_regrep.xsd.rim._3.ExtrinsicObjectType)46 RegistryPackageType (oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryPackageType)8 JAXBElement (javax.xml.bind.JAXBElement)7 RegistryObjectListType (oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectListType)7 ArrayList (java.util.ArrayList)5 AssociationType1 (oasis.names.tc.ebxml_regrep.xsd.rim._3.AssociationType1)5 IdentifiableType (oasis.names.tc.ebxml_regrep.xsd.rim._3.IdentifiableType)5 SlotType1 (oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1)5 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 ServiceType (oasis.names.tc.ebxml_regrep.xsd.rim._3.ServiceType)4 Date (java.util.Date)3 ClassificationType (oasis.names.tc.ebxml_regrep.xsd.rim._3.ClassificationType)3 Metacard (ddf.catalog.data.Metacard)2 OffsetDateTime (java.time.OffsetDateTime)2 HashMap (java.util.HashMap)2 QName (javax.xml.namespace.QName)2 SubmitObjectsRequest (oasis.names.tc.ebxml_regrep.xsd.lcm._3.SubmitObjectsRequest)2 ExternalIdentifierType (oasis.names.tc.ebxml_regrep.xsd.rim._3.ExternalIdentifierType)2