The Contents Velocity Viewtool provides methods for returning content, content properties, and content-related data.
Methods
Method | Return Value | Description |
---|---|---|
getContentByInode(long inode) | Contentlet | Returns the content associated with the inode passed in. |
getContentByInode(String inode) | Contentlet | Returns the content associated with the string passed in. |
getFieldByLogicalName(Structure st, String fieldName) | Field | Returns the field of a structure based on his logical name and the structure. E.G. Last_Name |
getFieldByLogicalName(String structureType, String fieldName) | Field | Returns the field of a structure based on his logical name and the structure Type name. E.G. Last_Name |
getFieldByLogicalNameAndInode(long structureInode, String fieldName) | Field | Returns the field of a structure based on his logical name and inode. E.G. Last_Name |
getFieldByLogicalNameAndInode(String structureInode, String fieldName) | Field | Returns 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) | HashMap | Returns a hashmap of the contents found in the Lucene index. |
searchWithLuceneQuery(String structureType, String luceneCondition, String sortBy, int maxResults) | HashMap | Returns 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) | HashMap | Returns a hashmap of the contents found that match the lucene query passed in sorted order. |
getContentIdentifiersFromLuceneHits(LuceneHits assets) | List | Returns a a list of contents hits. |
getContentletCategories(String inode) | List | Returns list of the catagories that match the string passed in. |
getRelationshipByName(String relationshipName) | Relationship | Returns the relationship associated with the relationship name. |
getRelationshipsOfContentlet(Contentlet cont) | List | Returns the relationship associated with the contentlet passed in. |
getRelationshipsOfContentlet(String contentletInode) | List | Returns the relationship associated with the string passed in. |
getRelationshipsOfContentlet(Contentlet cont, boolean hasParent) | List | Returns the relationships associated with the content passed in and matches the hasParent boolean. |
getRelationshipsOfContentlet(String contentletInode, boolean hasParent) | List | Returns the relationship associated with the string passed in and matches the hasParent boolean. |
isParent(Contentlet contentlet, Relationship relationship) | boolean | Returns a boolean based on if the contentlet passed is a parent |
isParent(String contentletInode, String relationshipInode) | boolean | Returns 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>