예제 #1
0
  /**
   * get all the existing elements
   *
   * @param pleles
   * @param plele
   * @param paths
   * @param path
   */
  private void collectionPaths(
      paloelements pleles, paloelement plele, List<List> paths, List<String> path) {

    int[] childIDs = plele.getElementChildren();
    int i = 0;
    List<String> tempPath = null;
    if (plele.hasChildren()) {
      tempPath = new ArrayList<String>();
      for (String s : path) {
        tempPath.add(s);
      }
    }
    if (childIDs != null) {
      for (long id : childIDs) {
        paloelement child = pleles.getElementByIdentifier(id);
        List copyPath = null;
        if (i != 0) {
          copyPath = new ArrayList<String>();
          for (String s : tempPath) {
            copyPath.add(s);
          }
          paths.add(copyPath);
          copyPath.add(child.getName());
          collectionPaths(pleles, child, paths, copyPath);
        } else {
          path.add(child.getName());
          collectionPaths(pleles, child, paths, path);
        }
        i++;
      }
    }
  }
예제 #2
0
 /**
  * get all existing elements and pass for the addMainInToTransformList() method
  *
  * @param pleles
  * @return
  * @throws paloexception
  */
 public void getAllExistPaloDimensionElements(paloelements pleles) throws paloexception {
   maxDepthElement(pleles);
   // List<String> sr = new ArrayList<String>();
   String[] arr = null;
   paths = new HashMap<String, List<List>>();
   for (paloelement plElm : pleles.getElements()) {
     // if element has no parent it means it's root element
     if (plElm.getElementParents() == null) {
       List elementPaths = new ArrayList<List>();
       List path = new ArrayList<String>();
       elementPaths.add(path);
       path.add(plElm.getName());
       paths.put(plElm.getName(), elementPaths);
       collectionPaths(pleles, plElm, elementPaths, path);
     }
   }
   for (String key : paths.keySet()) {
     List<List> elementPaths = paths.get(key);
     for (List<String> path : elementPaths) {
       arr = new String[maxDepth];
       for (int i = 0; i < path.size(); i++) {
         arr[i] = path.get(i);
       }
       addMainInToTransformList(arr);
     }
   }
 }