Examples of SbiFunctions


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

      aSession = getSession();
      tx = aSession.beginTransaction();
      Criterion domainCdCriterrion = Expression.eq("path", functionalityPath);
      Criteria criteria = aSession.createCriteria(SbiFunctions.class);
      criteria.add(domainCdCriterrion);
      SbiFunctions hibFunct = (SbiFunctions) criteria.uniqueResult();
      if (hibFunct == null)
        return null;
      lowFunctionaliy = toLowFunctionality(hibFunct, recoverBIObjects);
      tx.commit();
    } catch (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 = (SbiFunctions) aSession.load(
          SbiFunctions.class, aLowFunctionality.getId());
      // delete all roles functionality
     
      updateSbiCommonInfo4Update(hibFunct);
     
      Set oldRoles = hibFunct.getSbiFuncRoles();
      Iterator iterOldRoles = oldRoles.iterator();
      while (iterOldRoles.hasNext()) {
        SbiFuncRole role = (SbiFuncRole) iterOldRoles.next();
        aSession.delete(role);
      }
      // save roles functionality
      Set functRoleToSave = new HashSet();
      functRoleToSave.addAll(saveRolesFunctionality(aSession, hibFunct,
          aLowFunctionality, SpagoBIConstants.PERMISSION_ON_FOLDER_TO_DEVELOP));
      functRoleToSave.addAll(saveRolesFunctionality(aSession, hibFunct,
          aLowFunctionality, SpagoBIConstants.PERMISSION_ON_FOLDER_TO_TEST));
      functRoleToSave.addAll(saveRolesFunctionality(aSession, hibFunct,
          aLowFunctionality, SpagoBIConstants.PERMISSION_ON_FOLDER_TO_EXECUTE));
      functRoleToSave.addAll(saveRolesFunctionality(aSession, hibFunct,
          aLowFunctionality, SpagoBIConstants.PERMISSION_ON_FOLDER_TO_CREATE));
      // set new roles into sbiFunctions
      hibFunct.setSbiFuncRoles(functRoleToSave);
      // set new data
      hibFunct.setDescr(aLowFunctionality.getDescription());
      Criterion domainCdCriterrion = Expression.eq("valueCd",
          aLowFunctionality.getCodType());
      Criteria criteria = aSession.createCriteria(SbiDomains.class);
      criteria.add(domainCdCriterrion);
      SbiDomains functTypeDomain = (SbiDomains) criteria.uniqueResult();
      if (functTypeDomain == null){
        logger.error("The Domain with value_cd="+aLowFunctionality.getCodType()+" does not exist.");
        throw new EMFUserError(EMFErrorSeverity.ERROR, 1037);
      }

      hibFunct.setFunctType(functTypeDomain);
      hibFunct.setFunctTypeCd(aLowFunctionality.getCodType());
      hibFunct.setName(aLowFunctionality.getName());
     
     
     
      Integer parentId = aLowFunctionality.getParentId();
      Criteria parentCriteria = aSession.createCriteria(SbiFunctions.class);
      Criterion parentCriterion = Expression.eq("functId", parentId);
      parentCriteria.add(parentCriterion);
      SbiFunctions hibParentFunct = (SbiFunctions) parentCriteria.uniqueResult();
      if (hibParentFunct == null){
        logger.error("The parent Functionality with id = " + parentId + " does not exist.");
        throw new EMFUserError(EMFErrorSeverity.ERROR, 1037);
      }
      hibFunct.setParentFunct(hibParentFunct);

      // manages code and path
      String previousCode = hibFunct.getCode();
      String previousPath = hibFunct.getPath();
      String newCode = aLowFunctionality.getCode();
      String newPath = aLowFunctionality.getPath();
      if (!previousCode.equals(newCode) || !previousPath.equals(newPath)) {
        // the code or the path was changed, so the path of the current folder and of its child folders
        // must be changed

        // the condition !previousPath.equals(newPath) was added for the following reason:
        // till SpagoBI 1.9.3 a folder may have a path different from parentPath + "/" + code,
        // with this condition those cases are considered and corrected.

        // changes the code and path of the current folder
        hibFunct.setCode(newCode);
        hibFunct.setPath(newPath);

        // loads sub folders and changes their path
        Criteria subFoldersCriteria = aSession.createCriteria(SbiFunctions.class);
        Criterion subFoldersCriterion = Expression.like("path", previousPath + "/", MatchMode.START);
        subFoldersCriteria.add(subFoldersCriterion);
        List hibList = subFoldersCriteria.list();
        Iterator it = hibList.iterator();
        while (it.hasNext()) {
          SbiFunctions aSbiFunctions = (SbiFunctions) it.next();
          String oldPath = aSbiFunctions.getPath();
          String unchanged = oldPath.substring(previousPath.length());
          aSbiFunctions.setPath(newPath + unchanged);
        }
      }

      // commit all changes
      tx.commit();
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();
      hibFunct.setCode(aLowFunctionality.getCode());
      hibFunct.setDescr(aLowFunctionality.getDescription());
      Criterion domainCdCriterrion = Expression.eq("valueCd",
          aLowFunctionality.getCodType());
      Criteria criteria = aSession.createCriteria(SbiDomains.class);
      criteria.add(domainCdCriterrion);
      SbiDomains functTypeDomain = (SbiDomains) criteria.uniqueResult();
      if (functTypeDomain == null){
        logger.error("The Domain with value_cd="+aLowFunctionality.getCodType()+" does not exist.");
        throw new EMFUserError(EMFErrorSeverity.ERROR, 1038);
      }
      hibFunct.setFunctType(functTypeDomain);
      hibFunct.setFunctTypeCd(aLowFunctionality.getCodType());
      hibFunct.setName(aLowFunctionality.getName());
      hibFunct.setPath(aLowFunctionality.getPath());

      Integer parentId = aLowFunctionality.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

        params.put(SpagoBIConstants.OPERATION, SpagoBIConstants.FUNCTIONALITIES_OPERATION);
        throw new EMFUserError(EMFErrorSeverity.ERROR, 1000, new Vector(), params);
      }
      aSession = getSession();
      tx = aSession.beginTransaction();
      SbiFunctions hibFunct = (SbiFunctions) aSession.load(
          SbiFunctions.class, aLowFunctionality.getId());
      Set oldRoles = hibFunct.getSbiFuncRoles();
      Iterator iterOldRoles = oldRoles.iterator();
      while (iterOldRoles.hasNext()) {
        SbiFuncRole role = (SbiFuncRole) iterOldRoles.next();
        aSession.delete(role);
      }

      // update prog column in other functions
      //String hqlUpdateProg = "update SbiFunctions s set s.prog = (s.prog - 1) where s.prog > "
      //  + hibFunct.getProg() + " and s.parentFunct.functId = " + hibFunct.getParentFunct().getFunctId();
      if(hibFunct.getParentFunct()!=null){
        String hqlUpdateProg = "update SbiFunctions s set s.prog = (s.prog - 1) where s.prog > ? "
          + " and s.parentFunct.functId = ?" ;
        Query query = aSession.createQuery(hqlUpdateProg);
        query.setInteger(0, hibFunct.getProg().intValue());
        query.setInteger(1, hibFunct.getParentFunct().getFunctId().intValue());
        query.executeUpdate();
      }

      aSession.delete(hibFunct);
