| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| TypeStateCaseConstraint |
|
| 1.25;1.25 |
| 1 | /* | |
| 2 | * Copyright 2009 The Kuali Foundation | |
| 3 | * | |
| 4 | * Licensed under the Educational Community License, Version 2.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.osedu.org/licenses/ECL-2.0 | |
| 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.student.contract.model; | |
| 17 | ||
| 18 | import org.kuali.student.contract.model.CrossObjectConstraint; | |
| 19 | ||
| 20 | import java.util.List; | |
| 21 | ||
| 22 | /** | |
| 23 | * Models a single type state constraint that combines multiple entries into a single | |
| 24 | * constraint statement | |
| 25 | * @author nwright | |
| 26 | */ | |
| 27 | public class TypeStateCaseConstraint { | |
| 28 | ||
| 29 | private List<CrossObjectConstraint> typeStateWhens; | |
| 30 | ||
| 31 | 0 | public TypeStateCaseConstraint(List<CrossObjectConstraint> typeStateWhens) { |
| 32 | 0 | this.typeStateWhens = typeStateWhens; |
| 33 | 0 | } |
| 34 | ||
| 35 | public List<CrossObjectConstraint> getTypeStateWhens() { | |
| 36 | 0 | return typeStateWhens; |
| 37 | } | |
| 38 | ||
| 39 | public String getId() { | |
| 40 | 0 | StringBuffer buf = new StringBuffer(); |
| 41 | 0 | String separator = ""; |
| 42 | 0 | for (CrossObjectConstraint cons : typeStateWhens) { |
| 43 | 0 | buf.append(separator); |
| 44 | 0 | separator = "."; |
| 45 | 0 | buf.append(cons.getId()); |
| 46 | } | |
| 47 | 0 | return buf.toString(); |
| 48 | } | |
| 49 | ||
| 50 | public String getKey() { | |
| 51 | 0 | return getId(); |
| 52 | } | |
| 53 | } |