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.bo;
17  
18  import java.util.List;
19  
20  
21  /**
22   * 
23   * This is a marker interface used to determine whether we are dealing with a GlobalBusinessObject or something else
24   * 
25   * If implementations of this class implement {@link PersistableBusinessObject} as well, then it is strongly recommended that
26   * classes override {@link PersistableBusinessObject#buildListOfDeletionAwareLists()} as well.  If this is not done correctly, then
27   * deleted collection elements will not be persisted, and upon reload from the DB, the deleted items will appear in the collection.
28   */
29  public interface GlobalBusinessObject {
30  
31      /**
32       * Gets the documentNumber attribute.
33       * 
34       * @return Returns the documentNumber
35       * 
36       */
37      public String getDocumentNumber();
38  
39      /**
40       * Sets the documentNumber attribute.
41       * 
42       * @param documentNumber The documentNumber to set.
43       * 
44       */
45      public void setDocumentNumber(String documentNumber);
46  
47      /**
48       * 
49       * This method applies the global changed fields to the list of BOs contained within, and returns the list, with all the
50       * relevant values updated.
51       * 
52       * @return Returns a List of BusinessObjects that are ready for persisting, with any relevant values changed
53       * 
54       */
55      public List<PersistableBusinessObject> generateGlobalChangesToPersist();
56  
57      /**
58       * 
59       * This method generates a list of BusinessObjects that need to be deleted as part of the final processing for a global
60       * maintenance document. These records should be deleted before the records from getGlobalChangesToPersist() are persisted.
61       * 
62       * @return A List of BusinessObjects that should be deleted as part of this global maint doc's final processing.
63       * 
64       */
65      public List<PersistableBusinessObject> generateDeactivationsToPersist();
66  
67      /**
68       * 
69       * This method examines the underlying document and determines whether it can be persisted as part of the enclosing
70       * MaintenanceDocument. If it returns false, then the Maintenance Document it is part of should not be saved, as a SQL Exception
71       * is likely to result.
72       * 
73       * @return True if the document can be safely persisted, False if not.
74       * 
75       */
76      public boolean isPersistable();
77  
78      /**
79       * Returns a list of all global detail objects on this document.  This method needs to return all detail
80       * objects, even if they are of different types.
81       * 
82       * @return
83       */
84      public List<? extends GlobalBusinessObjectDetail> getAllDetailObjects();
85  }