import java.io.IOException;
import java.io.OutputStream;
+import java.util.HashSet;
+import java.util.Set;
import org.apache.log4j.Logger;
import org.springframework.remoting.httpinvoker.HttpInvokerClientConfiguration;
private RemoteInvocation currentRemoteInvocation;
+ protected final static Set<String> cachableMethods = new HashSet<String>();
+
+ public CdmServiceRequestExecutor() {
+ cachableMethods.add("merge");
+ cachableMethods.add("save");
+ cachableMethods.add("findWithUpdate");
+ cachableMethods.add("loadWithUpdate");
+ }
+
@Override
protected void writeRemoteInvocation(RemoteInvocation invocation, OutputStream os) throws IOException {
if(cdmEntitySessionManager == null) {
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) {
logger.info("Remote invoking : " + currentRemoteInvocation.getMethodName() + "@" + config.getServiceUrl());
rir = super.doExecuteRequest(config, baos);
if(rir.getValue() != null && !rir.hasException()) {
- if("merge".equals(currentRemoteInvocation.getMethodName()) ||
- "save".equals(currentRemoteInvocation.getMethodName()) ||
- "findWithUpdate".equals(currentRemoteInvocation.getMethodName())) {
- rir = new RemoteInvocationResult(cdmEntitySessionManager.load(rir.getValue(), true));
+ if(cachableMethods.contains(currentRemoteInvocation.getMethodName())) {
+ rir = new RemoteInvocationResult(cdmEntitySessionManager.load(rir.getValue(), true));
} else if(rir.getValue() instanceof UpdateResult){
UpdateResult result = (UpdateResult)rir.getValue();
if(result.isOk()){
// change others passwords
CdmStore.getService(IUserService.class).changePasswordForUser(user.getUsername(), passwordPage.getNewPassword());
}
+ CdmStore.getService(IUserService.class).loadWithUpdate(user.getUuid());
internalConversation.commit(false);
internalConversation.unbind();
internalConversation.close();
return false;
}catch (AuthenticationException e){
MessagingUtils.warningDialog("Could not change password", this, "The old password is not correct.");
-
+
return false;
}catch(Exception e){
MessagingUtils.warningDialog("Problem with changing password", this, "The password could not be changed. " + e.getMessage());