use of oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1 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.SlotType1 in project ddf by codice.
the class SlotWebConverter method getSlotGeoMap.
private Map<String, Object> getSlotGeoMap(SlotType1 slot) {
Map<String, Object> map = new HashMap<>();
if (!slot.isSetValueList()) {
return map;
}
ValueListType valueList = (ValueListType) slot.getValueList().getValue();
for (AnyValueType anyValue : valueList.getAnyValue()) {
anyValue.getContent().stream().filter(content -> content instanceof JAXBElement).forEach(content -> {
JAXBElement jaxbElement = (JAXBElement) content;
if (jaxbElement.getValue() instanceof PointType) {
Map<String, Object> pointMap = getPointMapFromPointType((PointType) jaxbElement.getValue());
if (MapUtils.isNotEmpty(pointMap)) {
Map<String, Object> valueMap = new HashMap<>();
valueMap.put(POINT_KEY, pointMap);
map.put(VALUE, valueMap);
}
}
});
}
return map;
}
use of oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1 in project ddf by codice.
the class SlotTypeHelper method create.
/**
* This is a convenience method to create a SlotType1 object with the List of values
*
* @param slotName the name of the slot, empty SlotType1 if null
* @param slotValues the value to set
* @param slotType the slot type of the slot
* @return
*/
public SlotType1 create(String slotName, List<String> slotValues, String slotType) {
SlotType1 slot = RIM_FACTORY.createSlotType1();
if (StringUtils.isNotBlank(slotName)) {
ValueListType valueList = RIM_FACTORY.createValueListType();
valueList.getValue().addAll(slotValues);
slot.setValueList(RIM_FACTORY.createValueList(valueList));
slot.setSlotType(slotType);
slot.setName(slotName);
}
return slot;
}
use of oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1 in project ddf by codice.
the class SlotWebConverter method getSlotBoundsMap.
private Map<String, Object> getSlotBoundsMap(SlotType1 slot) {
Map<String, Object> map = new HashMap<>();
if (!slot.isSetValueList()) {
return map;
}
ValueListType valueList = (ValueListType) slot.getValueList().getValue();
for (AnyValueType anyValue : valueList.getAnyValue()) {
anyValue.getContent().stream().filter(content -> content instanceof JAXBElement).forEach(content -> {
JAXBElement jaxbElement = (JAXBElement) content;
if (jaxbElement.getValue() instanceof EnvelopeType) {
Map<String, Object> boundsMap = getBoundsMapFromEnvelopeType((EnvelopeType) jaxbElement.getValue());
if (MapUtils.isNotEmpty(boundsMap)) {
Map<String, Object> valueMap = new HashMap<>();
valueMap.put(ENVELOPE_KEY, boundsMap);
map.put(VALUE, valueMap);
}
}
});
}
return map;
}
Aggregations