Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial support for product searches
- Loading branch information
Showing
12 changed files
with
3,885 additions
and
51 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
...nity/oseo/oseo-core/src/main/java/org/geoserver/opensearch/eo/ComplexFeatureAccessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,49 @@ | |||
/* (c) 2017 Open Source Geospatial Foundation - all rights reserved | |||
* This code is licensed under the GPL 2.0 license, available at the root | |||
* application directory. | |||
*/ | |||
package org.geoserver.opensearch.eo; | |||
|
|||
import org.geotools.feature.NameImpl; | |||
import org.opengis.feature.Feature; | |||
import org.opengis.feature.Property; | |||
|
|||
/** | |||
* Utility class to get complex feature attribute values (actual values, not property wrappers). | |||
* Can be used to simplify access to values when they are single valued and do not involve | |||
* | |||
* | |||
* @author Andrea Aime - GeoSolutions | |||
*/ | |||
public class ComplexFeatureAccessor { | |||
|
|||
/** | |||
* Returns a single attribute value assuming the attribute is in the same namespace as the | |||
* feature | |||
* | |||
* @param feature | |||
* @param attribute | |||
* @return | |||
*/ | |||
public static Object value(Feature feature, String attribute) { | |||
String prefix = feature.getType().getName().getNamespaceURI(); | |||
return value(feature, prefix, attribute); | |||
} | |||
|
|||
/** | |||
* Returns a single attribute value looking it up by qualified name | |||
* @param feature | |||
* @param namespace | |||
* @param attribute | |||
* @return | |||
*/ | |||
public static Object value(Feature feature, String namespace, String attribute) { | |||
Property property = feature.getProperty(new NameImpl(namespace, attribute)); | |||
if (property == null) { | |||
return null; | |||
} else { | |||
Object value = property.getValue(); | |||
return value; | |||
} | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.