/** * This is a method that will create list of all main entities. (Entities for which entity passed * to it is having containment association) * * @param entity entity * @param mainEntityList mainEntityList * @return mainEntityList List of main entities */ public static List<EntityInterface> getAllMainEntities( EntityInterface entity, List<EntityInterface> mainEntities) { List<EntityInterface> mainEntityList = mainEntities; try { List<AssociationInterface> associationList = getIncomingContainmentAssociations(entity); if (associationList.isEmpty()) { mainEntityList.add(entity); } else { for (AssociationInterface assocoation : associationList) { mainEntityList = getAllMainEntities(assocoation.getEntity(), mainEntityList); } } } catch (DynamicExtensionsSystemException deException) { logger.error(deException.getMessage(), deException); } return mainEntityList; }