| 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 | ||
| 30 | private List<CrossObjectConstraint> typeStateWhens; | |
| 31 | ||
| 32 | public TypeStateCaseConstraint (List<CrossObjectConstraint> typeStateWhens) | |
| 33 | 0 | { |
| 34 | 0 | this.typeStateWhens = typeStateWhens; |
| 35 | 0 | } |
| 36 | ||
| 37 | public List<CrossObjectConstraint> getTypeStateWhens () | |
| 38 | { | |
| 39 | 0 | return typeStateWhens; |
| 40 | } | |
| 41 | ||
| 42 | ||
| 43 | public String getId () | |
| 44 | { | |
| 45 | 0 | StringBuffer buf = new StringBuffer (); |
| 46 | 0 | String separator = ""; |
| 47 | 0 | for (CrossObjectConstraint cons: typeStateWhens) |
| 48 | { | |
| 49 | 0 | buf.append (separator); |
| 50 | 0 | separator = "."; |
| 51 | 0 | buf.append (cons.getId ()); |
| 52 | } | |
| 53 | 0 | return buf.toString (); |
| 54 | } | |
| 55 | ||
| 56 | public String getKey () | |
| 57 | { | |
| 58 | 0 | return getId (); |
| 59 | } | |
| 60 | } |