Interface IContentAPI

  • All Superinterfaces:
    T4PublishAPI

    public interface IContentAPI
    extends T4PublishAPI
    Publish API for getting information about the content item being published.

    Also provides methods to allow different content items to be loaded.

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      PDContentItem get()
      Get a reference to the currently publishing Content Item.
      PDContentItem get​(int id)
      Get a reference to the Content Item with the provided Id.
      PDContentItem get​(String language)
      Get a reference to the currently publishing Content Item in the language passed by parameter.
      String getAnchor()
      Generates a HTML anchor link to the currently publishing Content Item.
      PDDateTime getCreateDate()
      Get the creation date of the currently publishing Content Item.
      PDDateTime getExpiryDate()
      Get the expiry date of the currently publishing Content Item.
      String getFulltextURL()
      Gets the fulltext URL of the currently publishing Content Item.
      int getId()
      Get the id of the currently publishing Content Item.
      PDDateTime getLastModifiedDate()
      Get the last modified date of the currently publishing Content Item.
      PDDateTime getPublishDate()
      Get the publish date of the currently publishing Content Item.
      PDVersion getVersion()
      Get the version of the currently publishing Content Item.
      boolean isFirst()
      Checks whether the currently publish Content Item is the first in the currently publishing Section.
      boolean isFirstInSequence​(boolean matchSingleItem)
      Checks whether the currently publishing Content Item is the first in a sequence of Content Items using the same Content Type.
      boolean isFirstOfType()
      Checks whether the currently publishing Content Item is the first in the currently publishing Section that uses its Content Type.
      boolean isLast()
      Checks whether the currently publish Content Item is the last in the currently publishing Section.
      boolean isLastInSequence​(boolean matchSingleItem)
      Checks whether the currently publishing Content Item is the last in a sequence of Content Items using the same Content Type.
      boolean isLastOfType()
      Checks whether the currently publish Content Item is the last in the currently publishing Section that uses its Content Type.
    • Method Detail

      • get

        PDContentItem get()
        Get a reference to the currently publishing Content Item.

        If there's no current Content Item, a blank PDContentItem is returned. This can be verified using the exists method.

        Returns:
        The currently publishing Content Item or a blank equivalent when no Content Item is publishing.
      • get

        PDContentItem get​(String language)
        Get a reference to the currently publishing Content Item in the language passed by parameter.

        If there's no current Content Item, a blank PDContentItem is returned. This can be verified using the exists method.

        Returns:
        The currently publishing Content Item in the language code or a blank equivalent when no Content Item is publishing.
      • getId

        int getId()
        Get the id of the currently publishing Content Item.

        If there's no current Content Item, 0 is returned.

        Returns:
        The id of the currently publishing Content Item or 0 if no Content Item is publishing.
      • getVersion

        PDVersion getVersion()
        Get the version of the currently publishing Content Item.

        If there's no current Content Item, a version number of 0.0 is returned.

        Returns:
        The version of the currently publishing Content Item or 0.0 if no Content Item is publishing.
      • getLastModifiedDate

        PDDateTime getLastModifiedDate()
        Get the last modified date of the currently publishing Content Item.

        If there's no current Content Item, is returned.

        Returns:
        The last modified date of the currently publishing Content Item or PDDateTimeNotFound.INSTANCE if no Content Item is publishing.
      • getPublishDate

        PDDateTime getPublishDate()
        Get the publish date of the currently publishing Content Item.

        If there's no current Content Item, or if the publish date has not been set, PDDateTimeNotFound.INSTANCE is returned.

        Returns:
        The publish date of the currently publishing Content Item or PDDateTimeNotFound.INSTANCE if no Content Item is publishing or the publish date has not been set.
      • getExpiryDate

        PDDateTime getExpiryDate()
        Get the expiry date of the currently publishing Content Item.

        If there's no current Content Item, or if the expiry date has not been set, PDDateTimeNotFound.INSTANCE is returned.

        Returns:
        The expiry date of the currently publishing Content Item or PDDateTimeNotFound.INSTANCE if no Content Item is publishing or the expiry date has not been set.
      • getAnchor

        String getAnchor()
        Generates a HTML anchor link to the currently publishing Content Item.

        The generated anchor takes the form below.

          <span id="d.<language>.<content id>"></span>
         

        If there's no current Content Item, or if the publish date has not been set, an empty string is returned.

        Returns:
        An anchor link for the the currently publishing Content Item or an empty string if no Content Item is publishing.
      • get

        PDContentItem get​(int id)
        Get a reference to the Content Item with the provided Id.
        Parameters:
        id - The Id of the Content Item.
        Returns:
        A reference to the Content item or a reference to PDContentItemNotFound.INSTANCE if the content item could not be found.
      • isFirst

        boolean isFirst()
        Checks whether the currently publish Content Item is the first in the currently publishing Section.

        If there's no current Content Item, false is returned.

        Returns:
        If the Content Item is the first in the currently publish Section, this returns true. In all other cases, it returns false.
      • isFirstOfType

        boolean isFirstOfType()
        Checks whether the currently publishing Content Item is the first in the currently publishing Section that uses its Content Type.

        If there's no current Content Item, false is returned.

        Returns:
        If the Content Item is the first in the currently publish Section using the Content Type of the Content Item, this returns true. In all other cases, it returns false.
      • isFirstInSequence

        boolean isFirstInSequence​(boolean matchSingleItem)
        Checks whether the currently publishing Content Item is the first in a sequence of Content Items using the same Content Type.

        If there's no current Content Item, false is returned.

        Parameters:
        matchSingleItem - Whether single items should be matched, or whether the item must be the first of a sequence of two or more items.
        Returns:
        If the Content Item is first in a sequence of Content Items using the same Content Type, this returns true. In all other cases, it returns false.
      • isLast

        boolean isLast()
        Checks whether the currently publish Content Item is the last in the currently publishing Section.

        If there's no current Content Item, false is returned.

        Returns:
        If the Content Item is the last in the currently publish Section, this returns true. In all other cases, it returns false.
      • isLastOfType

        boolean isLastOfType()
        Checks whether the currently publish Content Item is the last in the currently publishing Section that uses its Content Type.

        If there's no current Content Item, false is returned.

        Returns:
        If the Content Item is the last in the currently publish Section using the Content Type of the Content Item, this returns true. In all other cases, it returns false.
      • isLastInSequence

        boolean isLastInSequence​(boolean matchSingleItem)
        Checks whether the currently publishing Content Item is the last in a sequence of Content Items using the same Content Type.

        If there's no current Content Item, false is returned.

        Parameters:
        matchSingleItem - Whether single items should be matched, or whether the item must be the last of a sequence of two or more items.
        Returns:
        If the Content Item is last in a sequence of Content Items using the same Content Type, this returns true. In all other cases, it returns false.
      • getFulltextURL

        String getFulltextURL()
        Gets the fulltext URL of the currently publishing Content Item.

        If there is no currently publishing Content Item, a blank string is returned.

        Returns:
        The fulltext URL or a blank string if there is no currently publishing Content Item.