use of oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1 in project ddf by codice.
the class SlotTypeHelperTest method createMultiValue.
@Test
public void createMultiValue() throws Exception {
String slotName = "slotName";
String slotValue1 = "slotValue1";
String slotValue2 = "slotValue2";
String slotType = "slotType";
List<String> values = new ArrayList<>();
values.add(slotValue1);
values.add(slotValue2);
SlotType1 slot = stHelper.create(slotName, values, slotType);
assertThat(slot, notNullValue());
assertThat(slot.getName(), is(equalTo(slotName)));
assertThat(slot.getSlotType(), is(equalTo(slotType)));
values = stHelper.getStringValues(slot);
assertThat(values, hasSize(2));
assertThat(values, contains(slotValue1, slotValue2));
}
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, String value) {
SlotType1 slot = new SlotType1();
ValueListType valueListType = new ValueListType();
List<String> vals = valueListType.getValue();
slot.setName(slotTypeEnum.getName());
slot.setValueList(valueListType);
vals.add(value);
return slot;
}
use of oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1 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);
}
}
}
use of oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1 in project ddf by codice.
the class RegistryPackageConverter method setAttributeFromMap.
private static void setAttributeFromMap(String metacardAttributeName, Map<String, SlotType1> map, MetacardImpl metacard) throws RegistryConversionException {
String xmlAttributeName = METACARD_XML_NAME_MAP.get(metacardAttributeName);
if (map.containsKey(xmlAttributeName)) {
SlotType1 slot = map.get(xmlAttributeName);
String slotType = slot.getSlotType();
if (slotType.contains(RegistryConstants.XML_DATE_TIME_TYPE)) {
setSlotDateAttribute(slot, metacardAttributeName, metacard);
} else if (slotType.contains(RegistryConstants.XML_GEO_TYPE)) {
setSlotGeoAttribute(slot, metacardAttributeName, metacard);
} else {
// default to string
setSlotStringAttribute(slot, metacardAttributeName, metacard);
}
}
}
use of oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1 in project ddf by codice.
the class RegistryPackageConverter method parseRegistryService.
private static void parseRegistryService(ServiceType service, MetacardImpl metacard) throws RegistryConversionException {
validateIdentifiable(service);
String xmlServiceBindingsTypesAttributeName = METACARD_XML_NAME_MAP.get(RegistryObjectMetacardType.SERVICE_BINDING_TYPES);
String xmlServiceBindingsAttributeName = METACARD_XML_NAME_MAP.get(RegistryObjectMetacardType.SERVICE_BINDINGS);
List<String> serviceBindings = new ArrayList<>();
List<String> serviceBindingTypes = new ArrayList<>();
List<String> bindings = new ArrayList<>();
List<String> bindingTypes = new ArrayList<>();
for (ServiceBindingType binding : service.getServiceBinding()) {
bindings.clear();
bindingTypes.clear();
Map<String, List<SlotType1>> slotMap = SLOT_TYPE_HELPER.getNameSlotMapDuplicateSlotNamesAllowed(binding.getSlot());
if (slotMap.containsKey(xmlServiceBindingsTypesAttributeName)) {
List<SlotType1> slots = slotMap.get(xmlServiceBindingsTypesAttributeName);
for (SlotType1 slot : slots) {
bindingTypes.addAll(SLOT_TYPE_HELPER.getStringValues(slot));
}
}
if (slotMap.containsKey(xmlServiceBindingsAttributeName)) {
List<SlotType1> slots = slotMap.get(xmlServiceBindingsAttributeName);
for (SlotType1 slot : slots) {
bindings.addAll(SLOT_TYPE_HELPER.getStringValues(slot));
}
}
serviceBindingTypes.addAll(bindingTypes);
serviceBindings.addAll(bindings);
}
metacard.setAttribute(RegistryObjectMetacardType.SERVICE_BINDING_TYPES, (Serializable) serviceBindingTypes);
metacard.setAttribute(RegistryObjectMetacardType.SERVICE_BINDINGS, (Serializable) serviceBindings);
}
Aggregations