| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||||
| EOEnterpriseObject |
|
| 1.0;1 |
| 1 | /* |
|
| 2 | Wotonomy: OpenStep design patterns for pure Java applications. |
|
| 3 | Copyright (C) 2001 Michael Powers |
|
| 4 | ||
| 5 | This library is free software; you can redistribute it and/or |
|
| 6 | modify it under the terms of the GNU Lesser General Public |
|
| 7 | License as published by the Free Software Foundation; either |
|
| 8 | version 2.1 of the License, or (at your option) any later version. |
|
| 9 | ||
| 10 | This library is distributed in the hope that it will be useful, |
|
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
| 13 | Lesser General Public License for more details. |
|
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public |
|
| 16 | License along with this library; if not, see http://www.gnu.org |
|
| 17 | */ |
|
| 18 | ||
| 19 | package net.wotonomy.control; |
|
| 20 | ||
| 21 | import net.wotonomy.foundation.NSArray; |
|
| 22 | import net.wotonomy.foundation.NSDictionary; |
|
| 23 | ||
| 24 | /** |
|
| 25 | * EOEnterpriseObject defines the required methods a data object |
|
| 26 | * must implement to take full advantage of the control package. |
|
| 27 | * |
|
| 28 | * @author michael@mpowers.net |
|
| 29 | * @author $Author: cgruber $ |
|
| 30 | * @version $Revision: 894 $ |
|
| 31 | */ |
|
| 32 | public interface EOEnterpriseObject |
|
| 33 | extends EOKeyValueCodingAdditions, |
|
| 34 | EORelationshipManipulation, |
|
| 35 | EODeferredFaulting, |
|
| 36 | EOValidation |
|
| 37 | { |
|
| 38 | /** |
|
| 39 | * Returns a List of all property keys defined on this object. |
|
| 40 | * This includes both attributes and relationships. |
|
| 41 | */ |
|
| 42 | NSArray allPropertyKeys(); |
|
| 43 | ||
| 44 | /** |
|
| 45 | * Returns a list of all attributes defined on this object. |
|
| 46 | * Attributes are all properties that are not relationships. |
|
| 47 | */ |
|
| 48 | NSArray attributeKeys(); |
|
| 49 | ||
| 50 | //void awakeFromClientUpdate(EOEditingContext aContext) |
|
| 51 | ||
| 52 | /** |
|
| 53 | * Called when the object has first been fetched into the |
|
| 54 | * specified editing context. |
|
| 55 | */ |
|
| 56 | void awakeFromFetch(EOEditingContext anEditingContext); |
|
| 57 | ||
| 58 | /** |
|
| 59 | * Called when the object has been inserted into the |
|
| 60 | * specified editing context. |
|
| 61 | */ |
|
| 62 | void awakeFromInsertion(EOEditingContext anEditingContext); |
|
| 63 | ||
| 64 | /** |
|
| 65 | * Returns a Map representing the delta of the current state |
|
| 66 | * from the state represented in the specified snapshot. |
|
| 67 | * The result will contain only the keys that have changed |
|
| 68 | * and their values. Relationship keys will map to an NSArray |
|
| 69 | * that contains an NSArray of added objects and an NSArray |
|
| 70 | * of removed objects, in that order. |
|
| 71 | */ |
|
| 72 | NSDictionary changesFromSnapshot(NSDictionary snapshot); |
|
| 73 | ||
| 74 | /** |
|
| 75 | * Returns a class description for this object. |
|
| 76 | */ |
|
| 77 | EOClassDescription classDescription(); |
|
| 78 | ||
| 79 | /** |
|
| 80 | * Returns a class description for the object at the |
|
| 81 | * other end of the specified relationship key. |
|
| 82 | */ |
|
| 83 | EOClassDescription classDescriptionForDestinationKey(String aKey); |
|
| 84 | ||
| 85 | /** |
|
| 86 | * Clears all property values for this object. |
|
| 87 | * This method is called to clean-up an object that |
|
| 88 | * will no longer be used, and implementations should |
|
| 89 | * ensure that all references are set to null to |
|
| 90 | * prevent problems with garbage-collection. |
|
| 91 | */ |
|
| 92 | void clearProperties(); |
|
| 93 | ||
| 94 | /** |
|
| 95 | * Returns the delete rule constant defined on EOClassDescription |
|
| 96 | * for the relationship defined by the specified key. |
|
| 97 | */ |
|
| 98 | int deleteRuleForRelationshipKey(String aRelationshipKey); |
|
| 99 | ||
| 100 | /** |
|
| 101 | * Returns the editing context in which this object is registered. |
|
| 102 | */ |
|
| 103 | EOEditingContext editingContext(); |
|
| 104 | ||
| 105 | /** |
|
| 106 | * Returns the name of the entity that this object represents. |
|
| 107 | */ |
|
| 108 | String entityName(); |
|
| 109 | ||
| 110 | /** |
|
| 111 | * Returns a String containing all property keys and values for |
|
| 112 | * this object. Relationships should be represented by calling |
|
| 113 | * eoShallowDescription() on the object. |
|
| 114 | */ |
|
| 115 | String eoDescription(); |
|
| 116 | ||
| 117 | /** |
|
| 118 | * Returns a String containing all attribute keys and values for |
|
| 119 | * this object. Relationships are not included. |
|
| 120 | */ |
|
| 121 | String eoShallowDescription(); |
|
| 122 | ||
| 123 | /** |
|
| 124 | * Returns the key used to reference this object on the |
|
| 125 | * object at the other end of the specified relationship. |
|
| 126 | */ |
|
| 127 | String inverseForRelationshipKey(String aRelationshipKey); |
|
| 128 | ||
| 129 | //Object invokeRemoteMethod( |
|
| 130 | // String aMethodName, Class[] aTypeArray Object[] anArgumentArray) |
|
| 131 | ||
| 132 | /** |
|
| 133 | * Returns whether the specified relationship key represents |
|
| 134 | * a to-many relationship. |
|
| 135 | */ |
|
| 136 | boolean isToManyKey(String aKey); |
|
| 137 | ||
| 138 | /** |
|
| 139 | * Returns whether the objects at the other end of the specified |
|
| 140 | * relationship should be deleted when this object is deleted. |
|
| 141 | */ |
|
| 142 | boolean ownsDestinationObjectsForRelationshipKey(String aKey); |
|
| 143 | ||
| 144 | //void prepareValuesForClient() |
|
| 145 | ||
| 146 | /** |
|
| 147 | * Called to perform the delete propagation for this object |
|
| 148 | * on the specified editing context. All relationships |
|
| 149 | * should be processed according to their corresponding |
|
| 150 | * delete rule. |
|
| 151 | */ |
|
| 152 | void propagateDeleteWithEditingContext(EOEditingContext aContext); |
|
| 153 | ||
| 154 | /** |
|
| 155 | * Applies the changes from the specified snapshot to |
|
| 156 | * this object. |
|
| 157 | * @see #changesFromSnapshot(NSDictionary) |
|
| 158 | */ |
|
| 159 | void reapplyChangesFromDictionary(NSDictionary aDeltaSnapshot); |
|
| 160 | ||
| 161 | /** |
|
| 162 | * Returns a snapshot of the current state of this object. |
|
| 163 | * All property keys are mapped to their values; nulls are |
|
| 164 | * represented by NSNull. |
|
| 165 | */ |
|
| 166 | NSDictionary snapshot(); |
|
| 167 | ||
| 168 | /** |
|
| 169 | * Returns a List of the to-many relationship keys |
|
| 170 | * for this object. |
|
| 171 | */ |
|
| 172 | NSArray toManyRelationshipKeys(); |
|
| 173 | ||
| 174 | /** |
|
| 175 | * Returns a List of the to-one relationship keys |
|
| 176 | * for this object. |
|
| 177 | */ |
|
| 178 | NSArray toOneRelationshipKeys(); |
|
| 179 | ||
| 180 | /** |
|
| 181 | * Applies the specified snapshot to this object, |
|
| 182 | * converting NSNulls to null and calling |
|
| 183 | * takeStoredValueForKey for each key in the Map. |
|
| 184 | */ |
|
| 185 | void updateFromSnapshot(NSDictionary aSnapshot); |
|
| 186 | ||
| 187 | /** |
|
| 188 | * Returns a short, stateful string representation |
|
| 189 | * of this object. |
|
| 190 | */ |
|
| 191 | String userPresentableDescription(); |
|
| 192 | ||
| 193 | /** |
|
| 194 | * This method should be implemented to call |
|
| 195 | * EOObserverCenter.objectWillChange( this ), |
|
| 196 | * and it should be called by each setter method |
|
| 197 | * on this object before changes are made to the |
|
| 198 | * object's internal state. |
|
| 199 | */ |
|
| 200 | void willChange(); |
|
| 201 | } |
|
| 202 | ||
| 203 | /* |
|
| 204 | * $Log$ |
|
| 205 | * Revision 1.2 2006/02/16 16:47:14 cgruber |
|
| 206 | * Move some classes in to "internal" packages and re-work imports, etc. |
|
| 207 | * |
|
| 208 | * Also use UnsupportedOperationExceptions where appropriate, instead of WotonomyExceptions. |
|
| 209 | * |
|
| 210 | * Revision 1.1 2006/02/16 13:19:57 cgruber |
|
| 211 | * Check in all sources in eclipse-friendly maven-enabled packages. |
|
| 212 | * |
|
| 213 | * Revision 1.1 2001/11/13 04:13:59 mpowers |
|
| 214 | * Added interfaces needed to begin work on EOCustomObject. |
|
| 215 | * |
|
| 216 | * |
|
| 217 | */ |
|
| 218 | ||
| 219 |