Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
AbstractTransitionRuleRI |
|
| 0.0;0 |
1 | /* | |
2 | wsmo4j extension - a Choreography API and Reference Implementation | |
3 | ||
4 | Copyright (c) 2005, University of Innsbruck, Austria | |
5 | ||
6 | This library is free software; you can redistribute it and/or modify it under | |
7 | the terms of the GNU Lesser General Public License as published by the Free | |
8 | Software Foundation; either version 2.1 of the License, or (at your option) | |
9 | any later version. | |
10 | This library is distributed in the hope that it will be useful, but WITHOUT | |
11 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
12 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more | |
13 | details. | |
14 | You should have received a copy of the GNU Lesser General Public License along | |
15 | with this library; if not, write to the Free Software Foundation, Inc., | |
16 | 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
17 | */ | |
18 | ||
19 | package org.deri.wsmo4j.orchestration.rule; | |
20 | ||
21 | import java.util.*; | |
22 | ||
23 | import org.wsmo.service.orchestration.rule.*; | |
24 | import org.wsmo.service.rule.*; | |
25 | ||
26 | /** | |
27 | * Implements common functionality for a Transition Rule. | |
28 | * | |
29 | * <pre> | |
30 | * Created on Jul 26, 2005 | |
31 | * Committed by $Author: vassil_momtchev $ | |
32 | * $Source$ | |
33 | * </pre> | |
34 | * | |
35 | * @author Thomas Haselwanter | |
36 | * @author James Scicluna | |
37 | * | |
38 | * @version $Revision: 1851 $ $Date: 2006-10-24 18:01:07 +0300 (Tue, 24 Oct 2006) $ | |
39 | */ | |
40 | public abstract class AbstractTransitionRuleRI implements OrchestrationTransitionRule { | |
41 | ||
42 | protected Condition condition; | |
43 | ||
44 | /** | |
45 | * @uml.property name="rules" | |
46 | * @uml.associationEnd multiplicity="(0 -1)" elementType="org.wsmo.service.rule.OrchestrationRule" | |
47 | */ | |
48 | 0 | protected Set<Rule> rules = new HashSet<Rule>(); |
49 | ||
50 | /** | |
51 | * Default constructor for Abstract Transition Rules | |
52 | */ | |
53 | public AbstractTransitionRuleRI() { | |
54 | 0 | super(); |
55 | 0 | } |
56 | ||
57 | /* | |
58 | * (non-Javadoc) | |
59 | * | |
60 | * @see org.wsmo.service.orchestration.rule.TransitionRule#getCondition() | |
61 | */ | |
62 | public Condition getCondition() { | |
63 | 0 | return this.condition; |
64 | } | |
65 | ||
66 | /* (non-Javadoc) | |
67 | * @see org.wsmo.service.orchestration.rule.TransitionRule#setCondition(org.wsmo.service.choreography.rule.Condition) | |
68 | */ | |
69 | public void setCondition(Condition condition) { | |
70 | 0 | this.condition = condition; |
71 | 0 | } |
72 | ||
73 | /* | |
74 | * (non-Javadoc) | |
75 | * | |
76 | * @see org.wsmo.service.orchestration.rule.TransitionRule#listNestedRules() | |
77 | */ | |
78 | public Set<Rule> listNestedRules() { | |
79 | 0 | return Collections.unmodifiableSet(rules); |
80 | } | |
81 | ||
82 | /* | |
83 | * (non-Javadoc) | |
84 | * | |
85 | * @see org.wsmo.service.orchestration.rule.TransitionRule#clearNestedRules() | |
86 | */ | |
87 | public void clearNestedRules() { | |
88 | 0 | this.rules.clear(); |
89 | 0 | } |
90 | ||
91 | /* | |
92 | * (non-Javadoc) | |
93 | * | |
94 | * @see org.wsmo.service.orchestration.rule.TransitionRule#add(org.wsmo.service.orchestration.rule.Rule) | |
95 | */ | |
96 | public void addRule(Rule rule) { | |
97 | 0 | if (rule != null) |
98 | 0 | rules.add(rule); |
99 | 0 | } |
100 | ||
101 | /* | |
102 | * (non-Javadoc) | |
103 | * | |
104 | * @see org.wsmo.service.orchestration.rule.TransitionRule#add(java.util.Set) | |
105 | */ | |
106 | public void addRules(Set<Rule> rules) { | |
107 | 0 | if (rules != null) |
108 | 0 | rules.addAll(rules); |
109 | 0 | } |
110 | ||
111 | /* | |
112 | * (non-Javadoc) | |
113 | * | |
114 | * @see org.wsmo.service.orchestration.rule.TransitionRule#removeRule(org.wsmo.service.orchestration.rule.Rule) | |
115 | */ | |
116 | public void removeRule(Rule rule) { | |
117 | 0 | rules.remove(rule); |
118 | 0 | } |
119 | ||
120 | /* (non-Javadoc) | |
121 | * @see org.wsmo.service.choreography.rule.TransitionRule#setRules(java.util.Set) | |
122 | */ | |
123 | public void setRules(Set<Rule> rules) { | |
124 | 0 | this.rules = rules; |
125 | 0 | } |
126 | ||
127 | protected String stringInnerRules() { | |
128 | 0 | String s = ""; |
129 | Rule r; | |
130 | 0 | Iterator<Rule> i = this.rules.iterator(); |
131 | 0 | while (i.hasNext()) { |
132 | 0 | r = i.next(); |
133 | 0 | s += r.toString() + "\n"; |
134 | } | |
135 | 0 | return s; |
136 | } | |
137 | } |