View Javadoc
1   /**
2    * Copyright 2005-2014 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.krad.util;
17  
18  import org.kuali.rice.krad.data.DataObjectWrapper;
19  
20  import java.io.Serializable;
21  import java.util.List;
22  
23  /**
24   * 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
25   * return value from various PersistenceStructureService methods.
26   *
27   * The object represents the state of the foreign-key fields of a reference object. For example, if Account is the bo, and
28   * organization is the reference object, then chartOfAccountsCode and organizationCode are the foreign key fields. Their state,
29   * rather they are all filled out, whether any of them are filled out, and which ones are not filled out, is what this class
30   * represents.
31   *
32   * @deprecated Replaced with methods on {@link DataObjectWrapper}
33   */
34  @Deprecated
35  public class ForeignKeyFieldsPopulationState implements Serializable {
36  
37      private boolean allFieldsPopulated;
38      private boolean anyFieldsPopulated;
39      private List<String> unpopulatedFieldNames;
40  
41      public ForeignKeyFieldsPopulationState(boolean allFieldsPopulated, boolean anyFieldsPopulated, List<String> unpopulatedFieldNames) {
42          this.allFieldsPopulated = allFieldsPopulated;
43          this.anyFieldsPopulated = anyFieldsPopulated;
44          this.unpopulatedFieldNames = unpopulatedFieldNames;
45      }
46  
47      /**
48       * Gets the allFieldsPopulated attribute.
49       *
50       * @return Returns the allFieldsPopulated.
51       */
52      public boolean isAllFieldsPopulated() {
53          return allFieldsPopulated;
54      }
55  
56      /**
57       * Gets the anyFieldsPopulated attribute.
58       *
59       * @return Returns the anyFieldsPopulated.
60       */
61      public boolean isAnyFieldsPopulated() {
62          return anyFieldsPopulated;
63      }
64  
65      /**
66       * Gets the unpopulatedFieldNames attribute.
67       *
68       * @return Returns the unpopulatedFieldNames.
69       */
70      public List<String> getUnpopulatedFieldNames() {
71          return unpopulatedFieldNames;
72      }
73  
74      public boolean hasUnpopulatedFieldName(String fieldName) {
75          if (this.unpopulatedFieldNames.contains(fieldName)) {
76              return true;
77          }
78          else {
79              return false;
80          }
81      }
82  }