Contents Viewtool

Last Updated: Jun 17, 2024
documentation for the dotCMS Content Management System

The Contents Velocity Viewtool provides methods for returning content, content properties, and content-related data.

Methods

MethodReturn ValueDescription
getContentByInode(long inode)ContentletReturns the content associated with the inode passed in.
getContentByInode(String inode)ContentletReturns the content associated with the string passed in.
getFieldByLogicalName(Structure st, String fieldName)FieldReturns the field of a structure based on his logical name and the structure. E.G. Last_Name
getFieldByLogicalName(String structureType, String fieldName)FieldReturns the field of a structure based on his logical name and the structure Type name. E.G. Last_Name
getFieldByLogicalNameAndInode(long structureInode, String fieldName)FieldReturns the field of a structure based on his logical name and inode. E.G. Last_Name
getFieldByLogicalNameAndInode(String structureInode, String fieldName)FieldReturns the field of an structure based on his logical name and inode. E.G. Last_Name
searchWithLuceneQuery(String structureType, String luceneCondition, String sortBy, String pageStr,String rowsPerPage)HashMapReturns a hashmap of the contents found in the Lucene index.
searchWithLuceneQuery(String structureType, String luceneCondition, String sortBy, int maxResults)HashMapReturns a hashmap of the contents found that match the lucene query passed in sorted order.
searchWithLuceneQuery(String structureType, String luceneCondition, String sortBy, int maxResults, int page, int pageSize)HashMapReturns a hashmap of the contents found that match the lucene query passed in sorted order.
getContentIdentifiersFromLuceneHits(LuceneHits assets)ListReturns a a list of contents hits.
getContentletCategories(String inode)ListReturns list of the catagories that match the string passed in.
getRelationshipByName(String relationshipName)RelationshipReturns the relationship associated with the relationship name.
getRelationshipsOfContentlet(Contentlet cont)ListReturns the relationship associated with the contentlet passed in.
getRelationshipsOfContentlet(String contentletInode)ListReturns the relationship associated with the string passed in.
getRelationshipsOfContentlet(Contentlet cont, boolean hasParent)ListReturns the relationships associated with the content passed in and matches the hasParent boolean.
getRelationshipsOfContentlet(String contentletInode, boolean hasParent)ListReturns the relationship associated with the string passed in and matches the hasParent boolean.
isParent(Contentlet contentlet, Relationship relationship)booleanReturns a boolean based on if the contentlet passed is a parent
isParent(String contentletInode, String relationshipInode)booleanReturns a boolean based on if the contentlet passed is a parent

The following example shows how the ContentsWebAPI Viewtool is mapped in the toolbox.xml file:

    <tool>
        <key>contents</key>
        <scope>request</scope>
        <class>com.dotcms.rendering.velocity.viewtools.ContentsWebAPI</class>
    </tool>

On this page

×

We Dig Feedback

Selected excerpt:

×