use of org.n52.shetland.ogc.ows.OwsKeyword in project arctic-sea by 52North.
the class AbstractCapabilitiesBaseTypeDecoder method parseServiceIdentification.
private OwsServiceIdentification parseServiceIdentification(ServiceIdentification serviceIdentification) {
if (serviceIdentification == null) {
return null;
}
OwsCode serviceType = parseCode(serviceIdentification.getServiceType());
Set<String> serviceTypeVersion = Optional.ofNullable(serviceIdentification.getServiceTypeVersionArray()).map(Arrays::stream).orElseGet(Stream::empty).collect(toSet());
Set<String> fees = Optional.ofNullable(serviceIdentification.getFees()).map(Collections::singleton).orElseGet(Collections::emptySet);
Set<URI> profiles = Optional.ofNullable(serviceIdentification.getProfileArray()).map(Arrays::stream).orElseGet(Stream::empty).map(URI::create).collect(toSet());
Set<String> accessConstraints = Optional.ofNullable(serviceIdentification.getAccessConstraintsArray()).map(Arrays::stream).orElseGet(Stream::empty).collect(toSet());
MultilingualString title = new MultilingualString();
MultilingualString abstrakt = new MultilingualString();
Optional.ofNullable(serviceIdentification.getTitleArray()).map(Arrays::stream).orElseGet(Stream::empty).map(this::parseLanguageString).forEach(title::addLocalization);
Optional.ofNullable(serviceIdentification.getAbstractArray()).map(Arrays::stream).orElseGet(Stream::empty).map(this::parseLanguageString).forEach(abstrakt::addLocalization);
Set<OwsKeyword> keywords = Optional.ofNullable(serviceIdentification.getKeywordsArray()).map(Arrays::stream).orElseGet(Stream::empty).flatMap(this::parseKeyword).filter(Objects::nonNull).collect(toSet());
return new OwsServiceIdentification(serviceType, serviceTypeVersion, profiles, fees, accessConstraints, title, abstrakt, keywords);
}
use of org.n52.shetland.ogc.ows.OwsKeyword in project arctic-sea by 52North.
the class OwsEncoderv110 method encodeServiceIdentification.
private XmlObject encodeServiceIdentification(OwsServiceIdentification serviceIdentification) throws EncodingException {
ServiceIdentification serviceIdent;
/* TODO check for required fields and fail on missing ones */
serviceIdent = ServiceIdentification.Factory.newInstance();
serviceIdentification.getAccessConstraints().forEach(serviceIdent::addAccessConstraints);
if (!serviceIdentification.getFees().isEmpty()) {
serviceIdent.setFees(serviceIdentification.getFees().iterator().next());
}
CodeType xbServiceType = serviceIdent.addNewServiceType();
xbServiceType.setStringValue(serviceIdentification.getServiceType().getValue());
if (serviceIdentification.getServiceType().getCodeSpace().isPresent()) {
xbServiceType.setCodeSpace(serviceIdentification.getServiceType().getCodeSpace().get().toString());
}
encodeMultilingualString(serviceIdentification.getTitle(), serviceIdent::addNewTitle);
encodeMultilingualString(serviceIdentification.getAbstract(), serviceIdent::addNewAbstract);
serviceIdentification.getServiceTypeVersion().stream().forEach(serviceIdent::addServiceTypeVersion);
serviceIdentification.getProfiles().stream().map(URI::toString).forEach(serviceIdent::addProfile);
serviceIdentification.getKeywords().stream().collect(groupingBy(OwsKeyword::getType, mapping(OwsKeyword::getKeyword, toList()))).forEach((type, keywords) -> encodeOwsKeywords(type, keywords, serviceIdent.addNewKeywords()));
return serviceIdent;
}
Aggregations