Examples of SbiMenu


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

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

      SbiMenu sbiMenu=(SbiMenu)tmpSession.load(SbiMenu.class, menuID);

      Integer fatherId=sbiMenu.getParentId();
      SbiMenu sbiFatherMenu=(SbiMenu)tmpSession.load(SbiMenu.class, fatherId);

      Integer grandFatherId=sbiFatherMenu.getParentId();

      //Change children:

      // get the children of old father, they will point to new father
      Criterion parentCriterrion = Expression.eq("parentId",
          fatherId);
      Criteria criteria = tmpSession.createCriteria(SbiMenu.class);
      criteria.add(parentCriterrion);

      // Get the list of children from the old father
      List oldFatherChildren=criteria.list();

      //I can retrieve all the children now and save all them
      for (Iterator iterator = oldFatherChildren.iterator(); iterator.hasNext();) {
        SbiMenu sbiMenuO = (SbiMenu) iterator.next();
        sbiMenuO.setParentId(menuID);
      }


      Criterion childCriterrion = Expression.eq("parentId",
          menuID);
      Criteria childCriteria = tmpSession.createCriteria(SbiMenu.class);
      childCriteria.add(childCriterrion);

      // Get the list of children from the new father
      List newFatherChildren=childCriteria.list();

      for (Iterator iterator = newFatherChildren.iterator(); iterator.hasNext();) {
        SbiMenu sbiMenuO = (SbiMenu) iterator.next();
        if(!(oldFatherChildren.contains(sbiMenuO))) sbiMenuO.setParentId(fatherId);
      }
     
      Integer fatherProg = sbiFatherMenu.getProg();
      Integer menuProg = sbiMenu.getProg();
      sbiMenu.setParentId(grandFatherId);
View Full Code Here

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

    Session tmpSession = null;
    Transaction tx = null;
    try {
      tmpSession = getSession();
      tx = tmpSession.beginTransaction();
      SbiMenu hibMenu = (SbiMenu) tmpSession.load(SbiMenu.class, menuID);
      Integer oldProg = hibMenu.getProg();
      Integer newProg = new Integer(oldProg.intValue() - 1);
      String upperMenuHql = "";
      Query query = null;
      if (hibMenu.getParentId() == null || hibMenu.getParentId().intValue()==0){
        //upperMenuHql = "from SbiMenu s where s.prog = " + newProg.toString() +
        //" and s.parentId is null ";
        upperMenuHql = "from SbiMenu s where s.prog = ? "  +
        " and (s.parentId is null or s.parentId = 0)";
        query = tmpSession.createQuery(upperMenuHql);
        query.setInteger(0, newProg.intValue());
      }
      else{
        //upperMenuHql = "from SbiMenu s where s.prog = " + newProg.toString() +
        //" and s.parentId = " + hibMenu.getParentId().toString();
         upperMenuHql = "from SbiMenu s where s.prog = ? "  +
          " and s.parentId = ? ";
         query = tmpSession.createQuery(upperMenuHql);
         query.setInteger(0, newProg.intValue());
         query.setInteger(1, hibMenu.getParentId().intValue());
      }
     
      SbiMenu hibUpperMenu = (SbiMenu) query.uniqueResult();
      if (hibUpperMenu == null) {
        logger.error("The menu with prog [" + newProg + "] does not exist.");
        return;
      }
     
      hibMenu.setProg(newProg);
      hibUpperMenu.setProg(oldProg);
      updateSbiCommonInfo4Update(hibMenu);
      updateSbiCommonInfo4Update(hibUpperMenu);
      tx.commit();
    } catch (HibernateException he) {
      if (tx != null)
View Full Code Here

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

    Transaction tx = null;
    try {
     
      tmpSession = getSession();
      tx = tmpSession.beginTransaction();
      SbiMenu hibMenu = (SbiMenu) tmpSession.load(SbiMenu.class, menuID);
      Integer oldProg = hibMenu.getProg();
      Integer newProg = new Integer(oldProg.intValue() + 1);
     
      String upperMenuHql = "";
      Query query = null;
      if (hibMenu.getParentId() == null || hibMenu.getParentId().intValue()==0){
        //upperMenuHql = "from SbiMenu s where s.prog = " + newProg.toString() +
        //" and s.parentId is null ";
        upperMenuHql = "from SbiMenu s where s.prog = ? "  +
        " and (s.parentId is null or s.parentId = 0)";
        query = tmpSession.createQuery(upperMenuHql);
        query.setInteger(0, newProg.intValue());
      }
      else {
        //upperMenuHql = "from SbiMenu s where s.prog = " + newProg.toString() +
        //" and s.parentId = " + hibMenu.getParentId().toString();
        upperMenuHql = "from SbiMenu s where s.prog = ? "  +
        " and s.parentId = ? " ;
        query = tmpSession.createQuery(upperMenuHql);
        query.setInteger(0, newProg.intValue());
        query.setInteger(1, hibMenu.getParentId().intValue());
      }
      //Query query = tmpSession.createQuery(upperMenuHql);
      SbiMenu hibUpperMenu = (SbiMenu) query.uniqueResult();
      if (hibUpperMenu == null) {
        logger.error("The menu with prog [" + newProg + "] does not exist.");
        return;
      }
     
      hibMenu.setProg(newProg);
      hibUpperMenu.setProg(oldProg);
      updateSbiCommonInfo4Update(hibMenu);
      updateSbiCommonInfo4Update(hibUpperMenu);
      tx.commit();
    } catch (HibernateException he) {
      if (tx != null)
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.