diff options
Diffstat (limited to 'id/server/idserverlib/src/main/java/at/gv')
3 files changed, 105 insertions, 27 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/process/dao/ProcessInstanceStore.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/process/dao/ProcessInstanceStore.java index ab71ef54d..c94c95516 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/process/dao/ProcessInstanceStore.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/process/dao/ProcessInstanceStore.java @@ -1,58 +1,80 @@ package at.gv.egovernment.moa.id.process.dao; +import java.io.Serializable; +import java.util.Map; + import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; import javax.persistence.Id; import javax.persistence.Lob; import javax.persistence.Table; +import at.gv.egovernment.moa.id.process.ProcessInstanceState; + @Entity -@Table(name = "process_instance") +@Table(name = "processinstance") public class ProcessInstanceStore { @Column(name = "id") @Id - private String id; + private int id; + + @Column(name = "processInstanceId", unique = true, nullable = false) + private String processInstanceId; + + @Column(name = "processDefinitionId", nullable = false) + private String processDefinitionId; - @Column(name = "processDefinitionID", unique = true, nullable = false) - private String processDefinitionID; + @Column(name = "nextTaskId", nullable = false) + private String nextTaskId; - @Column(name = "pointer", nullable = false) - private String pointer; + @Column(name = "processState", nullable = false) + @Enumerated(value = EnumType.STRING) + private Enum<ProcessInstanceState> processState; @Column(name = "executionContextData", nullable = false) @Lob - private byte[] executionContextData; + private Map<String, Serializable> executionContextData; - public String getId() { - return id; + public String getProcessInstanceId() { + return processInstanceId; } - public String getProcessDefinitionID() { - return processDefinitionID; + public String getProcessDefinitionId() { + return processDefinitionId; } - public String getPointer() { - return pointer; + public String getNextTaskId() { + return nextTaskId; } - public byte[] getExecutionContextData() { + public Enum<ProcessInstanceState> getProcessState() { + return processState; + } + + public Map<String, Serializable> getExecutionContextData() { return executionContextData; } - public void setId(String id) { - this.id = id; + public void setProcessInstanceId(String processInstanceId) { + this.processInstanceId = processInstanceId; + } + + public void setProcessDefinitionId(String processDefinitionId) { + this.processDefinitionId = processDefinitionId; } - public void setProcessDefinitionID(String processDefinitionID) { - this.processDefinitionID = processDefinitionID; + public void setNextTaskId(String nextTaskId) { + this.nextTaskId = nextTaskId; } - public void setPointer(String pointer) { - this.pointer = pointer; + public void setProcessState(Enum<ProcessInstanceState> processState) { + this.processState = processState; } - public void setExecutionContextData(byte[] executionContextData) { + public void setExecutionContextData(Map<String, Serializable> executionContextData) { this.executionContextData = executionContextData; } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/process/dao/ProcessInstanceStoreDAO.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/process/dao/ProcessInstanceStoreDAO.java index 5e2b12349..57489c33e 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/process/dao/ProcessInstanceStoreDAO.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/process/dao/ProcessInstanceStoreDAO.java @@ -1,5 +1,7 @@ package at.gv.egovernment.moa.id.process.dao; +import java.util.List; + import at.gv.egovernment.moa.id.process.ProcessInstance; public interface ProcessInstanceStoreDAO { @@ -11,7 +13,7 @@ public interface ProcessInstanceStoreDAO { * @param pIStore * the {@link ProcessInstanceStore} to persist. */ - public void save(ProcessInstanceStore pIStore); + void save(ProcessInstanceStore pIStore); /** * Loads a {@link ProcessInstanceStore}, defined by @@ -21,6 +23,34 @@ public interface ProcessInstanceStoreDAO { * the id of the {@code ProcessInstanceStore} to retrieve. * @return a ProcessInstanceStore. */ - public ProcessInstanceStore load(String processInstanceID); + ProcessInstanceStore load(String processInstanceId); + + /** + * Deletes the {@link ProcessInstance} corresponding with the + * {@code processInstanceId}. + * + * @param processInstanceID + * the id of the {@code ProcessInstance} to be deleted. + */ + void remove(String processInstanceId); + + /** + * Returns all {@link ProcessInstanceStore} objects stored in the database. + * The returned list may be empty, but never {@code null}. + * + * @return a list of {@link ProcessInstanceStore} (never {@code null}). + */ + List<ProcessInstanceStore> getAllProcessInstanceStores(); + + /** + * Returns the specific {@link ProcessInstanceStore} object corresponding to + * the given {@code processInstanceId}, or {@code null} if the object could + * not be found. + * + * @param processInstanceId + * the processInstanceId to search. + * @return the ProcessInstanceStore for the given id, or {@code null}. + */ + ProcessInstanceStore getProcessInstance(String processInstanceId); } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/process/dao/ProcessInstanceStoreDAOImpl.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/process/dao/ProcessInstanceStoreDAOImpl.java index 3480c4cfc..cde34acd1 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/process/dao/ProcessInstanceStoreDAOImpl.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/process/dao/ProcessInstanceStoreDAOImpl.java @@ -1,19 +1,27 @@ package at.gv.egovernment.moa.id.process.dao; +import java.util.List; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +/** + * Database backed implementation of the {@link ProcessInstanceStoreDAO} + * interface. + */ public class ProcessInstanceStoreDAOImpl implements ProcessInstanceStoreDAO { - + + private Logger log = LoggerFactory.getLogger(getClass()); + private static ProcessInstanceStoreDAO instance = new ProcessInstanceStoreDAOImpl(); - + public static ProcessInstanceStoreDAO getInstance() { return instance; } - + @Override public void save(ProcessInstanceStore pIStore) { // TODO Auto-generated method stub - } @Override @@ -22,4 +30,22 @@ public class ProcessInstanceStoreDAOImpl implements ProcessInstanceStoreDAO { return null; } + @Override + public void remove(String processInstanceId) { + // TODO Auto-generated method stub + + } + + @Override + public List<ProcessInstanceStore> getAllProcessInstanceStores() { + // TODO Auto-generated method stub + return null; + } + + @Override + public ProcessInstanceStore getProcessInstance(String processInstanceId) { + // TODO Auto-generated method stub + return null; + } + } |