Examples of SbiOrgUnitGrant


Examples of it.eng.spagobi.kpi.ou.metadata.SbiOrgUnitGrant

    Transaction tx = null;
    try {
      aSession = getSession();
      tx = aSession.beginTransaction();

      SbiOrgUnitGrant hibGrant = new SbiOrgUnitGrant();
      hibGrant.setLabel(grant.getLabel());
      hibGrant.setName(grant.getName());
      hibGrant.setDescription(grant.getDescription());
      hibGrant.setStartDate(grant.getStartDate());
      hibGrant.setEndDate(grant.getEndDate());
      hibGrant.setIsAvailable(grant.getIsAvailable());
      // set hierarchy
      Integer hierachyId = grant.getHierarchy().getId();
      Query query = aSession.createQuery(" from SbiOrgUnitHierarchies s where s.id = ? ");
      query.setInteger(0, hierachyId);
      SbiOrgUnitHierarchies h = (SbiOrgUnitHierarchies) query.uniqueResult();
      hibGrant.setSbiOrgUnitHierarchies(h);
     
      // set kpi model instance
      Integer kpiModelInstId = grant.getModelInstance().getId();
      query = aSession.createQuery(" from SbiKpiModelInst s where s.kpiModelInst = ? ");
      query.setInteger(0, kpiModelInstId);
      SbiKpiModelInst s = (SbiKpiModelInst) query.uniqueResult();
      hibGrant.setSbiKpiModelInst(s);
      updateSbiCommonInfo4Insert(hibGrant);
      aSession.save(hibGrant);
      tx.commit();
     
      grant.setId(hibGrant.getId());
     
     
    } finally {
      rollbackIfActiveAndClose(tx, aSession);
    }
View Full Code Here

