use of oasis.names.tc.ebxml_regrep.xsd.rim._3.VersionInfoType 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.VersionInfoType in project ddf by codice.
the class MapToSchemaElement method populateVersionInfoTypeElement.
public Optional<T> populateVersionInfoTypeElement(Map<String, Object> map, String mapKey, final Optional<T> referenceElement, BiConsumer<VersionInfoType, T> updater) {
Optional<T> elementToPopulate = Optional.empty();
if (referenceElement.isPresent()) {
elementToPopulate = Optional.of(referenceElement.get());
}
String valueToPopulate = MapUtils.getString(map, mapKey);
if (StringUtils.isNotBlank(valueToPopulate)) {
if (!elementToPopulate.isPresent()) {
elementToPopulate = Optional.of(objectFactory.get());
}
VersionInfoType versionInfo = RIM_FACTORY.createVersionInfoType();
versionInfo.setVersionName(valueToPopulate);
updater.accept(versionInfo, elementToPopulate.get());
}
return elementToPopulate;
}
use of oasis.names.tc.ebxml_regrep.xsd.rim._3.VersionInfoType in project ddf by codice.
the class RegistryPackageWebConverterTest method getVersionInfo.
private VersionInfoType getVersionInfo(String version) {
VersionInfoType versionInfoType = RIM_FACTORY.createVersionInfoType();
versionInfoType.setVersionName(version);
return versionInfoType;
}
Aggregations