|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.microsoft.tfs.core.checkinpolicies.PolicyDefinition
public class PolicyDefinition
A PolicyDefinition
represents a policy that is configured for a team
project on a Team Foundation Server. A definition has a policy type, some
flags like whether it is enabled, and policy type-specific configuration
information.
Several PolicyDefinition
objects may be defined on a single team
project, and these are collected in a PolicyAnnotation
for
serialization.
This class does not define a type of checkin policy (see
PolicyType
), rather it defines an "attachment" of a policy (and its
configuration info) to a Team Project.
A PolicyDefinition
has an evaluation priority (see
getPriority()
), which is a number that represents whether a policy
should be evaluated early or later when there are multiple policies definied
for a team project. Lower values mean earlier evaluation, and higher values
are later. The default priority is 0. Negative numbers can be used.
Each definition also contains regular expressions that allow the user to limit which items the policy applies to within a team project. These expressions are stored as an array of strings. An empty array means apply the policy to all items inside the team project. A non-empty array means apply the policy to all items inside the the team project that match any of the expressions in the array.
Field Summary | |
---|---|
static int |
SUPPORTED_VERSION
The single data version we read and write. |
Constructor Summary | |
---|---|
PolicyDefinition(PolicyInstance instance,
boolean enabled,
int priority,
java.lang.String[] scopeExpressions)
Creates a PolicyDefinition that describes the given instance's
type and configuration. |
|
PolicyDefinition(PolicyType type,
Memento configurationMemento,
boolean enabled,
int priority,
java.lang.String[] scopeExpressions)
Constructs a PolicyDefinition to hold the given information. |
Method Summary | |
---|---|
static PolicyDefinition |
fromMemento(Memento definitionMemento)
Reads a full PolicyDefinition from the given memento and its
children. |
Memento |
getConfigurationMemento()
|
int |
getPriority()
Gets the evaluation priority for this definition. |
java.lang.String[] |
getScopeExpressions()
Gets the regular expression strings that define the scope of this policy definition (for items inside a team project). |
PolicyType |
getType()
|
boolean |
isEnabled()
|
void |
toMemento(Memento definitionMemento)
Writes this definition's data into the given empty Memento . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int SUPPORTED_VERSION
1
Constructor Detail |
---|
public PolicyDefinition(PolicyType type, Memento configurationMemento, boolean enabled, int priority, java.lang.String[] scopeExpressions)
PolicyDefinition
to hold the given information.
public PolicyDefinition(PolicyInstance instance, boolean enabled, int priority, java.lang.String[] scopeExpressions)
PolicyDefinition
that describes the given instance's
type and configuration. The configuration and type data is copied from
the given instance immediately.
instance
- a configured PolicyInstance
to create a definition for
(must not be null
)enabled
- true if the policy definition is enabled, false if it is disabled.priority
- the evaluation priority of this definition (see
getPriority()
). 0 is a good default.Method Detail |
---|
public static PolicyDefinition fromMemento(Memento definitionMemento) throws PolicySerializationException
PolicyDefinition
from the given memento and its
children.
definitionMemento
- the memento node to read definition information from (must not be
null
)
PolicySerializationException
- if an error occurred reading the definitionspublic void toMemento(Memento definitionMemento)
Memento
.
definitionMemento
- the empty memento to write this definition's data into (must not
be null
)public boolean isEnabled()
public int getPriority()
public PolicyType getType()
public java.lang.String[] getScopeExpressions()
public Memento getConfigurationMemento()
Memento
that this
definition uses.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |