Search in sources :

Example 1 with LayerAttribute

use of org.geosdi.geoplatform.responce.LayerAttribute in project geo-platform by geosdi.

the class LayerService method describeFeatureType.

@Override
public List<GPLayerAttributes> describeFeatureType(String layerName) throws GeoPlatformException {
    List<GPLayerAttributes> attributeList = Lists.<GPLayerAttributes>newArrayList();
    try {
        List<LayerAttribute> result = this.geoPlatformPublishClient.describeFeatureType(layerName).getLayerAttributes();
        for (LayerAttribute layerAttribute : result) {
            GPLayerAttributes gpLayerAttributes = new GPLayerAttributes();
            gpLayerAttributes.setAttributeType(layerAttribute.getType());
            gpLayerAttributes.setAttributeValue(layerAttribute.getValue());
            attributeList.add(gpLayerAttributes);
        }
    } catch (ResourceNotFoundFault rnff) {
        throw new GeoPlatformException(rnff.getMessage());
    }
    return attributeList;
}
Also used : GPLayerAttributes(org.geosdi.geoplatform.gui.model.tree.GPLayerAttributes) LayerAttribute(org.geosdi.geoplatform.responce.LayerAttribute) ResourceNotFoundFault(org.geosdi.geoplatform.exception.ResourceNotFoundFault) GeoPlatformException(org.geosdi.geoplatform.gui.global.GeoPlatformException)

Example 2 with LayerAttribute

use of org.geosdi.geoplatform.responce.LayerAttribute in project geo-platform by geosdi.

the class FilterDescribeFeatureCommand method execute.

@Override
public FilterDescribeFeatureResponse execute(FilterDescribeFeatureRequest request, HttpServletRequest httpServletRequest) {
    try {
        logger.debug("##################### Executing {} Command", this.getClass().getSimpleName());
        List<GPLayerAttributes> attributeList = Lists.newArrayList();
        try {
            List<LayerAttribute> result = this.geoPlatformPublishClient.describeFeatureType(request.getLayerName()).getLayerAttributes();
            for (LayerAttribute layerAttribute : result) {
                GPLayerAttributes gpLayerAttributes = new GPLayerAttributes();
                gpLayerAttributes.setAttributeType(layerAttribute.getType());
                gpLayerAttributes.setAttributeValue(layerAttribute.getValue());
                attributeList.add(gpLayerAttributes);
            }
        } catch (ResourceNotFoundFault rnff) {
            throw new GeoPlatformException(rnff.getMessage());
        }
        logger.debug("#################### Found {} ", attributeList);
        return new FilterDescribeFeatureResponse(Lists.<GPLayerAttributes>newArrayList(attributeList));
    } catch (Exception ex) {
        ex.printStackTrace();
        throw new GeoPlatformException(ex.getMessage());
    }
}
Also used : FilterDescribeFeatureResponse(org.geosdi.geoplatform.gui.client.command.filter.basic.FilterDescribeFeatureResponse) GPLayerAttributes(org.geosdi.geoplatform.gui.model.tree.GPLayerAttributes) LayerAttribute(org.geosdi.geoplatform.responce.LayerAttribute) ResourceNotFoundFault(org.geosdi.geoplatform.exception.ResourceNotFoundFault) GeoPlatformException(org.geosdi.geoplatform.gui.global.GeoPlatformException) GeoPlatformException(org.geosdi.geoplatform.gui.global.GeoPlatformException)

Example 3 with LayerAttribute

use of org.geosdi.geoplatform.responce.LayerAttribute in project geo-platform by geosdi.

the class CASFilterDescribeFeatureCommand method execute.

@Override
public FilterDescribeFeatureResponse execute(FilterDescribeFeatureRequest request, HttpServletRequest httpServletRequest) {
    logger.debug("##################### Executing {} Command", this.getClass().getSimpleName());
    List<GPLayerAttributes> attributeList = Lists.<GPLayerAttributes>newArrayList();
    try {
        List<LayerAttribute> result = this.casPublisherService.describeFeatureType(request.getLayerName()).getLayerAttributes();
        for (LayerAttribute layerAttribute : result) {
            GPLayerAttributes gpLayerAttributes = new GPLayerAttributes();
            gpLayerAttributes.setAttributeType(layerAttribute.getType());
            gpLayerAttributes.setAttributeValue(layerAttribute.getValue());
            attributeList.add(gpLayerAttributes);
        }
    } catch (ResourceNotFoundFault rnff) {
        throw new GeoPlatformException(rnff.getMessage());
    }
    logger.debug("#################### Found {} ", attributeList);
    return new FilterDescribeFeatureResponse(Lists.newArrayList(attributeList));
}
Also used : FilterDescribeFeatureResponse(org.geosdi.geoplatform.gui.client.command.filter.basic.FilterDescribeFeatureResponse) GPLayerAttributes(org.geosdi.geoplatform.gui.model.tree.GPLayerAttributes) LayerAttribute(org.geosdi.geoplatform.responce.LayerAttribute) ResourceNotFoundFault(org.geosdi.geoplatform.exception.ResourceNotFoundFault) GeoPlatformException(org.geosdi.geoplatform.gui.global.GeoPlatformException)

Example 4 with LayerAttribute

use of org.geosdi.geoplatform.responce.LayerAttribute in project geo-platform by geosdi.

