Package it.eng.spagobi.analiticalmodel.functionalitytree.bo

Examples of it.eng.spagobi.analiticalmodel.functionalitytree.bo.LowFunctionality


   *
   * @see it.eng.spagobi.analiticalmodel.functionalitytree.dao.ILowFunctionalityDAO#loadLowFunctionalityByLabel(java.lang.String)
   */
  public LowFunctionality loadLowFunctionalityByCode(String code, boolean recoverBIObjects) throws EMFUserError {
    logger.debug( "IN" );
    LowFunctionality funct = null;
    Session aSession = null;
    Transaction tx = null;
    try {
      aSession = getSession();
      tx = aSession.beginTransaction();
View Full Code Here


      //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() );
        }
      }
      tx.commit();

    } catch (HibernateException he) {
View Full Code Here

   *
   * @see it.eng.spagobi.analiticalmodel.functionalitytree.dao.ILowFunctionalityDAO#loadRootLowFunctionality(boolean)
   */
  public LowFunctionality loadRootLowFunctionality(boolean recoverBIObjectsthrows EMFUserError {
    logger.debug( "IN" );
    LowFunctionality lowFunctionaliy = null;
    Session aSession = null;
    Transaction tx = null;
    try {
      aSession = getSession();
      tx = aSession.beginTransaction();
View Full Code Here

   *
   * @see it.eng.spagobi.analiticalmodel.functionalitytree.dao.ILowFunctionalityDAO#loadLowFunctionalityByPath(java.lang.String)
   */
  public LowFunctionality loadLowFunctionalityByPath(String functionalityPath, boolean recoverBIObjects) throws EMFUserError
    logger.debug( "IN" );
    LowFunctionality lowFunctionaliy = null;
    Session aSession = null;
    Transaction tx = null;
    try {
      aSession = getSession();
      tx = aSession.beginTransaction();
View Full Code Here

   *
   * @return the corrispondent output <code>LowFunctionality</code>
   */
  public LowFunctionality toLowFunctionality(SbiFunctions hibFunct, boolean recoverBIObjects){
    logger.debug( "IN" );
    LowFunctionality lowFunct = new LowFunctionality();
    lowFunct.setId(hibFunct.getFunctId());
    logger.debug( "ID="+hibFunct.getFunctId().toString() );
    lowFunct.setCode(hibFunct.getCode());
    lowFunct.setCodType(hibFunct.getFunctTypeCd());
    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();
    List testRolesList = new ArrayList();
    List execRolesList = new ArrayList();
    List createRolesList = new ArrayList();

    Set roles = hibFunct.getSbiFuncRoles();
    if (roles!=null){
      logger.debug( "getSbiFuncRoles() size="+roles.size() );
      Iterator iterRoles = roles.iterator();
      while(iterRoles.hasNext()) {
        SbiFuncRole hibfuncrole = (SbiFuncRole)iterRoles.next();
        SbiExtRoles hibRole = hibfuncrole.getId().getRole();
        SbiDomains hibPermission = hibfuncrole.getId().getState();
        logger.debug( "hibfuncrole.getId().getRole().getName()="+hibRole.getName() );
        RoleDAOHibImpl roleDAO =  new RoleDAOHibImpl();
        Role role = roleDAO.toRole(hibRole);

        String state = hibPermission.getValueCd();
        if(state.equals(SpagoBIConstants.PERMISSION_ON_FOLDER_TO_DEVELOP)) {
          devRolesList.add(role);
        } else if(state.equals(SpagoBIConstants.PERMISSION_ON_FOLDER_TO_TEST)) {
          testRolesList.add(role);
        } else if(state.equals(SpagoBIConstants.PERMISSION_ON_FOLDER_TO_EXECUTE)) {
          execRolesList.add(role);
        } else if(state.equals(SpagoBIConstants.PERMISSION_ON_FOLDER_TO_CREATE)) {
          createRolesList.add(role);
        }
      }
    }

    Role[] execRoles = new Role[execRolesList.size()];
    Role[] devRoles = new Role[devRolesList.size()];
    Role[] testRoles = new Role[testRolesList.size()];
    Role[] createRoles = new Role[createRolesList.size()];

    for (int i = 0; i < execRolesList.size(); i++)
      execRoles[i] = (Role) execRolesList.get(i);
    for (int i = 0; i < testRolesList.size(); i++)
      testRoles[i] = (Role) testRolesList.get(i);
    for (int i = 0; i < devRolesList.size(); i++)
      devRoles[i] = (Role) devRolesList.get(i);
    for (int i = 0; i < createRolesList.size(); i++)
      createRoles[i] = (Role) createRolesList.get(i);

    lowFunct.setDevRoles(devRoles);
    lowFunct.setTestRoles(testRoles);
    lowFunct.setExecRoles(execRoles);
    lowFunct.setCreateRoles(createRoles);

    List biObjects = new ArrayList();
    if (recoverBIObjects) {

      BIObjectDAOHibImpl objDAO = null;
      try {
        objDAO = (BIObjectDAOHibImpl) DAOFactory.getBIObjectDAO();

        Set hibObjFuncs = hibFunct.getSbiObjFuncs();
        for (Iterator it = hibObjFuncs.iterator(); it.hasNext();) {
          SbiObjFunc hibObjFunc = (SbiObjFunc) it.next();
          BIObject object = objDAO.toBIObject(hibObjFunc.getId()
              .getSbiObjects());
          biObjects.add(object);
        }
      } catch (EMFUserError e) {
        logger.error("Error", e);
      }
    }
    lowFunct.setBiObjects(biObjects);
    logger.debug( "OUT" );



    return lowFunct;
View Full Code Here

  }
 
  private boolean existFunction (List lstFunctions, SbiFunctions newFunct){
    boolean res = false;
    for (int i=0; i< lstFunctions.size(); i++){
      LowFunctionality tmpFunct = (LowFunctionality)lstFunctions.get(i);
      if (tmpFunct.getCode().equalsIgnoreCase(newFunct.getCode())){
        res = true;
        break;
      }
    }
    return res;
View Full Code Here

   * @see it.eng.spagobi.analiticalmodel.functionalitytree.dao.ILowFunctionalityDAO#loadAllLowFunctionalities(Integer)
   */
  public List loadParentFunctionalities(Integer functId, Integer rootFolderID) throws EMFUserError {
    logger.debug( "IN" );

    LowFunctionality funct = null;
    Integer tmpFunctId = null;
    Session aSession = null;
    Transaction tx = null;
    List realResult = new ArrayList();
    try {
View Full Code Here

      BIObject prevObj = objDAO.loadBIObjectById(id);
      List functionalitiesId = prevObj.getFunctionalities();
      Iterator it = functionalitiesId.iterator();
      while (it.hasNext()) {
        Integer folderId = (Integer) it.next();
        LowFunctionality folder = DAOFactory.getLowFunctionalityDAO().loadLowFunctionalityByID(folderId, false);
        String folderPath = folder.getPath();
        if (!folderPath.equalsIgnoreCase(initialPath) && !folderPath.startsWith(initialPath + "/")) {
          functionalities.add(folderId);
        }
      }
    }
View Full Code Here

   
    htmlStream.append("        " + treeName + " = new dTree('" + treeName + "', '" + context + "');\n");
       htmlStream.append("            " + treeName + ".add(" + dTreeRootId + ",-1,'"+nameTree+"');\n");
       Iterator it = objectsList.iterator();
       while (it.hasNext()) {
         LowFunctionality folder = (LowFunctionality) it.next();
         boolean isRoot = false;
        
         //only user personal folder
         boolean isUserFunct = folder.getPath().startsWith("/"+((UserProfile)profile).getUserId());
         if(!isUserFunct) {
           if (initialPath != null) {
             if (initialPath.equalsIgnoreCase(folder.getPath()))
               isRoot = true;
           } else {
             if (folder.getParentId() == null)
               isRoot = true;
           }
         }
         try {
        addItemForJSTree(htmlStream, folder, isRoot, isUserFunct);
View Full Code Here

      logger.error("FoldersJSONSerializer is unable to serialize object of type: " + o.getClass().getName());
      throw new SerializationException("FoldersJSONSerializer is unable to serialize object of type: " + o.getClass().getName());
    }
   
    try {
      LowFunctionality lowFunct = (LowFunctionality)o;
      result = new JSONObject();
     
      result.put(ID, lowFunct.getId() );
      result.put(CODE, lowFunct.getCode() );
      result.put(CODTYPE, lowFunct.getCodType() );
      result.put(PATH, lowFunct.getPath() );     
      result.put(PROG, lowFunct.getProg() );
      result.put(PARENTID, lowFunct.getParentId() );
      MessageBuilder msgBuild=new MessageBuilder();
      String lowFunctName=msgBuild.getUserMessage(lowFunct.getName(),null, locale);
      result.put(NAME, lowFunctName );
      String description = lowFunct.getDescription() != null ? msgBuild.getUserMessage(lowFunct.getDescription(), null,locale) : "";
      result.put(DESCRIPTION, description)
      result.put(DEVROLES, lowFunct.getDevRoles() );
      result.put(TESTROLES, lowFunct.getTestRoles() );   
      result.put(EXECROLES, lowFunct.getExecRoles() );
      result.put(BIOBJECTS, lowFunct.getBiObjects() );   
      result.put(ACTIONS, new JSONArray());
    } catch (Throwable t) {
      logger.error("An error occurred while serializing object: " + o);
      throw new SerializationException("An error occurred while serializing object: " + o, t);
    } finally {
View Full Code Here

TOP

Related Classes of it.eng.spagobi.analiticalmodel.functionalitytree.bo.LowFunctionality

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.