Class Article

  • All Implemented Interfaces:
    java.io.Serializable


    public class Article
    extends java.lang.Object
    implements java.io.Serializable
    This is a model class for an Article object that will be created by the HelpCenterProvider.
    See Also:
    Articles, Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static int UNKNOWN_VOTE_COUNT 
    • Constructor Summary

      Constructors 
      Constructor and Description
      Article() 
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      User getAuthor()
      Gets the author of this article
      java.lang.Long getAuthorId()
      Gets the ID of the author of the article
      java.lang.String getBody()
      Gets the body of the article in plain text
      java.util.Date getCreatedAt()
      Gets the date that the article was created at.
      int getDownvoteCount()
      Gets the number of downvotes for this article
      java.lang.String getHtmlUrl()
      Gets the html URL of the article.
      java.lang.Long getId()
      Gets the ID of the article
      java.util.List<java.lang.String> getLabelNames()
      Gets the label names of the article
      java.lang.String getLocale()
      Gets the locale of the article in the form of ll-CC, e.g.
      java.lang.Long getSectionId()
      Gets the ID of the section that the article belongs to
      java.lang.String getSourceLocale()
      Gets the source locale of the article in the form of ll-CC, e.g.
      java.lang.String getTitle()
      Gets the title of the article
      java.util.Date getUpdatedAt()
      Gets the date that the article was updated at.
      int getUpvoteCount()
      Gets the number of upvotes for this article.
      java.lang.String getUrl()
      Gets the API URL of the article
      int getVoteCount()
      Gets the total number of votes that have been cast for this article.
      int getVoteSum()
      Gets the sum of votes.
      boolean isCommentsDisabled()
      Checks whether comments are disabled or not
      boolean isDraft()
      Checks if the article is a draft or not
      boolean isOutdated()
      Checks whether the article is outdated or not
      void setAuthor(User author)
      Sets the author of this article.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Article

        public Article()
    • Method Detail

      • getId

        public java.lang.Long getId()
        Gets the ID of the article
        Returns:
        the ID of the article
        Since:
        1.0.0.1
      • getUrl

        public java.lang.String getUrl()
        Gets the API URL of the article
        Returns:
        the API URL of the article
        Since:
        1.0.0.1
      • getHtmlUrl

        public java.lang.String getHtmlUrl()
        Gets the html URL of the article. This is the URL that can be used to open the article in a browser.
        Returns:
        the html URL of the article
        Since:
        1.0.0.1
      • getAuthorId

        public java.lang.Long getAuthorId()
        Gets the ID of the author of the article
        Returns:
        the ID of the author of the article
        Since:
        1.0.0.1
      • isCommentsDisabled

        public boolean isCommentsDisabled()
        Checks whether comments are disabled or not
        Returns:
        true if comments are disabled, false otherwise
        Since:
        1.0.0.1
      • getLabelNames

        public java.util.List<java.lang.String> getLabelNames()
        Gets the label names of the article
        Returns:
        the label names of the article. The list will be unmodifiable.
        Since:
        1.0.0.1
      • isDraft

        public boolean isDraft()
        Checks if the article is a draft or not
        Returns:
        true if the article is a draft, false otherwise
        Since:
        1.0.0.1
      • getVoteSum

        public int getVoteSum()
        Gets the sum of votes. Unhelpful votes are taken as -1 value and helpful votes are taken as +1 value.

        For example, if there are 3 unhelpful votes and 5 helpful votes then the vote sum is (-1 * 3) + (+1 * 5) = 2

        Returns:
        The sum of votes. Unhelpful ones are -1, helpful ones are +1
        Since:
        1.1.0.1
      • getVoteCount

        public int getVoteCount()
        Gets the total number of votes that have been cast for this article.

        For example, if there are 3 unhelpful votes and 5 helpful votes then the total number of votes is 3 + 5 = 8.

        Returns:
        the total number of votes that have been cast for this article.
        Since:
        1.0.0.1
      • getSectionId

        public java.lang.Long getSectionId()
        Gets the ID of the section that the article belongs to
        Returns:
        the ID of the section that the article belongs to
        Since:
        1.0.0.1
      • getCreatedAt

        public java.util.Date getCreatedAt()
        Gets the date that the article was created at.
        Returns:
        the date that the article was created at. Unmodifiable.
        Since:
        1.0.0.1
      • getUpdatedAt

        public java.util.Date getUpdatedAt()
        Gets the date that the article was updated at.
        Returns:
        the date that the article was created at. Unmodifiable.
        Since:
        1.0.0.1
      • getTitle

        public java.lang.String getTitle()
        Gets the title of the article
        Returns:
        the title of the article
        Since:
        1.0.0.1
      • getBody

        public java.lang.String getBody()
        Gets the body of the article in plain text
        Returns:
        the body of the article in plain text
        Since:
        1.0.0.1
      • getSourceLocale

        public java.lang.String getSourceLocale()
        Gets the source locale of the article in the form of ll-CC, e.g. en-US
        Returns:
        the source locale of the article in the form of ll-CC, e.g. en-US
        Since:
        1.0.0.1
      • getLocale

        public java.lang.String getLocale()
        Gets the locale of the article in the form of ll-CC, e.g. en-US
        Returns:
        the locale of the article in the form of ll-CC, e.g. en-US
        Since:
        1.0.0.1
      • isOutdated

        public boolean isOutdated()
        Checks whether the article is outdated or not
        Returns:
        true if the article is outdated, false otherwise
        Since:
        1.0.0.1
      • getAuthor

        public User getAuthor()
        Gets the author of this article
        Returns:
        the author of this article
        Since:
        1.0.0.1
      • setAuthor

        public void setAuthor(User author)
        Sets the author of this article.

        This method is used by the providers to populate this object for convenience.

        Parameters:
        author - The author to set
        Since:
        1.0.0.1
      • getUpvoteCount

        public int getUpvoteCount()
        Gets the number of upvotes for this article.

        The formula that is used is ((vote_sum + vote_count) / 2)

        Returns:
        The number of upvotes for this article or Article.UNKNOWN_VOTE_COUNT if the number of upvotes cannot be determined due to an API error.
        Since:
        1.2.0.1
      • getDownvoteCount

        public int getDownvoteCount()
        Gets the number of downvotes for this article

        The formula that is used is abs(vote_sum - vote_count) / 2

        Returns:
        The number of downvotes for this article or Article.UNKNOWN_VOTE_COUNT if the number of downvotes cannot be determined due to an API error.
        Since:
        1.2.0.1