Package it.eng.spagobi.wapp.metadata

Examples of it.eng.spagobi.wapp.metadata.SbiMenu


      tx = tmpSession.beginTransaction()

      Criterion domainCdCriterrion = Expression.eq("menuId", menuID);
      Criteria criteria = tmpSession.createCriteria(SbiMenu.class);
      criteria.add(domainCdCriterrion);
      SbiMenu hibMenu = (SbiMenu) criteria.uniqueResult();
      if (hibMenu == null)
        return null;

      //SbiMenu hibMenu = (SbiMenu)tmpSession.load(SbiMenu.class,  menuID);
      toReturn = toMenu(hibMenu, null);
View Full Code Here


      tx = tmpSession.beginTransaction()

      Criterion domainCdCriterrion = Expression.eq("menuId", menuID);
      Criteria criteria = tmpSession.createCriteria(SbiMenu.class);
      criteria.add(domainCdCriterrion);
      SbiMenu hibMenu = (SbiMenu) criteria.uniqueResult();
      if (hibMenu == null)
        return null;

      //SbiMenu hibMenu = (SbiMenu)tmpSession.load(SbiMenu.class,  menuID);
      toReturn = toMenu(hibMenu, roleID);
View Full Code Here

      tx = tmpSession.beginTransaction();
      Criterion labelCriterrion = Expression.eq("name",
          name);
      Criteria criteria = tmpSession.createCriteria(SbiMenu.class);
      criteria.add(labelCriterrion)
      SbiMenu hibMenu = (SbiMenu) criteria.uniqueResult();
      if (hibMenu == null) return null;
      biMenu = toMenu(hibMenu, null);       

      //tx.commit();
    } catch (HibernateException he) {
View Full Code Here

    Transaction tx = null;
    try {
      tmpSession = getSession();
      tx = tmpSession.beginTransaction();

      SbiMenu hibMenu = (SbiMenu) tmpSession.load(SbiMenu.class, aMenu.getMenuId());
      hibMenu.setName(aMenu.getName());
      hibMenu.setDescr(aMenu.getDescr());
      hibMenu.setParentId(aMenu.getParentId())
      hibMenu.setObjId(aMenu.getObjId());
      hibMenu.setObjParameters(aMenu.getObjParameters());
      hibMenu.setSubObjName(aMenu.getSubObjName());
      hibMenu.setSnapshotName(aMenu.getSnapshotName());
      hibMenu.setSnapshotHistory(aMenu.getSnapshotHistory());
      hibMenu.setFunctionality(aMenu.getFunctionality());
      hibMenu.setInitialPath(aMenu.getInitialPath());
     
      //Modify Roles Associated
      // delete all roles previously associated
      Set oldRoles = hibMenu.getSbiMenuRoles();
      Iterator iterOldRoles = oldRoles.iterator();
      while (iterOldRoles.hasNext()) {
        SbiMenuRole role = (SbiMenuRole) iterOldRoles.next();
        tmpSession.delete(role);
      }
      // save roles functionality
      Set menuRoleToSave = new HashSet();
      menuRoleToSave.addAll(saveRolesMenu(tmpSession, hibMenu,
          aMenu));
      // set new roles into sbiFunctions
      hibMenu.setSbiMenuRoles(menuRoleToSave);
     
      // delete incongruous roles associations
      deleteIncongruousRoles(tmpSession, hibMenu);

      hibMenu.setViewIcons(new Boolean(aMenu.isViewIcons()));
      hibMenu.setHideToolbar(new Boolean(aMenu.getHideToolbar()));
      hibMenu.setHideSliders(new Boolean(aMenu.getHideSliders()));

      hibMenu.setStaticPage(aMenu.getStaticPage());
      hibMenu.setExternalApplicationUrl(aMenu.getExternalApplicationUrl());
      updateSbiCommonInfo4Update(hibMenu);
      tx.commit();

    } catch (HibernateException he) {
      logException(he);
View Full Code Here

    getChildrenMenuNodesQuery.setInteger(0, menuId.intValue());
    List childrenMenuNodes = getChildrenMenuNodesQuery.list();
    if (childrenMenuNodes != null && !childrenMenuNodes.isEmpty()) {
      Iterator it = childrenMenuNodes.iterator();
      while (it.hasNext()) {
        SbiMenu menu = (SbiMenu) it.next();
        deleteIncongruousRoles(aSession, menu);
      }
    }
  }
View Full Code Here

    Session tmpSession = null;
    Transaction tx = null;
    try {
      tmpSession = getSession();
      tx = tmpSession.beginTransaction();
      SbiMenu hibMenu = new SbiMenu();
      hibMenu.setName(aMenu.getName());
      hibMenu.setDescr(aMenu.getDescr());
      hibMenu.setParentId(aMenu.getParentId());
      hibMenu.setObjId(aMenu.getObjId());
      hibMenu.setObjParameters(aMenu.getObjParameters());
      hibMenu.setSubObjName(aMenu.getSubObjName());
      hibMenu.setSnapshotName(aMenu.getSnapshotName());
      hibMenu.setSnapshotHistory(aMenu.getSnapshotHistory());
      hibMenu.setFunctionality(aMenu.getFunctionality());
      hibMenu.setInitialPath(aMenu.getInitialPath());
      hibMenu.setViewIcons(new Boolean(aMenu.isViewIcons()));
      hibMenu.setHideToolbar(new Boolean(aMenu.getHideToolbar()));
      hibMenu.setHideSliders(new Boolean(aMenu.getHideSliders()));
      hibMenu.setStaticPage(aMenu.getStaticPage());
      hibMenu.setExternalApplicationUrl(aMenu.getExternalApplicationUrl());
     
      // manages prog column that determines the menu order
      Query hibQuery = null;
      if (aMenu.getParentId() == null || aMenu.getParentId().intValue()==0 ) //hibMenu.setProg(new Integer(1));
        hibQuery = tmpSession.createQuery("select max(s.prog) from SbiMenu s where s.parentId is null ");
      else {
        // loads sub menu
        //hibQuery = tmpSession.createQuery("select max(s.prog) from SbiMenu s where s.parentId = " + aMenu.getParentId());
        hibQuery = tmpSession.createQuery("select max(s.prog) from SbiMenu s where s.parentId = ?" );
        hibQuery.setInteger(0, aMenu.getParentId().intValue());
      }
      Integer maxProg = (Integer) hibQuery.uniqueResult();
      if (maxProg != null) hibMenu.setProg(new Integer(maxProg.intValue() + 1));
      else hibMenu.setProg(new Integer(1));
     
      updateSbiCommonInfo4Insert(hibMenu);
      tmpSession.save(hibMenu);

      Set menuRoleToSave = new HashSet();
      Set temp=saveRolesMenu(tmpSession, hibMenu,
          aMenu);
      menuRoleToSave.addAll(temp);
      // set new roles into sbiFunctions
      hibMenu.setSbiMenuRoles(menuRoleToSave);

      tx.commit();
    } catch (HibernateException he) {
      logException(he);
View Full Code Here

    Transaction tx = null;
    try {
      tmpSession = getSession();
      tx = tmpSession.beginTransaction();

      SbiMenu hibMenu = (SbiMenu) tmpSession.load(SbiMenu.class, aMenu.getMenuId());

      Set oldRoles = hibMenu.getSbiMenuRoles();
      Iterator iterOldRoles = oldRoles.iterator();
      while (iterOldRoles.hasNext()) {
        SbiMenuRole role = (SbiMenuRole) iterOldRoles.next();
        tmpSession.delete(role);
      }
      Integer eventualFatherId = aMenu.getMenuId();
      eraseMenuSons(eventualFatherId,tmpSession);

      // update prog column in other menu
      //String hqlUpdateProg = "update SbiMenu s set s.prog = (s.prog - 1) where s.prog > "
      //  + hibMenu.getProg() + " and s.parentId = " + hibMenu.getParentId();
     
      Integer parentId = hibMenu.getParentId();
      String hqlUpdateProg = null;
      Query query = null;
      if (parentId != null) {
        hqlUpdateProg = "update SbiMenu s set s.prog = (s.prog - 1) where s.prog > ?"
           + " and s.parentId = ? ";
        query = tmpSession.createQuery(hqlUpdateProg);
        query.setInteger(0, hibMenu.getProg().intValue());
        query.setInteger(1,  hibMenu.getParentId().intValue());
      } else {
        hqlUpdateProg = "update SbiMenu s set s.prog = (s.prog - 1) where s.prog > ?"
           + " and s.parentId = null";
        query = tmpSession.createQuery(hqlUpdateProg);
        query.setInteger(0, hibMenu.getProg().intValue());
      }

      query.executeUpdate();
     
      tmpSession.delete(hibMenu);
View Full Code Here

   
    List sons = queryD.list();
    if(sons!=null){
      Iterator it = sons.iterator();
      while(it.hasNext()){
        SbiMenu toDel = (SbiMenu)it.next();
        eraseMenuSons(toDel.getMenuId(),tmpSession);
        tmpSession.delete(toDel)
        Integer parentId = toDel.getParentId();
        String hqlUpdateProg = null;
        Query query = null;
        if (parentId != null) {
          hqlUpdateProg = "update SbiMenu s set s.prog = (s.prog - 1) where s.prog > ?"
             + " and s.parentId = ? ";
          query = tmpSession.createQuery(hqlUpdateProg);
          query.setInteger(0, toDel.getProg().intValue());
          query.setInteger(1,  toDel.getParentId().intValue());
        } else {
          hqlUpdateProg = "update SbiMenu s set s.prog = (s.prog - 1) where s.prog > ?"
             + " and s.parentId = null";
          query = tmpSession.createQuery(hqlUpdateProg);
          query.setInteger(0, toDel.getProg().intValue());
        }

        query.executeUpdate();
      }
    }
View Full Code Here

      Query hibQuery = tmpSession.createQuery(" from SbiMenu s order by s.parentId, s.prog");

      List hibList = hibQuery.list();
      Iterator it = hibList.iterator();     
      while (it.hasNext()) {     
        SbiMenu hibMenu = (SbiMenu) it.next()
        if (hibMenu != null) {
          Menu biMenu = toMenu(hibMenu, null);
          logger.debug("Add Menu:"+biMenu.getName());
          realResult.add(biMenu);
        }
View Full Code Here

      aQuery.setInteger(0, menuId.intValue());
     
      List hibList = aQuery.list();
      Iterator it = hibList.iterator();     
      while (it.hasNext()) {     
        SbiMenu hibMenu = (SbiMenu) it.next()
        if (hibMenu != null) {
            if (roleID != null){
              //check if the child can be visualized from the user
              hql = " from SbiMenuRole as mf  where mf.id.menuId = ? and mf.id.extRoleId = ? ";
              
              aQuery = tmpSession.createQuery(hql);
              aQuery.setInteger(0, hibMenu.getMenuId());
              aQuery.setInteger(1, roleID);
             
              List hibListRoles = aQuery.list();
              if (hibListRoles.size()>0){
                 Menu biMenu = toMenu(hibMenu, roleID)
View Full Code Here

TOP

Related Classes of it.eng.spagobi.wapp.metadata.SbiMenu

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.