import java.io.IOException;
import java.io.OutputStream;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.remoting.httpinvoker.HttpInvokerClientConfiguration;
import org.springframework.remoting.support.RemoteInvocation;
import org.springframework.remoting.support.RemoteInvocationResult;
+import org.springframework.stereotype.Component;
-public abstract class CdmServiceRequestExecutor extends CdmAuthenticatedHttpInvokerRequestExecutor {
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager;
+
+@Component
+public class CdmServiceRequestExecutor extends CdmAuthenticatedHttpInvokerRequestExecutor {
+
+ @Autowired
+ private ICdmEntitySessionManager cdmEntitySessionManager;
private RemoteInvocation currentRemoteInvocation;
java.lang.ClassNotFoundException {
RemoteInvocationResult rir = fromCache(currentRemoteInvocation);
+ // if rir is not null at this point we assume that the
+ // the object has already been loaded in the cache and
+ // does not need to be reloaded
+
if(rir == null) {
rir = super.doExecuteRequest(config, baos);
+ if(rir.getValue() != null && !rir.hasException()) {
+ rir = new RemoteInvocationResult(cdmEntitySessionManager.load(rir.getValue()));
+ }
cache(currentRemoteInvocation, rir);
}
-
currentRemoteInvocation = null;
+
return rir;
}
- public abstract void cache(RemoteInvocation ri, RemoteInvocationResult rir);
+ public void cache(RemoteInvocation ri, RemoteInvocationResult rir) {
+
+ }
- public abstract RemoteInvocationResult fromCache(RemoteInvocation ri);
+ public RemoteInvocationResult fromCache(RemoteInvocation ri) {
+ return null;
+ }
}