public interface RuleAdminSession extends OsidSession
This session creates, updates, and deletes Rules.
The
data for create and update is provided by the consumer via the form
object. OsidForms
are requested for each create or update
and may not be reused.
Create and update operations differ in their usage. To create a
Rule,
a RuleForm
is requested using
getRuleFormForCreate()
specifying the desired record Types
or none if no record Types
are needed. The returned
RuleForm
will indicate that it is to be used with a create
operation and can be used to examine metdata or validate data prior to
creation. Once the RuleForm
is submiited to a create
operation, it cannot be reused with another create operation unless the
first operation was unsuccessful. Each RuleForm
corresponds
to an attempted transaction.
For updates, RuleForms
are requested to the Rule
Id
that is to be updated using
getRuleFormForUpdate().
Similarly, the RuleForm
has
metadata about the data that can be updated and it can perform validation
before submitting the update. The RuleForm
can only be used
once for a successful update and cannot be reused.
The delete operations delete Rules.
To unmap a
Rule
from the current Engine,
the
RuleEngineAssignmentSession
should be used. These delete
operations attempt to remove the Rule
itself thus removing
it from all known Engine
catalogs.
This session includes an Id
aliasing mechanism to
assign an external Id
to an internally assigned Id.
Modifier and Type | Method and Description |
---|---|
void |
aliasRule(Id ruleId,
Id aliasId)
Adds an
Id to a Rule for the purpose of
creating compatibility. |
boolean |
canCreateRules()
Tests if this user can create
Rules. |
boolean |
canCreateRuleWithRecordTypes(Type[] ruleRecordTypes)
Tests if this user can create a single
Rule using the
desired record types. |
boolean |
canDeleteRules()
Tests if this user can delete
Rules. |
boolean |
canManageRuleAliases()
Tests if this user can manage
Id aliases for
Rules. |
boolean |
canUpdateRules()
Tests if this user can update
Rules. |
Rule |
createRule(RuleForm ruleForm)
Creates a new
Rule. |
void |
deleteRule(Id ruleId)
Deletes the
Rule identified by the given Id. |
Engine |
getEngine()
Gets the
Engine associated with this session. |
Id |
getEngineId()
Gets the
Engine Id associated with this
session. |
RuleForm |
getRuleFormForCreate(Type[] ruleRecordTypes)
Gets the rule form for creating new rules.
|
RuleForm |
getRuleFormForUpdate(Id ruleId)
Gets the rule form for updating an existing rule.
|
void |
updateRule(RuleForm ruleForm)
Updates an existing rule.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactions
close
Id getEngineId()
Engine
Id
associated with this
session. Engine Id
associated with this sessionmandatory
- This method must be implemented. Engine getEngine() throws OperationFailedException, PermissionDeniedException
Engine
associated with this session. Engine
associated with this sessionOperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canCreateRules()
Rules.
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known creating a Rule
will result
in a PERMISSION_DENIED.
This is intended as a hint to
an application that may opt not to offer create operations to an
unauthorized user. false
if Rule
creation is not
authorized, true
otherwisemandatory
- This method must be implemented. boolean canCreateRuleWithRecordTypes(Type[] ruleRecordTypes)
Rule
using the
desired record types. While RulesManager.getRuleRecordTypes()
can be used to examine which records are supported, this
method tests which record(s) are required for creating a specific
Rule.
Providing an empty array tests if a Rule
can be created with no records.ruleRecordTypes
- array of rule record types true
if Rule
creation using the
specified record Types
is supported,
false
otherwiseNullArgumentException
- ruleRecordTypes
is null
mandatory
- This method must be implemented. RuleForm getRuleFormForCreate(Type[] ruleRecordTypes) throws OperationFailedException, PermissionDeniedException
ruleRecordTypes
- array of rule record typesNullArgumentException
- ruleRecordTypes
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- unable to get form with
requested record typesmandatory
- This method must be implemented. Rule createRule(RuleForm ruleForm) throws OperationFailedException, PermissionDeniedException
Rule.
ruleForm
- the form for this Rule
Rule
IllegalStateException
- ruleForm
already
used in a create transactionInvalidArgumentException
- one or more of the form
elements is invalidNullArgumentException
- ruleForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- ruleForm
did not
originate from getRuleFormForCreate()
mandatory
- This method must be implemented. boolean canUpdateRules()
Rules.
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known updating a Rule
will result
in a PERMISSION_DENIED.
This is intended as a hint to
an application that may opt not to offer update operations to an
unauthorized user. false
if rule modification is not authorized,
true
otherwisemandatory
- This method must be implemented. RuleForm getRuleFormForUpdate(Id ruleId) throws NotFoundException, OperationFailedException, PermissionDeniedException
ruleId
- the Id
of the Rule
NotFoundException
- ruleId
is not foundNullArgumentException
- ruleId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. void updateRule(RuleForm ruleForm) throws OperationFailedException, PermissionDeniedException
ruleForm
- the form containing the elements to be updatedIllegalStateException
- ruleForm
already
used in an update transactionInvalidArgumentException
- the form contains an invalid
valueNullArgumentException
- ruleForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- ruleForm
did not
originate from getRuleFormForUpdate()
mandatory
- This method must be implemented. boolean canDeleteRules()
Rules.
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known deleting a Rule
will result
in a PERMISSION_DENIED.
This is intended as a hint to
an application that may opt not to offer delete operations to an
unauthorized user. false
if Rule
deletion is not
authorized, true
otherwisemandatory
- This method must be implemented. void deleteRule(Id ruleId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Rule
identified by the given Id.
ruleId
- the Id
of the Rule
to
deleteNotFoundException
- a Rule
was not found
identified by the given Id
NullArgumentException
- ruleId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canManageRuleAliases()
Id
aliases for
Rules.
A return of true does not guarantee successful
authorization. A return of false indicates that it is known changing
an alias will result in a PERMISSION_DENIED.
This is
intended as a hint to an application that may opt not to offer alias
operations to an unauthorized user. false
if Rule
aliasing is not
authorized, true
otherwisemandatory
- This method must be implemented. void aliasRule(Id ruleId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
Id
to a Rule
for the purpose of
creating compatibility. The primary Id
of the
Rule
is determined by the provider. The new Id
performs as an alias to the primary Id.
If the alias is
a pointer to another rule, it is reassigned to the given rule
Id.
ruleId
- the Id
of a Rule
aliasId
- the alias Id
AlreadyExistsException
- aliasId
is
already assignedNotFoundException
- ruleId
not foundNullArgumentException
- ruleId
or
aliasId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented.