Package com.dotmarketing.portlets.contentlet.model

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


    return RelationshipFactory.getAllRelationshipRecords(relationship, contentlet, true, true,"");
  }

  public List<Contentlet> getRelatedParentContent(String relationshipName, String contentletInode) throws DotDataException, DotSecurityException {
    Relationship relationship = RelationshipFactory.getRelationshipByRelationTypeValue(relationshipName);
    Contentlet contentlet = conAPI.find(contentletInode, user, true);
    return RelationshipFactory.getAllRelationshipRecords(relationship, contentlet, false, true,"");
  }
View Full Code Here


    return RelationshipFactory.getAllRelationshipRecords(relationship, contentlet, false, true,"");
  }

  public List<Contentlet> getAllRelatedContent(String relationshipName, String contentletInode) throws DotDataException, DotSecurityException {
    Relationship relationship = RelationshipFactory.getRelationshipByRelationTypeValue(relationshipName);
    Contentlet contentlet = conAPI.find(contentletInode, user, true);
    @SuppressWarnings({ "rawtypes", "unchecked" })
    Set<Contentlet> contSet = new HashSet();
    contSet.addAll(RelationshipFactory.getAllRelationshipRecords(relationship, contentlet, false));
    contSet.addAll(RelationshipFactory.getAllRelationshipRecords(relationship, contentlet, true));
    @SuppressWarnings({ "rawtypes", "unchecked" })
View Full Code Here

    return conts;
  }

  public List<Contentlet> getRelatedContentletsByCondition(String relationshipInode, String contentletInode, boolean hasParent, String condition) throws DotDataException, DotSecurityException {
    Relationship relationship = (Relationship) InodeFactory.getInode(relationshipInode, Relationship.class);
    Contentlet contentlet = conAPI.find(contentletInode, user, true);
    return RelationshipFactory.getAllRelationshipRecords(relationship, contentlet, hasParent, true, condition);
  }
View Full Code Here

   * @throws DotDataException
   */
  public List<Contentlet> pullRelatedContent (String relationshipName, String contentletInode, int limit, String orderBy) {
    ContentletAPI conAPI = APILocator.getContentletAPI();

    Contentlet contentlet = null;
    try {
      contentlet = conAPI.find(contentletInode, APILocator.getUserAPI().getSystemUser(), true);
    } catch (DotSecurityException e) {
      Logger.info(this, "Unable to look up content because of a problem getting the system user");
    } catch (DotDataException de) {
      Logger.info(this, "Unable to retrieve content with inode = " + contentletInode);
    }
    Relationship relationship = RelationshipFactory.getRelationshipByRelationTypeValue(relationshipName);
    if(contentlet == null || !InodeUtils.isSet(contentlet.getInode()) || relationship == null || !InodeUtils.isSet(relationship.getInode()))
      return new ArrayList<Contentlet>();

    if(UtilMethods.isSet(orderBy)) {
      String[] orderBySplitted = orderBy != null?orderBy.split("[,\\s]+"):new String[0];
      for (String orderBySeg : orderBySplitted) {
        orderBySeg = orderBySeg.trim();
        if(orderBySeg.toLowerCase().equals("desc") || orderBySeg.toLowerCase().equals("asc"))
          continue;
        if(orderBySeg.toLowerCase().equals("moddate")) {
          orderBy = orderBy.replaceAll("(?i)moddate", "mod_date");
          continue;
        }
        Field field = FieldFactory.getFieldByVariableName(contentlet.getStructureInode(), orderBySeg);
        if (field != null && InodeUtils.isSet(field.getInode()))
          orderBy = orderBy.replaceAll(orderBySeg, field.getFieldContentlet());
      }
    }
    return RelationshipFactory.getRelatedContentlets(relationship, contentlet, orderBy, null, true, limit);
View Full Code Here

    return isParentOfTheRelationship(String.valueOf(contentletInode), String.valueOf(relationshipInode));
  }

  public boolean isParentOfTheRelationship(String contentletInode, String relationshipInode) throws DotDataException, DotSecurityException {
    Relationship relationship = (Relationship) InodeFactory.getInode(relationshipInode, Relationship.class);
    Contentlet contentlet = conAPI.find(contentletInode, user, true);
    return isParentOfTheRelationship(contentlet, relationship);
  }
View Full Code Here

    return isChildOfTheRelationship(String.valueOf(contentletInode), String.valueOf(relationshipInode));
  }

  public boolean isChildOfTheRelationship(String contentletInode, String relationshipInode) throws DotDataException, DotSecurityException {
    Relationship relationship = (Relationship) InodeFactory.getInode(relationshipInode, Relationship.class);
    Contentlet contentlet = conAPI.find(contentletInode, user, true);
    return isChildOfTheRelationship(contentlet, relationship);
  }
View Full Code Here

    List<HashMap> returnList = new ArrayList<HashMap>();

    for(HashMap content: contents) {
      String inode = (String) content.get("inode");

      Contentlet contentlet = new Contentlet();
      try{
        contentlet = conAPI.find(inode, user, true);
      }catch (DotDataException ex){
        Logger.error(this, "Unable to find contentlet with inode " + inode);
      }
View Full Code Here

   * @throws DotDataException
   * @throws NumberFormatException
   * @since 1.5
   */
  public boolean isContentletIdentifierOrInode(String id) throws NumberFormatException{
    Contentlet contentlet = null;
    User user;
    try {
      user = APILocator.getUserAPI().getSystemUser();
    } catch (DotDataException e) {
      Logger.debug(this, "Unable to look up system user", e);
      return false;
    }
    try{
      contentlet = conAPI.find(id,user,true);
    }catch(Exception de){
      Logger.debug(this, "Unable to find contentlet by inode", de);
    }
    if(contentlet != null && InodeUtils.isSet(contentlet.getInode())){
      return true;
    }else{
      try {
        contentlet = conAPI.findContentletByIdentifier(id, false, langAPI.getDefaultLanguage().getId(), user, true);
      } catch (Exception e) {
        Logger.debug(this, "Unable to find contentlet by identifier", e);
      }
      if(contentlet != null && InodeUtils.isSet(contentlet.getInode())){
        return true;
      }else{
        return false;
      }
    }
View Full Code Here

   */
  public boolean doesUserHasPermission (String contentInode, int permission, User user, boolean respectFrontendRoles) throws DotDataException {
    try {
      if(!InodeUtils.isSet(contentInode))
        return false;
      Contentlet cont = conAPI.find(contentInode, user, respectFrontendRoles);
      return perAPI.doesUserHavePermission(cont, permission, user, respectFrontendRoles);
    } catch (DotSecurityException e) {
      return false;
    }
  }
View Full Code Here

   * @return String with the URL Map. Null if the structure of the content doesn't have the URL Map Pattern set.
   */
  public String getUrlMapForContentlet(String identifier) {
    String result = null;
    try {
      Contentlet contentlet = conAPI.findContentletByIdentifier(identifier, true, langAPI.getDefaultLanguage().getId(), user, true);
      result = getUrlMapForContentlet(contentlet);
    } catch (Exception e) {
      Logger.warn(ContentsWebAPI.class, e.toString());
    }

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.