Package it.eng.spagobi.kpi.ou.bo

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


 
  private void insertNode(Node<OrganizationalUnit> node,
      Node<OrganizationalUnit> parent,
      OrganizationalUnitHierarchy hierarchy) {
    logger.debug("IN: node = " + node + ", parent = " + parent + ", hierarchy = " + hierarchy);
    OrganizationalUnitNode aNode = new OrganizationalUnitNode();
    aNode.setHierarchy(hierarchy);
    OrganizationalUnit content = node.getNodeContent();
    content = DAOFactory.getOrganizationalUnitDAO().getOrganizationalUnitByLabelAndName(content.getLabel(), content.getName());
    if(content == null){
      //then insert it!!there could be a misalignment
      DAOFactory.getOrganizationalUnitDAO().insertOrganizationalUnit(node.getNodeContent());
      content = DAOFactory.getOrganizationalUnitDAO().getOrganizationalUnitByLabelAndName(node.getNodeContent().getLabel(), node.getNodeContent().getName());
    }
    aNode.setOu(content);
    aNode.setPath(node.getPath());
    if (parent != null) {
      OrganizationalUnitNode parentNode = DAOFactory.getOrganizationalUnitDAO().getOrganizationalUnitNode(parent.getPath(), hierarchy.getId());
      Integer parentNodeId = parentNode.getNodeId();
      aNode.setParentNodeId(parentNodeId);
    }
    DAOFactory.getOrganizationalUnitDAO().insertOrganizationalUnitNode(aNode);
    logger.debug("OUT");
  }
View Full Code Here


    return toReturn;
  }
 
  private void removeNoMoreExistingNodes(Tree<OrganizationalUnit> tree, OrganizationalUnitHierarchy hierarchy) {
    logger.debug("IN");
    OrganizationalUnitNode rootNode = DAOFactory.getOrganizationalUnitDAO().getRootNode(hierarchy.getId());
    if (rootNode != null) {
      List<OrganizationalUnitNode> nodes = new ArrayList<OrganizationalUnitNode>();
      nodes.add(rootNode);
      removeNoMoreExistingNodes(tree, nodes, hierarchy);
    }
View Full Code Here

 
  private void removeNoMoreExistingNodes(Tree<OrganizationalUnit> tree, List<OrganizationalUnitNode> nodes, OrganizationalUnitHierarchy hierarchy) {
    logger.debug("IN");
    Iterator<OrganizationalUnitNode> it = nodes.iterator();
    while (it.hasNext()) {
      OrganizationalUnitNode aNode = it.next();
      logger.debug("Examining node " + aNode + " ....");
      if (tree.containsPath(aNode.getPath())) {
        logger.debug("Node " + aNode + " exists in hierarchy " + hierarchy + ".");
        // recursion
        List<OrganizationalUnitNode> children = DAOFactory.getOrganizationalUnitDAO().getChildrenNodes(aNode.getNodeId());
        removeNoMoreExistingNodes(tree, children, hierarchy);
      } else {
        logger.debug("Node " + aNode + " does no more exists. Removing it ....");
        DAOFactory.getOrganizationalUnitDAO().eraseOrganizationalUnitNode(aNode);
        logger.debug("Node " + aNode + " removed.");
View Full Code Here

    return toReturn;
  }
 
  public OrganizationalUnitNode getRootNode(Integer hierarchyId) {
    logger.debug("IN: hierarchyId = " + hierarchyId);
    OrganizationalUnitNode toReturn = null;
    Session aSession = null;
    Transaction tx = null;
    try {
      aSession = getSession();
      tx = aSession.beginTransaction();
View Full Code Here

    return toReturn;
  }
 
  public OrganizationalUnitNode getOrganizationalUnitNode(String path, Integer hierarchyId) {
    logger.debug("IN: path = " + path + ", hierarchy = " + hierarchyId);
    OrganizationalUnitNode toReturn = null;
    Session aSession = null;
    Transaction tx = null;
    try {
      aSession = getSession();
      tx = aSession.beginTransaction();
View Full Code Here

      hibQuery.setInteger(0, hierarchyId);
     
      SbiOrgUnitNodes root = (SbiOrgUnitNodes) hibQuery.uniqueResult();

      if (root != null) {
        OrganizationalUnitNode node = toOrganizationalUnitNode(root);
        toReturn = getNodeWithGrants(node, grantId, aSession);
      }
    } finally {
      rollbackIfActiveAndClose(tx, aSession);
    }
View Full Code Here

     
      List hibList = hibQuery.list();
      Iterator it = hibList.iterator();

      while (it.hasNext()) {
        OrganizationalUnitNode node = toOrganizationalUnitNode((SbiOrgUnitNodes) it.next());
        OrganizationalUnitNodeWithGrant nodeWithGrants = getNodeWithGrants(node, grantId, aSession);
        toReturn.add(nodeWithGrants);
      }
    } finally {
      rollbackIfActiveAndClose(tx, aSession);
View Full Code Here

     
      List hibList = hibQuery.list();
      Iterator it = hibList.iterator();

      while (it.hasNext()) {
        OrganizationalUnitNode node = toOrganizationalUnitNode((SbiOrgUnitNodes) it.next());
        OrganizationalUnitNodeWithGrant nodeWithGrants = getNodeWithGrants(node, grantId, aSession);
        toReturn.add(nodeWithGrants);
      }
    } finally {
      rollbackIfActiveAndClose(tx, aSession);
View Full Code Here

  }
 
  public OrganizationalUnitNode toOrganizationalUnitNode(SbiOrgUnitNodes hibOrgUnitNode) {
    OrganizationalUnit ou = toOrganizationalUnit(hibOrgUnitNode.getSbiOrgUnit());
    OrganizationalUnitHierarchy hierarchy = toOrganizationalUnitHierarchy(hibOrgUnitNode.getSbiOrgUnitHierarchies());
    OrganizationalUnitNode node = new OrganizationalUnitNode(hibOrgUnitNode.getNodeId(), ou, hierarchy,
        hibOrgUnitNode.getPath(),
        hibOrgUnitNode.getSbiOrgUnitNodes() == null ? null : hibOrgUnitNode.getSbiOrgUnitNodes().getNodeId() );

    Session aSession = null;
    Transaction tx = null;
   
    try {
      aSession = getSession();
      tx = aSession.beginTransaction();
     
      Query hibQuery = aSession.createQuery(" from SbiOrgUnitNodes n where n.sbiOrgUnitNodes.nodeId = ? ");
      hibQuery.setInteger(0, node.getNodeId());
     
      List hibList = hibQuery.list();
      Iterator it = hibList.iterator();

      node.setLeaf(!it.hasNext());

    } finally {
      rollbackIfActiveAndClose(tx, aSession);
    }
   
View Full Code Here

  }
 
 
  public OrganizationalUnitGrantNode toOrganizationalUnitGrantNode(
      SbiOrgUnitGrantNodes hibGrantNode, Session aSession) {
    OrganizationalUnitNode ouNode = toOrganizationalUnitNode(hibGrantNode.getSbiOrgUnitNodes());
    ModelInstanceNode modelInstanceNode;
    try {
      modelInstanceNode = ModelInstanceDAOImpl.toModelInstanceNode(hibGrantNode.getSbiKpiModelInst());
    } catch (EMFUserError e) {
      throw new RuntimeException(e);
View Full Code Here

TOP

Related Classes of it.eng.spagobi.kpi.ou.bo.OrganizationalUnitNode

Copyright © 2018 www.massapicom. 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.