| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| PersistenceService | 
  | 
  | 1.0;1 | 
| 1 |  /* | |
| 2 |   * Copyright 2005-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.service; | |
| 17 | ||
| 18 |  import java.util.List; | |
| 19 |  import java.util.Map; | |
| 20 | ||
| 21 |  import org.kuali.rice.kns.bo.PersistableBusinessObject; | |
| 22 |  import org.kuali.rice.kns.exception.ClassNotPersistableException; | |
| 23 | ||
| 24 | public interface PersistenceService {  | |
| 25 |  //    public void initialize(); | |
| 26 | ||
| 27 | public void loadRepositoryDescriptor(String ojbRepositoryFilePath);  | |
| 28 | ||
| 29 | public void clearCache();  | |
| 30 | ||
| 31 |      public Object resolveProxy(Object o); | |
| 32 | ||
| 33 |      /** | |
| 34 |       * @param persistableObject object whose primary key field name,value pairs you want | |
| 35 |       * @return a Map containing the names and values of fields specified the given class which are designated as key fields in the | |
| 36 |       *         OJB repository file | |
| 37 |       * @throws IllegalArgumentException if the given Object is null | |
| 38 |       * @throws ClassNotPersistableException if the given object is of a type not described in the OJB repository | |
| 39 |       */ | |
| 40 |      public Map getPrimaryKeyFieldValues(Object persistableObject); | |
| 41 | ||
| 42 |      /** | |
| 43 |       * @param persistableObject object whose primary key field name,value pairs you want | |
| 44 |       * @param sortFieldNames if true, the returned Map will iterate through its entries sorted by fieldName | |
| 45 |       * @return a Map containing the names and values of fields specified the given class which are designated as key fields in the | |
| 46 |       *         OJB repository file | |
| 47 |       * @throws IllegalArgumentException if the given Object is null | |
| 48 |       * @throws ClassNotPersistableException if the given object is of a type not described in the OJB repository | |
| 49 |       */ | |
| 50 | public Map getPrimaryKeyFieldValues(Object persistableObject, boolean sortFieldNames);  | |
| 51 | ||
| 52 |      /** | |
| 53 |       * @param persistableObject object whose objects need to be filled in based on primary keys | |
| 54 |       * @return the object whose key fields have just been retrieved | |
| 55 |       * @throws IllegalArgumentException if the given Object is null | |
| 56 |       * @throws ClassNotPersistableException if the given object is of a type not described in the OJB repository | |
| 57 |       */ | |
| 58 | public void retrieveNonKeyFields(Object persistableObject);  | |
| 59 | ||
| 60 |      /** | |
| 61 |       * @param persistableObject object whose specified reference object needs to be filled in based on primary keys | |
| 62 |       * @param referenceObjectName the name of the reference object that will be filled in based on primary key values | |
| 63 |       * @throws IllegalArgumentException if the given Object is null | |
| 64 |       * @throws ClassNotPersistableException if the given object is of a type not described in the OJB repository | |
| 65 |       */ | |
| 66 | public void retrieveReferenceObject(Object persistableObject, String referenceObjectName);  | |
| 67 | ||
| 68 | ||
| 69 |      /** | |
| 70 |       * @param persistableObject object whose specified reference objects need to be filled in based on primary keys | |
| 71 |       * @param referenceObjectNames the names of the reference objects that will be filled in based on primary key values | |
| 72 |       * @throws IllegalArgumentException if either of the given lists is null or empty, or if any of the referenceObjectNames is | |
| 73 |       *         blank | |
| 74 |       * @throws ClassNotPersistableException if the given object is of a type not described in the OJB repository | |
| 75 |       */ | |
| 76 | public void retrieveReferenceObjects(Object persistableObject, List referenceObjectNames);  | |
| 77 | ||
| 78 |      /** | |
| 79 |       * @param persistableObjects objects whose specified reference objects need to be filled in based on primary keys | |
| 80 |       * @param referenceObjectNames the names of the reference objects that will be filled in based on primary key values | |
| 81 |       * @throws IllegalArgumentException if either of the given lists is null or empty, or if any of the referenceObjectNames is | |
| 82 |       *         blank | |
| 83 |       * @throws ClassNotPersistableException if the given object is of a type not described in the OJB repository | |
| 84 |       */ | |
| 85 | public void retrieveReferenceObjects(List persistableObjects, List referenceObjectNames);  | |
| 86 | ||
| 87 | ||
| 88 |      /** | |
| 89 |       * @param persistableObject object whose objects need to have keys filled | |
| 90 |       * @return the object whose key fields have just been filled | |
| 91 |       * @throws IllegalArgumentException if the given Object is null | |
| 92 |       * @throws ClassNotPersistableException if the given object is of a type not described in the OJB repository | |
| 93 |       */ | |
| 94 | public void linkObjects(Object persistableObject);  | |
| 95 | ||
| 96 | ||
| 97 |      /** | |
| 98 |       * Gets the value for the given field name from the object, works for anonymous fields as well as simple fields | |
| 99 |       *  | |
| 100 |       * @param persistableObject object to get value from | |
| 101 |       * @param fieldName name of the field to get from the object | |
| 102 |       * @return Object value of field in object, or null | |
| 103 |       */ | |
| 104 |      // This method never called | |
| 105 |      //public Object getFieldValue(Object persistableObject, String fieldName); | |
| 106 | ||
| 107 |      /** | |
| 108 |       * @param persistableObject object whose primary key field name,value pairs you want | |
| 109 |       * @param bounded - whether to restrict the number of rows returned | |
| 110 |       * @return a String representation of the primary key fields and values for the given persistableObject | |
| 111 |       * @throws IllegalArgumentException if the given Object is null | |
| 112 |       * @throws ClassNotPersistableException if the given object is of a type not described in the OJB repository | |
| 113 |       */ | |
| 114 |      public String getFlattenedPrimaryKeyFieldValues(Object persistableObject); | |
| 115 | ||
| 116 |      /** | |
| 117 |       *  | |
| 118 |       * This method examines whether all the foreign key fields for the specified reference contain values. | |
| 119 |       *  | |
| 120 |       * @param bo | |
| 121 |       * @param referenceName | |
| 122 |       * @return true if they all are accessible and have values, false otherwise | |
| 123 |       *  | |
| 124 |       */ | |
| 125 | public boolean allForeignKeyValuesPopulatedForReference(PersistableBusinessObject bo, String referenceName);  | |
| 126 | ||
| 127 |      /** | |
| 128 |       *  | |
| 129 |       * This method refreshes all reference objects to this main object that are 'non-updateable'. In general, this means that if a | |
| 130 |       * reference object is configured to not be updated when the parent document is saved, then they are non-updated. | |
| 131 |       *  | |
| 132 |       * This will not refresh updateable objects, which can cause problems when you're creating new objects. | |
| 133 |       *  | |
| 134 |       * See PersistenceServiceImpl.isUpdateableReference() for the full logic. | |
| 135 |       *  | |
| 136 |       * @param bo - the businessObject to be refreshed | |
| 137 |       *  | |
| 138 |       */ | |
| 139 | public void refreshAllNonUpdatingReferences(PersistableBusinessObject bo);  | |
| 140 | ||
| 141 | ||
| 142 |      /** | |
| 143 |       * Determines if the given object is proxied by the ORM or not | |
| 144 |       *  | |
| 145 |       * @param object the object to determine if it is a proxy | |
| 146 |       * @return true if the object is an ORM proxy; false otherwise | |
| 147 |       */ | |
| 148 | public abstract boolean isProxied(Object object);  | |
| 149 | ||
| 150 |      /** | |
| 151 |           * Determines if JPA is enabled for the KNS and for the given class | |
| 152 |           *  | |
| 153 |           * @param clazz the class to check for JPA enabling of | |
| 154 |           * @return true if JPA is enabled for the class, false otherwise | |
| 155 |           */ | |
| 156 | public abstract boolean isJpaEnabledForKnsClass(Class clazz);  | |
| 157 | }  |