Package it.geosolutions.geostore.services.rest.model

Examples of it.geosolutions.geostore.services.rest.model.ShortResourceList


    protected File doSearch(File file) throws JAXBException, IOException,ConnectException {
        boolean isShortResourceList = conf.isShortResource();
        //read searchFilter from passed file
        SearchFilter searchFilter = (SearchFilter) unmarshaller.unmarshal(file);

        ShortResourceList list =  geostore.searchResources(searchFilter);
//        String  context = getRunningContext();
        File outputFile = File.createTempFile("gstsearch_", file.getName(), getTempDir());

        if (list==null || list.getList()==null || list.getList().isEmpty()) {
            return outputFile; // TODO: fixme: the file will be empty!
        }
        shortResourceList = list.getList();
        if (isShortResourceList) {
          Marshaller m = JAXBMarshallerBuilder.getJAXBMarshaller(list.getClass());
            m.marshal(list, outputFile);
        } else {
           
            for (ShortResource shortResource: shortResourceList) {
                if(LOGGER.isDebugEnabled())
View Full Code Here


        }

    }

    public void deleteAllResources(GeoStoreClient geostore) {
        ShortResourceList sres = geostore.searchResources(new FieldFilter(BaseField.NAME, "*", SearchOperator.IS_NOT_NULL));
        if( ! sres.isEmpty() ) {
            LOGGER.info("DeleteAll: deleting " + sres.getList().size() + " resources");
            for (ShortResource shortResource : sres.getList()) {
                LOGGER.info("DeleteAll: deleting resource #"+shortResource.getId()+ " " + shortResource.getName());
                geostore.deleteResource(shortResource.getId());
            }
        }
    }
View Full Code Here

     * @return always a not null list
     */
    @Override
    protected List search(SearchFilter filter, boolean getShortResource) throws GeoStoreException {
        try{
            ShortResourceList srl = geoStoreClient.searchResources(filter);
            if(srl == null || srl.getList() == null)
                return Collections.EMPTY_LIST;

            if(getShortResource) {
                return srl.getList();
            } else {
                List<Resource> ret = new ArrayList<Resource>(srl.getList().size());
                for (ShortResource shortResource : srl.getList()) {
                    Resource r = geoStoreClient.getResource(shortResource.getId());
                    String data = geoStoreClient.getData(shortResource.getId());
                    StoredData sdata = new StoredData();
                    sdata.setData(data);
                    r.setData(sdata);
View Full Code Here

        Resource fullChartScript = gstcu.getGeoStoreClient().getResource(chartScriptId);

        // ok, some real testing now
        SearchFilter chartDataFilter = new CategoryFilter(UNREDDCategories.CHARTDATA.getName(), SearchOperator.EQUAL_TO);
//        ShortResourceList res0 = geostoreClient.searchResources(chartDataFilter);
        ShortResourceList res0 = gstcu.getGeoStoreClient().searchResources(chartDataFilter);
        assertTrue(res0.isEmpty());


        FlowUtil flowUtil = new FlowUtil(getTempDir(), getConfigDir());
        flowUtil.runScripts(getGeoStoreUtil(), Arrays.asList(fullChartScript));

        ShortResourceList res1 = gstcu.getGeoStoreClient().searchResources(chartDataFilter);
        assertEquals(5, res1.getList().size());
    }
View Full Code Here

        chartScriptRes.setName("testChartScript");
        gstcu.insert(chartScriptRes);
//        Resource fullChartScript = gstcu.getGeoStoreClient().getResource(chartScriptId);

        SearchFilter chartDataFilter = new CategoryFilter(UNREDDCategories.CHARTDATA.getName(), SearchOperator.EQUAL_TO);
        ShortResourceList res0 = gstcu.getGeoStoreClient().searchResources(chartDataFilter);
        assertTrue(res0.isEmpty());

        //---------------------
        // ok, some real testing now

        LOGGER.info("===== Run the code!");

        FlowUtil flowUtil = new FlowUtil(getTempDir(), getConfigDir());
        flowUtil.runStatsAndScripts(LAYERNAME, YEAR, MONTH, DAY, classFile, getGeoStoreUtil());

//---------------------
        LOGGER.info("===== Testing results");

        Resource loadedStatsData = gstcu.searchStatsData(STATSDEFNAME, YEAR, MONTH, DAY);
        assertNotNull("Could not reload StatsData", loadedStatsData);

        ShortResourceList res1 = gstcu.getGeoStoreClient().searchResources(chartDataFilter);
        assertNotNull(res1);
        assertNotNull(res1.getList());
        assertEquals(1, res1.getList().size());

    }
View Full Code Here

        RESTResource rs = UNREDDResourceBuilder.createStatsDataResource(statsdef, year, month, day, content);
        return geostoreClient1.insert(rs);
    }

    public static void deleteAllResources() {
        ShortResourceList sres = geostoreClient1.searchResources(new FieldFilter(BaseField.NAME, "*", SearchOperator.IS_NOT_NULL));
        if( ! sres.isEmpty() ) {
            LOGGER.info("DeleteAll: deleting " + sres.getList().size() + " resources");
            for (ShortResource shortResource : sres.getList()) {
                LOGGER.info("DeleteAll: deleting resource #"+shortResource.getId()+ " " + shortResource.getName());
                geostoreClient1.deleteResource(shortResource.getId());
            }
        }
    }
View Full Code Here

    }

    public static void deleteResources(UNREDDCategories cat) {
        LOGGER.info("Removing all resources in category " + cat);
        SearchFilter  filter = new CategoryFilter(cat.getName(), SearchOperator.EQUAL_TO);
        ShortResourceList sres = geostoreClient1.searchResources(filter);
        if( ! sres.isEmpty() ) {
            LOGGER.info("Deleting " + sres.getList().size() + " resources");
            for (ShortResource shortResource : sres.getList()) {
                LOGGER.info("Deleting resource #"+shortResource.getId()+ " " + shortResource.getName());
                geostoreClient1.deleteResource(shortResource.getId());
            }
        }
    }
View Full Code Here

//        Resource fullChartScript = gstcu.getGeoStoreClient().getResource(chartScriptId);

        // ok, some real testing now
        SearchFilter chartDataFilter = new CategoryFilter(UNREDDCategories.CHARTDATA.getName(), SearchOperator.EQUAL_TO);

        ShortResourceList res0 = gstcu.getGeoStoreClient().searchResources(chartDataFilter);
        assertTrue(res0.isEmpty());

        LOGGER.info("--------------- Data setup complete-- running real test ----------");
        //=== Data is set, prepare flow
        File inputFile = loadFile("reprocess/reprocessChart.xml");
        SingleFileActionExecutor.execute(reprocessAction, inputFile);
       
        ShortResourceList res1 = gstcu.getGeoStoreClient().searchResources(chartDataFilter);
        assertEquals(5, res1.getList().size());
    }
View Full Code Here

        //=== Check outcome
        SearchFilter chartDataFilter = new CategoryFilter(UNREDDCategories.CHARTDATA.getName(), SearchOperator.EQUAL_TO);
        SearchFilter layerUpdateFilter = new CategoryFilter(UNREDDCategories.LAYERUPDATE.getName(), SearchOperator.EQUAL_TO);

        ShortResourceList luList = gstcu.getGeoStoreClient().searchResources(layerUpdateFilter);
        assertEquals("Bad layerupdate #", 1, luList.getList().size());
        assertEquals(LAYERNAME+"_2010", luList.getList().get(0).getName());

        ShortResourceList cdList = gstcu.getGeoStoreClient().searchResources(chartDataFilter);
        assertEquals("Bad layerupdate #", 1, cdList.getList().size());
    }
View Full Code Here

TOP

Related Classes of it.geosolutions.geostore.services.rest.model.ShortResourceList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.