]>
git.argeo.org Git - gpl/argeo-slc.git/blob - runtime/org.argeo.slc.support.jcr/src/main/java/org/argeo/slc/jcr/execution/JcrExecutionProcess.java
1 package org
.argeo
.slc
.jcr
.execution
;
4 import javax
.jcr
.RepositoryException
;
6 import org
.apache
.commons
.logging
.Log
;
7 import org
.apache
.commons
.logging
.LogFactory
;
8 import org
.argeo
.jcr
.JcrUtils
;
9 import org
.argeo
.slc
.SlcException
;
10 import org
.argeo
.slc
.execution
.ExecutionProcess
;
11 import org
.argeo
.slc
.jcr
.SlcNames
;
13 /** Execution process implementation based on a JCR node. */
14 public class JcrExecutionProcess
implements ExecutionProcess
{
15 private Log log
= LogFactory
.getLog(JcrExecutionProcess
.class);
16 private final Node node
;
18 public JcrExecutionProcess(Node node
) {
22 public String
getUuid() {
24 return node
.getProperty(SlcNames
.SLC_UUID
).getString();
25 } catch (RepositoryException e
) {
26 throw new SlcException("Cannot get uuid for " + node
, e
);
30 public String
getStatus() {
32 return node
.getProperty(SlcNames
.SLC_STATUS
).getString();
33 } catch (RepositoryException e
) {
34 log
.error("Cannot get status: " + e
);
35 // we should re-throw exception because this information can
36 // probably used for monitoring in case there are already unexpected
42 public void setStatus(String status
) {
44 node
.setProperty(SlcNames
.SLC_STATUS
, status
);
45 // last modified properties needs to be manually updated
46 // see https://issues.apache.org/jira/browse/JCR-2233
47 JcrUtils
.updateLastModified(node
);
48 node
.getSession().save();
49 } catch (RepositoryException e
) {
51 JcrUtils
.discardQuietly(node
.getSession());
52 } catch (RepositoryException e1
) {
55 // we should re-throw exception because this information can
56 // probably used for monitoring in case there are already unexpected
58 log
.error("Cannot set status " + status
+ ": " + e
);
62 public Node
getNode() {