Package com.liusoft.dlog4j.base

Examples of com.liusoft.dlog4j.base.Orderable


      if (links.size() >= ConfigDAO.getMaxCatalogCount(obj.getSite()
          .getId()))
        throw new CapacityExceedException(links.size());
      if (links.size() > 1) {
        for (int i = 0; i < links.size(); i++) {
          Orderable lb = (Orderable) links.get(i);
          executeNamedUpdate("UPDATE_FORUM_ORDER", i+1, lb.getId());
        }
      }
      commit();
    } catch (HibernateException e) {
      rollback();
View Full Code Here


   * @param up ���ϵ����������µ���
   */
  public static void move(SiteBean site, int cat_id, boolean up){
    List objects = site.getForums();
    for (int i = 0; i < objects.size(); i++) {
      Orderable obj = (Orderable) objects.get(i);
      int sort_order = obj.getSortOrder();
      if (obj.getId() == cat_id) {
        if (up) {
          if (i > 0) {
            try {
              Orderable prev = (Orderable) objects.get(i - 1);
              int prev_order = prev.getSortOrder();
              beginTransaction();
              executeNamedUpdate("UPDATE_FORUM_ORDER", sort_order, prev.getId());
              executeNamedUpdate("UPDATE_FORUM_ORDER", prev_order, obj.getId());
              commit();
            } catch (HibernateException e) {
              rollback();
              throw e;
            }
          }
        } else {
          if (i < (objects.size() - 1)) {
            try {
              Orderable next = (Orderable) objects.get(i + 1);
              int next_order = next.getSortOrder();
              beginTransaction();
              executeNamedUpdate("UPDATE_FORUM_ORDER", sort_order, next.getId());
              executeNamedUpdate("UPDATE_FORUM_ORDER", next_order, obj.getId());
              commit();
            } catch (HibernateException e) {
              rollback();
              throw e;
View Full Code Here

      if (links.size() >= ConfigDAO.intValue(mbox.getSite().getId(),
          "MAX_MUSICBOX_COUNT", MAX_MUSICBOX_COUNT))
        throw new CapacityExceedException(links.size());
      if (links.size() > 1) {
        for (int i = 0; i < links.size(); i++) {         
          Orderable lb = (Orderable) links.get(i);
          executeNamedUpdate("UPDATE_MUSICBOX_ORDER", (i+1), lb.getId());
        }
      }
      commit();
    } catch (HibernateException e) {
      rollback();
View Full Code Here

   *            ���ϵ����������µ���
   */
  public static void move(SiteBean site, int cat_id, boolean up){
    List objects = site.getCatalogs();
    for (int i = 0; i < objects.size(); i++) {
      Orderable obj = (Orderable) objects.get(i);
      int sort_order = obj.getSortOrder();
      if (obj.getId() == cat_id) {
        if (up) {
          if (i > 0) {
            try {
              Orderable prev = (Orderable) objects.get(i - 1);
              int prev_order = prev.getSortOrder();
              beginTransaction();
              executeNamedUpdate("UPDATE_CATALOG_ORDER",sort_order, prev.getId());
              executeNamedUpdate("UPDATE_CATALOG_ORDER",prev_order, obj.getId());
              commit();
            } catch (HibernateException e) {
              rollback();
              throw e;
            }
          }
        } else {
          if (i < (objects.size() - 1)) {
            try {
              Orderable next = (Orderable) objects.get(i + 1);
              int next_order = next.getSortOrder();
              beginTransaction();
              executeNamedUpdate("UPDATE_CATALOG_ORDER",sort_order, next.getId());
              executeNamedUpdate("UPDATE_CATALOG_ORDER",next_order, obj.getId());
              commit();
            } catch (HibernateException e) {
              rollback();
              throw e;
View Full Code Here

      beginTransaction();
      ssn.save(obj);
      List catalogs = findNamedAll("LIST_CATALOGS",obj.getSite().getId());
      if (catalogs.size() > 1) {
        for (int i = 0; i < catalogs.size(); i++) {         
          Orderable lb = (Orderable) catalogs.get(i);
          executeNamedUpdate("UPDATE_CATALOG_ORDER",(i+1),lb.getId());
        }
      }
      commit();
    } catch (HibernateException e) {
      rollback();
View Full Code Here

   * @throws SQLException
   */
  public static void move(SiteBean site, int linkid, boolean up){
    List links = site.getLinks();
    for(int i=0;i<links.size();i++){
      Orderable link = (Orderable)links.get(i);
      int sort_order = link.getSortOrder();
      if(link.getId()==linkid){
        if(up){
          if(i > 0){
            try{
              Orderable prev = (Orderable)links.get(i-1);
              int prev_order = prev.getSortOrder();
              beginTransaction();
              executeNamedUpdate("UPDATE_LINK_ORDER", sort_order, prev.getId());
              executeNamedUpdate("UPDATE_LINK_ORDER", prev_order, link.getId());
              commit();
            }catch(HibernateException e){
              rollback();
              throw e;
            }
          }
        }
        else{
          if(i < (links.size()-1)){
            try{
              Orderable next = (Orderable)links.get(i+1);
              int next_order = next.getSortOrder();
              beginTransaction();
              executeNamedUpdate("UPDATE_LINK_ORDER", sort_order, next.getId());
              executeNamedUpdate("UPDATE_LINK_ORDER", next_order, link.getId());
              commit();
            }catch(HibernateException e){
              rollback();
              throw e;
View Full Code Here

   * @throws SQLException
   */
  public static void move(SiteBean site, int album_id, boolean up){
    List objects = site.getCatalogs();
    for (int i = 0; i < objects.size(); i++) {
      Orderable obj = (Orderable) objects.get(i);
      int sort_order = obj.getSortOrder();
      if (obj.getId() == album_id) {
        if (up) {
          if (i > 0) {
            try {
              Orderable prev = (Orderable) objects.get(i - 1);
              int prev_order = prev.getSortOrder();
              DAO.beginTransaction();
              executeNamedUpdate("UPDATE_ALBUM_ORDER", sort_order, prev.getId());
              executeNamedUpdate("UPDATE_ALBUM_ORDER", prev_order, obj.getId());
              commit();
            } catch (HibernateException e) {
              rollback();
              throw e;
            }
          }
        } else {
          if (i < (objects.size() - 1)) {
            try {
              Orderable next = (Orderable) objects.get(i + 1);
              int next_order = next.getSortOrder();
              beginTransaction();             
              executeNamedUpdate("UPDATE_ALBUM_ORDER", sort_order, next.getId());
              executeNamedUpdate("UPDATE_ALBUM_ORDER", next_order, obj.getId());
              commit();
            } catch (HibernateException e) {
              rollback();
              throw e;
View Full Code Here

      List albums = findNamedAll("LIST_ALBUM",obj.getSite().getId());
      if (albums.size() >= ConfigDAO.getMaxAlbumCount(obj.getSite().getId()))
        throw new CapacityExceedException(albums.size());
      if (albums.size() > 1) {
        for (int i = 0; i < albums.size(); i++) {
          Orderable lb = (Orderable) albums.get(i);
          executeNamedUpdate("UPDATE_ALBUM_ORDER", i+1, lb.getId());
        }
      }
      commit();
    } catch (HibernateException e) {
      rollback();
View Full Code Here

TOP

Related Classes of com.liusoft.dlog4j.base.Orderable

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.