Examples of SbiKpiModelInst


Examples of it.eng.spagobi.kpi.model.metadata.SbiKpiModelInst

     
      // 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();
     
View Full Code Here

Examples of it.eng.spagobi.kpi.model.metadata.SbiKpiModelInst

     
      // 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);
     
View Full Code Here

Examples of it.eng.spagobi.kpi.model.metadata.SbiKpiModelInst

        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());
View Full Code Here

Examples of it.eng.spagobi.kpi.model.metadata.SbiKpiModelInst

                : "Resource name null"));
        res.add(r);
      }
    }
    // gets father id
    SbiKpiModelInst father = hibSbiKpiModelInst.getSbiKpiModelInst();
    Integer fatherId = null;
    Boolean isRoot = false;
    if (father != null) {
      fatherId = father.getKpiModelInst();
      logger
      .debug("SbiKpiModelInstanceNode fatherId: "
          + (fatherId != null ? fatherId.toString()
              : "fatherId null"));
    } else {
      isRoot = true;
    }

    // gets list of children id
    Set children = hibSbiKpiModelInst.getSbiKpiModelInsts();
    List childrenIds = new ArrayList();
    Iterator iCI = children.iterator();
    logger.debug("Started list of children");
    while (iCI.hasNext()) {
      SbiKpiModelInst skml = (SbiKpiModelInst) iCI.next();
      Integer childId = skml.getKpiModelInst();
      logger.debug("SbiKpiModelInstanceNode childrenId: "
          + (childId != null ? childId.toString() : "childId null"));
      childrenIds.add(childId);
    }
View Full Code Here

