Package com.jada.jpa.entity

Examples of com.jada.jpa.entity.Menu


      EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
        AdminBean adminBean = getAdminBean(request);
        Site site = adminBean.getSite();
        MenuMaintActionForm form = (MenuMaintActionForm) actionForm;
        initSiteProfiles(form, site);
        Menu menu = (Menu) em.find(Menu.class, Format.getLong(form.getMenuId()));
   
    cascadeRemoveMenu(Format.getLong(form.getMenuId()), site.getSiteId());
       
        Long siteProfileClassId = form.getSiteProfileClassId();
        form.setJsonMenuList(Utility.makeJSONMenuTree(Format.getLong(form.getSiteDomainId()), siteProfileClassId, form.isSiteProfileClassDefault()).toHtmlString());
        form.setMode("");
       
        CacheDAO.removeByKeyPrefix(site.getSiteId(), Constants.CACHE_MENU + "." + menu.getMenuSetName());

        ActionForward actionForward = actionMapping.findForward("success");
        return actionForward;
    }
View Full Code Here


        initSiteProfiles(form, site);
       
        Long siteProfileClassId = form.getSiteProfileClassId();
        form.setJsonMenuList(Utility.makeJSONMenuTree(Format.getLong(form.getSiteDomainId()), siteProfileClassId, form.isSiteProfileClassDefault()).toHtmlString());
        String menuId = (String) request.getParameter("menuId");
        Menu menu = MenuDAO.load(site.getSiteId(), Format.getLong(menuId));

        form.setMenuId(menuId);
        if (menu.getMenuParent() != null) {
          form.setMenuParentId(menu.getMenuParent().getMenuId().toString());
        }
       
        form.setMenuId(Format.getLong(menu.getMenuId()));
        form.setMenuSetName(menu.getMenuSetName());
        form.setMenuName(menu.getMenuLanguage().getMenuName());
        form.setMenuType(menu.getMenuType());
        form.setMenuUrl(menu.getMenuUrl());
        form.setMenuWindowTarget(menu.getMenuWindowTarget());
        form.setMenuWindowMode(menu.getMenuWindowMode());
        form.setPublished(menu.getPublished() == Constants.PUBLISHED_YES ? true : false);
        form.setMode(Constants.MODE_UPDATE);
        form.setPublished(true);
        form.setMode(Constants.MODE_UPDATE);
        form.setSequence(true);
       
View Full Code Here

    MenuDisplayForm childMenus[] = form.getChildrenMenus();
    String menuSetName = "";
        for (int i = 0; i < childMenus.length; i++) {
          int seqNum = Format.getInt(childMenus[i].getSeqNum());
          Long menuId = Format.getLong(childMenus[i].getMenuId());
        Menu menu = new Menu();
        menu = MenuDAO.load(site.getSiteId(), menuId);
        menu.setSeqNum(seqNum);
        menuSetName = menu.getMenuSetName();
        // em.update(menu);
        }
        Long siteProfileClassId = form.getSiteProfileClassId();
        form.setJsonMenuList(Utility.makeJSONMenuTree(Format.getLong(form.getSiteDomainId()), siteProfileClassId, form.isSiteProfileClassDefault()).toHtmlString());
        form.setSequence(true);
