import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
+import org.argeo.slc.core.SlcException;
import org.argeo.slc.core.process.SlcExecution;
import org.argeo.slc.dao.process.SlcExecutionDao;
import org.argeo.slc.msg.process.SlcExecutionRequest;
+import org.argeo.slc.msg.process.SlcExecutionStatusRequest;
+
import org.springframework.ws.server.endpoint.AbstractMarshallingPayloadEndpoint;
public class SlcExecutionRequestEp extends AbstractMarshallingPayloadEndpoint {
@Override
protected Object invokeInternal(Object requestObject) throws Exception {
- SlcExecutionRequest msg = (SlcExecutionRequest) requestObject;
- SlcExecution slcExecution = msg.getSlcExecution();
-
- if (slcExecutionDao.getSlcExecution(slcExecution.getUuid()) == null) {
- slcExecutionDao.create(slcExecution);
-
- if (log.isDebugEnabled())
- log.debug("Created SlcExecution with uuid "
- + slcExecution.getUuid());
- } else {
+ if (requestObject instanceof SlcExecutionRequest) {
+
+ SlcExecutionRequest msg = (SlcExecutionRequest) requestObject;
+ SlcExecution slcExecution = msg.getSlcExecution();
+
+ if (slcExecutionDao.getSlcExecution(slcExecution.getUuid()) == null) {
+ if (log.isDebugEnabled())
+ log.debug("Creating SlcExecution with uuid "
+ + slcExecution.getUuid());
+
+ slcExecutionDao.create(slcExecution);
+ } else {
+ if (log.isDebugEnabled())
+ log.debug("Updating SlcExecution with uuid "
+ + slcExecution.getUuid());
+
+ slcExecutionDao.update(slcExecution);
+ }
+ return null;
+
+ } else if (requestObject instanceof SlcExecutionStatusRequest) {
+ SlcExecutionStatusRequest msg = (SlcExecutionStatusRequest) requestObject;
+ SlcExecution slcExecution = slcExecutionDao.getSlcExecution(msg
+ .getSlcExecutionUuid());
+ slcExecution.setStatus(msg.getNewStatus());
slcExecutionDao.update(slcExecution);
-
- if (log.isDebugEnabled())
- log.debug("Updated SlcExecution with uuid "
- + slcExecution.getUuid());
+ return null;
+ } else {
+ throw new SlcException("Unrecognized request format: "
+ + requestObject.getClass());
}
- return null;
}
}
@Override
protected Object invokeInternal(Object requestObject) throws Exception {
CloseTreeTestResultRequest msg = (CloseTreeTestResultRequest) requestObject;
- treeTestResultDao.close(msg.getResultUuid(), msg.getCloseDate());
-
+
if (log.isDebugEnabled())
- log.debug("Close result with id " + msg.getResultUuid()
+ log.debug("Closing result with id " + msg.getResultUuid()
+ " at date " + msg.getCloseDate());
+
+ treeTestResultDao.close(msg.getResultUuid(), msg.getCloseDate());
+
return null;
}
TestRunDescriptor testRunDescriptor = msg.getTestRunDescriptor();
if (testRunDescriptor != null) {
- testRunDescriptorDao.saveOrUpdate(testRunDescriptor);
if (log.isDebugEnabled())
- log.debug("Updated test run descriptor with id "
+ log.debug("Updating test run descriptor with id "
+ testRunDescriptor.getTestRunUuid());
+
+ testRunDescriptorDao.saveOrUpdate(testRunDescriptor);
}
TreeTestResult treeTestResult = treeTestResultDao.getTestResult(msg
lst.getParts().add(msg.getResultPart());
treeTestResult.getElements().putAll(msg.getRelatedElements());
+ if (log.isDebugEnabled())
+ log.debug("Updating result with id " + treeTestResult.getUuid());
+
treeTestResultDao.update(treeTestResult);
- if (log.isDebugEnabled())
- log.debug("Update result with id " + treeTestResult.getUuid());
return null;
}