use of org.geotools.feature.NameImpl in project polymap4-core by Polymap4.
the class P4DataStoreInfo method canHandle.
/**
* Returns a newly created {@link P4DataStoreInfo}, or null if the layer is not
* connected to a {@link FeatureStore}.
*
* @throws Exception
*/
public static P4DataStoreInfo canHandle(Catalog catalog, ILayer layer) throws Exception {
GeoServerServlet server = GeoServerServlet.instance.get();
Optional<Pipeline> pipeline = server.getOrCreatePipeline(layer, FeaturesProducer.class);
if (pipeline.isPresent()) {
PipelineFeatureSource fs = new PipelineDataStore(pipeline.get()).getFeatureSource();
// check with P4FeatureTypeInfo
Name name = new NameImpl(GeoServerUtils.defaultNsInfo.get().getName(), GeoServerUtils.simpleName(layer.label.get()));
Params params = new Params();
FeatureRenameProcessor.NAME.rawput(params, name);
PipelineProcessorSite procSite = new PipelineProcessorSite(params);
ProcessorDescriptor proc = new ProcessorDescriptor(FeatureRenameProcessor.class, params);
proc.processor().init(procSite);
fs.pipeline().addFirst(proc);
return new P4DataStoreInfo(catalog, layer, fs);
} else {
return null;
}
}
use of org.geotools.feature.NameImpl in project ddf by codice.
the class CswRecordMapperFilterVisitorTest method setUpBeforeClass.
@BeforeClass
public static void setUpBeforeClass() throws Exception {
factory = new FilterFactoryImpl();
attrExpr = factory.property(new NameImpl(new QName(CswConstants.DUBLIN_CORE_SCHEMA, UNMAPPED_PROPERTY, CswConstants.DUBLIN_CORE_NAMESPACE_PREFIX)));
created = new AttributeExpressionImpl(new NameImpl(new QName(CswConstants.DUBLIN_CORE_SCHEMA, Core.CREATED, CswConstants.DUBLIN_CORE_NAMESPACE_PREFIX)));
attributeRegistry = new AttributeRegistryImpl();
attributeRegistry.registerMetacardType(CswQueryFactoryTest.getCswMetacardType());
visitor = new CswRecordMapperFilterVisitor(DEFAULT_CSW_RECORD_MAP, attributeRegistry);
}
use of org.geotools.feature.NameImpl in project ddf by codice.
the class CswRecordMapperFilterVisitorTest method testVisitWithMappedName.
@Test
public void testVisitWithMappedName() {
AttributeExpressionImpl propName = new AttributeExpressionImpl(new NameImpl(new QName(CswConstants.DUBLIN_CORE_SCHEMA, CswConstants.CSW_ALTERNATIVE, CswConstants.DUBLIN_CORE_NAMESPACE_PREFIX)));
CswRecordMapperFilterVisitor visitor = new CswRecordMapperFilterVisitor(DEFAULT_CSW_RECORD_MAP, attributeRegistry);
PropertyName propertyName = (PropertyName) visitor.visit(propName, null);
assertThat(propertyName.getPropertyName(), is(Core.TITLE));
assertThat(propertyName.getPropertyName(), not(is(CswConstants.CSW_ALTERNATIVE)));
}
use of org.geotools.feature.NameImpl in project ddf by codice.
the class CswRecordMapperFilterVisitorTest method testVisitPropertyIsGreaterThanTemporal.
@Test
public void testVisitPropertyIsGreaterThanTemporal() {
Expression val = factory.literal(new Date(System.currentTimeMillis() - 1000));
Expression test = new AttributeExpressionImpl(new NameImpl(new QName(CswConstants.DUBLIN_CORE_SCHEMA, "TestDate", CswConstants.DUBLIN_CORE_NAMESPACE_PREFIX)));
PropertyIsGreaterThan filter = factory.greater(test, val);
Object obj = visitor.visit(filter, null);
assertThat(obj, instanceOf(PropertyIsGreaterThan.class));
PropertyIsGreaterThan duplicate = (PropertyIsGreaterThan) obj;
assertThat(duplicate.getExpression1(), is(test));
assertThat(duplicate.getExpression2(), is(val));
}
use of org.geotools.feature.NameImpl in project hale by halestudio.
the class StyleServiceImpl method getSelectedStyle.
/**
* Convert the given style for selection
*
* @param fts the feature type style to convert
*
* @return the converted feature type style
*/
private FeatureTypeStyle getSelectedStyle(FeatureTypeStyle fts) {
List<Rule> rules = fts.rules();
List<Rule> newRules = new ArrayList<Rule>();
for (Rule rule : rules) {
Symbolizer[] symbolizers = rule.getSymbolizers();
List<Symbolizer> newSymbolizers = new ArrayList<Symbolizer>();
for (Symbolizer symbolizer : symbolizers) {
// get symbolizers
List<Symbolizer> addSymbolizers = getSelectionSymbolizers(symbolizer);
if (addSymbolizers != null) {
newSymbolizers.addAll(addSymbolizers);
}
}
// create new rule
Rule newRule = styleBuilder.createRule(newSymbolizers.toArray(new Symbolizer[newSymbolizers.size()]));
newRule.setFilter(rule.getFilter());
newRule.setElseFilter(rule.isElseFilter());
newRule.setName(rule.getName());
newRules.add(newRule);
}
// TODO Handle case if there is more than one featureTypeName
return styleBuilder.createFeatureTypeStyle(fts.featureTypeNames().stream().findFirst().orElse(new NameImpl("Feature")).getLocalPart(), newRules.toArray(new Rule[newRules.size()]));
}
Aggregations