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());
}
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;
}
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);
}
}
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);
}
}
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);
}
}
}
Aggregations