the class GeoserverConnectorFeatureTypesTest method b_readFeatureType.

/*
url: "http://${geoserver_url}/geoserver/rest/workspaces/${workspace_name}/datastores/${store_name}/featuretypes/${layer_name}.json
 */
@Test()
public void b_readFeatureType() throws Exception {
    GeoserverLoadFeatureTypeWithUrlRequest geoserverLoadFeatureTypeWithUrlRequest = this.geoserverConnectorStore.loadFeatureTypeWithUrl().withUrl("http://150.145.141.180/geoserver/rest/workspaces/tiger/datastores/nyc/featuretypes/poi.json");
    GPGeoserverFeatureTypeInfo gpGeoserverFeatureTypeInfo = geoserverLoadFeatureTypeWithUrlRequest.getResponse();
    logger.info("########################ATTRIBUTES {}\n", gpGeoserverFeatureTypeInfo.getAttributes());
    List<LayerAttribute> result = gpGeoserverFeatureTypeInfo.getAttributes().getValues().stream().map(att -> new LayerAttribute(att.getName(), att.getBinding())).collect(Collectors.toList());
    logger.info("########################RESULT {}\n", result);
}
Also used : Logger(org.slf4j.Logger) SortedSet(java.util.SortedSet) GPGeoserverFeatureTypeCategory(org.geosdi.geoplatform.connector.geoserver.model.featuretypes.category.GPGeoserverFeatureTypeCategory) LoggerFactory(org.slf4j.LoggerFactory) Test(org.junit.Test) GPGeoserverFeatureTypes(org.geosdi.geoplatform.connector.geoserver.model.featuretypes.configured.GPGeoserverFeatureTypes) GeoserverLoadFeatureTypeWithUrlRequest(org.geosdi.geoplatform.connector.geoserver.request.featuretypes.GeoserverLoadFeatureTypeWithUrlRequest) RESTFeatureTypeList(it.geosolutions.geoserver.rest.decoder.RESTFeatureTypeList) Collectors(java.util.stream.Collectors) NameLinkElem(it.geosolutions.geoserver.rest.decoder.utils.NameLinkElem) TreeSet(java.util.TreeSet) List(java.util.List) GPGeoserverFeatureTypeWrapper(org.geosdi.geoplatform.connector.geoserver.model.featuretypes.wrapper.GPGeoserverFeatureTypeWrapper) GPGeoserverFeatureTypeInfo(org.geosdi.geoplatform.connector.geoserver.model.featuretypes.GPGeoserverFeatureTypeInfo) LayerAttribute(org.geosdi.geoplatform.responce.LayerAttribute) GeoserverConnectorTest(org.geosdi.geoplatform.geoserver.GeoserverConnectorTest) GeoserverLoadFeatureTypeWithUrlRequest(org.geosdi.geoplatform.connector.geoserver.request.featuretypes.GeoserverLoadFeatureTypeWithUrlRequest) LayerAttribute(org.geosdi.geoplatform.responce.LayerAttribute) GPGeoserverFeatureTypeInfo(org.geosdi.geoplatform.connector.geoserver.model.featuretypes.GPGeoserverFeatureTypeInfo) Test(org.junit.Test) GeoserverConnectorTest(org.geosdi.geoplatform.geoserver.GeoserverConnectorTest)

Aggregations

LayerAttribute (org.geosdi.geoplatform.responce.LayerAttribute)4 ResourceNotFoundFault (org.geosdi.geoplatform.exception.ResourceNotFoundFault)3 GeoPlatformException (org.geosdi.geoplatform.gui.global.GeoPlatformException)3 GPLayerAttributes (org.geosdi.geoplatform.gui.model.tree.GPLayerAttributes)3 FilterDescribeFeatureResponse (org.geosdi.geoplatform.gui.client.command.filter.basic.FilterDescribeFeatureResponse)2 RESTFeatureTypeList (it.geosolutions.geoserver.rest.decoder.RESTFeatureTypeList)1 NameLinkElem (it.geosolutions.geoserver.rest.decoder.utils.NameLinkElem)1 List (java.util.List)1 SortedSet (java.util.SortedSet)1 TreeSet (java.util.TreeSet)1 Collectors (java.util.stream.Collectors)1 GPGeoserverFeatureTypeInfo (org.geosdi.geoplatform.connector.geoserver.model.featuretypes.GPGeoserverFeatureTypeInfo)1 GPGeoserverFeatureTypeCategory (org.geosdi.geoplatform.connector.geoserver.model.featuretypes.category.GPGeoserverFeatureTypeCategory)1 GPGeoserverFeatureTypes (org.geosdi.geoplatform.connector.geoserver.model.featuretypes.configured.GPGeoserverFeatureTypes)1 GPGeoserverFeatureTypeWrapper (org.geosdi.geoplatform.connector.geoserver.model.featuretypes.wrapper.GPGeoserverFeatureTypeWrapper)1 GeoserverLoadFeatureTypeWithUrlRequest (org.geosdi.geoplatform.connector.geoserver.request.featuretypes.GeoserverLoadFeatureTypeWithUrlRequest)1 GeoserverConnectorTest (org.geosdi.geoplatform.geoserver.GeoserverConnectorTest)1 Test (org.junit.Test)1 Logger (org.slf4j.Logger)1 LoggerFactory (org.slf4j.LoggerFactory)1