Examples of RestResource


Examples of com.eviware.soapui.impl.rest.RestResource

    super( messages.get( "title" ), messages.get( "description" ) );
  }

  protected RestResource createRestResource( RestService service, String path, XFormDialog dialog )
  {
    RestResource possibleParent = null;
    String p = service.getBasePath() + path;

    for( RestResource resource : service.getAllResources() )
    {
      if( p.startsWith( resource.getFullPath() ) )
      {
        int c = 0;
        for( ; c < resource.getChildResourceCount(); c++ )
        {
          if( p.startsWith( resource.getChildResourceAt( c ).getFullPath() ) )
            break;
        }

        // found subresource?
        if( c != resource.getChildResourceCount() )
          continue;

        possibleParent = resource;
        break;
      }
    }

    RestResource resource;

    if( possibleParent != null
        && UISupport.confirm( "Create resource as child to [" + possibleParent.getName() + "]",
            "New Child Resource" ) )
    {
View Full Code Here

Examples of com.eviware.soapui.impl.rest.RestResource

      }
      catch( MalformedURLException e )
      {
      }

      RestResource resource = createRestResource( service, path, dialog );
      paramsTable.extractParams( resource.getParams(), ParamLocation.RESOURCE );

      // RestMethod method = createRestMethod(resource, dialog);
      // paramsTable.extractParams(method.getParams(), ParamLocation.METHOD);

      // UISupport.select(method);
View Full Code Here

Examples of com.eviware.soapui.impl.rest.RestResource

  }

  private DefinitionContext<?> getWadlContext( RestMessageExchange messageExchange, SubmitContext context )
      throws Exception
  {
    RestResource operation = messageExchange.getResource();
    RestService service = operation.getService();
    if( StringUtils.isNullOrEmpty( definition )
        || definition.equals( PathUtils.expandPath( service.getDefinition(), service, context ) ) )
    {
      definitionContext = service.getWadlContext();
      ( ( WadlDefinitionContext )definitionContext ).loadIfNecessary();
View Full Code Here

Examples of com.eviware.soapui.impl.rest.RestResource

    getRequestStepConfig().setService( method.getInterface().getName() );
    getRequestStepConfig().setResourcePath( method.getResource().getFullPath() );
    getRequestStepConfig().setMethodName( method.getName() );

    // new resource?
    RestResource res = findRestResource();
    if( res != getResource() )
    {
      restResource.removePropertyChangeListener( this );
      restResource.getService().removeInterfaceListener( interfaceListener );
      restResource.getService().removePropertyChangeListener( this );
View Full Code Here

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

     *
     * @param resource the source Resource
     * @return
     */
    public static RESTResource copyResource(Resource resource) {
        RESTResource ret = new RESTResource();
        ret.setName(resource.getName());
        ret.setDescription(resource.getDescription());
        ret.setMetadata(resource.getMetadata());
        if(resource.getData() != null)
            ret.setData(resource.getData().getData());
        ret.setCategory(new RESTCategory(resource.getCategory().getName()));
        copyResourceAttribs(resource, ret);
        return ret;
    }
View Full Code Here

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

        //=== COPY LAYER

        Resource dstLayer = dstGeostore.searchLayer(layerName);
        if( dstLayer == null) {
            LOGGER.info("Copying Layer into destination: " + srcLayer);
            RESTResource layer = FlowUtil.copyResource(srcLayer);
            dstGeostore.insert(layer);
        }

        //==================================================
        //=== LAYERUPDATE
        //===
        //=== Insert LayerUpdate if it does not exist

        Resource srcLayerUpdate = srcGeostore.searchLayerUpdate(layerName, year, month, day);
        if (srcLayerUpdate == null) {
            throw new ActionException(this, "Source LayerUpdate not found [layer:" + layerName + " year:" + year + " month:" + month + "]");
        }

        //=== COPY LAYERUPDATE

        Resource dstLayerUpdate = dstGeostore.searchLayerUpdate(layerName, year, month, day);
        if ( dstLayerUpdate == null ) {
            LOGGER.info("Copying LayerUpdate " + layerName+":"+year+":"+month);

            RESTResource layerUpdate = FlowUtil.copyResource(srcLayerUpdate);
            dstGeostore.insert(layerUpdate);
        }

        //==================================================
        //=== STATS
        //===
        //=== loop on all the statistics associated with the layer

        Map<Long, Resource> srcChartScripts = new HashMap<Long, Resource>();

        List<ShortResource> statsDefList = srcGeostore.searchStatsDefByLayer(layerName, true); // may be empty, is always not null

        for (ShortResource statDef : statsDefList) {
            String statsDefName = statDef.getName();
            LOGGER.info("Found stats def :" + statsDefName);

            //=== OVERWRITE STATSDEF

            Resource dstStatsDef = dstGeostore.searchStatsDefByName(statsDefName);
            if(dstStatsDef != null) {
                LOGGER.info("Removing previous StatsDef " + statsDefName);
                dstGeostore.delete(dstStatsDef.getId());
            }

            LOGGER.info("Copying StatsDef " + statsDefName);
            Resource srcStatsDef = srcGeostore.searchStatsDefByName(statsDefName);
            RESTResource statsDef = FlowUtil.copyResource(srcStatsDef);
            dstGeostore.insert(statsDef);

            //=== OVERWRITE STATSDATA

            Resource dstStatsData = dstGeostore.searchStatsData(statsDefName, year, month, day);
            if(dstStatsData != null) {
                LOGGER.info("Removing previous StatsData [statsdef:"+statsDefName+" year:"+year+" month:"+month+"]");
                dstGeostore.delete(dstStatsData.getId());
            }

            Resource srcStatsData = srcGeostore.searchStatsData(statsDefName, year, month, day);
            if (srcStatsData == null) {
                LOGGER.warn("No StatsData found for [statsdef:"+statsDefName+" year:"+year+" month:"+month+"]");
            } else {
                LOGGER.info("Copying StatsData " + srcStatsData.getName());
                RESTResource statsData = FlowUtil.copyResource(srcStatsData);
                dstGeostore.insert(statsData);
               
                // Add attribute Published=true to srcGeostore, usefull for staging admin application
              LOGGER.info("Adding attribute published=true to resource " + srcStatsData.getName());
              RESTResource statsDataTmp = FlowUtil.copyResource(srcStatsData);
              ShortAttribute published = new ShortAttribute(UNREDDLayerUpdate.Attributes.PUBLISHED.getName(), "true", DataType.STRING);
             
              //DamianoG workaround for search in list due to ShortAttribute don't override equals method
              boolean flag = true;
              for(ShortAttribute el : statsDataTmp.getAttribute()){
                if(el.toString().equals(published.toString())){
                  flag = false;
                  break;
                }
              }
             
            //if(!statsDataTmp.getAttribute().contains(published)){
              if(flag){
                List<ShortAttribute> l = new ArrayList<ShortAttribute>();
                l.add(published);
                l.addAll(statsDataTmp.getAttribute());
                statsDataTmp.setAttribute(l);
                srcGeostore.delete(srcStatsData.getId());
                srcGeostore.insert(statsDataTmp);
              }
            }

            // Collect dependant chartscript to be copied
            List<Resource> csList = srcGeostore.searchChartScriptByStatsDef(statsDefName);
            for (Resource cs : csList) {
                LOGGER.info("Collecting ChartScript: adding " + cs.getName());
                srcChartScripts.put(cs.getId(), cs);
            }
          
           
        }

        //==================================================
        //=== CHARTS
        //===
        //=== loop on all the collected charts

        for (Resource srcChartScript : srcChartScripts.values()) {
            String chartScriptName = srcChartScript.getName();
            LOGGER.info("Removing previous charts stuff: " + chartScriptName);

            //== remove chartScript
            Resource dstChartScript = dstGeostore.searchChartScript(chartScriptName);
            if(dstChartScript != null) {
                LOGGER.info("Removing previous ChartScript :"+ chartScriptName);
                dstGeostore.delete(dstChartScript.getId());
            }

            //== remove chartData
            List<ShortResource> dstChartDataList = dstGeostore.searchChartDataByChartScript(chartScriptName);
            for (ShortResource dstChartData : dstChartDataList) {
                LOGGER.info("Removing previous ChartData :"+ dstChartData.getName() + " [cscript:" + chartScriptName+ ']');
                dstGeostore.delete(dstChartData.getId());
            }

            //== Insert chartScript
            LOGGER.info("Copying ChartScript " + chartScriptName);
            RESTResource chartScript = FlowUtil.copyResource(srcChartScript);
            dstGeostore.insert(chartScript);

            //DamianoG commented due to chartData must be recalculated not copyed from staging
            //== Insert chartData
//            List<Resource> srcChartDataList = srcGeostore.searchChartDataPublished(chartScriptName);
View Full Code Here

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

    @Ignore
    public void testBadFormat() throws GeoStoreException, FlowException, ActionException {
        clearPlayfield();
        UNREDDLayer layer = buildRasterLayer();
        layer.setAttribute(UNREDDLayer.Attributes.LAYERTYPE, UNREDDFormat.VECTOR.getName());
        RESTResource layerResource = layer.createRESTResource();
        layerResource.setName("layer1");
        gstcu.insert(layerResource);

        //=== Data is set, prepare flow
        LOGGER.info("===== Run the code!");
        File inputFile = loadFile("context/Request.zip");
View Full Code Here

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

    @Ignore
    public void testBadSize() throws GeoStoreException, FlowException, ActionException {
        clearPlayfield();
        UNREDDLayer layer = buildRasterLayer();
        layer.setAttribute(UNREDDLayer.Attributes.RASTERPIXELWIDTH, "42");
        RESTResource layerResource = layer.createRESTResource();
        layerResource.setName("layer1");
        gstcu.insert(layerResource);

        //=== Data is set, prepare flow
        LOGGER.info("===== Run the code!");
        File inputFile = loadFile("context/Request.zip");
View Full Code Here

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

    @Test
    @Ignore
    public void testBadExistingLayerUpdate() throws GeoStoreException, FlowException, ActionException {
        clearPlayfield();
        UNREDDLayer layer = buildRasterLayer();
        RESTResource layerResource = layer.createRESTResource();
        layerResource.setName("layer1");
        gstcu.insert(layerResource);

        UNREDDLayerUpdate layerUpdate = new UNREDDLayerUpdate();
        layerUpdate.setAttribute(Attributes.YEAR, "2012");
        layerUpdate.setAttribute(Attributes.LAYER, "layer1");
        RESTResource luResource = layerUpdate.createRESTResource();
        luResource.setName(NameUtils.buildLayerUpdateName("layer1", "2012", null, null));
        gstcu.insert(luResource);

        //=== Data is set, prepare flow
        LOGGER.info("===== Run the code!");
        File inputFile = loadFile("context/Request.zip");
View Full Code Here

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

    @Test
    public void testProperIngestRaster() throws GeoStoreException, FlowException, ActionException {

        clearPlayfield();
        UNREDDLayer layer = buildRasterLayer();
        RESTResource layerResource = layer.createRESTResource();
        layerResource.setName("layer1");
        gstcu.insert(layerResource);
       
        //=== Data is set, prepare flow
        LOGGER.info("===== Run the code!");
        File inputFile = loadFile("context/Request.zip");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.