Search in sources :

Example 1 with AreaInfo

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

the class AreaInfoProvider method get.

@Override
public AreaInfo get() {
    AreaInfo areaInfo = new AreaInfo();
    areaInfo.setBBox(new BBox());
    return areaInfo;
}
Also used : BBox(org.geosdi.geoplatform.gui.shared.bean.BBox) AreaInfo(org.geosdi.geoplatform.gui.responce.AreaInfo)

Example 2 with AreaInfo

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

the class AreaSearchRequestFilter method processGetRecordsRequest.

/**
 * @param theRequest
 * @param theFilterType
 * @param theFilterPredicates
 * @throws IllegalParameterFault
 */
@Override
protected void processGetRecordsRequest(CatalogGetRecordsRequest theRequest, FilterType theFilterType, List<JAXBElement<?>> theFilterPredicates) throws IllegalParameterFault {
    logger.debug("#####################Called {}#processGetRecordsRequest", this);
    AreaInfo areaInfo = theRequest.getCatalogFinder().getAreaInfo();
    if (areaInfo != null && areaInfo.isActive()) {
        AreaSearchType areaSearchType = areaInfo.getAreaSearchType();
        BBox bbox = areaInfo.getBBox();
        logger.debug("############################ Search Type: {}.\n", areaSearchType);
        logger.debug("############################ Bbox : {}.\n", bbox);
        List<JAXBElement<?>> areaPredicate = this.createFilterAreaPredicate(areaSearchType, bbox);
        logger.trace("\n############################ Time filter: \"{}\"\n.", areaPredicate);
        theFilterPredicates.addAll(areaPredicate);
    }
}
Also used : BBox(org.geosdi.geoplatform.gui.shared.bean.BBox) JAXBElement(javax.xml.bind.JAXBElement) AreaInfo(org.geosdi.geoplatform.gui.responce.AreaInfo) AreaSearchType(org.geosdi.geoplatform.gui.responce.AreaInfo.AreaSearchType)

Example 3 with AreaInfo

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

the class AreaSearchRequestCQL method processGetRecordsRequest.

/**
 * @param request
 * @throws IllegalParameterFault
 */
@Override
protected void processGetRecordsRequest(@Nonnull(when = NEVER) CatalogGetRecordsRequest request) throws IllegalParameterFault {
    checkArgument(request != null, "The Parameter request must not be null.");
    logger.debug("##########################Called {}#processGetRecordsRequest\n", this);
    AreaInfo areaInfo = request.getCatalogFinder().getAreaInfo();
    if (areaInfo != null && areaInfo.isActive()) {
        AreaSearchType areaSearchType = areaInfo.getAreaSearchType();
        BBox bbox = areaInfo.getBBox();
        logger.debug("###################### Search Type: {}\n", areaSearchType);
        logger.debug("###################### BBOX : {}\n", bbox);
        String areaConstraint = this.createCQLAreaPredicate(areaSearchType, bbox);
        logger.trace("###################### Area CQL constraint: \"{}\"\n", areaConstraint);
        super.addCQLConstraint(request, areaConstraint);
    }
}
Also used : BBox(org.geosdi.geoplatform.gui.shared.bean.BBox) AreaInfo(org.geosdi.geoplatform.gui.responce.AreaInfo) AreaSearchType(org.geosdi.geoplatform.gui.responce.AreaInfo.AreaSearchType)

Example 4 with AreaInfo

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

the class CatalogGetRecordsTest method testGetRecordsOurCountAreaItaly.

@Test
public void testGetRecordsOurCountAreaItaly() throws Exception {
    GPCatalogConnectorStore internalServer = newConnector().withServerUrl(new URL("http://catalog.geosdi.org:80/geonetwork/srv/eng/csw")).build();
    CatalogFinderBean catalogFinder = new CatalogFinderBean();
    AreaInfo areaInfo = new AreaInfo();
    areaInfo.setActive(true);
    BBox bBoxItaly = new BBox(6.624, 36.6492, 18.5144, 47.0946);
    areaInfo.setBBox(bBoxItaly);
    areaInfo.setAreaSearchType(OVERLAP);
    catalogFinder.setAreaInfo(areaInfo);
    CatalogGetRecordsRequest<GetRecordsResponseType> request = internalServer.createGetRecordsRequest();
    request.setTypeName(RECORD_V202);
    request.setOutputSchema(CSW_V202);
    request.setElementSetName(ElementSetType.BRIEF.value());
    request.setResultType(ResultType.HITS.value());
    request.setConstraintLanguage(FILTER);
    request.setConstraintLanguageVersion(V110);
    request.setCatalogFinder(catalogFinder);
    logger.info("###########################RESPONSE : \n{}\n", request.getResponseAsString());
}
Also used : BBox(org.geosdi.geoplatform.gui.shared.bean.BBox) CatalogFinderBean(org.geosdi.geoplatform.gui.responce.CatalogFinderBean) URL(java.net.URL) AreaInfo(org.geosdi.geoplatform.gui.responce.AreaInfo) Test(org.junit.Test)

Example 5 with AreaInfo

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

the class CSWCatalogRecordTest method testGetRecordsOurCountAreaItaly.

@Test
public void testGetRecordsOurCountAreaItaly() throws Exception {
    int tot = cswService.getRecordsCount(catalogFinder);
    // assertEquals(595, tot);
    AreaInfo areaInfo = catalogFinder.getAreaInfo();
    areaInfo.setActive(true);
    BBox bBoxItaly = new BBox(6.624, 36.6492, 18.5144, 47.0946);
    areaInfo.setBBox(bBoxItaly);
    areaInfo.setAreaSearchType(AreaInfo.AreaSearchType.ENCLOSES);
    int countEncloses = cswService.getRecordsCount(catalogFinder);
    // assertEquals(24, countEncloses);
    areaInfo.setAreaSearchType(AreaInfo.AreaSearchType.IS);
    int countIs = cswService.getRecordsCount(catalogFinder);
    // assertEquals(0, countIs);
    areaInfo.setAreaSearchType(AreaInfo.AreaSearchType.OUTSIDE);
    int countOutside = cswService.getRecordsCount(catalogFinder);
    // assertEquals(39, countOutside);
    areaInfo.setAreaSearchType(AreaInfo.AreaSearchType.OVERLAP);
    int countOverlap = cswService.getRecordsCount(catalogFinder);
    // assertEquals(543, countOverlap);
    logger.info("################ TOT: {}\nENCLOSES: {}\nIS: {}\nOUTSIDE {}\nOVERLAP {}", tot, countEncloses, countIs, countOutside, countOverlap);
}
Also used : BBox(org.geosdi.geoplatform.gui.shared.bean.BBox) AreaInfo(org.geosdi.geoplatform.gui.responce.AreaInfo) Test(org.junit.Test)

Aggregations

AreaInfo (org.geosdi.geoplatform.gui.responce.AreaInfo)6 BBox (org.geosdi.geoplatform.gui.shared.bean.BBox)5 AreaSearchType (org.geosdi.geoplatform.gui.responce.AreaInfo.AreaSearchType)2 CatalogFinderBean (org.geosdi.geoplatform.gui.responce.CatalogFinderBean)2 Test (org.junit.Test)2 URL (java.net.URL)1 JAXBElement (javax.xml.bind.JAXBElement)1 GPOrganization (org.geosdi.geoplatform.core.model.GPOrganization)1 TextInfo (org.geosdi.geoplatform.gui.responce.TextInfo)1 TimeInfo (org.geosdi.geoplatform.gui.responce.TimeInfo)1 Before (org.junit.Before)1