1 package org
.argeo
.slc
.ws
.process
;
3 import org
.apache
.commons
.logging
.Log
;
4 import org
.apache
.commons
.logging
.LogFactory
;
6 import org
.argeo
.slc
.core
.SlcException
;
7 import org
.argeo
.slc
.core
.process
.SlcExecution
;
8 import org
.argeo
.slc
.dao
.process
.SlcExecutionDao
;
9 import org
.argeo
.slc
.msg
.process
.SlcExecutionRequest
;
10 import org
.argeo
.slc
.msg
.process
.SlcExecutionStatusRequest
;
12 import org
.springframework
.ws
.server
.endpoint
.AbstractMarshallingPayloadEndpoint
;
14 public class SlcExecutionRequestEp
extends AbstractMarshallingPayloadEndpoint
{
16 private Log log
= LogFactory
.getLog(getClass());
18 private final SlcExecutionDao slcExecutionDao
;
20 public SlcExecutionRequestEp(SlcExecutionDao slcExecutionDao
) {
21 this.slcExecutionDao
= slcExecutionDao
;
25 protected Object
invokeInternal(Object requestObject
) throws Exception
{
26 if (requestObject
instanceof SlcExecutionRequest
) {
28 SlcExecutionRequest msg
= (SlcExecutionRequest
) requestObject
;
29 SlcExecution slcExecution
= msg
.getSlcExecution();
31 if (slcExecutionDao
.getSlcExecution(slcExecution
.getUuid()) == null) {
32 if (log
.isDebugEnabled())
33 log
.debug("Creating SlcExecution with uuid "
34 + slcExecution
.getUuid());
36 slcExecutionDao
.create(slcExecution
);
38 if (log
.isDebugEnabled())
39 log
.debug("Updating SlcExecution with uuid "
40 + slcExecution
.getUuid());
42 slcExecutionDao
.update(slcExecution
);
46 } else if (requestObject
instanceof SlcExecutionStatusRequest
) {
47 SlcExecutionStatusRequest msg
= (SlcExecutionStatusRequest
) requestObject
;
48 SlcExecution slcExecution
= slcExecutionDao
.getSlcExecution(msg
49 .getSlcExecutionUuid());
50 slcExecution
.setStatus(msg
.getNewStatus());
51 slcExecutionDao
.update(slcExecution
);
54 throw new SlcException("Unrecognized request format: "
55 + requestObject
.getClass());