01: /*
02: * Copyright 2006 Luca Garulli (luca.garulli@assetdata.it)
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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:
17: package org.romaframework.aspect.persistence;
18:
19: import java.util.List;
20:
21: import org.romaframework.core.aspect.Aspect;
22:
23: /**
24: * Persistence aspect. Manage application objects in datastore.
25: *
26: * @author Luca Garulli (luca.garulli@assetdata.it)
27: */
28: public interface PersistenceAspect extends Aspect {
29:
30: public static final String ASPECT_NAME = "persistence";
31:
32: /**
33: * Define the full mode when to load full object properties.
34: */
35: public static final String FULL_MODE_LOADING = "full";
36:
37: public static final byte STRATEGY_DEFAULT = 0;
38: public static final byte STRATEGY_STANDARD = 1;
39: public static final byte STRATEGY_DETACHING = 2;
40: public static final byte STRATEGY_TRANSIENT = 3;
41:
42: public String getOID(Object iObject) throws PersistenceException;
43:
44: public <T> T loadObject(T iObject, String iMode)
45: throws PersistenceException;
46:
47: public <T> T loadObject(T iObject, String iMode, byte iStrategy)
48: throws PersistenceException;
49:
50: public <T> T loadObjectByOID(String iOID, String iMode)
51: throws PersistenceException;
52:
53: public <T> T loadObjectByOID(String iOID, String iMode,
54: byte iStrategy) throws PersistenceException;
55:
56: public <T> T createObject(Object iObject)
57: throws PersistenceException;
58:
59: public <T> T updateObject(Object iObject)
60: throws PersistenceException;
61:
62: public void updateObjects(Object[] iObjects)
63: throws PersistenceException;
64:
65: public void deleteObject(Object iObject)
66: throws PersistenceException;
67:
68: public void deleteObjects(Object[] iObjects)
69: throws PersistenceException;
70:
71: public <T> List<T> query(Query iQuery) throws PersistenceException;
72:
73: public byte getStrategy();
74:
75: public void setStrategy(byte iStrategy);
76:
77: public boolean isActive();
78:
79: public void commit();
80:
81: public void rollback();
82:
83: public void close();
84: }
|