Interface RuleAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, 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.
-
Method Summary
Modifier and TypeMethodDescriptionvoidAdds anIdto aRulefor the purpose of creating compatibility.booleanTests if this user can createRules.booleancanCreateRuleWithRecordTypes(Type[] ruleRecordTypes) Tests if this user can create a singleRuleusing the desired record types.booleanTests if this user can deleteRules.booleanTests if this user can manageIdaliases forRules.booleanTests if this user can updateRules.createRule(RuleForm ruleForm) Creates a newRule.voiddeleteRule(Id ruleId) Deletes theRuleidentified by the givenId.Gets theEngineassociated with this session.Gets theEngineIdassociated with this session.getRuleFormForCreate(Type[] ruleRecordTypes) Gets the rule form for creating new rules.getRuleFormForUpdate(Id ruleId) Gets the rule form for updating an existing rule.voidupdateRule(RuleForm ruleForm) Updates an existing rule.Methods inherited from interface OsidSession
closeMethods inherited from interface OsidSession
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactionsModifier and TypeMethodDescriptionGets the agent authenticated to this session.Gets theIdof the agent authenticated to this session.Gets the rate of the service clock.getDate()Gets the service date which may be the current date or the effective date in which this session exists.Gets the effective agent in use by this session.Gets theIdof the effective agent in use by this session.Gets theDisplayTextformatTypepreference in effect for this session.Gets the locale indicating the localization preferences in effect for this session.booleanTests if an agent is authenticated to this session.Starts a new transaction for this sesson.booleanTests for the availability of transactions.
-
Method Details
-
getEngineId
Id getEngineId()Gets theEngineIdassociated with this session.- Returns:
- the
Engine Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getEngine
Gets theEngineassociated with this session.- Returns:
- the
Engineassociated with this session - Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreateRules
boolean canCreateRules()Tests if this user can createRules. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aRulewill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer create operations to an unauthorized user.- Returns:
falseifRulecreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateRuleWithRecordTypes
Tests if this user can create a singleRuleusing the desired record types. WhileRulesManager.getRuleRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificRule. Providing an empty array tests if aRulecan be created with no records.- Parameters:
ruleRecordTypes- array of rule record types- Returns:
trueifRulecreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-ruleRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getRuleFormForCreate
RuleForm getRuleFormForCreate(Type[] ruleRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the rule form for creating new rules. A new form should be requested for each create transaction.- Parameters:
ruleRecordTypes- array of rule record types- Returns:
- the rule form
- Throws:
NullArgumentException-ruleRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form with requested record types- Compliance:
mandatory- This method must be implemented.
-
createRule
Creates a newRule.- Parameters:
ruleForm- the form for thisRule- Returns:
- the new
Rule - Throws:
IllegalStateException-ruleFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-ruleFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-ruleFormdid not originate fromgetRuleFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateRules
boolean canUpdateRules()Tests if this user can updateRules. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aRulewill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer update operations to an unauthorized user.- Returns:
falseif rule modification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getRuleFormForUpdate
RuleForm getRuleFormForUpdate(Id ruleId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the rule form for updating an existing rule. A new rule form should be requested for each update transaction.- Parameters:
ruleId- theIdof theRule- Returns:
- the rule form
- Throws:
NotFoundException-ruleIdis not foundNullArgumentException-ruleIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateRule
Updates an existing rule.- Parameters:
ruleForm- the form containing the elements to be updated- Throws:
IllegalStateException-ruleFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-ruleFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-ruleFormdid not originate fromgetRuleFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteRules
boolean canDeleteRules()Tests if this user can deleteRules. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aRulewill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer delete operations to an unauthorized user.- Returns:
falseifRuledeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteRule
void deleteRule(Id ruleId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes theRuleidentified by the givenId.- Parameters:
ruleId- theIdof theRuleto delete- Throws:
NotFoundException- aRulewas not found identified by the givenIdNullArgumentException-ruleIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageRuleAliases
boolean canManageRuleAliases()Tests if this user can manageIdaliases forRules. A return of true does not guarantee successful authorization. A return of false indicates that it is known changing an alias will result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer alias operations to an unauthorized user.- Returns:
falseifRulealiasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasRule
void aliasRule(Id ruleId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aRulefor the purpose of creating compatibility. The primaryIdof theRuleis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another rule, it is reassigned to the given ruleId.- Parameters:
ruleId- theIdof aRulealiasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-ruleIdnot foundNullArgumentException-ruleIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-