Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
RuleTreeSimplePropositionParameterNode |
|
| 2.0;2 |
1 | /* | |
2 | * Copyright 2011 The Kuali Foundation | |
3 | * | |
4 | * Licensed under the Educational Community License, Version 1.0 (the "License"); | |
5 | * you may not use this file except in compliance with the License. | |
6 | * You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.opensource.org/licenses/ecl1.php | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | package org.kuali.rice.krms.impl.ui; | |
17 | ||
18 | import java.util.List; | |
19 | ||
20 | import org.kuali.rice.krms.api.repository.proposition.PropositionType; | |
21 | import org.kuali.rice.krms.impl.repository.PropositionBo; | |
22 | import org.kuali.rice.krms.impl.repository.PropositionParameterBo; | |
23 | ||
24 | /** | |
25 | * abstract data class for the rule tree {@link Node}s | |
26 | * | |
27 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
28 | * | |
29 | */ | |
30 | public class RuleTreeSimplePropositionParameterNode extends RuleTreeNode { | |
31 | protected String parameterDisplayString; | |
32 | ||
33 | public RuleTreeSimplePropositionParameterNode(PropositionBo proposition){ | |
34 | 0 | super(proposition); |
35 | 0 | setupParameterDisplayString(); |
36 | 0 | } |
37 | ||
38 | private void setupParameterDisplayString(){ | |
39 | 0 | if (proposition != null && proposition.getPropositionTypeCode().equalsIgnoreCase(PropositionType.SIMPLE.getCode())){ |
40 | // Simple Propositions should have 3 parameters ordered in reverse polish notation. | |
41 | // TODO: enhance to get term names for term type parameters. | |
42 | 0 | List<PropositionParameterBo> parameters = proposition.getParameters(); |
43 | 0 | if (parameters != null && parameters.size() == 3){ |
44 | 0 | setParameterDisplayString(parameters.get(0).getValue() |
45 | + " " + parameters.get(2).getValue() | |
46 | + " " + parameters.get(1).getValue()); | |
47 | } else { | |
48 | // should not happen | |
49 | } | |
50 | } | |
51 | 0 | } |
52 | ||
53 | /** | |
54 | * @return the parameterDisplayString | |
55 | */ | |
56 | public String getParameterDisplayString() { | |
57 | 0 | return this.parameterDisplayString; |
58 | } | |
59 | ||
60 | /** | |
61 | * @param parameterDisplayString the parameterDisplayString to set | |
62 | */ | |
63 | public void setParameterDisplayString(String parameterDisplayString) { | |
64 | 0 | this.parameterDisplayString = parameterDisplayString; |
65 | 0 | } |
66 | ||
67 | ||
68 | } |