private tPaloDimensionElements getDimenionElement(String strName) {
   tPaloDimensionElements rctPaloDimensionElements = null;
   for (tPaloDimensionElements tParentDimensionElement : lstPaloDimensionElements) {
     if (tParentDimensionElement.getElementName().equals(strName)) {
       rctPaloDimensionElements = tParentDimensionElement;
     }
   }
   return rctPaloDimensionElements;
 }
  public void buildParentChildRelationShipNormal() {

    int iPosition = 0;
    for (String[] strMainIn : lstTalendMainIn) {
      for (int i = 0; i < strMainIn.length; i++) {
        boolean bElemenExists = false;
        // Check if Dimension Element allready Exists
        for (tPaloDimensionElements tDimensionElement : lstPaloDimensionElements) {
          if (tDimensionElement.getElementName() != null
              && tDimensionElement.getElementName().equals(strMainIn[i])) {
            bElemenExists = true;
            break;
          }
        }
        // if(!bElemenExists){
        int iParentPosition = -1;
        // Get ParentPosision
        if (i > 0) {
          for (tPaloDimensionElements tParentDimensionElement : lstPaloDimensionElements) {
            if (tParentDimensionElement.getElementName() != null
                && tParentDimensionElement.getElementName().equals(strMainIn[i - 1])) {
              iParentPosition = tParentDimensionElement.getPosition();
              break;
            }
          }
        }
        tPaloDimensionElements tDimensionElement =
            new tPaloDimensionElements(iPosition, strMainIn[i], iParentPosition, i);
        lstPaloDimensionElements.add(tDimensionElement);
        iPosition++;
        // }
      }
    }
  }
  public void buildConsolidationNormal(
      paloelements paloElements, String strElementName, int iParentPosition) throws paloexception {

    boolean bConsolidationElementsFound = false;
    paloconsolidations paloCons = new paloconsolidations();

    for (tPaloDimensionElements tConsElement : lstPaloDimensionElements) {
      if (tConsElement.getParentPosition() == iParentPosition
          && tConsElement.getElementName() != null
          && !tConsElement.getElementName().equals(strElementName)) {
        paloCons.addElementToConsolidation(
            paloElements.getElement(tConsElement.getElementName()), tConsElement.getFactor());
        bConsolidationElementsFound = true;
      }
    }
    if (bConsolidationElementsFound) {
      paloElements.getElement(strElementName).updateElement(paloCons, true);
    }
  }
  public void buildParentChildRelationShipReferenced() {
    int iPosition = 0;
    for (String[] strMainIn : lstTalendMainIn) {
      for (int i = 0; i < 2; i++) {
        boolean bFound = false;
        for (tPaloDimensionElements tParentDimensionElement : lstPaloDimensionElements) {
          if (tParentDimensionElement.getElementName() != null
              && tParentDimensionElement.getElementName().equals(strMainIn[i])) {
            bFound = true;
            break;
          }
        }
        if (!bFound) {
          int iLevel = getElementLevel(strMainIn[0], 0);

          double dFactor = 1;
          // Check for factor
          if (strMainIn.length == 3 && i == 1) {
            try {
              dFactor = Double.parseDouble(strMainIn[2]);
            } catch (Exception e) {
            }
          }
          tPaloDimensionElements tDimensionElement =
              new tPaloDimensionElements(iPosition, strMainIn[i], -1, iLevel, dFactor);
          lstPaloDimensionElements.add(tDimensionElement);
          iPosition++;
        }
      }
    }
    for (String[] strMainIn : lstTalendMainIn) {
      for (tPaloDimensionElements tParentDimensionElement : lstPaloDimensionElements) {
        if (tParentDimensionElement.getElementName() != null
            && tParentDimensionElement.getElementName().equals(strMainIn[0])) {
          tPaloDimensionElements actElem = getDimenionElement(strMainIn[1]);
          if (null != actElem) {
            actElem.setLevel(tParentDimensionElement.getLevel() + 1);
            actElem.setParentPosition(tParentDimensionElement.getPosition());
          }
          break;
        }
      }
    }
  }
 public int compare(tPaloDimensionElements o1, tPaloDimensionElements o2) {
   if (o1.getLevel() > o2.getLevel()) return 1;
   else return -1;
 }