| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| ForeignKeyFieldsPopulationState |
|
| 1.4;1.4 |
| 1 | /* | |
| 2 | * Copyright 2006-2008 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.opensource.org/licenses/ecl2.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.kns.util; | |
| 17 | ||
| 18 | import java.io.Serializable; | |
| 19 | import java.util.List; | |
| 20 | ||
| 21 | /** | |
| 22 | * This class is a token-style class, that is write-once, then read-only for all consumers of the class. It is often used as a | |
| 23 | * return value from various PersistenceStructureService methods. | |
| 24 | * | |
| 25 | * The object represents the state of the foreign-key fields of a reference object. For example, if Account is the bo, and | |
| 26 | * organization is the reference object, then chartOfAccountsCode and organizationCode are the foreign key fields. Their state, | |
| 27 | * rather they are all filled out, whether any of them are filled out, and which ones are not filled out, is what this class | |
| 28 | * represents. | |
| 29 | * | |
| 30 | * | |
| 31 | */ | |
| 32 | public class ForeignKeyFieldsPopulationState implements Serializable { | |
| 33 | ||
| 34 | private boolean allFieldsPopulated; | |
| 35 | private boolean anyFieldsPopulated; | |
| 36 | private List<String> unpopulatedFieldNames; | |
| 37 | ||
| 38 | 0 | public ForeignKeyFieldsPopulationState(boolean allFieldsPopulated, boolean anyFieldsPopulated, List<String> unpopulatedFieldNames) { |
| 39 | 0 | this.allFieldsPopulated = allFieldsPopulated; |
| 40 | 0 | this.anyFieldsPopulated = anyFieldsPopulated; |
| 41 | 0 | this.unpopulatedFieldNames = unpopulatedFieldNames; |
| 42 | 0 | } |
| 43 | ||
| 44 | /** | |
| 45 | * Gets the allFieldsPopulated attribute. | |
| 46 | * | |
| 47 | * @return Returns the allFieldsPopulated. | |
| 48 | */ | |
| 49 | public boolean isAllFieldsPopulated() { | |
| 50 | 0 | return allFieldsPopulated; |
| 51 | } | |
| 52 | ||
| 53 | /** | |
| 54 | * Gets the anyFieldsPopulated attribute. | |
| 55 | * | |
| 56 | * @return Returns the anyFieldsPopulated. | |
| 57 | */ | |
| 58 | public boolean isAnyFieldsPopulated() { | |
| 59 | 0 | return anyFieldsPopulated; |
| 60 | } | |
| 61 | ||
| 62 | /** | |
| 63 | * Gets the unpopulatedFieldNames attribute. | |
| 64 | * | |
| 65 | * @return Returns the unpopulatedFieldNames. | |
| 66 | */ | |
| 67 | public List<String> getUnpopulatedFieldNames() { | |
| 68 | 0 | return unpopulatedFieldNames; |
| 69 | } | |
| 70 | ||
| 71 | /** | |
| 72 | * @see org.kuali.rice.kns.service.PersistenceStructureService.ForeignKeyFieldsPopulation#hasUnpopulatedFieldName(java.lang.String) | |
| 73 | */ | |
| 74 | public boolean hasUnpopulatedFieldName(String fieldName) { | |
| 75 | 0 | if (this.unpopulatedFieldNames.contains(fieldName)) { |
| 76 | 0 | return true; |
| 77 | } | |
| 78 | else { | |
| 79 | 0 | return false; |
| 80 | } | |
| 81 | } | |
| 82 | } |