Package com.dotmarketing.db

Examples of com.dotmarketing.db.HibernateUtil.load()


      try {
        HibernateUtil dh = new HibernateUtil(UserProxy.class);
        dh.setQuery("from user_proxy in class com.dotmarketing.beans.UserProxy where lower(long_lived_cookie) = lower(?)");
        dh.setParam(dotCMSID);
 
        up = (UserProxy) dh.load();
        upc.addToUserProxyCache(up);
      } catch (Exception e) {
        Logger.warn(UserProxyAPIImpl.class, "getUserProxyByLongLiveCookie failed:" + e, e);
        throw new DotRuntimeException(e.getMessage(),e);
      }
View Full Code Here


  }

  @Override
  public void saveUserProxy(UserProxy userProxy) throws DotRuntimeException, DotDataException{
    HibernateUtil hu = new HibernateUtil();
    UserProxy up = (UserProxy)hu.load(UserProxy.class, userProxy.getInode());
    try {
      BeanUtils.copyProperties(up, userProxy);
      up.setNoclicktracking(userProxy.isNoclicktracking());
    } catch (Exception e) {
      throw new DotRuntimeException(e.getMessage(), e);
View Full Code Here

    Category cat = catCache.getByKey(key);
    if(cat ==null){
      HibernateUtil hu = new HibernateUtil(Category.class);
      hu.setQuery("from " + Category.class.getName() + " as cat where lower(cat.key) = ? and category0__1_.type='category'");
      hu.setParam(key.toLowerCase());
      cat = (Category) hu.load();
      if(cat != null)
        try {
          catCache.put(cat);
        } catch (DotCacheException e) {
          throw new DotDataException(e.getMessage(), e);
View Full Code Here

  @Override
  protected Category findByName(String name) throws DotDataException {
    HibernateUtil hu = new HibernateUtil(Category.class);
    hu.setQuery("from " + Category.class.getName() + " as cat where cat.categoryName = ? and category0__1_.type='category'");
    hu.setParam(name);
    return (Category) hu.load();
  }

  @SuppressWarnings("unchecked")
  @Override
  protected List<Category> findAll() throws DotDataException {
View Full Code Here

    HibernateUtil dh = new HibernateUtil(clazz);
    dh.setQuery("from inode in class " + clazz.getName() + " where inode.inode=?");
    dh.setParam(vinfo.getWorkingInode());
    Logger.debug(this.getClass(), "findWorkingVersion query: " + dh.getQuery());

    Versionable v =(Versionable) dh.load();
    if(v.getVersionId() ==null){
      throw new DotStateException("Invalid working version for identifier : " +id + " / working inode : " + vinfo.getWorkingInode());
    }
    return v;
View Full Code Here

      if(UtilMethods.isSet(vinfo.getLiveInode())){
          HibernateUtil dh = new HibernateUtil(clazz);
          dh.setQuery("from inode in class " + clazz.getName() + " where inode.inode=?");
          dh.setParam(vinfo.getLiveInode());
          Logger.debug(this.getClass(), "findLiveVersion query: " + dh.getQuery());
          return (Versionable) dh.load();
      }else{
        return null;
      }
    }else {
        // hey! there is no live version for this versionable
View Full Code Here

    HibernateUtil dh = new HibernateUtil(clazz);
    dh.setQuery("from inode in class " + clazz.getName() + " where identifier = ? and inode.type='" + identifier.getAssetType() + "' and deleted="
        + DbConnectionFactory.getDBTrue());
    dh.setParam(id);
    Logger.debug(this.getClass(), "findDeletedVersion query: " + dh.getQuery());
    return (Versionable) dh.load();
  }
  @Override
  protected List<Versionable> findAllVersions(String id) throws DotDataException, DotStateException {
    Identifier identifier = iapi.find(id);
    if(identifier ==null){
View Full Code Here

            Class clazz = UtilMethods.getVersionInfoType(ident.getAssetType());
            HibernateUtil dh = new HibernateUtil(clazz);
            dh.setQuery("from "+clazz.getName()+" where identifier=?");
            dh.setParam(identifier);
            Logger.debug(this.getClass(), "getVersionInfo query: "+dh.getQuery());
            vi=(VersionInfo)dh.load();
            if(!UtilMethods.isSet(vi.getIdentifier())) {
              vi.setIdentifier(identifier);
              vi.setWorkingInode("NOTFOUND");
            }
            icache.addVersionInfoToCache(vi);
View Full Code Here

            if(clazz != null) {
              HibernateUtil dh = new HibernateUtil(clazz);
              dh.setQuery("from "+clazz.getName()+" where identifier=?");
              dh.setParam(identifer.getId());
              Logger.debug(this.getClass(), "getVersionInfo query: "+dh.getQuery());
              vi=(VersionInfo)dh.load();
            }
            if(vi ==null || !UtilMethods.isSet(vi.getIdentifier())) {
              try {
                    vi = (VersionInfo) clazz.newInstance();
                } catch (Exception e) {
View Full Code Here

            HibernateUtil dh = new HibernateUtil(ContentletVersionInfo.class);
            dh.setQuery("from "+ContentletVersionInfo.class.getName()+" where identifier=? and lang=?");
            dh.setParam(identifier);
            dh.setParam(lang);
            Logger.debug(this.getClass(), "getContentletVersionInfo query: "+dh.getQuery());
            contv = (ContentletVersionInfo)dh.load();
            if(UtilMethods.isSet(contv.getIdentifier()))
                icache.addContentletVersionInfoToCache(contv);
        }
        return contv;
    }
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.