View Full Code Here

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

    lowFunct.setDescription(hibFunct.getDescr());
    lowFunct.setName(hibFunct.getName());
    logger.debug( "NAME="+hibFunct.getName() );
    lowFunct.setPath(hibFunct.getPath());
    lowFunct.setProg(hibFunct.getProg());
    SbiFunctions parentFuntionality = hibFunct.getParentFunct();
    if (parentFuntionality != null
      // if it is not the root find the id of the parent functionality
      lowFunct.setParentId(parentFuntionality.getFunctId());
    else
      // if it is the root set the parent id to null
      lowFunct.setParentId(null);

    List devRolesList = new ArrayList();
View Full Code Here

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

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

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

      // loads folder corresponding to initial path
      Criterion domainCdCriterrion = Expression.eq("path",initialPath);
      Criteria criteria = aSession.createCriteria(SbiFunctions.class);
      criteria.add(domainCdCriterrion);
      SbiFunctions hibFunct = (SbiFunctions) criteria.uniqueResult();
      if (hibFunct == null) return null;
      realResult.add(toLowFunctionality(hibFunct, recoverBIObjects));

      // loads sub functionalities
View Full Code Here

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

      parentCriteria.add(parentChildCriterion);
      List childFunctions = parentCriteria.list();
      if (childFunctions != null && childFunctions.size() > 0) return true;

      // controls if there are objects inside
      SbiFunctions hibFunct = (SbiFunctions) aSession.load(SbiFunctions.class, id);
      Set hibObjfunctions = hibFunct.getSbiObjFuncs();
      if (hibObjfunctions != null && hibObjfunctions.size() > 0) return true;
//      Criterion objectChildCriterion = Expression.eq("sbiFunction.functId", id);
//      Criteria objectCriteria = aSession.createCriteria(SbiObjFunc.class);
//      objectCriteria.add(objectChildCriterion);
//      List childObjects = objectCriteria.list();
View Full Code Here

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

      while (i.hasNext()){
        ArrayList rolesArray = (ArrayList)i.next();
        Integer functId = (Integer)rolesArray.get(0);
        Integer roleId = (Integer)rolesArray.get(1);
        String permission = (String)rolesArray.get(2);
        SbiFunctions sbiFunct = new SbiFunctions();
        sbiFunct.setFunctId(functId);

        //hql = " from SbiFuncRole as funcRole where funcRole.id.function = '" + sbiFunct.getFunctId() +
        //"' AND  funcRole.id.role = '"+ roleId +"' AND funcRole.stateCd ='"+stateCD+"'";
        hql = " from SbiFuncRole as funcRole where funcRole.id.function = ? " +
        " AND  funcRole.id.role = ?  AND funcRole.stateCd = ?";

        hqlQuery = aSession.createQuery(hql);
        hqlQuery.setInteger(0, sbiFunct.getFunctId().intValue());
        hqlQuery.setInteger(1, roleId.intValue());
        hqlQuery.setString(2, permission);
        functions = hqlQuery.list();

        Iterator it = functions.iterator();
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);
     
      Integer oldProg = hibFunct.getProg();
      Integer newProg = new Integer(oldProg.intValue() + 1);

      //String upperFolderHql = "from SbiFunctions s where s.prog = " + newProg.toString() +
      //  " and s.parentFunct.functId = " + hibFunct.getParentFunct().getFunctId().toString();
      String upperFolderHql = "from SbiFunctions s where s.prog = ? "+
      " and s.parentFunct.functId = ?" ;
      Query query = aSession.createQuery(upperFolderHql);
      query.setInteger(0, newProg.intValue());     
      query.setInteger(1, hibFunct.getParentFunct().getFunctId().intValue());
      SbiFunctions hibUpperFunct = (SbiFunctions) query.uniqueResult();
      if (hibUpperFunct == null) {
        logger.error("The function with prog [" + newProg + "] does not exist.");
        return;
      }
     
      hibFunct.setProg(newProg);
      hibUpperFunct.setProg(oldProg);
     
      updateSbiCommonInfo4Update(hibFunct);
      updateSbiCommonInfo4Update(hibUpperFunct);
     
      tx.commit();
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.