use of org.codice.ddf.spatial.ogc.wfs.catalog.MetacardTypeEnhancer in project ddf by codice.
the class WfsSource method createFeatureMetacardTypeRegistration.
private FeatureMetacardType createFeatureMetacardTypeRegistration(FeatureTypeType featureTypeType, String ftName, XmlSchema schema) {
MetacardTypeEnhancer metacardTypeEnhancer = metacardTypeEnhancers.stream().filter(me -> me.getFeatureName() != null).filter(me -> me.getFeatureName().equalsIgnoreCase(ftName)).findAny().orElse(FeatureMetacardType.DEFAULT_METACARD_TYPE_ENHANCER);
FeatureMetacardType ftMetacard = new FeatureMetacardType(schema, featureTypeType.getName(), nonQueryableProperties != null ? Arrays.stream(nonQueryableProperties).collect(toSet()) : new HashSet<>(), Wfs11Constants.GML_3_1_1_NAMESPACE, metacardTypeEnhancer);
Dictionary<String, Object> props = new DictionaryMap<>();
props.put(Metacard.CONTENT_TYPE, new String[] { ftName });
LOGGER.debug("WfsSource {}: Registering MetacardType: {}", getId(), ftName);
return ftMetacard;
}
use of org.codice.ddf.spatial.ogc.wfs.catalog.MetacardTypeEnhancer in project ddf by codice.
the class FeatureMetacardTypeTest method testMetacardTypeEnhancer.
@Test
public void testMetacardTypeEnhancer() {
final AttributeDescriptor attributeDescriptor = new AttributeDescriptorImpl("foo", true, true, true, true, BasicTypes.STRING_TYPE);
final MetacardTypeEnhancer metacardTypeEnhancer = mock(MetacardTypeEnhancer.class);
doReturn(Collections.singleton(attributeDescriptor)).when(metacardTypeEnhancer).getAttributeDescriptors();
final QName featureTypeName = new QName("http://codice.org/test", "TheFeatureType");
final FeatureMetacardType featureMetacardType = new FeatureMetacardType(new XmlSchema(), featureTypeName, EMPTY_NON_QUERYABLE_PROPS, GML_3_1_1_NAMESPACE, metacardTypeEnhancer);
assertThat(featureMetacardType.getAttributeDescriptor("foo"), is(attributeDescriptor));
}
Aggregations