Package com.dotmarketing.portlets.contentlet.model

Examples of com.dotmarketing.portlets.contentlet.model.Contentlet


        }
  }

  @Override
  protected Contentlet find(String inode) throws ElasticSearchException, DotStateException, DotDataException, DotSecurityException {
    Contentlet con = cc.get(inode);
    if (con != null && InodeUtils.isSet(con.getInode())) {
      if(CACHE_404_CONTENTLET.equals(con.getInode())){
        return null;
      }
      return con;
    }

    /*try {

      Client client = new ESClient().getClient();
      QueryBuilder builder = QueryBuilders.boolQuery().must(QueryBuilders.fieldQuery("inode", inode));

      SearchResponse response = client.prepareSearch().setQuery(builder).execute().actionGet();
      SearchHits hits = response.hits();
      Contentlet contentlet = loadInode(hits.getAt(0));

      return contentlet;
    } catch (Exception e) {
      throw new ElasticSearchException(e.getMessage());
    }*/
    com.dotmarketing.portlets.contentlet.business.Contentlet fatty = null;
        try{
            fatty = (com.dotmarketing.portlets.contentlet.business.Contentlet)HibernateUtil.load(com.dotmarketing.portlets.contentlet.business.Contentlet.class, inode);
        } catch (DotHibernateException e) {
            if(!(e.getCause() instanceof ObjectNotFoundException))
                throw e;
        }
        if(fatty == null){
          cc.add(inode, cache404Content);
            return null;
        }else{
            Contentlet c = convertFatContentletToContentlet(fatty);
            cc.add(c.getInode(), c);
            return c;
        }
  }
View Full Code Here


        List<com.dotmarketing.portlets.contentlet.business.Contentlet> fatties = hu.list();
        if(fatties == null)
            return cons;
        else{
            for (com.dotmarketing.portlets.contentlet.business.Contentlet fatty : fatties) {
                Contentlet content = convertFatContentletToContentlet(fatty);
                cc.add(String.valueOf(content.getInode()), content);
                cons.add(content);
            }
        }
        return cons;
  }
View Full Code Here

        if(limit > 0)
            hu.setMaxResults(limit);
        List<com.dotmarketing.portlets.contentlet.business.Contentlet> fatties =  hu.list();
        List<Contentlet> result = new ArrayList<Contentlet>();
        for (com.dotmarketing.portlets.contentlet.business.Contentlet fatty : fatties) {
            Contentlet content = convertFatContentletToContentlet(fatty);
            cc.add(String.valueOf(content.getInode()), content);
//          result.add(content);
            result.add(convertFatContentletToContentlet(fatty));
        }
        return result;
  }
View Full Code Here

      IndiciesInfo info=APILocator.getIndiciesAPI().loadIndicies();
      SearchResponse response = request.setIndices((live ? info.live : info.working))
              .addFields("inode","identifier").execute().actionGet();
      SearchHits hits = response.getHits();
      Contentlet contentlet = find(hits.getAt(0).field("inode").getValue().toString());
      return contentlet;
    }
    // if we don't have the con in this language
    catch(java.lang.ArrayIndexOutOfBoundsException aibex){
      return null;
View Full Code Here

  protected List<Contentlet> findContentlets(List<String> inodes) throws DotDataException, DotStateException, DotSecurityException {
   
      ArrayList<Contentlet> result = new ArrayList<Contentlet>();
        ArrayList<String> inodesNotFound = new ArrayList<String>();
        for (String i : inodes) {
            Contentlet c = cc.get(i);
            if(c != null && InodeUtils.isSet(c.getInode())){
                result.add(c);
            } else {
                inodesNotFound.add(i);
            }
        }
        if(inodesNotFound.isEmpty()){
            return result;
        }

        final String hql = "select {contentlet.*} from contentlet join inode contentlet_1_ " +
                "on contentlet_1_.inode = contentlet.inode and contentlet_1_.type = 'contentlet' where  contentlet.inode in ('";
       
        for(int init=0; init < inodesNotFound.size(); init+=200) {
            int end = Math.min(init + 200, inodesNotFound.size());
           
            HibernateUtil hu = new HibernateUtil(com.dotmarketing.portlets.contentlet.business.Contentlet.class);
            hu.setSQLQuery( hql + StringUtils.join(inodesNotFound.subList(init, end), "','") + "')");
           
            List<com.dotmarketing.portlets.contentlet.business.Contentlet> fatties =  hu.list();
            for (com.dotmarketing.portlets.contentlet.business.Contentlet fatty : fatties) {
                Contentlet con = convertFatContentletToContentlet(fatty);
                result.add(con);
                cc.add(con.getInode(), con);
            }
            HibernateUtil.getSession().clear();
        }
       
        return result;
View Full Code Here

          hu.setParam(languageId.longValue());
        }
        hu.setParam(identifier);
        List<com.dotmarketing.portlets.contentlet.business.Contentlet> fatties = hu.list();
        for (com.dotmarketing.portlets.contentlet.business.Contentlet fatty : fatties) {
            Contentlet con = convertFatContentletToContentlet(fatty);
            cc.add(String.valueOf(con.getInode()), con);
            cons.add(con);
        }
        return cons;
  }
View Full Code Here

        hu.setParam(containerIdentifier);

        List<com.dotmarketing.portlets.contentlet.business.Contentlet> fatties =  hu.list();
        List<Contentlet> result = new ArrayList<Contentlet>();
        for (com.dotmarketing.portlets.contentlet.business.Contentlet fatty : fatties) {
            Contentlet content = convertFatContentletToContentlet(fatty);
            cc.add(content.getInode(), content);
            result.add(content);
        }
        return result;
  }
View Full Code Here

        hu.setSQLQuery(queryBuffer.toString());
        hu.setParam(identifier);
        List<com.dotmarketing.portlets.contentlet.business.Contentlet> fatties =  hu.list();
        List<Contentlet> result = new ArrayList<Contentlet>();
        for (com.dotmarketing.portlets.contentlet.business.Contentlet fatty : fatties) {
            Contentlet content = convertFatContentletToContentlet(fatty);
            cc.add(content.getInode(), content);
            result.add(content);
        }
        return result;
  }
View Full Code Here

           dc.addParam(userId);
           dc.loadResult();
           for(HashMap<String, String> ident:contentInodes){
             String inode = ident.get("inode");
             cc.remove(inode);
             Contentlet content = find(inode);
             new ESContentletIndexAPI().addContentToIndex(content);
          }
        } catch (DotDataException e) {
            Logger.error(this.getClass(),e.getMessage(),e);
            throw new DotDataException(e.getMessage(), e);
View Full Code Here

        if(UtilMethods.isSet(existingInode))
            HibernateUtil.saveWithPrimaryKey(fatty, existingInode);
        else
            HibernateUtil.saveOrUpdate(fatty);

        final Contentlet content = convertFatContentletToContentlet(fatty);

        if (InodeUtils.isSet(contentlet.getHost())) {
            content.setHost(contentlet.getHost());
        }

        if (InodeUtils.isSet(contentlet.getFolder())) {
            content.setFolder(contentlet.getFolder());
        }

        cc.remove(content.getInode());
        cc.add(content.getInode(), content);
        HibernateUtil.evict(content);

        return content;
  }
View Full Code Here

TOP

Related Classes of com.dotmarketing.portlets.contentlet.model.Contentlet

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.