1 /* 2 * Copyright 2007 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.bo; 17 18 import java.util.List; 19 20 import org.apache.ojb.broker.PersistenceBrokerAware; 21 22 /** 23 * Declares common methods for all persistable objects. 24 */ 25 public interface PersistableBusinessObject extends BusinessObject, PersistenceBrokerAware { 26 27 /** 28 * @return object versionm number, used by optimistic locking 29 */ 30 public Long getVersionNumber(); 31 32 /** 33 * Sets object's version number, used by optimistic locking 34 * 35 * @param versionNumber 36 */ 37 public void setVersionNumber(Long versionNumber); 38 39 /** 40 * @return objectID, the unique identifier for the object 41 */ 42 public String getObjectId(); 43 44 /** 45 * Sets the unique identifer for the object 46 * 47 * @param objectId 48 */ 49 public void setObjectId(String objectId); 50 51 public abstract boolean isBoNotesSupport(); 52 53 /** 54 * @return Returns the boNotes List. 55 */ 56 public abstract List getBoNotes(); 57 58 /** 59 * @see org.kuali.rice.kns.bo.BusinessObject#refreshNonUpdateableReferences() 60 */ 61 public abstract void refreshNonUpdateableReferences(); 62 63 /** 64 * This method is used to refresh a reference object that hangs off of a document. For example, if the attribute's keys were 65 * updated for a reference object, but the reference object wasn't, this method would go out and retrieve the reference object. 66 * 67 * @param referenceObjectName 68 */ 69 public abstract void refreshReferenceObject(String referenceObjectName); 70 71 /** 72 * If this method is not implemented appropriately for PersistableBusinessObject with collections, then PersistableBusinessObject with collections will not persist deletions correctly. 73 * Elements that have been deleted will reappear in the DB after retrieval. 74 * 75 * @return List of collections which need to be monitored for changes by OJB 76 */ 77 public List buildListOfDeletionAwareLists(); 78 79 /** 80 * Returns the boolean indicating whether this record is a new record of a maintenance document collection. 81 * Used to determine whether the record can be deleted on the document. 82 */ 83 public boolean isNewCollectionRecord(); 84 85 /** 86 * Sets the boolean indicating this record is a new record of a maintenance document collection. 87 * Used to determine whether the record can be deleted on the document. 88 */ 89 public void setNewCollectionRecord(boolean isNewCollectionRecord); 90 91 /** 92 * Hook to link in any editable user fields. 93 */ 94 public void linkEditableUserFields(); 95 96 public Note getBoNote(int nbr); 97 98 public boolean addNote(Note note); 99 100 public boolean deleteNote(Note note); 101 102 public PersistableBusinessObjectExtension getExtension(); 103 public void setExtension(PersistableBusinessObjectExtension extension); 104 public void setAutoIncrementSet(boolean autoIncrementSet); 105 }