Class Policy

java.lang.Object
com.nettoolkit.gatekeeper.Policy
All Implemented Interfaces:
Serializable

public class Policy extends Object implements Serializable
Policy is a model for the main building blocks of a rule set. Policies describe how your application should handle incoming visits based on visit history and IP intelligence.
See Also:
  • Constructor Details

  • Method Details

    • getId

      public UUID getId()
      Get policy ID.
      Returns:
      policy ID
    • getName

      public String getName()
      Get policy name.
      Returns:
      policy name
    • isVisitorNegated

      public boolean isVisitorNegated()
      Get visitor negation setting. If true, this policy will count visitors that do not match the policy's visitor groups.
      Returns:
      visitor negation setting
    • getVisitorGroupIds

      public List<UUID> getVisitorGroupIds()
      Get list of IDs for policy visitor groups.
      Returns:
      list of visitor group IDs
    • getPageGroupIds

      public List<UUID> getPageGroupIds()
      Get list of IDs for policy page groups. For policies that do not use page groups, the list will be empty.
      Returns:
      list of page group IDs
    • getCaptchaStatus

      public String getCaptchaStatus()
      Get CAPTCHA status setting. TODO: make this an enum?
    • getNumTimes

      public int getNumTimes()
      Get number of visits required to trigger policy.
      Returns:
      number of visits
    • getTimeIntervalNum

      public int getTimeIntervalNum()
      Get time interval number for triggering policy. For example, if the time interval is "10 MINUTES", this method will return 10.
      Returns:
      time interval number
    • getTimeIntervalUnit

      public String getTimeIntervalUnit()
      Get time interval time unit for triggering policy. For example, if the time interval is "10 MINUTES", this method will return "MINUTES".
      Returns:
      time interval unit
    • getVisitInterval

      public int getVisitInterval()
      Get visit interval number for triggering policy. The visit interval is the number of visits after the policy if first triggered before it can be triggered again. Visit interval only applies to CAPTCHA authorization policies at the moment.
      Returns:
      visit interval number or 0 if not applicable
    • getAuthorization

      public String getAuthorization()
      Get the policy authorization. This could be "allow", "deny", "captcha", or something custom.
      Returns:
      policy authorization
    • getReason

      public String getReason()
      Get the policy reason for being triggered. This must be manually set.
      Returns:
      policy reason
    • getIpAppenderVisitorGroupId

      public UUID getIpAppenderVisitorGroupId()
      Get the ID for this policy's IP appender visitor group. If set, Gatekeeper will automatically append the visitor's IP address to the given visitor group when this policy is triggered.
      Returns:
      IP appender visitor group ID or null if unset
    • getIpAppenderExpirationTimeNum

      public int getIpAppenderExpirationTimeNum()
      Get the expiration time number for IP appender. For example, if IP appender expiration is "1 MONTHS", this method will return 1.
      Returns:
      IP appender expiration time number or 0 if unset
    • getIpAppenderExpirationTimeUnit

      public String getIpAppenderExpirationTimeUnit()
      Get the expiration time unit for IP appender. For example, if IP appender expiration is "1 MONTHS", this method will return "MONTHS".
      Returns:
      IP appender expiration time unit or null if unset
    • getPriority

      public int getPriority()
      Get policy priority number. Policies with a higher priority will be checked first.
      Returns:
      policy priority
    • isEnabled

      public boolean isEnabled()
      Get policy enabled status. Disabled policies will not be checked.
      Returns:
      enabled status
    • getDescription

      public String getDescription()
      Get policy description. Description is used purely for internal notes.
      Returns:
      policy description
    • getCreated

      public long getCreated()
      Get policy creation timestamp in milliseconds. Time zone is set to UTC.
      Returns:
      policy creation timestamp
    • isDefault

      public boolean isDefault()
      Check whether policy is a preset default. Default policies are created automatically by Gatekeeper and cannot be modified.
      Returns:
      whether policy is a default