Examples of SbiFunctions


Examples of it.eng.spagobi.analiticalmodel.functionalitytree.metadata.SbiFunctions

   *
   * @throws EMFUserError
   */
  private void importFunctionalities() throws EMFUserError {
    logger.debug("IN");
    SbiFunctions functToInsert = null;
    try {
      List exportedFuncts = importer.getAllExportedSbiObjects(sessionExpDB, "SbiFunctions", null);

      while (exportedFuncts.size() != 0) {
        Iterator iterSbiFuncts = exportedFuncts.iterator();
        int minEl = 1000;

        SbiFunctions funct = null;

        // search the functionality for insert
        while (iterSbiFuncts.hasNext()) {
          funct = (SbiFunctions) iterSbiFuncts.next();
          String path = funct.getPath();
          int numEl = path.split("/").length; // the number of levels
          if (numEl < minEl) {
            minEl = numEl;
            functToInsert = funct;
          }
        }

        // remove function from list
        exportedFuncts = removeFromList(exportedFuncts, functToInsert);

        logger.info("Insert the Funtionality (Path):" + functToInsert.getPath());

        // insert function
        Integer expId = functToInsert.getFunctId();
        Map functIdAss = metaAss.getFunctIDAssociation();
        Set functIdAssSet = functIdAss.keySet();
        // if the functionality is present skip the insert
        if (functIdAssSet.contains(expId)) {
          logger.info("Exported functionality " + functToInsert.getName() + " not inserted"
              + " because it has the same label (and the same path) of an existing functionality");
          metaLog.log("Exported functionality " + functToInsert.getName() + " not inserted"
              + " because it has the same label (and the same path) of an existing functionality");
          continue;
        }
        SbiFunctions newFunct = ImportUtilities.makeNewSbiFunction(functToInsert);
        String functCd = functToInsert.getFunctTypeCd();
        Map unique = new HashMap();
        unique.put("valuecd", functCd);
        unique.put("domaincd", "FUNCT_TYPE");
        SbiDomains existDom = (SbiDomains) importer.checkExistence(unique, sessionCurrDB, new SbiDomains());
        if (existDom != null) {
          newFunct.setFunctType(existDom);
          newFunct.setFunctTypeCd(existDom.getValueCd());
        }
        String path = newFunct.getPath();
        String parentPath = path.substring(0, path.lastIndexOf('/'));
        Query hibQuery = sessionCurrDB.createQuery(" from SbiFunctions where path = '" + parentPath + "'");
        SbiFunctions functParent = (SbiFunctions) hibQuery.uniqueResult();
        if (functParent != null) {
          newFunct.setParentFunct(functParent);
        }
        // manages prog column that determines the folders order
        if (functParent == null)
          newFunct.setProg(new Integer(1));
        else {
          // loads sub functionalities
          Query query = sessionCurrDB
          .createQuery("select max(s.prog) from SbiFunctions s where s.parentFunct.functId = "
              + functParent.getFunctId());
          Integer maxProg = (Integer) query.uniqueResult();
          if (maxProg != null)
            newFunct.setProg(new Integer(maxProg.intValue() + 1));
          else
            newFunct.setProg(new Integer(1));
View Full Code Here

Examples of it.eng.spagobi.analiticalmodel.functionalitytree.metadata.SbiFunctions

  private List removeFromList(List complete, SbiFunctions funct) {
    logger.debug("IN");
    List toReturn = new ArrayList();
    Iterator iterList = complete.iterator();
    while (iterList.hasNext()) {
      SbiFunctions listFunct = (SbiFunctions) iterList.next();
      if (!listFunct.getPath().equals(funct.getPath())) {
        toReturn.add(listFunct);
      }
    }
    logger.debug("OUT");
    return toReturn;
View Full Code Here

Examples of it.eng.spagobi.analiticalmodel.functionalitytree.metadata.SbiFunctions

        Integer newFunctid = (Integer) functIdAss.get(functid);
        Integer newObjectid = (Integer) biobjIdAss.get(objid);
        // build a new id for the SbiObjFunct
        SbiObjFuncId objfunctid = objfunct.getId();
        if (objfunctid != null) {
          SbiFunctions sbifunct = objfunctid.getSbiFunctions();
          SbiFunctions newFunct = ImportUtilities.makeNewSbiFunction(sbifunct, newFunctid);
          objfunctid.setSbiFunctions(newFunct);
          functid = newFunctid;
        }
        if (newObjectid != null) {
          SbiObjects sbiobj = objfunctid.getSbiObjects();
View Full Code Here

Examples of it.eng.spagobi.analiticalmodel.functionalitytree.metadata.SbiFunctions

      }
    }
    List exportedFunct = importer.getAllExportedSbiObjects(sessionExpDB, "SbiFunctions", null);
    Iterator iterSbiFunct = exportedFunct.iterator();
    while (iterSbiFunct.hasNext()) {
      SbiFunctions functExp = (SbiFunctions) iterSbiFunct.next();
      String code = functExp.getCode();
      Object existObj = importer.checkExistence(code, sessionCurrDB, new SbiFunctions());
      if (existObj != null) {
        SbiFunctions functCurr = (SbiFunctions) existObj;
        metaAss.insertCoupleFunct(functExp.getFunctId(), functCurr.getFunctId());
        metaAss.insertCoupleFunct(functExp, functCurr);
        metaLog.log("Found an existing Functionality " + functCurr.getName() + " with "
            + "the same CODE of the exported functionality " + functExp.getName());
      }
    }
    List exportedEngine = importer.getAllExportedSbiObjects(sessionExpDB, "SbiEngines", null);
    Iterator iterSbiEng = exportedEngine.iterator();
View Full Code Here

Examples of it.eng.spagobi.analiticalmodel.functionalitytree.metadata.SbiFunctions

          Expression.eq("functTypeCd", "USER_FUNCT"));
      Criterion filters = Expression.and(userfunctANDnullparent,
          Expression.like("path", "/"+userId));
      Criteria criteria = aSession.createCriteria(SbiFunctions.class);
      criteria.add(filters);
      SbiFunctions hibFunct = (SbiFunctions) criteria.uniqueResult();
      if (hibFunct != null)
        exists = true;
      tx.commit();
    } catch (HibernateException he) {
      logger.error( "HibernateException",he );
View Full Code Here

Examples of it.eng.spagobi.analiticalmodel.functionalitytree.metadata.SbiFunctions

    Session aSession = null;
    Transaction tx = null;
    try {
      aSession = getSession();
      tx = aSession.beginTransaction();
      SbiFunctions hibFunct = new SbiFunctions();

      // recover sbidomain of the user functionality
      Criterion vcdEQusfunct = Expression.eq("valueCd", "USER_FUNCT");
      Criteria criteria = aSession.createCriteria(SbiDomains.class);
      criteria.add(vcdEQusfunct);
      SbiDomains functTypeDomain = (SbiDomains) criteria.uniqueResult();

      hibFunct.setFunctType(functTypeDomain);
      hibFunct.setCode(userfunct.getCode());
      hibFunct.setFunctTypeCd(functTypeDomain.getValueCd());
      hibFunct.setDescr(userfunct.getDescription());
      hibFunct.setName(userfunct.getName());
      hibFunct.setPath(userfunct.getPath());

      Integer parentId = userfunct.getParentId();
      SbiFunctions hibParentFunct = null;
      if (parentId != null) {
        // if it is not the root controls if the parent functionality exists
        Criteria parentCriteria = aSession.createCriteria(SbiFunctions.class);
        Criterion parentCriterion = Expression.eq("functId", parentId);
        parentCriteria.add(parentCriterion);
View Full Code Here

Examples of it.eng.spagobi.analiticalmodel.functionalitytree.metadata.SbiFunctions

    Session aSession = null;
    Transaction tx = null;
    try {
      aSession = getSession();
      tx = aSession.beginTransaction();
      SbiFunctions hibFunct = (SbiFunctions)aSession.load(SbiFunctions.class, functionalityID);
      funct = toLowFunctionality(hibFunct, recoverBIObjects);
      tx.commit();
    } catch (HibernateException he) {
      logger.error( "HibernateException",he );
      if (tx != null)
View Full Code Here

Examples of it.eng.spagobi.analiticalmodel.functionalitytree.metadata.SbiFunctions

      aSession = getSession();
      tx = aSession.beginTransaction();
      Criterion labelCriterrion = Expression.eq("code", code);
      Criteria criteria = aSession.createCriteria(SbiFunctions.class);
      criteria.add(labelCriterrion);
      SbiFunctions hibFunct = (SbiFunctions) criteria.uniqueResult();
      funct = toLowFunctionality(hibFunct, recoverBIObjects);
      tx.commit();
    } catch (HibernateException he) {
      logger.error( "HibernateException",he );
      if (tx != null)
View Full Code Here

Examples of it.eng.spagobi.analiticalmodel.functionalitytree.metadata.SbiFunctions

      //Query query=aSession.createQuery("from SbiFunctions f inner join f.sbiFuncRoles where s.functId in ("+functionalityIDs.get(0)+")");
      //List temp = query.list();
      if(!temp.isEmpty()){
        Iterator it = temp.iterator();
        while(it.hasNext()){
          SbiFunctions func = (SbiFunctions)it.next();
          LowFunctionality lowFunctionality = toLowFunctionality(func, false);
          lowFunctList.add(lowFunctionality);
          logger.debug( "ADD funcionality:"+lowFunctionality.getName() );
        }
      }
View Full Code Here

Examples of it.eng.spagobi.analiticalmodel.functionalitytree.metadata.SbiFunctions

          Expression.isNull("parentFunct"),
          Expression.eq("functTypeCd", "LOW_FUNCT"));
      /* ************ end luca changes ************** */
      Criteria criteria = aSession.createCriteria(SbiFunctions.class);
      criteria.add(filters);
      SbiFunctions hibFunct = (SbiFunctions) criteria.uniqueResult();
      if (hibFunct == null)
        return null;
      lowFunctionaliy = toLowFunctionality(hibFunct, recoverBIObjects);
      tx.commit();
    } catch (HibernateException he) {
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.