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
.SlcExecutionRequest
;
8 import org
.argeo
.slc
.msg
.process
.SlcExecutionStatusRequest
;
9 import org
.argeo
.slc
.process
.SlcExecution
;
10 import org
.argeo
.slc
.services
.process
.SlcExecutionService
;
12 public class SlcExecutionServiceImpl
implements SlcExecutionService
{
13 private final Log log
= LogFactory
.getLog(getClass());
15 private final SlcExecutionDao slcExecutionDao
;
17 public SlcExecutionServiceImpl(SlcExecutionDao slcExecutionDao
) {
18 this.slcExecutionDao
= slcExecutionDao
;
21 public void newExecution(SlcExecution slcExecutionMsg
) {
22 SlcExecution slcExecutionPersisted
= slcExecutionDao
23 .getSlcExecution(slcExecutionMsg
.getUuid());
24 if (slcExecutionPersisted
== null) {
25 if (log
.isTraceEnabled())
26 log
.trace("Creating SLC execution #"
27 + slcExecutionMsg
.getUuid());
29 slcExecutionDao
.create(slcExecutionMsg
);
31 if (log
.isTraceEnabled())
32 log
.trace("Updating SLC execution #"
33 + slcExecutionMsg
.getUuid());
35 slcExecutionDao
.merge(slcExecutionMsg
);
39 public void updateStatus(SlcExecutionStatusRequest msg
) {
40 SlcExecution slcExecution
= slcExecutionDao
.getSlcExecution(msg
41 .getSlcExecutionUuid());
42 if (slcExecution
== null)
43 throw new SlcException("Could not find SLC execution #"
44 + msg
.getSlcExecutionUuid());
46 slcExecution
.setStatus(msg
.getNewStatus());
48 if (log
.isTraceEnabled())
49 log
.trace("Updating status for SLC execution #"
50 + slcExecution
.getUuid());
52 slcExecutionDao
.update(slcExecution
);