001: /*******************************************************************************
002: * Licensed to the Apache Software Foundation (ASF) under one
003: * or more contributor license agreements. See the NOTICE file
004: * distributed with this work for additional information
005: * regarding copyright ownership. The ASF licenses this file
006: * to you under the Apache License, Version 2.0 (the
007: * "License"); you may not use this file except in compliance
008: * with the License. You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing,
013: * software distributed under the License is distributed on an
014: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015: * KIND, either express or implied. See the License for the
016: * specific language governing permissions and limitations
017: * under the License.
018: *******************************************************************************/package org.ofbiz.entity;
019:
020: import java.util.Collection;
021: import java.util.List;
022: import java.util.Map;
023: import java.util.Set;
024:
025: import org.ofbiz.entity.cache.Cache;
026: import org.ofbiz.entity.condition.EntityCondition;
027: import org.ofbiz.entity.datasource.GenericHelper;
028: import org.ofbiz.entity.model.ModelEntity;
029: import org.ofbiz.entity.model.ModelFieldType;
030: import org.ofbiz.entity.model.ModelGroupReader;
031: import org.ofbiz.entity.model.ModelReader;
032: import org.ofbiz.entity.util.EntityFindOptions;
033: import org.ofbiz.entity.util.EntityListIterator;
034: import org.ofbiz.entity.util.SequenceUtil;
035:
036: /**
037: * Delegator Interface
038: */
039: public interface DelegatorInterface {
040:
041: String getDelegatorName();
042:
043: ModelReader getModelReader();
044:
045: ModelGroupReader getModelGroupReader();
046:
047: ModelEntity getModelEntity(String entityName);
048:
049: String getEntityGroupName(String entityName);
050:
051: List getModelEntitiesByGroup(String groupName);
052:
053: Map getModelEntityMapByGroup(String groupName);
054:
055: String getGroupHelperName(String groupName);
056:
057: String getEntityHelperName(String entityName);
058:
059: String getEntityHelperName(ModelEntity entity);
060:
061: GenericHelper getEntityHelper(String entityName)
062: throws GenericEntityException;
063:
064: GenericHelper getEntityHelper(ModelEntity entity)
065: throws GenericEntityException;
066:
067: ModelFieldType getEntityFieldType(ModelEntity entity, String type)
068: throws GenericEntityException;
069:
070: Collection getEntityFieldTypeNames(ModelEntity entity)
071: throws GenericEntityException;
072:
073: GenericValue makeValue(String entityName, Map fields);
074:
075: GenericValue makeValidValue(String entityName, Map fields);
076:
077: GenericPK makePK(String entityName, Map fields);
078:
079: GenericValue create(String entityName, Map fields)
080: throws GenericEntityException;
081:
082: GenericValue create(GenericValue value)
083: throws GenericEntityException;
084:
085: GenericValue create(GenericValue value, boolean doCacheClear)
086: throws GenericEntityException;
087:
088: GenericValue create(GenericPK primaryKey)
089: throws GenericEntityException;
090:
091: GenericValue create(GenericPK primaryKey, boolean doCacheClear)
092: throws GenericEntityException;
093:
094: GenericValue createOrStore(GenericValue value, boolean doCacheClear)
095: throws GenericEntityException;
096:
097: GenericValue createOrStore(GenericValue value)
098: throws GenericEntityException;
099:
100: GenericValue findByPrimaryKey(GenericPK primaryKey)
101: throws GenericEntityException;
102:
103: GenericValue findByPrimaryKeyCache(GenericPK primaryKey)
104: throws GenericEntityException;
105:
106: GenericValue findByPrimaryKey(String entityName, Map fields)
107: throws GenericEntityException;
108:
109: GenericValue findByPrimaryKeyCache(String entityName, Map fields)
110: throws GenericEntityException;
111:
112: GenericValue findByPrimaryKeyPartial(GenericPK primaryKey, Set keys)
113: throws GenericEntityException;
114:
115: List findAllByPrimaryKeys(Collection primaryKeys)
116: throws GenericEntityException;
117:
118: List findAllByPrimaryKeysCache(Collection primaryKeys)
119: throws GenericEntityException;
120:
121: int removeByPrimaryKey(GenericPK primaryKey)
122: throws GenericEntityException;
123:
124: int removeByPrimaryKey(GenericPK primaryKey, boolean doCacheClear)
125: throws GenericEntityException;
126:
127: int removeValue(GenericValue value) throws GenericEntityException;
128:
129: int removeValue(GenericValue value, boolean doCacheClear)
130: throws GenericEntityException;
131:
132: List findAll(String entityName) throws GenericEntityException;
133:
134: List findAll(String entityName, List orderBy)
135: throws GenericEntityException;
136:
137: List findAllCache(String entityName) throws GenericEntityException;
138:
139: List findAllCache(String entityName, List orderBy)
140: throws GenericEntityException;
141:
142: List findByAnd(String entityName, Map fields)
143: throws GenericEntityException;
144:
145: List findByOr(String entityName, Map fields)
146: throws GenericEntityException;
147:
148: List findByAnd(String entityName, Map fields, List orderBy)
149: throws GenericEntityException;
150:
151: //List findByAnd(ModelEntity modelEntity, Map fields, List orderBy) throws GenericEntityException;
152:
153: List findByOr(String entityName, Map fields, List orderBy)
154: throws GenericEntityException;
155:
156: List findByAndCache(String entityName, Map fields)
157: throws GenericEntityException;
158:
159: List findByAndCache(String entityName, Map fields, List orderBy)
160: throws GenericEntityException;
161:
162: List findByAnd(String entityName, List expressions)
163: throws GenericEntityException;
164:
165: List findByOr(String entityName, List expressions)
166: throws GenericEntityException;
167:
168: List findByAnd(String entityName, List expressions, List orderBy)
169: throws GenericEntityException;
170:
171: List findByOr(String entityName, List expressions, List orderBy)
172: throws GenericEntityException;
173:
174: List findByLike(String entityName, Map fields)
175: throws GenericEntityException;
176:
177: List findByLike(String entityName, Map fields, List orderBy)
178: throws GenericEntityException;
179:
180: List findByCondition(String entityName,
181: EntityCondition entityCondition, Collection fieldsToSelect,
182: List orderBy) throws GenericEntityException;
183:
184: EntityListIterator findListIteratorByCondition(String entityName,
185: EntityCondition entityCondition, Collection fieldsToSelect,
186: List orderBy) throws GenericEntityException;
187:
188: EntityListIterator findListIteratorByCondition(String entityName,
189: EntityCondition whereEntityCondition,
190: EntityCondition havingEntityCondition,
191: Collection fieldsToSelect, List orderBy,
192: EntityFindOptions findOptions)
193: throws GenericEntityException;
194:
195: int removeByAnd(String entityName, Map fields)
196: throws GenericEntityException;
197:
198: int removeByAnd(String entityName, Map fields, boolean doCacheClear)
199: throws GenericEntityException;
200:
201: int removeByCondition(String entityName, EntityCondition condition)
202: throws GenericEntityException;
203:
204: int removeByCondition(String entityName, EntityCondition condition,
205: boolean doCacheClear) throws GenericEntityException;
206:
207: List getMultiRelation(GenericValue value, String relationNameOne,
208: String relationNameTwo, List orderBy)
209: throws GenericEntityException;
210:
211: List getMultiRelation(GenericValue value, String relationNameOne,
212: String relationNameTwo) throws GenericEntityException;
213:
214: List getRelated(String relationName, GenericValue value)
215: throws GenericEntityException;
216:
217: List getRelatedByAnd(String relationName, Map byAndFields,
218: GenericValue value) throws GenericEntityException;
219:
220: List getRelatedOrderBy(String relationName, List orderBy,
221: GenericValue value) throws GenericEntityException;
222:
223: List getRelated(String relationName, Map byAndFields, List orderBy,
224: GenericValue value) throws GenericEntityException;
225:
226: GenericPK getRelatedDummyPK(String relationName, Map byAndFields,
227: GenericValue value) throws GenericEntityException;
228:
229: List getRelatedCache(String relationName, GenericValue value)
230: throws GenericEntityException;
231:
232: GenericValue getRelatedOne(String relationName, GenericValue value)
233: throws GenericEntityException;
234:
235: GenericValue getRelatedOneCache(String relationName,
236: GenericValue value) throws GenericEntityException;
237:
238: int removeRelated(String relationName, GenericValue value)
239: throws GenericEntityException;
240:
241: int removeRelated(String relationName, GenericValue value,
242: boolean doCacheClear) throws GenericEntityException;
243:
244: void refresh(GenericValue value) throws GenericEntityException;
245:
246: void refresh(GenericValue value, boolean doCacheClear)
247: throws GenericEntityException;
248:
249: int store(GenericValue value) throws GenericEntityException;
250:
251: int store(GenericValue value, boolean doCacheClear)
252: throws GenericEntityException;
253:
254: int storeAll(List values) throws GenericEntityException;
255:
256: int storeAll(List values, boolean doCacheClear)
257: throws GenericEntityException;
258:
259: int storeByCondition(String entityName, Map fieldsToSet,
260: EntityCondition condition) throws GenericEntityException;
261:
262: int storeByCondition(String entityName, Map fieldsToSet,
263: EntityCondition condition, boolean doCacheClear)
264: throws GenericEntityException;
265:
266: int removeAll(List dummyPKs) throws GenericEntityException;
267:
268: int removeAll(List dummyPKs, boolean doCacheClear)
269: throws GenericEntityException;
270:
271: void clearAllCaches();
272:
273: void clearAllCaches(boolean distribute);
274:
275: void clearCacheLine(String entityName, Map fields);
276:
277: void clearCacheLineFlexible(GenericEntity dummyPK);
278:
279: void clearCacheLineFlexible(GenericEntity dummyPK,
280: boolean distribute);
281:
282: void clearCacheLine(GenericPK primaryKey);
283:
284: void clearCacheLine(GenericPK primaryKey, boolean distribute);
285:
286: void clearCacheLine(GenericValue value);
287:
288: void clearCacheLine(GenericValue value, boolean distribute);
289:
290: void clearCacheLineByCondition(String entityName,
291: EntityCondition condition);
292:
293: void clearAllCacheLinesByDummyPK(Collection dummyPKs);
294:
295: void clearAllCacheLinesByValue(Collection values);
296:
297: GenericValue getFromPrimaryKeyCache(GenericPK primaryKey);
298:
299: String getNextSeqId(String seqName);
300:
301: String getNextSeqId(String seqName, long staggerMax);
302:
303: Long getNextSeqIdLong(String seqName);
304:
305: Long getNextSeqIdLong(String seqName, long staggerMax);
306:
307: void setSequencer(SequenceUtil sequencer);
308:
309: void refreshSequencer();
310:
311: Cache getCache();
312: }
|