001/** 002 * Copyright 2005-2015 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.kuali.rice.krad.util; 017 018import java.io.Serializable; 019import java.util.List; 020 021/** 022 * 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 023 * return value from various PersistenceStructureService methods. 024 * 025 * The object represents the state of the foreign-key fields of a reference object. For example, if Account is the bo, and 026 * organization is the reference object, then chartOfAccountsCode and organizationCode are the foreign key fields. Their state, 027 * rather they are all filled out, whether any of them are filled out, and which ones are not filled out, is what this class 028 * represents. 029 * 030 * 031 */ 032public class ForeignKeyFieldsPopulationState implements Serializable { 033 034 private boolean allFieldsPopulated; 035 private boolean anyFieldsPopulated; 036 private List<String> unpopulatedFieldNames; 037 038 public ForeignKeyFieldsPopulationState(boolean allFieldsPopulated, boolean anyFieldsPopulated, List<String> unpopulatedFieldNames) { 039 this.allFieldsPopulated = allFieldsPopulated; 040 this.anyFieldsPopulated = anyFieldsPopulated; 041 this.unpopulatedFieldNames = unpopulatedFieldNames; 042 } 043 044 /** 045 * Gets the allFieldsPopulated attribute. 046 * 047 * @return Returns the allFieldsPopulated. 048 */ 049 public boolean isAllFieldsPopulated() { 050 return allFieldsPopulated; 051 } 052 053 /** 054 * Gets the anyFieldsPopulated attribute. 055 * 056 * @return Returns the anyFieldsPopulated. 057 */ 058 public boolean isAnyFieldsPopulated() { 059 return anyFieldsPopulated; 060 } 061 062 /** 063 * Gets the unpopulatedFieldNames attribute. 064 * 065 * @return Returns the unpopulatedFieldNames. 066 */ 067 public List<String> getUnpopulatedFieldNames() { 068 return unpopulatedFieldNames; 069 } 070 071 /** 072 * @see org.kuali.rice.krad.service.PersistenceStructureService.ForeignKeyFieldsPopulation#hasUnpopulatedFieldName(java.lang.String) 073 */ 074 public boolean hasUnpopulatedFieldName(String fieldName) { 075 if (this.unpopulatedFieldNames.contains(fieldName)) { 076 return true; 077 } 078 else { 079 return false; 080 } 081 } 082}