Package com.dotmarketing.portlets.structure.model

Examples of com.dotmarketing.portlets.structure.model.Relationship


      String commentStructureName = commentsStructure.getName().replaceAll("\\s", "_").replaceAll("[^a-zA-Z0-9\\_]", "");
      String contentletStructureName = contentletStructure.getName().replaceAll("\\s", "_").replaceAll("[^a-zA-Z0-9\\_]", "");

      // Create the relationship
      Relationship relationship = new Relationship();
      relationship.setCardinality(0);
      relationship.setChildRelationName(commentStructureName);
      relationship.setParentRelationName(contentletStructureName);
      relationship.setChildStructureInode(commentsStructure.getInode());
      relationship.setParentStructureInode(contentletStructure.getInode());
      relationship.setRelationTypeValue(contentletStructureName + "-" + commentStructureName);
      relationship.setParentRequired(false);
      relationship.setChildRequired(false);
      relationship.setFixed(true);
      RelationshipFactory.saveRelationship(relationship);

    }
  }
View Full Code Here


  public List<Contentlet> getRelatedContentlets(long relationshipInode, long contentletInode, boolean hasParent) throws DotDataException, DotSecurityException {
    return getRelatedContentlets(String.valueOf(relationshipInode), String.valueOf(contentletInode),hasParent);
  }

  public List<Contentlet> getRelatedContentlets(String relationshipInode, String contentletInode, boolean hasParent) 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,"");
  }
View Full Code Here

    Contentlet contentlet = conAPI.find(contentletInode, user, true);
    return RelationshipFactory.getAllRelationshipRecords(relationship, contentlet, hasParent, true,"");
  }

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

    Contentlet contentlet = conAPI.find(contentletInode, user, true);
    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

    Contentlet contentlet = conAPI.find(contentletInode, user, true);
    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));
View Full Code Here

    conts.addAll(contSet);
    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

    } 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) {
View Full Code Here

  public boolean isParentOfTheRelationship(long contentletInode, long relationshipInode) throws DotDataException, DotSecurityException {
    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

  public boolean isChildOfTheRelationship(long contentletInode, long relationshipInode) throws DotDataException, DotSecurityException {
    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

            String childId = relatedEntry.get("child").toString();
            String parentId = relatedEntry.get("parent").toString();
            String relType=relatedEntry.get("relation_type").toString();
            String order = relatedEntry.get("tree_order").toString();

            Relationship rel = RelationshipFactory.getRelationshipByRelationTypeValue(relType);

            if(rel!=null && InodeUtils.isSet(rel.getInode())) {
                boolean isSameStructRelationship = rel.getParentStructureInode().equalsIgnoreCase(rel.getChildStructureInode());

                String propName = isSameStructRelationship ?
                        (con.getIdentifier().equals(parentId)?rel.getRelationTypeValue() + "-child":rel.getRelationTypeValue() + "-parent")
                        : rel.getRelationTypeValue();

                String orderKey = rel.getRelationTypeValue()+"-order";

                if(relatedEntry.get("relation_type").equals(rel.getRelationTypeValue())) {
                    String me = con.getIdentifier();
                    String related = me.equals(childId)? parentId : childId;

                    // put a pointer to the related content
                    m.put(propName, (m.get(propName) != null ? m.get(propName) : "") + related + " " );
View Full Code Here

TOP

Related Classes of com.dotmarketing.portlets.structure.model.Relationship

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.