use of net.opengis.cat.wrs.v_1_0_2.ValueListType 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 net.opengis.cat.wrs.v_1_0_2.ValueListType 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 net.opengis.cat.wrs.v_1_0_2.ValueListType in project ddf by codice.
the class SlotTypeConverter method getWrsValueList.
private Optional<net.opengis.cat.wrs.v_1_0_2.ValueListType> getWrsValueList(Map<String, Object> map) {
Optional<net.opengis.cat.wrs.v_1_0_2.ValueListType> optionalValueList = Optional.empty();
if (MapUtils.isEmpty(map) || !map.containsKey(VALUE)) {
return optionalValueList;
}
Map<String, Object> valueMap = (Map<String, Object>) map.get(VALUE);
if (valueMap.containsKey(POINT_KEY)) {
Optional<PointType> optionalPoint = getPoint((Map<String, Object>) valueMap.get(POINT_KEY));
if (optionalPoint.isPresent()) {
AnyValueType anyValue = WRS_FACTORY.createAnyValueType();
anyValue.getContent().add(GML_FACTORY.createPoint(optionalPoint.get()));
net.opengis.cat.wrs.v_1_0_2.ValueListType valueList = WRS_FACTORY.createValueListType();
valueList.getAnyValue().add(anyValue);
if (!optionalValueList.isPresent()) {
optionalValueList = Optional.of(WRS_FACTORY.createValueListType());
}
optionalValueList.get().getAnyValue().add(anyValue);
}
} else if (valueMap.containsKey(ENVELOPE_KEY)) {
Optional<EnvelopeType> optionalEnvelope = getEnvelope((Map<String, Object>) valueMap.get(ENVELOPE_KEY));
if (optionalEnvelope.isPresent()) {
AnyValueType anyValue = WRS_FACTORY.createAnyValueType();
anyValue.getContent().add(GML_FACTORY.createEnvelope(optionalEnvelope.get()));
net.opengis.cat.wrs.v_1_0_2.ValueListType valueList = WRS_FACTORY.createValueListType();
valueList.getAnyValue().add(anyValue);
if (!optionalValueList.isPresent()) {
optionalValueList = Optional.of(WRS_FACTORY.createValueListType());
}
optionalValueList.get().getAnyValue().add(anyValue);
}
}
return optionalValueList;
}
use of net.opengis.cat.wrs.v_1_0_2.ValueListType 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 net.opengis.cat.wrs.v_1_0_2.ValueListType 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