Examples of it.eng.spagobi.kpi.model.metadata.SbiKpiModelInst

    Transaction tx = null;

    try {
      aSession = getSession();
      tx = aSession.beginTransaction();
      SbiKpiModelInst hibSbiKpiModelInst = (SbiKpiModelInst) aSession
      .get(SbiKpiModelInst.class, id);
      toReturn = toModelInstanceNode(hibSbiKpiModelInst);

    } catch (HibernateException he) {
      logger.error("Error while loading the Model Instance with id "
View Full Code Here

Examples of it.eng.spagobi.kpi.model.metadata.SbiKpiModelInst

      aSession = getSession();
      tx = aSession.beginTransaction();
      Criterion nameCriterrion = Expression.eq("label", label);
      Criteria criteria = aSession.createCriteria(SbiKpiModelInst.class);
      criteria.add(nameCriterrion);
      SbiKpiModelInst hibSbiKpiModelInst = (SbiKpiModelInst) criteria
      .uniqueResult();
      if (hibSbiKpiModelInst == null)
        return null;
      toReturn = toModelInstanceNode(hibSbiKpiModelInst);
View Full Code Here

Examples of it.eng.spagobi.kpi.model.metadata.SbiKpiModelInst

      Criteria crit = aSession.createCriteria(SbiKpiModelInst.class);
      crit.add(Expression.isNull("sbiKpiModelInst"));
      List sbiKpiModelInstanceList = crit.list();
      for (Iterator iterator = sbiKpiModelInstanceList.iterator(); iterator
      .hasNext();) {
        SbiKpiModelInst sbiKpiModelInst = (SbiKpiModelInst) iterator
        .next();
        ModelInstance aModelInst = toModelInstanceWithoutChildren(
            sbiKpiModelInst, aSession);
        toReturn.add(aModelInst);
      }
View Full Code Here

Examples of it.eng.spagobi.kpi.model.metadata.SbiKpiModelInst

    Session aSession = null;
    Transaction tx = null;
    try {
      aSession = getSession();
      tx = aSession.beginTransaction();
      SbiKpiModelInst hibSbiKpiModelInstance = (SbiKpiModelInst) aSession
      .load(SbiKpiModelInst.class, id);
      toReturn = toModelInstanceWithoutChildren(hibSbiKpiModelInstance,
          aSession);

    } catch (HibernateException he) {
View Full Code Here

Examples of it.eng.spagobi.kpi.model.metadata.SbiKpiModelInst

      aSession = getSession();
      tx = aSession.beginTransaction();
      Criterion nameCriterrion = Expression.eq("label", label);
      Criteria criteria = aSession.createCriteria(SbiKpiModelInst.class);
      criteria.add(nameCriterrion);
      SbiKpiModelInst hibSbiKpiModelInst = (SbiKpiModelInst) criteria
      .uniqueResult();
      if (hibSbiKpiModelInst == null)
        return null;
      toReturn = toModelInstanceWithoutChildren(hibSbiKpiModelInst,
          aSession);
View Full Code Here

Examples of it.eng.spagobi.kpi.model.metadata.SbiKpiModelInst

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

      // main attributes     
      SbiKpiModelInst hibMi = new SbiKpiModelInst();
      hibMi.setKpiModelInst(mi.getId());
      hibMi.setName(mi.getName());
      hibMi.setLabel(mi.getLabel());
      hibMi.setDescription(mi.getDescription());
      hibMi.setStartDate(mi.getStartDate());
      hibMi.setEndDate(mi.getEndDate());
      hibMi.setModelUUID(mi.getModelUUID());

      // insert Parent
      if(mi.getParentId()!=null){
        SbiKpiModelInst hibKpiModelInstParent = (SbiKpiModelInst) session.load(SbiKpiModelInst.class, mi.getParentId());
        hibMi.setSbiKpiModelInst(hibKpiModelInstParent);
      }

      // model
      if(mi.getModel()!=null){
        SbiKpiModel hibModel = (SbiKpiModel) session.load(SbiKpiModel.class, mi.getModel().getId());
        hibMi.setSbiKpiModel(hibModel);
      }

      // Load tKpi Instance
      if (mi.getKpiInstance() != null) {
        KpiInstance kpiInstance=mi.getKpiInstance();
        insertKpiInstance(kpiInstance.getKpiInstanceId(), session);
        SbiKpiInstance hibKpiInst = (SbiKpiInstance) session.load(SbiKpiInstance.class, kpiInstance.getKpiInstanceId());
        hibMi.setSbiKpiInstance(hibKpiInst);

      }

      //load all organizational units
      List<OrganizationalUnitGrantNode> grants = DAOFactory.getOrganizationalUnitDAO().getGrants(mi.getId());
      if(grants != null){
        for (OrganizationalUnitGrantNode organizationalUnitGrantNode : grants) {
          OrganizationalUnitGrant organizationalUnitGrant = organizationalUnitGrantNode.getGrant();
          insertOrgUnitGrant(organizationalUnitGrant, session);
          insertOrgUnitGrantNodes(organizationalUnitGrantNode, session);
        }
      }


      Transaction tx = session.beginTransaction();
      session.save(hibMi);
      tx.commit();

      // Load all the model resources of the current instance model
      // after having inserted model instance
      IModelResourceDAO modelResourceDao=DAOFactory.getModelResourcesDAO();     
      List modelResources=modelResourceDao.loadModelResourceByModelId(mi.getId());
      for (Iterator iterator = modelResources.iterator(); iterator.hasNext();) {
        ModelResources modRes = (ModelResources) iterator.next();
        insertModelResources(modRes, session);
        // TODO: maybe insert also the set
      }

      Set modelInstanceChildren=new HashSet();
      logger.debug("insert current model instance children");
      // get the Model Instance children
      IModelInstanceDAO modelInstDao=DAOFactory.getModelInstanceDAO();
      ModelInstance modInstWithChildren=modelInstDao.loadModelInstanceWithChildrenById(mi.getId());
      List childrenList=modInstWithChildren.getChildrenNodes();
      if(childrenList!=null){
        for (Iterator iterator = childrenList.iterator(); iterator.hasNext();) {
          ModelInstance childNode = (ModelInstance) iterator.next();
          logger.debug("insert child "+childNode.getLabel());
          insertModelInstanceTree(childNode,session);       
          SbiKpiModelInst hibKpiModelInst = (SbiKpiModelInst) session.load(SbiKpiModelInst.class, childNode.getId());
          modelInstanceChildren.add(hibKpiModelInst);
        }
      }
      hibMi.setSbiKpiModelInsts(modelInstanceChildren)// serve?
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.