01: /*
02: * Copyright 2005-2006 The Kuali Foundation.
03: *
04: *
05: * Licensed under the Educational Community License, Version 1.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * http://www.opensource.org/licenses/ecl1.php
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package edu.iu.uis.eden.validation;
18:
19: import edu.iu.uis.eden.routetemplate.RuleBaseValues;
20: import edu.iu.uis.eden.routetemplate.RuleDelegation;
21: import edu.iu.uis.eden.web.session.UserSession;
22:
23: /**
24: * The RuleValidationContext represents the context under which to validate a Rule which is being entered
25: * into the system, be it through the web-based Rule GUI or via an XML import.
26: *
27: * The ruleAuthor is the UserSession of the individual who is entering or editing the rule. This may
28: * be <code>null</code> if the rule is being run through validation from the context of an XML rule
29: * import.
30: *
31: * The RuleDelegation represents the pointer to the rule from it's parent rule's RuleResponsibility.
32: * This will be <code>null</code> if the rule being entered is not a delegation rule.
33: *
34: * @author ewestfal
35: */
36: public class RuleValidationContext {
37:
38: private final RuleBaseValues rule;
39: private final RuleDelegation ruleDelegation;
40: private final UserSession ruleAuthor;
41:
42: /**
43: * Construct a RuleValidationContext under which to validate a rule. The rule must be non-null, the delegation
44: * and author can be <code>null</code> given the circumstances defined in the description of this class.
45: */
46: public RuleValidationContext(RuleBaseValues rule,
47: RuleDelegation ruleDelegation, UserSession ruleAuthor) {
48: this .ruleAuthor = ruleAuthor;
49: this .rule = rule;
50: this .ruleDelegation = ruleDelegation;
51: }
52:
53: /**
54: * Retrieve the rule which is being validated.
55: */
56: public RuleBaseValues getRule() {
57: return rule;
58: }
59:
60: /**
61: * Retrieve the UserSession of the individual entering the rule into the system. May be null in the
62: * case of an XML rule import.
63: */
64: public UserSession getRuleAuthor() {
65: return ruleAuthor;
66: }
67:
68: /**
69: * Retrieve the RuleDelegation representing the parent of the rule being validated. If the rule is
70: * not a delegation rule, then this will return null;
71: */
72: public RuleDelegation getRuleDelegation() {
73: return ruleDelegation;
74: }
75:
76: }
|