-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #241 from DependencyTrack/create-model-for-workflo…
…w-engine Create model for workflow engine
- Loading branch information
Showing
9 changed files
with
689 additions
and
15 deletions.
There are no files selected for viewing
123 changes: 123 additions & 0 deletions
123
src/main/java/org/dependencytrack/model/WorkflowState.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
package org.dependencytrack.model; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
|
||
import javax.jdo.annotations.Column; | ||
import javax.jdo.annotations.Extension; | ||
import javax.jdo.annotations.IdGeneratorStrategy; | ||
import javax.jdo.annotations.PersistenceCapable; | ||
import javax.jdo.annotations.Persistent; | ||
import javax.jdo.annotations.PrimaryKey; | ||
import javax.jdo.annotations.Unique; | ||
import javax.validation.constraints.NotNull; | ||
import java.io.Serializable; | ||
import java.util.Date; | ||
import java.util.UUID; | ||
|
||
@PersistenceCapable(table= "WORKFLOW_STATE") | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
@Unique(name = "WORKFLOW_STATE_COMPOSITE_IDX", members = {"token", "step"}) | ||
public class WorkflowState implements Serializable { | ||
|
||
@PrimaryKey | ||
@Persistent(valueStrategy = IdGeneratorStrategy.NATIVE) | ||
private long id; | ||
|
||
// null allowed because first step will have no parent and will be the first step of recursion | ||
@Persistent | ||
@Column(name = "PARENT_STEP_ID" , allowsNull = "true") | ||
private WorkflowState parent; | ||
|
||
@Persistent | ||
@Column(name = "TOKEN", jdbcType = "VARCHAR", length = 36, allowsNull = "false") | ||
@NotNull | ||
private UUID token; | ||
|
||
@Persistent | ||
@Column(name = "STARTED_AT", allowsNull = "true") | ||
private Date startedAt; | ||
|
||
@Persistent | ||
@Column(name = "UPDATED_AT", allowsNull = "true") | ||
private Date updatedAt; | ||
|
||
@Persistent | ||
@Column(name = "STEP", jdbcType = "VARCHAR", length = 64, allowsNull = "false") | ||
@NotNull | ||
@Extension(vendorName = "datanucleus", key = "enum-check-constraint", value = "true") | ||
private WorkflowStep step; | ||
|
||
@Persistent | ||
@Column(name = "STATUS", jdbcType = "VARCHAR", length = 64, allowsNull = "false") | ||
@NotNull | ||
@Extension(vendorName = "datanucleus", key = "enum-check-constraint", value = "true") | ||
private WorkflowStatus status; | ||
|
||
@Persistent | ||
@Column(name = "FAILURE_REASON", jdbcType = "CLOB", allowsNull = "true") | ||
private String failureReason; | ||
|
||
public long getId() { | ||
return id; | ||
} | ||
|
||
public void setId(long id) { | ||
this.id = id; | ||
} | ||
|
||
public WorkflowState getParent() { | ||
return parent; | ||
} | ||
|
||
public void setParent(WorkflowState parent) { | ||
this.parent = parent; | ||
} | ||
|
||
public UUID getToken() { | ||
return token; | ||
} | ||
|
||
public void setToken(UUID token) { | ||
this.token = token; | ||
} | ||
|
||
public Date getStartedAt() { | ||
return startedAt; | ||
} | ||
|
||
public void setStartedAt(Date startedAt) { | ||
this.startedAt = startedAt; | ||
} | ||
|
||
public Date getUpdatedAt() { | ||
return updatedAt; | ||
} | ||
|
||
public void setUpdatedAt(Date updatedAt) { | ||
this.updatedAt = updatedAt; | ||
} | ||
|
||
public WorkflowStep getStep() { | ||
return step; | ||
} | ||
|
||
public void setStep(WorkflowStep step) { | ||
this.step = step; | ||
} | ||
|
||
public WorkflowStatus getStatus() { | ||
return status; | ||
} | ||
|
||
public void setStatus(WorkflowStatus status) { | ||
this.status = status; | ||
} | ||
|
||
public String getFailureReason() { | ||
return failureReason; | ||
} | ||
|
||
public void setFailureReason(String failureReason) { | ||
this.failureReason = failureReason; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/org/dependencytrack/model/WorkflowStatus.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package org.dependencytrack.model; | ||
|
||
public enum WorkflowStatus { | ||
PENDING, | ||
TIMED_OUT, | ||
COMPLETED, | ||
FAILED, | ||
CANCELLED, | ||
NOT_APPLICABLE | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package org.dependencytrack.model; | ||
|
||
public enum WorkflowStep { | ||
BOM_CONSUMPTION, | ||
BOM_PROCESSING, | ||
VULN_ANALYSIS, | ||
REPO_META_ANALYSIS, | ||
POLICY_EVALUATION, | ||
METRICS_UPDATE | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.