litesoft
Diff Revisions
151
vs
239
for /trunk/Java/core/Server/src/org/litesoft/orsup/nonpublic/TransactionImpl.java
|
@@ -246,6 +246,33 @@ |
246 |
246 |
|
} |
247 |
247 |
|
|
248 |
248 |
|
/** |
|
249 |
+ |
* Refresh the pPersistedObject into this transaction if it is not already in the Transaction. |
|
250 |
+ |
* |
|
251 |
+ |
* @param pPersistedObject - Persisted Object to be freshly read (if needed) |
|
252 |
+ |
* |
|
253 |
+ |
* @return Transactional copy of the latest version read via Transaction (if needed), or Null if the PO is in another Transaction and isNew() OR has been deleted |
|
254 |
+ |
* |
|
255 |
+ |
* @throws DBException - Exception regarding the OR layer |
|
256 |
+ |
*/ |
|
257 |
+ |
@SuppressWarnings({"unchecked"}) |
|
258 |
+ |
public <T extends PersistentObject> T freshIntoIfNotInTransaction( PersistentObject<T> pPersistedObject ) |
|
259 |
+ |
throws DBException |
|
260 |
+ |
{ |
|
261 |
+ |
if ( pPersistedObject == null ) |
|
262 |
+ |
{ |
|
263 |
+ |
return null; |
|
264 |
+ |
} |
|
265 |
+ |
PersistentObjectURL url = pPersistedObject.getPersistentObjectURL(); |
|
266 |
+ |
PersistentObject<?> existing = getPersistentObjectFromIdentityMap( url ); |
|
267 |
+ |
if ( existing != null ) |
|
268 |
+ |
{ |
|
269 |
+ |
return (T) existing; |
|
270 |
+ |
} |
|
271 |
+ |
// todo: Caches |
|
272 |
+ |
return (T) findOne( url ); |
|
273 |
+ |
} |
|
274 |
+ |
|
|
275 |
+ |
/** |
249 |
276 |
|
* Refresh the pPersistedObject into this transaction. |
250 |
277 |
|
* |
251 |
278 |
|
* @param pPersistedObject - Persisted Object to be freshly read |