Examples of OrganizationalUnitGrantNode


Examples of it.eng.spagobi.kpi.ou.bo.OrganizationalUnitGrantNode

    toReturn.setKpiValueId(value.getIdKpiInstanceValue());
    logger.debug("Kpi value ID setted");
    toReturn.setValueXml(value.getXmlData());
    logger.debug("Kpi value XML setted");

    OrganizationalUnitGrantNode grantNode = new OrganizationalUnitGrantNode();
    OrganizationalUnitNode node = new OrganizationalUnitNode();
    if(value.getSbiOrgUnit() != null){
      OrganizationalUnit ou = DAOFactory.getOrganizationalUnitDAO().getOrganizationalUnit(value.getSbiOrgUnit().getId());
      node.setOu(ou);
    }
    if(value.getSbiOrgUnitHierarchies() != null){
      OrganizationalUnitHierarchy hierarchy = DAOFactory.getOrganizationalUnitDAO().getHierarchy(value.getSbiOrgUnitHierarchies().getId());
      node.setHierarchy(hierarchy);
    }
    if(value.getSbiOrgUnit() != null && value.getSbiOrgUnitHierarchies() != null){
      grantNode.setOuNode(node);
      toReturn.setGrantNodeOU(grantNode);
    }
    logger.debug("Kpi value orgnaizational unit grant node setted");

    logger.debug("OUT");
View Full Code Here

Examples of it.eng.spagobi.kpi.ou.bo.OrganizationalUnitGrantNode

    }
    return allnodestosave;
  }
  private List<OrganizationalUnitGrantNode> buildGrantNodesForAll(OrganizationalUnitNode ouNode, List<ModelInstanceNode> miNodes,  OrganizationalUnitGrant grant) throws EMFUserError{
    List<OrganizationalUnitGrantNode> nodes = new ArrayList<OrganizationalUnitGrantNode>();
    OrganizationalUnitGrantNode childNode;

    for(int i=0; i<miNodes.size(); i++){

      childNode = new OrganizationalUnitGrantNode();
      childNode.setGrant(grant);
      childNode.setModelInstanceNode(miNodes.get(i));
      childNode.setOuNode(ouNode);
      nodes.add(childNode);
    }
    return nodes;
  }
View Full Code Here

Examples of it.eng.spagobi.kpi.ou.bo.OrganizationalUnitGrantNode

   * @param grant the grant of that object
   * @return the deserialized object
   * @throws Exception
   */
  private OrganizationalUnitGrantNode deserializeOrganizationalUnitGrantNode(JSONObject JSONGrantNode, OrganizationalUnitGrant grant) throws Exception{
    OrganizationalUnitGrantNode node = new OrganizationalUnitGrantNode();
    int hierarchyId = JSONGrantNode.getInt("hierarchyId");
    int modelInstanceId = JSONGrantNode.getInt("modelinstance");
    String ouPath = JSONGrantNode.getString("ouPath");
    ModelInstanceNode modelInstanceNode = DAOFactory.getModelInstanceDAO().loadModelInstanceById(modelInstanceId, null);
    OrganizationalUnitNode ouNode = orUnitDao.getOrganizationalUnitNode(ouPath, hierarchyId);
    node.setGrant(grant);
    node.setModelInstanceNode(modelInstanceNode);
    node.setOuNode(ouNode);
    return node;
  }
View Full Code Here

