001: /*
002: * Copyright 2005-2007 The Kuali Foundation.
003: *
004: *
005: * Licensed under the Educational Community License, Version 1.0 (the "License");
006: * you may not use this file except in compliance with the License.
007: * You may obtain a copy of the License at
008: *
009: * http://www.opensource.org/licenses/ecl1.php
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package org.kuali.workflow.tools.xml;
018:
019: import java.util.ArrayList;
020: import java.util.List;
021:
022: /**
023: *
024: * @author ewestfal
025: */
026: public class Rule {
027:
028: private DocumentType documentType;
029: private Template template;
030: private String description;
031: private Boolean ignorePrevious;
032: private List<RuleExtension> ruleExtensions = new ArrayList<RuleExtension>();
033: private List<Responsibility> responsibilities = new ArrayList<Responsibility>();
034:
035: public String getDescription() {
036: return description;
037: }
038:
039: public void setDescription(String description) {
040: this .description = description;
041: }
042:
043: public DocumentType getDocumentType() {
044: return documentType;
045: }
046:
047: public void setDocumentType(DocumentType documentType) {
048: this .documentType = documentType;
049: }
050:
051: public Boolean getIgnorePrevious() {
052: return ignorePrevious;
053: }
054:
055: public void setIgnorePrevious(Boolean ignorePrevious) {
056: this .ignorePrevious = ignorePrevious;
057: }
058:
059: public List<Responsibility> getResponsibilities() {
060: return responsibilities;
061: }
062:
063: public void setResponsibilities(
064: List<Responsibility> responsibilities) {
065: this .responsibilities = responsibilities;
066: }
067:
068: public List<RuleExtension> getRuleExtensions() {
069: return ruleExtensions;
070: }
071:
072: public void setRuleExtensions(List<RuleExtension> ruleExtensions) {
073: this .ruleExtensions = ruleExtensions;
074: }
075:
076: public RuleExtension getRuleExtensionForAttribute(
077: String attributeName) {
078: for (RuleExtension ruleExtension : ruleExtensions) {
079: if (ruleExtension.getAttribute().getName().equals(
080: attributeName)) {
081: return ruleExtension;
082: }
083: }
084: return null;
085: }
086:
087: public Template getTemplate() {
088: return template;
089: }
090:
091: public void setTemplate(Template template) {
092: this .template = template;
093: }
094:
095: public String toString() {
096: String toString = "Rule: \n"
097: + "[documentType: "
098: + (documentType == null ? "null" : documentType
099: .getName()) + "]\n" + "[template: "
100: + (template == null ? "null" : template.getName())
101: + "]\n" + "[ignorePrevious: " + ignorePrevious + "]\n"
102: + "[description: " + description + "]\n"
103: + "[extensions: ";
104: for (RuleExtension extension : getRuleExtensions()) {
105: for (RuleExtensionValue extensionValue : extension
106: .getExtensionValues()) {
107: toString += "[" + extensionValue.getKey() + "="
108: + extensionValue.getValue() + "]";
109: }
110: }
111: toString += "]\n";
112: return toString;
113: }
114:
115: }
|