コード例 #1
0
ファイル: Container.java プロジェクト: cpnatwork/hydra_dev
 /**
  * Removes the deep sub element.
  *
  * @param element the element
  * @return true, if successful
  */
 private boolean removeDeepSubElement(final FingerprintedElement element) {
   final File eFile = FileUtilities.findCanonicalLocation(element.cloneWorkspaceFile());
   final String[] splitPath =
       FileUtilities.findSubPath(this.workspaceFile, eFile).substring(1).split("\\\\|\\/");
   Container ptr = this;
   for (int i = 0; i < (splitPath.length - 1); i++) {
     ptr = (Container) ptr.getElement(splitPath[i]);
     if (ptr == null) return false;
   }
   return ptr.removeElement(element);
 }
コード例 #2
0
ファイル: Container.java プロジェクト: cpnatwork/hydra_dev
 /**
  * Adds the deep sub element.
  *
  * @param element the element
  * @return true, if successful
  */
 private boolean addDeepSubElement(final FingerprintedElement element) {
   final String SEPARATOR = File.separator;
   final File eFile = FileUtilities.findCanonicalLocation(element.cloneWorkspaceFile());
   final String[] splitPath =
       FileUtilities.findSubPath(this.workspaceFile, eFile).substring(1).split("\\\\|\\/");
   final StringBuilder sbPath = new StringBuilder(this.workspaceFile + SEPARATOR);
   Container ptr = this;
   for (int i = 0; i < (splitPath.length - 1); i++) {
     if (!splitPath[i].equals("")) {
       sbPath.append(splitPath[i] + SEPARATOR);
       if (ptr.getElement(splitPath[i]) == null) {
         try {
           ptr.addElement(new Container(new File(sbPath.toString())));
         } catch (final Exception e) {
           this.logger.exception("Unable to Add Container [" + sbPath.toString() + "].", e);
           return false;
         }
       }
       ptr = (Container) ptr.getElement(splitPath[i]);
     }
   }
   return ptr.addElement(element);
 }