Package it.eng.spagobi.kpi.model.bo

Examples of it.eng.spagobi.kpi.model.bo.ModelInstance


    return toReturn;
  }
  public OrganizationalUnitGrant toOrganizationalUnitGrant(
      SbiOrgUnitGrant hibGrant, Session aSession) {
    OrganizationalUnitHierarchy hierarchy = toOrganizationalUnitHierarchy(hibGrant.getSbiOrgUnitHierarchies());
    ModelInstance modelInstance = ModelInstanceDAOImpl.toModelInstanceWithoutChildren(hibGrant.getSbiKpiModelInst(), aSession);
    OrganizationalUnitGrant grant = new OrganizationalUnitGrant(hibGrant.getId(), hibGrant.getIsAvailable(), modelInstance,
        hierarchy, hibGrant.getStartDate(), hibGrant.getEndDate(), hibGrant.getLabel(),
        hibGrant.getName(), hibGrant.getDescription());
    return grant;
  }
View Full Code Here


      List sbiKpiModelInstanceList = crit.list();
      for (Iterator iterator = sbiKpiModelInstanceList.iterator(); iterator
      .hasNext();) {
        SbiKpiModelInst sbiKpiModelInst = (SbiKpiModelInst) iterator
        .next();
        ModelInstance aModelInst = toModelInstanceWithoutChildren(
            sbiKpiModelInst, aSession);
        toReturn.add(aModelInst);
      }
    } catch (HibernateException he) {
      logException(he);
View Full Code Here

  }

  public static ModelInstance toModelInstanceWithoutChildren(SbiKpiModelInst value,
      Session aSession) {
    logger.debug("IN");
    ModelInstance toReturn = new ModelInstance();

    String name = value.getName();
    String description = value.getDescription();
    String label = value.getLabel();
    Date startDate = value.getStartDate();
    Date endDate = value.getEndDate();
    Integer id = value.getKpiModelInst();
    SbiKpiModel sbiKpiModel = value.getSbiKpiModel();
    String modelUUID = value.getModelUUID();

    // insert Parent
    if (value.getSbiKpiModelInst() != null) {
      toReturn.setParentId(value.getSbiKpiModelInst().getKpiModelInst());
    }

    // load with Dao to get also domains
    try {
      SbiKpiModel sbiKpiModel2 = null;
      IModelDAO modelDao = (IModelDAO) DAOFactory.getModelDAO();
      Integer modelId = sbiKpiModel.getKpiModelId();
      // sbiKpiModel2=modelDao.l(modelId);

    } catch (EMFUserError e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    Model aModel = ModelDAOImpl.toModelWithoutChildren(sbiKpiModel,
        aSession);
    SbiKpiInstance sbiKpiInstance = value.getSbiKpiInstance();

    if (sbiKpiInstance != null) {
      // toKpiInstance
      KpiInstance aKpiInstance = new KpiInstance();
      aKpiInstance.setKpiInstanceId(sbiKpiInstance.getIdKpiInstance());
      aKpiInstance.setKpi(sbiKpiInstance.getSbiKpi().getKpiId());
      if (sbiKpiInstance.getSbiThreshold() != null) {
        aKpiInstance.setThresholdId(sbiKpiInstance.getSbiThreshold()
            .getThresholdId());
      }
      if (sbiKpiInstance.getChartType() != null) {
        aKpiInstance.setChartTypeId(sbiKpiInstance.getChartType()
            .getValueId());
      }
      // TODO
      if (sbiKpiInstance.getSbiKpiInstPeriods() != null
          && !(sbiKpiInstance.getSbiKpiInstPeriods().isEmpty())) {
        SbiKpiInstPeriod instPeriod = (SbiKpiInstPeriod) sbiKpiInstance
        .getSbiKpiInstPeriods().toArray()[0];

        aKpiInstance.setPeriodicityId(instPeriod.getSbiKpiPeriodicity()
            .getIdKpiPeriodicity());
      } //
      aKpiInstance.setWeight(sbiKpiInstance.getWeight());
      aKpiInstance.setTarget(sbiKpiInstance.getTarget());
      aKpiInstance.setD(sbiKpiInstance.getBeginDt());
      //
      toReturn.setKpiInstance(aKpiInstance);
    }

    toReturn.setId(id);
    toReturn.setName(name);
    toReturn.setDescription(description);
    toReturn.setLabel(label);
    toReturn.setStartDate(startDate);
    toReturn.setEndDate(endDate);
    toReturn.setModel(aModel);
    toReturn.setModelUUID(modelUUID);

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

  }

  public ModelInstance loadModelInstanceWithoutChildrenById(Integer id)
  throws EMFUserError {
    logger.debug("IN");
    ModelInstance toReturn = null;
    Session aSession = null;
    Transaction tx = null;
    try {
      aSession = getSession();
      tx = aSession.beginTransaction();
View Full Code Here

  }

  public ModelInstance loadModelInstanceWithoutChildrenByLabel(String label)
  throws EMFUserError {
    logger.debug("IN");
    ModelInstance toReturn = null;
    Session aSession = null;
    Transaction tx = null;

    try {
      aSession = getSession();
View Full Code Here

  public ModelInstance loadModelInstanceWithChildrenById(Integer id)
  throws EMFUserError {
    logger.debug("IN");
    Session aSession = null;
    Transaction tx = null;
    ModelInstance toReturn = null;
    try {
      aSession = getSession();
      tx = aSession.beginTransaction();
      SbiKpiModelInst hibSbiKpiModelInst = (SbiKpiModelInst) aSession
      .load(SbiKpiModelInst.class, id);
View Full Code Here

  public ModelInstance loadModelInstanceWithChildrenByLabel(String label)
  throws EMFUserError {
    logger.debug("IN");
    Session aSession = null;
    Transaction tx = null;
    ModelInstance toReturn = null;
    try {
      aSession = getSession();
      tx = aSession.beginTransaction();
      SbiKpiModelInst hibSbiKpiModelInst = (SbiKpiModelInst) aSession
      .load(SbiKpiModelInst.class, label);
View Full Code Here

  }

  private ModelInstance toModelInstanceWithChildren(Session session,
      SbiKpiModelInst value, Integer parentId) {
    logger.debug("IN");
    ModelInstance toReturn = new ModelInstance();
    String name = value.getName();
    String description = value.getDescription();
    String label = value.getLabel();
    Date startDate = value.getStartDate();
    Date endDate = value.getEndDate();
    Integer id = value.getKpiModelInst();
    SbiKpiModel sbiKpiModel = value.getSbiKpiModel();
    String modelUUID = value.getModelUUID();
    Model aModel = ModelDAOImpl
    .toModelWithoutChildren(sbiKpiModel, session);
    SbiKpiInstance sbiKpiInstance = value.getSbiKpiInstance();

    if (sbiKpiInstance != null) {
      // toKpiInstance
      KpiInstance aKpiInstance = new KpiInstance();
      aKpiInstance.setKpiInstanceId(sbiKpiInstance.getIdKpiInstance());
      aKpiInstance.setKpi(sbiKpiInstance.getSbiKpi().getKpiId());
      if (sbiKpiInstance.getSbiThreshold() != null) {
        aKpiInstance.setThresholdId(sbiKpiInstance.getSbiThreshold()
            .getThresholdId());
      }
      if (sbiKpiInstance.getChartType() != null) {
        aKpiInstance.setChartTypeId(sbiKpiInstance.getChartType()
            .getValueId());
      }
      // TODO
      if (sbiKpiInstance.getSbiKpiInstPeriods() != null
          && !(sbiKpiInstance.getSbiKpiInstPeriods().isEmpty())) {
        SbiKpiInstPeriod instPeriod = (SbiKpiInstPeriod) sbiKpiInstance
        .getSbiKpiInstPeriods().toArray()[0];

        aKpiInstance.setPeriodicityId(instPeriod.getSbiKpiPeriodicity()
            .getIdKpiPeriodicity());
      }
      aKpiInstance.setWeight(sbiKpiInstance.getWeight());
      aKpiInstance.setTarget(sbiKpiInstance.getTarget());
      aKpiInstance.setD(sbiKpiInstance.getBeginDt());
      //
      toReturn.setKpiInstance(aKpiInstance);
    }

    List childrenNodes = new ArrayList();

    Criteria critt = session.createCriteria(SbiKpiModelInst.class);
    critt.add(Expression.eq("sbiKpiModelInst", value));
    critt.createCriteria("sbiKpiModel").addOrder(Order.asc("kpiModelCd"));

    List children = critt.list();

    for (Iterator iterator = children.iterator(); iterator.hasNext();) {
      SbiKpiModelInst sbiKpichild = (SbiKpiModelInst) iterator.next();
      ModelInstance child = toModelInstanceWithChildren(session,
          sbiKpichild, id);
      childrenNodes.add(child);
    }

    toReturn.setId(id);
View Full Code Here

      List sbiKpiModelInstanceList = crit.list();
      for (Iterator iterator = sbiKpiModelInstanceList.iterator(); iterator
      .hasNext();) {
        SbiKpiModelInst sbiKpiModelInst = (SbiKpiModelInst) iterator
        .next();
        ModelInstance aModelInst = toModelInstanceWithoutChildren(
            sbiKpiModelInst, aSession);
        toReturn.add(aModelInst);
      }
    } catch (HibernateException he) {
      logException(he);
View Full Code Here

    logger.debug("IN");
    if (mi.getParentId() == null) {
      logger.debug("OUT");
      return mi;
    } else {
      ModelInstance miPar = loadModelInstanceWithoutChildrenById(mi
          .getParentId());
      logger.debug("Searching model instance parent.");
      return loadModelInstanceRoot(miPar);
    }
  }
View Full Code Here

TOP

Related Classes of it.eng.spagobi.kpi.model.bo.ModelInstance

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.