Package com.agiletec.plugins.jacms.aps.system.services.resource.model

Examples of com.agiletec.plugins.jacms.aps.system.services.resource.model.ResourceInstance


        if (resource.isMultiInstance()) {
          AbstractMultiInstanceResource multiResource = (AbstractMultiInstanceResource) resource;
          Map<String, ResourceInstance> instancesMap = multiResource.getInstances();
          Iterator<ResourceInstance> iter = instancesMap.values().iterator();
          while (iter.hasNext()) {
            ResourceInstance resourceInstance = iter.next();
            String path = folder + resourceInstance.getFileName();
            //System.out.println("source " + path);
            InputStream is = this.getStorageManager().getStream(path, true);
            if (is != null) {
              String pathDest = folderDest + resourceInstance.getFileName();
              //System.out.println("destination " + pathDest);
              this.getStorageManager().saveFile(pathDest, isProtected, is);
            }
          }
        } else {
          AbstractMonoInstanceResource monoResource = (AbstractMonoInstanceResource) resource;
          ResourceInstance resourceInstance = monoResource.getInstance();
          String path = folder + resourceInstance.getFileName();
          //System.out.println("source " + path);
          InputStream is = this.getStorageManager().getStream(path, true);
          if (null != is) {
            String pathDest = folderDest + resourceInstance.getFileName();
            //System.out.println("destination " + pathDest);
            this.getStorageManager().saveFile(pathDest, isProtected, is);
          }
        }
          this.getResourceDAO().addResource(resource);
View Full Code Here


      if (resource.isMultiInstance()) {
        AbstractMultiInstanceResource multiResource = (AbstractMultiInstanceResource) resource;
        Map<String, ResourceInstance> instancesMap = multiResource.getInstances();
        Iterator<ResourceInstance> iter = instancesMap.values().iterator();
        while (iter.hasNext()) {
          ResourceInstance resourceInstance = iter.next();
          String path = folder + resourceInstance.getFileName();
          this.getStorageManager().deleteFile(path, true);
        }
      } else {
        AbstractMonoInstanceResource monoResource = (AbstractMonoInstanceResource) resource;
        ResourceInstance resourceInstance = monoResource.getInstance();
        String path = folder + resourceInstance.getFileName();
        this.getStorageManager().deleteFile(path, true);
      }
      //}
      this.getTrashedResourceDAO().delTrashedResource(resource.getId());
    } catch (Throwable t) {
View Full Code Here

      if (resource.isMultiInstance()) {
        AbstractMultiInstanceResource multiResource = (AbstractMultiInstanceResource) resource;
        Map<String, ResourceInstance> instancesMap = multiResource.getInstances();
        Iterator<ResourceInstance> iter = instancesMap.values().iterator();
        while (iter.hasNext()) {
          ResourceInstance resourceInstance = iter.next();
          InputStream is = resource.getResourceStream(resourceInstance);
          if (null != is) {
            String path = folder + resourceInstance.getFileName();
            paths.add(path);
            this.getStorageManager().saveFile(path, true, is);
          }
        }
      } else {
        AbstractMonoInstanceResource monoResource = (AbstractMonoInstanceResource) resource;
        ResourceInstance resourceInstance = monoResource.getInstance();
        InputStream is = resource.getResourceStream(resourceInstance);
        if (null != is) {
          String path = folder + resourceInstance.getFileName();
          paths.add(path);
          this.getStorageManager().saveFile(path, true, is);
        }
      }
      this.getTrashedResourceDAO().addTrashedResource(resource);
View Full Code Here

      UserDetails currentUser = this.getCurrentUser();
      if (!this.getAuthManager().isAuthOnGroup(currentUser, mainGroup)) {
        return null;
      }
      int size = Integer.parseInt(this.getSize());
      ResourceInstance instance = null;
      //String path = null;
      if (resource.isMultiInstance()) {
        instance = ((AbstractMultiInstanceResource) resource).getInstance(size, getLangCode());
        //Map<String,String> trashPathsForInstances = getTrashedResourceManager().resourceInstancesTrashFilePaths(resource);
        //path = trashPathsForInstances.get(this.getSize());
      } else {
        instance = ((AbstractMonoInstanceResource) resource).getInstance();
        //Map<String,String> trashPathsForInstances = getTrashedResourceManager().resourceInstancesTrashFilePaths(resource);
        //path = trashPathsForInstances.get("0");
      }
      documentInputStream = this.getTrashedResourceManager().getTrashFileStream(resource, instance);
      this.setContentType(instance.getMimeType());
      this.setNameFile(instance.getFileName());
      //File fileTemp = new File(path);
      //ApsSystemUtils.getLogger().info(" path " + fileTemp);
      //if (fileTemp.exists()) {
      //documentInputStream = new FileInputStream(fileTemp);
      //}
View Full Code Here

TOP

Related Classes of com.agiletec.plugins.jacms.aps.system.services.resource.model.ResourceInstance

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.