View Full Code Here

        ActionForward actionForward = actionMapping.findForward("success");
        return actionForward;
    }
   
    protected void initListInfo(MenuMaintActionForm form, String siteId) throws Exception {
    Menu menu = MenuDAO.load(siteId, Format.getLong(form.getMenuId()));
   
    Vector<MenuDisplayForm> vector = new Vector<MenuDisplayForm>();
    for (Menu childMenu : menu.getMenuChildren()) {
      MenuDisplayForm display = new MenuDisplayForm();
      display.setMenuId(Format.getLong(childMenu.getMenuId()));
      display.setMenuName(childMenu.getMenuLanguage().getMenuName());
      display.setSeqNum(Format.getInt(childMenu.getSeqNum()));
      display.setMenuWindowTarget(childMenu.getMenuWindowTarget());
View Full Code Here

      return errors;
    }
   
    public void cascadeRemoveMenu(Long menuId, String siteId) throws Exception {
      EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
      Menu parent = MenuDAO.load(siteId, menuId);
      for (Menu childMenu : parent.getMenuChildren()) {
        cascadeRemoveMenu(childMenu.getMenuId(), siteId);
      }
      parent.setMenuLanguage(null);
      for (MenuLanguage menuLanguage: parent.getMenuLanguages()) {
        em.remove(menuLanguage);
      }
      em.remove(parent);
      return;
    }
View Full Code Here

        sql = "from Menu menu where menu.siteDomain in (select siteDomain from SiteDomain siteDomain where siteDomain.site.siteId = :siteId)";
        query = em.createQuery(sql);
        query.setParameter("siteId", site.getSiteId());
        iterator = query.getResultList().iterator();
        while (iterator.hasNext()) {
          Menu menu = (Menu) iterator.next();
          menu.setMenuLanguage(null);
          for (MenuLanguage menuLanguage : menu.getMenuLanguages()) {
            em.remove(menuLanguage);
          }
          em.remove(menu);
        }
      
View Full Code Here

        String sql = "from Menu where siteId = :siteId order by menuSetName";
        Query query = em.createQuery(sql);
        query.setParameter("siteId", Constants.SITE_SYSTEM);
        Iterator<?> iterator = query.getResultList().iterator();
        while (iterator.hasNext()) {
          Menu master = (Menu) iterator.next();
          Menu menu = new Menu();
          PropertyUtils.copyProperties(menu, master);
//          menu.setSite(site);
          menu.setMenuId(null);
          menu.setRecUpdateBy(userId);
          menu.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
          menu.setRecCreateBy(userId);
          menu.setRecCreateDatetime(new Date(System.currentTimeMillis()));
          menu.setCategory(null);
          menu.setContent(null);
          menu.setItem(null);
          menu.setMenuLanguages(null);
          em.persist(menu);
        }
  }
View Full Code Here

    }
    CategorySearchUtil.contentDescSearchUpdate(content, site, adminBean);

    Iterator<?> iterator = content.getMenus().iterator();
    while (iterator.hasNext()) {
      Menu menu = (Menu) iterator.next();
      CacheDAO.removeByKeyPrefix(site.getSiteId(), Constants.CACHE_MENU + "." + menu.getMenuSetName());
    }
    Indexer.getInstance(site.getSiteId()).updateContent(content);
   
        copyProperties(form, content);
    createAdditionalInfo(adminBean, content, form);
View Full Code Here

        }
        em.remove(contentLanguage);
      }
      Iterator<?> iterator = content.getMenus().iterator();
      while (iterator.hasNext()) {
        Menu menu = (Menu) iterator.next();
        menu.setContent(null);
        CacheDAO.removeByKeyPrefix(site.getSiteId(), Constants.CACHE_MENU + "." + menu.getMenuSetName());
      }
      content.setContentLanguage(null);
      em.getTransaction().commit();
    }
    catch (Exception e) {
View Full Code Here

  public JSONEscapeObject createJsonSelectedMenus(String siteId, Content content, Long siteProfileClassId) throws Exception {
    JSONEscapeObject jsonResult = new JSONEscapeObject();
    Iterator<?> iterator = content.getMenus().iterator();
    Vector<JSONEscapeObject> menus = new Vector<JSONEscapeObject>();
    while (iterator.hasNext()) {
      Menu menu = (Menu) iterator.next();
      JSONEscapeObject menuObject = new JSONEscapeObject();
      menuObject.put("menuId", menu.getMenuId());
      menuObject.put("menuLongDesc", Utility.formatMenuName(siteId, menu.getMenuId(), siteProfileClassId));
      menuObject.put("siteDomainName", menu.getSiteDomain().getSiteDomainLanguage().getSiteName());
      menus.add(menuObject);
    }
    jsonResult.put("menus", menus);
    jsonResult.put("status", Constants.WEBSERVICE_STATUS_SUCCESS);
View Full Code Here

TOP

Related Classes of com.jada.jpa.entity.Menu

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.