Пример #1
0
 /**
  * Searches for main entity in parent hierarchy or child hierarchy.
  *
  * @param mainEntityList - list of all main Entities
  * @param node - current node
  * @return - main Entity if found in parent or child hierarchy. Returns null if not found
  */
 private static EntityInterface getMainEntity(
     List<EntityInterface> mainEntityList, OutputTreeDataNode node) {
   // check if node itself is main entity
   EntityInterface entity = null;
   // check if main entity is present in parent hierarchy
   if (node.getParent() != null) {
     entity = getMainEntityFromParentHierarchy(mainEntityList, node.getParent());
   }
   if (entity == null) {
     // check if main entity is present in child hierarchy
     entity = getMainEntityFromChildHierarchy(mainEntityList, node);
   }
   return entity;
 }
Пример #2
0
 /**
  * @param mainEntityList mainEntityList
  * @param node node
  * @return entity
  */
 private static EntityInterface getFinalMainEntity(
     List<EntityInterface> mainEntityList, OutputTreeDataNode node) {
   EntityInterface entity;
   entity = getMainEntityFromParentHierarchy(mainEntityList, node.getParent());
   if (entity == null && node.getChildren().size() != 0) {
     entity = getMainEntityFromChildHierarchy(mainEntityList, node);
   }
   return entity;
 }