1 package org
.argeo
.slc
.services
.impl
.process
;
3 import org
.apache
.commons
.logging
.Log
;
4 import org
.apache
.commons
.logging
.LogFactory
;
5 import org
.argeo
.slc
.SlcException
;
6 import org
.argeo
.slc
.dao
.process
.SlcExecutionDao
;
7 import org
.argeo
.slc
.msg
.process
.SlcExecutionStatusRequest
;
8 import org
.argeo
.slc
.process
.SlcExecution
;
9 import org
.argeo
.slc
.services
.process
.SlcExecutionService
;
11 public class SlcExecutionServiceImpl
implements SlcExecutionService
{
12 private final Log log
= LogFactory
.getLog(getClass());
14 private final SlcExecutionDao slcExecutionDao
;
16 public SlcExecutionServiceImpl(SlcExecutionDao slcExecutionDao
) {
17 this.slcExecutionDao
= slcExecutionDao
;
20 public void newExecution(SlcExecution slcExecutionMsg
) {
21 SlcExecution slcExecutionPersisted
= slcExecutionDao
22 .getSlcExecution(slcExecutionMsg
.getUuid());
23 if (slcExecutionPersisted
== null) {
24 if (log
.isTraceEnabled())
25 log
.trace("Creating SLC execution #"
26 + slcExecutionMsg
.getUuid());
28 slcExecutionDao
.create(slcExecutionMsg
);
30 if (log
.isTraceEnabled())
31 log
.trace("Updating SLC execution #"
32 + slcExecutionMsg
.getUuid());
34 slcExecutionDao
.merge(slcExecutionMsg
);
38 public void updateStatus(SlcExecutionStatusRequest msg
) {
39 SlcExecution slcExecution
= slcExecutionDao
.getSlcExecution(msg
40 .getSlcExecutionUuid());
41 if (slcExecution
== null)
42 throw new SlcException("Could not find SLC execution #"
43 + msg
.getSlcExecutionUuid());
45 slcExecution
.setStatus(msg
.getNewStatus());
47 if (log
.isTraceEnabled())
48 log
.trace("Updating status for SLC execution #"
49 + slcExecution
.getUuid());
51 slcExecutionDao
.update(slcExecution
);