001: /*
002: * $Id: DelegatorInterface.java,v 1.5 2003/12/12 04:02:04 ajzeneski Exp $
003: *
004: * Copyright (c) 2001, 2002 The Open For Business Project - www.ofbiz.org
005: *
006: * Permission is hereby granted, free of charge, to any person obtaining a
007: * copy of this software and associated documentation files (the "Software"),
008: * to deal in the Software without restriction, including without limitation
009: * the rights to use, copy, modify, merge, publish, distribute, sublicense,
010: * and/or sell copies of the Software, and to permit persons to whom the
011: * Software is furnished to do so, subject to the following conditions:
012: *
013: * The above copyright notice and this permission notice shall be included
014: * in all copies or substantial portions of the Software.
015: *
016: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
017: * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
018: * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
019: * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
020: * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
021: * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
022: * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
023: *
024: */
025: package org.ofbiz.entity;
026:
027: import java.util.Collection;
028: import java.util.List;
029: import java.util.Map;
030: import java.util.Set;
031:
032: import org.ofbiz.base.util.UtilCache;
033: import org.ofbiz.entity.condition.EntityCondition;
034: import org.ofbiz.entity.datasource.GenericHelper;
035: import org.ofbiz.entity.model.ModelEntity;
036: import org.ofbiz.entity.model.ModelFieldType;
037: import org.ofbiz.entity.model.ModelGroupReader;
038: import org.ofbiz.entity.model.ModelReader;
039: import org.ofbiz.entity.util.EntityFindOptions;
040: import org.ofbiz.entity.util.EntityListIterator;
041: import org.ofbiz.entity.util.SequenceUtil;
042:
043: /**
044: * Delegator Interface
045: *
046: * @author <a href="mailto:plightbo@cisco.com">Patrick Lightbody</a>
047: * @version $Revision: 1.5 $
048: * @since 2.0
049: */
050: public interface DelegatorInterface {
051:
052: String getDelegatorName();
053:
054: ModelReader getModelReader();
055:
056: ModelGroupReader getModelGroupReader();
057:
058: ModelEntity getModelEntity(String entityName);
059:
060: String getEntityGroupName(String entityName);
061:
062: List getModelEntitiesByGroup(String groupName);
063:
064: Map getModelEntityMapByGroup(String groupName);
065:
066: String getGroupHelperName(String groupName);
067:
068: String getEntityHelperName(String entityName);
069:
070: String getEntityHelperName(ModelEntity entity);
071:
072: GenericHelper getEntityHelper(String entityName)
073: throws GenericEntityException;
074:
075: GenericHelper getEntityHelper(ModelEntity entity)
076: throws GenericEntityException;
077:
078: ModelFieldType getEntityFieldType(ModelEntity entity, String type)
079: throws GenericEntityException;
080:
081: Collection getEntityFieldTypeNames(ModelEntity entity)
082: throws GenericEntityException;
083:
084: GenericValue makeValue(String entityName, Map fields);
085:
086: GenericValue makeValidValue(String entityName, Map fields);
087:
088: GenericPK makePK(String entityName, Map fields);
089:
090: GenericValue create(String entityName, Map fields)
091: throws GenericEntityException;
092:
093: GenericValue create(GenericValue value)
094: throws GenericEntityException;
095:
096: GenericValue create(GenericValue value, boolean doCacheClear)
097: throws GenericEntityException;
098:
099: GenericValue create(GenericPK primaryKey)
100: throws GenericEntityException;
101:
102: GenericValue create(GenericPK primaryKey, boolean doCacheClear)
103: throws GenericEntityException;
104:
105: GenericValue createOrStore(GenericValue value, boolean doCacheClear)
106: throws GenericEntityException;
107:
108: GenericValue createOrStore(GenericValue value)
109: throws GenericEntityException;
110:
111: GenericValue findByPrimaryKey(GenericPK primaryKey)
112: throws GenericEntityException;
113:
114: GenericValue findByPrimaryKeyCache(GenericPK primaryKey)
115: throws GenericEntityException;
116:
117: GenericValue findByPrimaryKey(String entityName, Map fields)
118: throws GenericEntityException;
119:
120: GenericValue findByPrimaryKeyCache(String entityName, Map fields)
121: throws GenericEntityException;
122:
123: GenericValue findByPrimaryKeyPartial(GenericPK primaryKey, Set keys)
124: throws GenericEntityException;
125:
126: List findAllByPrimaryKeys(Collection primaryKeys)
127: throws GenericEntityException;
128:
129: List findAllByPrimaryKeysCache(Collection primaryKeys)
130: throws GenericEntityException;
131:
132: int removeByPrimaryKey(GenericPK primaryKey)
133: throws GenericEntityException;
134:
135: int removeByPrimaryKey(GenericPK primaryKey, boolean doCacheClear)
136: throws GenericEntityException;
137:
138: int removeValue(GenericValue value) throws GenericEntityException;
139:
140: int removeValue(GenericValue value, boolean doCacheClear)
141: throws GenericEntityException;
142:
143: List findAll(String entityName) throws GenericEntityException;
144:
145: List findAll(String entityName, List orderBy)
146: throws GenericEntityException;
147:
148: List findAllCache(String entityName) throws GenericEntityException;
149:
150: List findAllCache(String entityName, List orderBy)
151: throws GenericEntityException;
152:
153: List findByAnd(String entityName, Map fields)
154: throws GenericEntityException;
155:
156: List findByOr(String entityName, Map fields)
157: throws GenericEntityException;
158:
159: List findByAnd(String entityName, Map fields, List orderBy)
160: throws GenericEntityException;
161:
162: List findByAnd(ModelEntity modelEntity, Map fields, List orderBy)
163: throws GenericEntityException;
164:
165: List findByOr(String entityName, Map fields, List orderBy)
166: throws GenericEntityException;
167:
168: List findByAndCache(String entityName, Map fields)
169: throws GenericEntityException;
170:
171: List findByAndCache(String entityName, Map fields, List orderBy)
172: throws GenericEntityException;
173:
174: List findByAnd(String entityName, List expressions)
175: throws GenericEntityException;
176:
177: List findByOr(String entityName, List expressions)
178: throws GenericEntityException;
179:
180: List findByAnd(String entityName, List expressions, List orderBy)
181: throws GenericEntityException;
182:
183: List findByOr(String entityName, List expressions, List orderBy)
184: throws GenericEntityException;
185:
186: List findByLike(String entityName, Map fields)
187: throws GenericEntityException;
188:
189: List findByLike(String entityName, Map fields, List orderBy)
190: throws GenericEntityException;
191:
192: List findByCondition(String entityName,
193: EntityCondition entityCondition, Collection fieldsToSelect,
194: List orderBy) throws GenericEntityException;
195:
196: EntityListIterator findListIteratorByCondition(String entityName,
197: EntityCondition entityCondition, Collection fieldsToSelect,
198: List orderBy) throws GenericEntityException;
199:
200: EntityListIterator findListIteratorByCondition(String entityName,
201: EntityCondition whereEntityCondition,
202: EntityCondition havingEntityCondition,
203: Collection fieldsToSelect, List orderBy,
204: EntityFindOptions findOptions)
205: throws GenericEntityException;
206:
207: int removeByAnd(String entityName, Map fields)
208: throws GenericEntityException;
209:
210: int removeByAnd(String entityName, Map fields, boolean doCacheClear)
211: throws GenericEntityException;
212:
213: List getMultiRelation(GenericValue value, String relationNameOne,
214: String relationNameTwo, List orderBy)
215: throws GenericEntityException;
216:
217: List getMultiRelation(GenericValue value, String relationNameOne,
218: String relationNameTwo) throws GenericEntityException;
219:
220: List getRelated(String relationName, GenericValue value)
221: throws GenericEntityException;
222:
223: List getRelatedByAnd(String relationName, Map byAndFields,
224: GenericValue value) throws GenericEntityException;
225:
226: List getRelatedOrderBy(String relationName, List orderBy,
227: GenericValue value) throws GenericEntityException;
228:
229: List getRelated(String relationName, Map byAndFields, List orderBy,
230: GenericValue value) throws GenericEntityException;
231:
232: GenericPK getRelatedDummyPK(String relationName, Map byAndFields,
233: GenericValue value) throws GenericEntityException;
234:
235: List getRelatedCache(String relationName, GenericValue value)
236: throws GenericEntityException;
237:
238: GenericValue getRelatedOne(String relationName, GenericValue value)
239: throws GenericEntityException;
240:
241: GenericValue getRelatedOneCache(String relationName,
242: GenericValue value) throws GenericEntityException;
243:
244: int removeRelated(String relationName, GenericValue value)
245: throws GenericEntityException;
246:
247: int removeRelated(String relationName, GenericValue value,
248: boolean doCacheClear) throws GenericEntityException;
249:
250: void refresh(GenericValue value) throws GenericEntityException;
251:
252: void refresh(GenericValue value, boolean doCacheClear)
253: throws GenericEntityException;
254:
255: int store(GenericValue value) throws GenericEntityException;
256:
257: int store(GenericValue value, boolean doCacheClear)
258: throws GenericEntityException;
259:
260: int storeAll(List values) throws GenericEntityException;
261:
262: int storeAll(List values, boolean doCacheClear)
263: throws GenericEntityException;
264:
265: int removeAll(List dummyPKs) throws GenericEntityException;
266:
267: int removeAll(List dummyPKs, boolean doCacheClear)
268: throws GenericEntityException;
269:
270: void clearAllCaches();
271:
272: void clearAllCaches(boolean distribute);
273:
274: void clearCacheLine(String entityName, Map fields);
275:
276: void clearCacheLineFlexible(GenericEntity dummyPK);
277:
278: void clearCacheLineFlexible(GenericEntity dummyPK,
279: boolean distribute);
280:
281: void clearCacheLine(GenericPK primaryKey);
282:
283: void clearCacheLine(GenericPK primaryKey, boolean distribute);
284:
285: void clearCacheLine(GenericValue value);
286:
287: void clearCacheLine(GenericValue value, boolean distribute);
288:
289: Set getFieldNameSetsCopy(String entityName);
290:
291: void clearAllCacheLinesByDummyPK(Collection dummyPKs);
292:
293: void clearAllCacheLinesByValue(Collection values);
294:
295: GenericValue getFromPrimaryKeyCache(GenericPK primaryKey);
296:
297: List getFromAllCache(String entityName);
298:
299: List getFromAndCache(String entityName, Map fields);
300:
301: List getFromAndCache(ModelEntity entity, Map fields);
302:
303: void putInPrimaryKeyCache(GenericPK primaryKey, GenericValue value);
304:
305: void putAllInPrimaryKeyCache(List values);
306:
307: void putInAllCache(String entityName, List values);
308:
309: void putInAllCache(ModelEntity entity, List values);
310:
311: void putInAndCache(String entityName, Map fields, List values);
312:
313: void putInAndCache(ModelEntity entity, Map fields, List values);
314:
315: Long getNextSeqId(String seqName);
316:
317: void setSequencer(SequenceUtil sequencer);
318:
319: void refreshSequencer();
320:
321: UtilCache getPrimaryKeyCache();
322:
323: UtilCache getAndCache();
324:
325: UtilCache getAllCache();
326: }
|