コード例 #1
0
 @Override
 public void deleteContent(CopyToEnvironmentItem item) {
   PersistenceManagerService persistenceManagerService =
       _servicesManager.getService(PersistenceManagerService.class);
   String fullPath =
       SITE_ENVIRONMENT_ROOT_PATTERN.replaceAll(SITE_REPLACEMENT_PATTERN, item.getSite());
   fullPath = fullPath.replaceAll(ENVIRONMENT_REPLACEMENT_PATTERN, WORK_AREA_REPOSITORY);
   fullPath = fullPath + item.getPath();
   NodeRef nodeRef = persistenceManagerService.getNodeRef(fullPath);
   if (nodeRef != null) {
     // _dmContentService.deleteContent(site, path, true, true, null);
     // return;
     List<String> paths = new ArrayList<String>();
     paths.add(item.getPath());
     _dmContentService.generateDeleteActivity(item.getSite(), paths, item.getUser());
     NodeRef parentNode = persistenceManagerService.getPrimaryParent(nodeRef).getParentRef();
     persistenceManagerService.deleteNode(nodeRef);
     persistenceManagerService.deleteObjectState(nodeRef.getId());
     List<FileInfo> children = persistenceManagerService.list(parentNode);
     while (children == null || children.size() < 1) {
       NodeRef helpNode = parentNode;
       parentNode = persistenceManagerService.getPrimaryParent(helpNode).getParentRef();
       persistenceManagerService.deleteNode(helpNode);
       children = persistenceManagerService.list(parentNode);
     }
   }
 }
コード例 #2
0
 @Override
 public void deleteContent(String site, String environment, String path) {
   PersistenceManagerService persistenceManagerService =
       _servicesManager.getService(PersistenceManagerService.class);
   String fullPath = SITE_ENVIRONMENT_ROOT_PATTERN.replaceAll(SITE_REPLACEMENT_PATTERN, site);
   fullPath = fullPath.replaceAll(ENVIRONMENT_REPLACEMENT_PATTERN, environment);
   fullPath = fullPath + path;
   NodeRef nodeRef = persistenceManagerService.getNodeRef(fullPath);
   if (nodeRef != null) {
     NodeRef parentNode = persistenceManagerService.getPrimaryParent(nodeRef).getParentRef();
     persistenceManagerService.deleteNode(nodeRef);
     List<FileInfo> children = persistenceManagerService.list(parentNode);
     while (children == null || children.size() < 1) {
       NodeRef helpNode = parentNode;
       parentNode = persistenceManagerService.getPrimaryParent(helpNode).getParentRef();
       persistenceManagerService.deleteNode(helpNode);
       children = persistenceManagerService.list(parentNode);
     }
   }
 }