Package com.nettoolkit.gatekeeper
Class Policy
java.lang.Object
com.nettoolkit.gatekeeper.Policy
- All Implemented Interfaces:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the policy authorization.Get CAPTCHA status setting.longGet policy creation timestamp in milliseconds.Get policy description.getId()Get policy ID.intGet the expiration time number for IP appender.Get the expiration time unit for IP appender.Get the ID for this policy's IP appender visitor group.getName()Get policy name.intGet number of visits required to trigger policy.Get list of IDs for policy page groups.intGet policy priority number.Get the policy reason for being triggered.intGet time interval number for triggering policy.Get time interval time unit for triggering policy.intGet visit interval number for triggering policy.Get list of IDs for policy visitor groups.booleanCheck whether policy is a preset default.booleanGet policy enabled status.booleanGet visitor negation setting.
-
Constructor Details
-
Policy
- Throws:
ParsingException
-
-
Method Details
-
getId
Get policy ID.- Returns:
- policy ID
-
getName
Get policy name.- Returns:
- policy name
-
isVisitorNegated
public boolean isVisitorNegated()Get visitor negation setting. Iftrue, this policy will count visitors that do not match the policy's visitor groups.- Returns:
- visitor negation setting
-
getVisitorGroupIds
Get list of IDs for policy visitor groups.- Returns:
- list of visitor group IDs
-
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
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 return10.- Returns:
- time interval number
-
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
0if not applicable
-
getAuthorization
Get the policy authorization. This could be"allow","deny","captcha", or something custom.- Returns:
- policy authorization
-
getReason
Get the policy reason for being triggered. This must be manually set.- Returns:
- policy reason
-
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
nullif 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 return1.- Returns:
- IP appender expiration time number or
0if unset
-
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
nullif 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
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
-