Package com.dotmarketing.portlets.contentlet.model

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


      Logger.error(WebAPI.class, e1.getMessage(), e1);
    }
    String idenInode = iden.getInode();
    Language language = langAPI.getDefaultLanguage();
    long languageId = language.getId();
    Contentlet cont = null;
    try{
      cont = conAPI.findContentletByIdentifier(idenInode, true, languageId, user, true);
    }catch(Exception e){
      Logger.debug(this, e.getMessage());
      return "0";
    }

    return  cont.getInode();
  }
View Full Code Here


        if(backEndUser!=null){
          localUser = backEndUser;
        }else if(user!=null){
          localUser = user;
        }
        Contentlet cont;
        if(ADMIN_MODE && (EDIT_MODE || PREVIEW_MODE)){
          cont = APILocator.getContentletAPI().findContentletByIdentifier(id.getId(), false, APILocator.getLanguageAPI().getDefaultLanguage().getId(), localUser, true);
        }else{
          cont = APILocator.getContentletAPI().findContentletByIdentifier(id.getId(), true, APILocator.getLanguageAPI().getDefaultLanguage().getId(), localUser, true);
        }
        if(cont!=null && InodeUtils.isSet(cont.getInode())){
          realPath = APILocator.getFileAssetAPI().getRealAssetPath(cont.getInode(), fileName, ext);
        }
      }else{
        realPath = APILocator.getFileAPI().getRealAssetPath(fileName, ext);
      }
      return realPath;
View Full Code Here

          localUser = backEndUser;
        }else if(user!=null){
          localUser = user;
        }

        Contentlet cont;
        if(ADMIN_MODE && (EDIT_MODE || PREVIEW_MODE)){
          cont = APILocator.getContentletAPI().findContentletByIdentifier(id.getId(), false, APILocator.getLanguageAPI().getDefaultLanguage().getId(), localUser, true);
        }else{
          cont = APILocator.getContentletAPI().findContentletByIdentifier(id.getId(), true, APILocator.getLanguageAPI().getDefaultLanguage().getId(), localUser, true);
        }
        if(cont!=null && InodeUtils.isSet(cont.getInode())){
          return cont.getInode();
        }
      }else{
        File f = APILocator.getFileAPI().getFileByURI(path, host, false,backEndUser!=null?backEndUser:user, false);
        return f.getInode();
      }