Examples of it.eng.spagobi.kpi.ou.metadata.SbiOrgUnitGrant

    Transaction tx = null;
    try {
      aSession = getSession();
      tx = aSession.beginTransaction();

      SbiOrgUnitGrant hibGrant = (SbiOrgUnitGrant) aSession.load(SbiOrgUnitGrant.class, grant.getId());
      hibGrant.setLabel(grant.getLabel());
      hibGrant.setName(grant.getName());
      hibGrant.setDescription(grant.getDescription());
      hibGrant.setStartDate(grant.getStartDate());
      hibGrant.setEndDate(grant.getEndDate());
      hibGrant.setIsAvailable(grant.getIsAvailable());
      // if hierarchy and/or kpi model instance have been changed, erase previous defined node grants
      Integer previousHierachyId = hibGrant.getSbiOrgUnitHierarchies().getId();
      Integer newHierachyId = grant.getHierarchy().getId();
      Integer previousKpiModelInstId = hibGrant.getSbiKpiModelInst().getKpiModelInst();
      Integer newKpiModelInstId = grant.getModelInstance().getId();
      if (previousHierachyId.intValue() != newHierachyId.intValue()
          || previousKpiModelInstId.intValue() != newKpiModelInstId.intValue()) {
        String hql = "delete from SbiOrgUnitGrantNodes s where s.id.grantId = ?";
            Query query = aSession.createQuery(hql);
            query.setInteger(0, hibGrant.getId());
            query.executeUpdate();
      }
     
      // update hierarchy
      if (previousHierachyId.intValue() != newHierachyId.intValue()) {
        Query query = aSession.createQuery(" from SbiOrgUnitHierarchies s where s.id = ? ");
        query.setInteger(0, newHierachyId);
        SbiOrgUnitHierarchies h = (SbiOrgUnitHierarchies) query.uniqueResult();
        hibGrant.setSbiOrgUnitHierarchies(h);
      }
     
      // update kpi model instance
      if (previousKpiModelInstId.intValue() != newKpiModelInstId.intValue()) {
        Query query = aSession.createQuery(" from SbiKpiModelInst s where s.kpiModelInst = ? ");
        query.setInteger(0, newKpiModelInstId);
        SbiKpiModelInst s = (SbiKpiModelInst) query.uniqueResult();
        hibGrant.setSbiKpiModelInst(s);
      }
      updateSbiCommonInfo4Update(hibGrant);
      aSession.save(hibGrant);
     
      tx.commit();
View Full Code Here

Examples of it.eng.spagobi.kpi.ou.metadata.SbiOrgUnitGrant

    Transaction tx = null;
    try {
      aSession = getSession();
      tx = aSession.beginTransaction();

      SbiOrgUnitGrant hibGrant = (SbiOrgUnitGrant) aSession.load(SbiOrgUnitGrant.class, grantId);
      aSession.delete(hibGrant);
     
      tx.commit();
    } finally {
      rollbackIfActiveAndClose(tx, aSession);
View Full Code Here

Examples of it.eng.spagobi.kpi.ou.metadata.SbiOrgUnitGrant

    Session aSession = null;
    Transaction tx = null;
    try {
      aSession = getSession();
      tx = aSession.beginTransaction();
      SbiOrgUnitGrant hibGrant = (SbiOrgUnitGrant) aSession.load(SbiOrgUnitGrant.class, grantId);
      Iterator<OrganizationalUnitGrantNode> it = grantNodes.iterator();
      while (it.hasNext()) {
        OrganizationalUnitGrantNode aGrantNode = it.next();

        Integer hierarchyNodeId = aGrantNode.getOuNode().getNodeId();
        Integer kpiModelInstNodeId = aGrantNode.getModelInstanceNode().getModelInstanceNodeId();
       
        SbiOrgUnitGrantNodes grantNode = new SbiOrgUnitGrantNodes();
     
        SbiOrgUnitGrantNodesId grantNodeId = new SbiOrgUnitGrantNodesId(hierarchyNodeId, kpiModelInstNodeId, grantId);
        grantNode.setId(grantNodeId);
       
        SbiOrgUnitNodes hibNode = (SbiOrgUnitNodes) aSession.load(SbiOrgUnitNodes.class, hierarchyNodeId);
        grantNode.setSbiOrgUnitNodes(hibNode);
       
        SbiKpiModelInst kpiModelInst = (SbiKpiModelInst) aSession.load(SbiKpiModelInst.class, kpiModelInstNodeId);
        grantNode.setSbiKpiModelInst(kpiModelInst);
       
       
        grantNode.setSbiOrgUnitGrant(hibGrant);
        logger.debug("Saving grant node with node Id:"+grantNodeId.getNodeId()+" modelInst Id "+grantNodeId.getKpiModelInstNodeId()+" ang grant Id "+grantNodeId.getGrantId());
        //System.out.println("Saving grant node with node Id:"+grantNodeId.getNodeId()+" modelInst Id "+grantNodeId.getKpiModelInstNodeId()+" ang grant Id "+grantNodeId.getGrantId());
        updateSbiCommonInfo4Insert(grantNode);
        aSession.save(grantNode);
      }
      //sets grant available if everithing ok
      hibGrant.setIsAvailable(true);
      aSession.save(hibGrant);
      tx.commit();
    }catch(Exception e){

      logger.error(e.getMessage());
View Full Code Here

Examples of it.eng.spagobi.kpi.ou.metadata.SbiOrgUnitGrant

      }
      SbiOrgUnitHierarchies hier =(SbiOrgUnitHierarchies)session.load(SbiOrgUnitHierarchies.class, grant.getHierarchy().getId());
      SbiKpiModelInst mi =(SbiKpiModelInst)session.load(SbiKpiModelInst.class, grant.getModelInstance().getId());

      // main attributes     
      SbiOrgUnitGrant hibGrant = new SbiOrgUnitGrant();
      hibGrant.setDescription(grant.getDescription());
      hibGrant.setEndDate(grant.getEndDate());
      hibGrant.setId(grant.getId());
      hibGrant.setLabel(grant.getLabel());
      hibGrant.setName(grant.getName());
      hibGrant.setSbiKpiModelInst(mi);
      hibGrant.setSbiOrgUnitHierarchies(hier);
      hibGrant.setStartDate(grant.getStartDate());
      hibGrant.setIsAvailable(grant.getIsAvailable());

      Transaction tx = session.beginTransaction();     
      session.save(hibGrant);
      tx.commit();
View Full Code Here

Examples of it.eng.spagobi.kpi.ou.metadata.SbiOrgUnitGrant

      if(!hibList.isEmpty()) {
        return;
      }

      SbiKpiModelInst mi =(SbiKpiModelInst)session.load(SbiKpiModelInst.class, ou.getModelInstanceNode().getModelInstanceNodeId());
      SbiOrgUnitGrant g =(SbiOrgUnitGrant)session.load(SbiOrgUnitGrant.class, ou.getGrant().getId());
      SbiOrgUnitNodes n =(SbiOrgUnitNodes)session.load(SbiOrgUnitNodes.class, ou.getOuNode().getNodeId());
      // main attributes     
      SbiOrgUnitGrantNodes hibGrant = new SbiOrgUnitGrantNodes();
      SbiOrgUnitGrantNodesId id = new SbiOrgUnitGrantNodesId();
      id.setKpiModelInstNodeId(ou.getModelInstanceNode().getModelInstanceNodeId());
View Full Code Here

Examples of it.eng.spagobi.kpi.ou.metadata.SbiOrgUnitGrant

      return hibnode;   
    }else if (hibObj instanceof SbiOrgUnitGrant) {
      String label = (String) unique;
      hql = "from SbiOrgUnitGrant u where u.label = '" + label + "'";
      hqlQuery = sessionCurrDB.createQuery(hql);
      SbiOrgUnitGrant hibOu = (SbiOrgUnitGrant) hqlQuery.uniqueResult();
      return hibOu;   
    }else if (hibObj instanceof SbiOrgUnitGrantNodes) {
      Map uniqueMap = (Map) unique;
      Integer nodeId = (Integer) uniqueMap.get("nodeId");
      Integer grantId = (Integer) uniqueMap.get("grantId");
View Full Code Here

Examples of it.eng.spagobi.kpi.ou.metadata.SbiOrgUnitGrant

    return toReturn;
  }
  private void resetGrantsAvailable(Session aSession, List grants) throws Exception {
    logger.debug("IN");
    for(int i=0; i< grants.size(); i++){
      SbiOrgUnitGrant grant = (SbiOrgUnitGrant)grants.get(i);
      grant.setIsAvailable(true);
      aSession.save(grant);
      aSession.flush();
    }
   
    logger.debug("OUT");
View Full Code Here

Examples of it.eng.spagobi.kpi.ou.metadata.SbiOrgUnitGrant

   *
   * @return the new hibernate parameter object
   */
  public static SbiOrgUnitGrant makeNewOuGrant(SbiOrgUnitGrant grant ,Session sessionCurrDB, MetadataAssociations metaAss, ImporterMetadata importer){
    logger.debug("IN");
    SbiOrgUnitGrant newGrant = new SbiOrgUnitGrant();
    try{
      newGrant.setDescription(grant.getDescription());
      newGrant.setEndDate(grant.getEndDate());
      newGrant.setLabel(grant.getLabel());
      newGrant.setName(grant.getName());
      newGrant.setStartDate(grant.getStartDate());
      newGrant.setIsAvailable(true);
      // associations
      entitiesAssociationsOuGrant(grant, newGrant, sessionCurrDB, metaAss, importer);

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

Examples of it.eng.spagobi.kpi.ou.metadata.SbiOrgUnitGrant

   * @throws EMFUserError the EMF user error
   */
  public static SbiOrgUnitGrant modifyExistingOuGrant(SbiOrgUnitGrant exportedGrant, Session sessionCurrDB,
      Integer existingId) throws EMFUserError {
    logger.debug("IN");
    SbiOrgUnitGrant existingGrant = null;
    try {
      // update Grant
      existingGrant = (SbiOrgUnitGrant) sessionCurrDB.load(SbiOrgUnitGrant.class, existingId);
      existingGrant.setDescription(exportedGrant.getDescription());
      existingGrant.setEndDate(exportedGrant.getEndDate());
      existingGrant.setLabel(exportedGrant.getLabel());
      existingGrant.setName(exportedGrant.getName());
      existingGrant.setStartDate(exportedGrant.getStartDate());
      existingGrant.setIsAvailable(true);
    }

    finally {
      logger.debug("OUT");
    }
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.