Examples of it.eng.spagobi.kpi.ou.bo.OrganizationalUnitGrantNode

   * @param grant the grant of that object
   * @return the deserialized object
   * @throws Exception
   */
  private List<OrganizationalUnitGrantNode> deserializeOrganizationalUnitGrantNodeAndUpdateChilds(JSONObject JSONGrantNode, OrganizationalUnitGrant grant) throws Exception{
    OrganizationalUnitGrantNode node = new OrganizationalUnitGrantNode();
    int hierarchyId = JSONGrantNode.getInt("hierarchyId");
    int modelInstanceId = JSONGrantNode.getInt("modelinstance");
    String ouPath = JSONGrantNode.getString("ouPath");
    ModelInstanceNode modelInstanceNode = DAOFactory.getModelInstanceDAO().loadModelInstanceById(modelInstanceId, null);
    OrganizationalUnitNode ouNode = orUnitDao.getOrganizationalUnitNode(ouPath, hierarchyId);
    node.setGrant(grant);
    node.setModelInstanceNode(modelInstanceNode);
    node.setOuNode(ouNode);
    List<OrganizationalUnitGrantNode> nodes = new ArrayList<OrganizationalUnitGrantNode>();

    HashMap<Integer, Integer> tempGrantNodeIds = new HashMap<Integer, Integer>();
    tempGrantNodeIds.put(modelInstanceNode.getModelInstanceNodeId(),ouNode.getNodeId());
    if(!utilityGrantNodesCollection.contains(tempGrantNodeIds)  ){     
      Integer modelInstancesToUncheck = JSONGrantNode.optInt("childrenToUncheck");
      if(modelInstancesToUncheck!=null){

        if(modelInstancesToUncheck.equals(modelInstanceNode.getModelInstanceNodeId())){
          return nodes;
        }

      }
      nodes.add(node);
      utilityGrantNodesCollection.add(tempGrantNodeIds);
    }else{
      return nodes;
    }
    boolean expanded = JSONGrantNode.getBoolean("expanded");
    if(!expanded){
      //if(JSONGrantNode.opt("childrenToUncheck")== null || JSONGrantNode.getInt("childrenToUncheck")!=modelInstanceNode.getModelInstanceNodeId()){
        nodes.addAll(buildGrantForChilds(ouNode, modelInstanceNode, grant));
      //}
    }
    Integer checkChildren = null;
   
    try{
      checkChildren = JSONGrantNode.getInt("childrenToCheck");
      ModelInstanceNode modelInstNode = DAOFactory.getModelInstanceDAO().loadModelInstanceById(checkChildren, null);
      List<OrganizationalUnitGrantNode> childrenChecked = buildGrantForModelInstChildren(ouNode, modelInstNode, grant);
      for(int i=0; i< childrenChecked.size(); i++){
        OrganizationalUnitGrantNode nodeToAdd = childrenChecked.get(i);
        HashMap<Integer, Integer> temp2GrantNodeIds = new HashMap<Integer, Integer>();
        temp2GrantNodeIds.put(nodeToAdd.getModelInstanceNode().getModelInstanceNodeId(), nodeToAdd.getOuNode().getNodeId());
        if(!utilityGrantNodesCollection.contains(temp2GrantNodeIds)){
          nodes.add(nodeToAdd);
          utilityGrantNodesCollection.add(temp2GrantNodeIds);
        }
      }
View Full Code Here

Examples of it.eng.spagobi.kpi.ou.bo.OrganizationalUnitGrantNode

   * @param grant
   * @return
   */
  private List<OrganizationalUnitGrantNode> buildGrantForChilds(OrganizationalUnitNode ouNode, ModelInstanceNode modelInstanceNode,  OrganizationalUnitGrant grant){
    List<OrganizationalUnitGrantNode> nodes = new ArrayList<OrganizationalUnitGrantNode>();
    OrganizationalUnitGrantNode childNode;
    //System.out.println(ouNode.getNodeId());
    Integer parentId =ouNode.getNodeId();
    List<OrganizationalUnitNode> childOus = new ArrayList<OrganizationalUnitNode>();
    //check if already loaded
    if(ouChildrenByParentIDMap.get(parentId) == null){
      childOus = orUnitDao.getChildrenNodes(ouNode.getNodeId());
      ouChildrenByParentIDMap.put(parentId, childOus);
    }else{
      childOus = ouChildrenByParentIDMap.get(parentId);
    }
   
    for(int i=0; i<childOus.size(); i++){
      childNode= new OrganizationalUnitGrantNode();
      childNode.setGrant(grant);
      childNode.setModelInstanceNode(modelInstanceNode);
      childNode.setOuNode(childOus.get(i));
     
      HashMap<Integer, Integer> tempGrantNodeIds = new HashMap<Integer, Integer>();
      tempGrantNodeIds.put(modelInstanceNode.getModelInstanceNodeId(), childOus.get(i).getNodeId());
      if(!utilityGrantNodesCollection.contains(tempGrantNodeIds)){
        nodes.add(childNode);
View Full Code Here

Examples of it.eng.spagobi.kpi.ou.bo.OrganizationalUnitGrantNode

   * @return
   * @throws EMFUserError
   */
  private List<OrganizationalUnitGrantNode> buildGrantForModelInstChildren(OrganizationalUnitNode ouNode, ModelInstanceNode modelInstanceNode,  OrganizationalUnitGrant grant) throws EMFUserError{
    List<OrganizationalUnitGrantNode> nodes = new ArrayList<OrganizationalUnitGrantNode>();
    OrganizationalUnitGrantNode childNode;
    List<Integer> childOus = modelInstanceNode.getChildrenIds();
    for(int i=0; i<childOus.size(); i++){
      ModelInstanceNode miChildNode = DAOFactory.getModelInstanceDAO().loadModelInstanceById((Integer)childOus.get(i), null);
      childNode = new OrganizationalUnitGrantNode();
      childNode.setGrant(grant);
      childNode.setModelInstanceNode(miChildNode);
      childNode.setOuNode(ouNode);
      nodes.add(childNode);
      nodes.addAll(buildGrantForModelInstChildren(ouNode, miChildNode, grant));
    }
    return nodes;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.