View Full Code Here

  }
 
  private String getRelationshipName(String contentletInode) throws DotSecurityException {
    try{
      Contentlet contentlet = APILocator.getContentletAPI().find(contentletInode, APILocator.getUserAPI().getSystemUser(), true);
      return getRelationshipName(contentlet);
    }catch(DotDataException e){
      Logger.error(this, "Unable to look up contentlet with inode " + contentletInode, e);
      return "";
    }
View Full Code Here

 
 
  public List<Contentlet> getComments(String inode, boolean descendingOrder){
    try{
      ContentletAPI conAPI = APILocator.getContentletAPI();
      Contentlet contentlet = new Contentlet();
      try{
        contentlet = conAPI.find(inode, APILocator.getUserAPI().getSystemUser(), true);
      }catch(DotDataException e){
        Logger.debug(this, "Unable to look up contentlet with inode " + inode, e);
      }
      validateComments(contentlet);
      if(!InodeUtils.isSet(contentlet.getInode())){
        return new ArrayList<Contentlet>();
      }
      List<Contentlet> comments = null;
      if(contentlet.getStructure().getVelocityVarName().equals(commentsVelocityStructureName)){
        comments = conAPI.search("+Comments-Comments-parent:" + contentlet.getIdentifier() + " +live:true +languageid:" + contentlet.getLanguageId() + " +deleted:false", 0, -1, "Comments.datePublished " + (descendingOrder ? "desc":"asc"), APILocator.getUserAPI().getSystemUser(), true);
      }else{
        comments = conAPI.search("+" + getRelationshipName(contentlet) + ":" + contentlet.getIdentifier() + " +live:true +languageid:" + contentlet.getLanguageId() + " +deleted:false", 0, -1, "Comments.datePublished " + (descendingOrder ? "desc":"asc"), APILocator.getUserAPI().getSystemUser(), true);
      }
//      int count = 0;
//      StringBuilder bob = new StringBuilder();
//      for (Contentlet c : comments) {
//        bob.append("Comments-Comments-child:" + c.getIdentifier() + " ");
View Full Code Here

  }

  public void validateComments(String contentletInode) throws DotSecurityException, DotHibernateException {
    // Load the contentlet
    ContentletAPI conAPI = APILocator.getContentletAPI();
    Contentlet contentlet = new Contentlet();
    try{
      contentlet = conAPI.find(contentletInode, APILocator.getUserAPI().getSystemUser(), true);
    }catch(DotDataException e){
      Logger.debug(this, "validateComments for no inode : " + contentletInode);
    }
View Full Code Here

 
  public int getCommentsCount(String inode) {
    int commentNumber = 0;
    try{
        ContentletAPI conAPI = APILocator.getContentletAPI();
        Contentlet contentlet = new Contentlet();
      contentlet = conAPI.find(inode, APILocator.getUserAPI().getSystemUser(), respectFrontendRoles);

      Structure contentletStructure = StructureCache.getStructureByInode(contentlet.getStructureInode());

        Field field =  contentletStructure.getField("CommentsCount");
        if (!InodeUtils.isSet(field.getInode())){
          return 0;
        }
        if(field.getFieldContentlet().startsWith(Field.DataType.TEXT.toString())){
            commentNumber = Integer.parseInt(contentlet.getStringProperty(field.getVelocityVarName())) ;
           
        }else {
          commentNumber = new Long(contentlet.getLongProperty(field.getVelocityVarName())).intValue();
        }
       
        }catch(DotDataException e){
                Logger.error(this, "Unable to look up contentlet with inode " + inode, e);
        }catch (DotSecurityException se) {
View Full Code Here

             
            cons = conAPI.searchIndex(query.toString(), 2, 0, (hostIsRequired?"conhost, modDate": "modDate"), user, true);
            int idx = 0;
            if(checkIndex && cons.size()==2) {
                // prefer session setting
                Contentlet second=conAPI.find(cons.get(1).getInode(), user, true);
                if(second.getLanguageId()==sessionLang)
                    idx=1;
            }
            ContentletSearch c = cons.get(idx);
            session.setAttribute(com.dotmarketing.util.WebKeys.HTMLPAGE_LANGUAGE,String.valueOf(conAPI.find(c.getInode(), user, true).getLanguageId()));
            request.setAttribute(WebKeys.WIKI_CONTENTLET, c.getIdentifier());
View Full Code Here

    while(APILocator.getFileAssetAPI().fileNameExists(host,folder, fileName, "")) {
      fileName = UtilMethods.getFileName(baseFilename) + "-" + c + "." + UtilMethods.getFileExtension(baseFilename);
      c++;
    }
   
    Contentlet cont = new Contentlet();
    cont.setStructureInode(folder.getDefaultFileType());
    cont.setStringProperty(FileAssetAPI.TITLE_FIELD, UtilMethods.getFileName(fileName));
    cont.setFolder(folder.getInode());
    cont.setHost(host.getIdentifier());
    cont.setBinary(FileAssetAPI.BINARY_FIELD, fileToSave);
    APILocator.getContentletAPI().checkin(cont, APILocator.getUserAPI().getSystemUser(),false);

    return path + "/" + fileName;
  }
View Full Code Here

      String title = multilingual?"$languagewebapi.get('" + request.getParameter("crumbTitle") + "')":request.getParameter("crumbTitle");
      title = UtilHTML.escapeHTMLSpecialChars(title);
      stringbuffer.append("<li>" + title + "</li>");
    } else if (UtilMethods.isSet(request.getParameter("inode")) || UtilMethods.isSet(request.getParameter("id"))) {

      Contentlet cont = new Contentlet();
      if(InodeUtils.isSet(request.getParameter("id"))) {
        try {
          Identifier id = APILocator.getIdentifierAPI().find(request.getParameter("id"));
          long languageId = 0;
          try{
View Full Code Here

TOP

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

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.