| 1 |
|
package org.trails.record; |
| 2 |
|
|
| 3 |
|
import org.trails.persistence.PersistenceService; |
| 4 |
|
import org.trails.util.Utils; |
| 5 |
|
import org.trails.descriptor.DescriptorService; |
| 6 |
|
import org.trails.descriptor.IClassDescriptor; |
| 7 |
|
|
| 8 |
|
|
| 9 |
0 |
public class ReloadReattachPropertyPersistenceStrategy extends ReattachPropertyPersistenceStrategy |
| 10 |
|
{ |
| 11 |
|
|
| 12 |
|
DescriptorService descriptorService; |
| 13 |
|
PersistenceService persistenceService; |
| 14 |
|
|
| 15 |
|
protected String getStrategyId() |
| 16 |
|
{ |
| 17 |
0 |
return "reattach-reload"; |
| 18 |
|
} |
| 19 |
|
|
| 20 |
|
protected Object reattach(Object entity) |
| 21 |
|
{ |
| 22 |
0 |
IClassDescriptor classDescriptor = descriptorService.getClassDescriptor(Utils.checkForCGLIB(entity.getClass())); |
| 23 |
0 |
return persistenceService |
| 24 |
0 |
.loadInstance(classDescriptor.getType(), persistenceService.getIdentifier(entity, classDescriptor)); |
| 25 |
|
} |
| 26 |
|
|
| 27 |
|
public void setPersistenceService(PersistenceService persistenceService) |
| 28 |
|
{ |
| 29 |
0 |
this.persistenceService = persistenceService; |
| 30 |
0 |
} |
| 31 |
|
|
| 32 |
|
public void setDescriptorService(DescriptorService descriptorService) |
| 33 |
|
{ |
| 34 |
0 |
this.descriptorService = descriptorService; |
| 35 |
0 |
} |
| 36 |
|
} |