Ejemplo n.º 1
0
  /**
   * @param dao
   * @param finishedRiskLists
   */
  public static void hydrateElement(
      IBaseDao<FinishedRiskAnalysisLists, Serializable> dao,
      FinishedRiskAnalysisLists finishedRiskLists) {
    if (finishedRiskLists != null) {
      List<GefaehrdungsUmsetzung> list = finishedRiskLists.getAllGefaehrdungsUmsetzungen();
      for (GefaehrdungsUmsetzung gefaehrdungsUmsetzung : list) {
        hydrateEntity(dao, gefaehrdungsUmsetzung.getEntity());
      }

      List<GefaehrdungsUmsetzung> list2 = finishedRiskLists.getAssociatedGefaehrdungen();
      dao.initialize(list2);
      for (GefaehrdungsUmsetzung gefaehrdungsUmsetzung : list2) {
        hydrateEntity(dao, gefaehrdungsUmsetzung.getEntity());
      }

      List<GefaehrdungsUmsetzung> list3 = finishedRiskLists.getNotOKGefaehrdungsUmsetzungen();
      dao.initialize(list3);
      for (GefaehrdungsUmsetzung gefaehrdungsUmsetzung : list3) {
        hydrateEntity(dao, gefaehrdungsUmsetzung.getEntity());
        RetrieveInfo ri = new RetrieveInfo();
        ri.setChildren(true);
        hydrateElement(dao, gefaehrdungsUmsetzung, ri);

        Set<CnATreeElement> children = gefaehrdungsUmsetzung.getChildren();
        for (CnATreeElement child : children) {
          if (child instanceof MassnahmenUmsetzung) {
            MassnahmenUmsetzung mn = (MassnahmenUmsetzung) child;
            hydrateElement(dao, mn, null);
          }
        }
      }
    }
  }
Ejemplo n.º 2
0
 public static void hydrateElement(
     IBaseDao dao, CnATreeElement element, boolean retrieveChildren) {
   RetrieveInfo ri = null;
   if (retrieveChildren) {
     ri = new RetrieveInfo();
     ri.setChildren(true);
   }
   hydrateElement(dao, element, ri);
 }
Ejemplo n.º 3
0
 public static <T extends CnATreeElement> void hydrateElements(
     IBaseDao dao, List<T> elements, boolean retrieveChildren) {
   RetrieveInfo ri = null;
   if (retrieveChildren) {
     ri = new RetrieveInfo();
     ri.setChildren(true);
   }
   hydrateElements(dao, elements, ri);
 }
Ejemplo n.º 4
0
 private void addPermissions(IBaseDao<CnATreeElement, Serializable> containerDAO) {
   // By default, inherit permissions from parent element but ITVerbund
   // instances cannot do this, as its parents (BSIModel) is not visible
   // and has no permissions. Therefore we use the name of the currently
   // logged in user as a role which has read and write permissions for
   // the new ITVerbund.
   if (child instanceof ITVerbund
       || child instanceof Organization
       || (child instanceof Audit && !isInheritAuditPermissions())) {
     addPermissions(child);
   } else {
     RetrieveInfo ri = new RetrieveInfo();
     ri.setPermissions(true);
     CnATreeElement elementPerm = containerDAO.retrieve(container.getDbId(), ri);
     child.setPermissions(Permission.clonePermissionSet(child, elementPerm.getPermissions()));
   }
 }
Ejemplo n.º 5
0
 private Map<String, CnATreeElement> loadChildrenTitleMap(
     String uuidParent, Map<String, CnATreeElement> map) {
   RetrieveInfo ri = RetrieveInfo.getChildrenInstance().setChildrenProperties(true);
   ControlGroup source = getDao().findByUuid(uuidParent, ri);
   if (source != null) {
     for (CnATreeElement element : source.getChildren()) {
       if (element instanceof IISO27kGroup) {
         map = loadChildrenTitleMap(element.getUuid(), map);
       } else {
         map.put(getNumberOrTitle(element.getTitle()), element);
       }
     }
   }
   return map;
 }
Ejemplo n.º 6
0
 private CnATreeElement getFromCache(CnATreeElement element) {
   final Element cachedElement = getCache().get(element.getUuid());
   if (cachedElement != null) {
     element = (CnATreeElement) cachedElement.getValue();
     if (getLog().isDebugEnabled()) {
       getLog()
           .debug("Element from cache: " + element.getTitle() + ", UUID: " + element.getUuid());
     }
   } else {
     element = getDao().retrieve(element.getDbId(), RetrieveInfo.getPropertyInstance());
     if (element != null) {
       getCache().put(new Element(element.getUuid(), element));
     }
   }
   return element;
 }