Skip to content

Commit

Permalink
Merge branch 'master' into github
Browse files Browse the repository at this point in the history
  • Loading branch information
dofs197 committed Sep 15, 2022
2 parents a8b3361 + bd91426 commit 1796ec5
Show file tree
Hide file tree
Showing 133 changed files with 3,545 additions and 1,024 deletions.
49 changes: 25 additions & 24 deletions wfe-core/src/main/java/ru/runa/wfe/audit/Attributes.java
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
package ru.runa.wfe.audit;

public interface Attributes {
static final String ATTR_ACTION = "action";
static final String ATTR_NODE_NAME = "nodeName";
static final String ATTR_NODE_TYPE = "nodeType";
static final String ATTR_NODE_ID_FROM = "nodeIdFrom";
static final String ATTR_NODE_ID_TO = "nodeIdTo";
static final String ATTR_TRANSITION_ID = "transitionId";
static final String ATTR_MESSAGE = "message";
static final String ATTR_INFO = "info";
static final String ATTR_PROCESS_ID = "processId";
static final String ATTR_TOKEN_ID = "tokenId";
static final String ATTR_ACTOR_ID = "actorId";
static final String ATTR_ACTOR_NAME = "actorName";
static final String ATTR_OLD_VALUE = "oldValue";
static final String ATTR_NEW_VALUE = "newValue";
static final String ATTR_VARIABLE_NAME = "varName";
static final String ATTR_TASK_ID = "taskId";
static final String ATTR_TASK_NAME = "taskName";
static final String ATTR_INDEX = "index";
static final String ATTR_IS_FILE_VALUE = "fileValue";
static final String ATTR_IS_EXECUTOR_VALUE = "executorValue";
static final String ATTR_DUE_DATE = "dueDate";
static final String ATTR_ID = "id";
static final String ATTR_PARAM = "param";
static final String ATTR_VALUE_TRUE = Boolean.TRUE.toString();
String ATTR_ACTION = "action";
String ATTR_NODE_NAME = "nodeName";
String ATTR_NODE_TYPE = "nodeType";
String ATTR_NODE_ID_FROM = "nodeIdFrom";
String ATTR_NODE_ID_TO = "nodeIdTo";
String ATTR_TRANSITION_ID = "transitionId";
String ATTR_MESSAGE = "message";
String ATTR_INFO = "info";
String ATTR_PROCESS_ID = "processId";
String ATTR_TOKEN_ID = "tokenId";
String ATTR_ACTOR_ID = "actorId";
String ATTR_ACTOR_NAME = "actorName";
String ATTR_OLD_VALUE = "oldValue";
String ATTR_NEW_VALUE = "newValue";
String ATTR_VARIABLE_NAME = "varName";
String ATTR_TASK_ID = "taskId";
String ATTR_TASK_NAME = "taskName";
String ATTR_INDEX = "index";
String ATTR_IS_FILE_VALUE = "fileValue";
String ATTR_IS_EXECUTOR_VALUE = "executorValue";
String ATTR_DUE_DATE = "dueDate";
String ATTR_ID = "id";
String ATTR_TRANSITION_NAME = "transitionName";
String ATTR_PARAM = "param";
String ATTR_VALUE_TRUE = Boolean.TRUE.toString();
}
37 changes: 37 additions & 0 deletions wfe-core/src/main/java/ru/runa/wfe/audit/NodeInfoLog.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package ru.runa.wfe.audit;

import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.Transient;
import ru.runa.wfe.lang.Node;

/**
* Info log from Groovy Action.
*
* @author vromav
*/
@Entity
@DiscriminatorValue(value = "J")
public class NodeInfoLog extends NodeLog {
private static final long serialVersionUID = 1L;

public NodeInfoLog() {
}

public NodeInfoLog(Node node, Severity severity, String data) {
super(node);
addAttributeWithTruncation(ATTR_PARAM, data);
setSeverity(severity);
}

@Override
public void processBy(ProcessLogVisitor visitor) {
visitor.onNodeInfoLog(this);
}

@Override
@Transient
public Object[] getPatternArguments() {
return new Object[] { getAttribute(ATTR_PARAM) };
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public interface ProcessLogVisitor {

void onTaskRemovedOnProcessEndLog(TaskRemovedOnProcessEndLog taskRemovedOnProcessEndLog);

void onTaskRemovedOnEmbeddedSubprocessEndLog(TaskRemovedOnEmbeddedSubprocessEndLog log);

void onTaskExpiredLog(TaskExpiredLog taskExpiredLog);

void onTaskEndBySubstitutorLog(TaskEndBySubstitutorLog taskEndBySubstitutorLog);
Expand All @@ -61,4 +63,6 @@ public interface ProcessLogVisitor {
void onVariableUpdateLog(VariableUpdateLog variableUpdateLog);

void onAdminActionLog(AdminActionLog adminActionLog);

void onNodeInfoLog(NodeInfoLog nodeInfoLog);
}
11 changes: 10 additions & 1 deletion wfe-core/src/main/java/ru/runa/wfe/audit/TaskEndLog.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@
*/
package ru.runa.wfe.audit;

import java.util.List;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.Transient;
import ru.runa.wfe.audit.presentation.ExecutorNameValue;
import ru.runa.wfe.execution.Process;
import ru.runa.wfe.lang.StartNode;
import ru.runa.wfe.lang.Transition;
import ru.runa.wfe.task.Task;
import ru.runa.wfe.task.TaskCompletionInfo;
import ru.runa.wfe.user.Actor;
Expand All @@ -49,11 +51,18 @@ public TaskEndLog(Task task, TaskCompletionInfo completionInfo) {
if (completionInfo.getExecutor() != null) {
addAttribute(ATTR_ACTOR_NAME, completionInfo.getExecutor().getName());
}
addAttribute(ATTR_TRANSITION_NAME, completionInfo.getTransitionName());
}

public TaskEndLog(Process process, StartNode startNode, Actor actor) {
public TaskEndLog(Process process, StartNode startNode, Actor actor, String transitionName) {
super(process, startNode);
addAttribute(ATTR_ACTOR_NAME, actor.getName());
addAttribute(ATTR_TRANSITION_NAME, transitionName);
}

@Transient
public String getTransitionName() {
return getAttribute(ATTR_TRANSITION_NAME);
}

@Transient
Expand Down
3 changes: 1 addition & 2 deletions wfe-core/src/main/java/ru/runa/wfe/audit/TaskExpiredLog.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.Transient;

import ru.runa.wfe.task.Task;
import ru.runa.wfe.task.TaskCompletionInfo;

Expand All @@ -14,7 +13,7 @@
*/
@Entity
@DiscriminatorValue(value = "9")
public class TaskExpiredLog extends TaskEndLog {
public class TaskExpiredLog extends TaskCancelledLog {
private static final long serialVersionUID = 1L;

public TaskExpiredLog() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package ru.runa.wfe.audit;

import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.Transient;
import ru.runa.wfe.task.Task;
import ru.runa.wfe.task.TaskCompletionInfo;

@Entity
@DiscriminatorValue(value = "P")
public class TaskRemovedOnEmbeddedSubprocessEndLog extends TaskCancelledLog {
private static final long serialVersionUID = 1L;

public TaskRemovedOnEmbeddedSubprocessEndLog() {
}

public TaskRemovedOnEmbeddedSubprocessEndLog(Task task, TaskCompletionInfo completionInfo) {
super(task, completionInfo);
}

@Override
@Transient
public Object[] getPatternArguments() {
return new Object[] { getTaskName() };
}

@Override
public void processBy(ProcessLogVisitor visitor) {
visitor.onTaskRemovedOnEmbeddedSubprocessEndLog(this);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.Transient;

import ru.runa.wfe.audit.presentation.ProcessIdValue;
import ru.runa.wfe.task.Task;
import ru.runa.wfe.task.TaskCompletionInfo;
Expand All @@ -16,7 +15,7 @@
*/
@Entity
@DiscriminatorValue(value = "M")
public class TaskRemovedOnProcessEndLog extends TaskEndLog {
public class TaskRemovedOnProcessEndLog extends TaskCancelledLog {
private static final long serialVersionUID = 1L;

public TaskRemovedOnProcessEndLog() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ public class TaskAggregatedLog {
*/
private List<TaskAssignmentHistory> assignmentHistory = new LinkedList<TaskAssignmentHistory>();

private String transitionName;

public TaskAggregatedLog() {
super();
}
Expand Down Expand Up @@ -143,12 +145,16 @@ public void updateAssignment(TaskAssignLog taskAssignLog) {
* Actor, which end's task.
* @param endReason
* Task instance complete reason.
*
* @param transitionName
* Task selected transition name.
*/
public void updateOnEnd(Date endDate, String actorName, EndReason endReason) {
public void updateOnEnd(Date endDate, String actorName, EndReason endReason, String transitionName) {
saveAssignment(endDate, actorName);
this.endDate = endDate;
completeActorName = actorName;
this.endReason = endReason;
this.transitionName = transitionName;
}

/**
Expand Down Expand Up @@ -309,6 +315,15 @@ public void setSwimlaneName(String swimlaneName) {
this.swimlaneName = swimlaneName;
}

@Column(name = "TRANSITION_NAME", length = 1024)
public String getTransitionName() {
return transitionName;
}

public void setTransitionName(String transitionName) {
this.transitionName = transitionName;
}

@OneToMany(targetEntity = TaskAssignmentHistory.class, fetch = FetchType.LAZY)
@JoinColumn(name = "ASSIGNMENT_OBJECT_ID", nullable = false)
@IndexColumn(name = "IDX")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import ru.runa.wfe.audit.CreateTimerLog;
import ru.runa.wfe.audit.NodeEnterLog;
import ru.runa.wfe.audit.NodeErrorLog;
import ru.runa.wfe.audit.NodeInfoLog;
import ru.runa.wfe.audit.NodeLeaveLog;
import ru.runa.wfe.audit.ProcessActivateLog;
import ru.runa.wfe.audit.ProcessCancelLog;
Expand All @@ -27,6 +28,7 @@
import ru.runa.wfe.audit.TaskEndLog;
import ru.runa.wfe.audit.TaskEscalationLog;
import ru.runa.wfe.audit.TaskExpiredLog;
import ru.runa.wfe.audit.TaskRemovedOnEmbeddedSubprocessEndLog;
import ru.runa.wfe.audit.TaskRemovedOnProcessEndLog;
import ru.runa.wfe.audit.TransitionLog;
import ru.runa.wfe.audit.VariableCreateLog;
Expand Down Expand Up @@ -198,6 +200,11 @@ public void onTaskRemovedOnProcessEndLog(TaskRemovedOnProcessEndLog taskRemovedO
onTaskEnd(taskRemovedOnProcessEndLog, EndReason.PROCESS_END);
}

@Override
public void onTaskRemovedOnEmbeddedSubprocessEndLog(TaskRemovedOnEmbeddedSubprocessEndLog log) {
onTaskEnd(log, EndReason.CANCELLED);
}

@Override
public void onTaskExpiredLog(TaskExpiredLog taskExpiredLog) {
onTaskEnd(taskExpiredLog, EndReason.TIMEOUT);
Expand Down Expand Up @@ -242,6 +249,10 @@ public void onVariableUpdateLog(VariableUpdateLog variableUpdateLog) {
public void onAdminActionLog(AdminActionLog adminActionLog) {
}

@Override
public void onNodeInfoLog(NodeInfoLog nodeInfoLog) {
}

private ProcessInstanceAggregatedLog getProcessInstanceLog(long processId) {
QProcessInstanceAggregatedLog l = QProcessInstanceAggregatedLog.processInstanceAggregatedLog;
return queryFactory.selectFrom(l).where(l.processInstanceId.eq(processId)).fetchFirst();
Expand All @@ -257,7 +268,7 @@ private void onTaskEnd(TaskEndLog taskEndLog, EndReason endReason) {
if (logEntry == null) {
return;
}
logEntry.updateOnEnd(taskEndLog.getCreateDate(), taskEndLog.getActorName(), endReason);
logEntry.updateOnEnd(taskEndLog.getCreateDate(), taskEndLog.getActorName(), endReason, taskEndLog.getTransitionName());
sessionFactory.getCurrentSession().merge(logEntry);
}
}
59 changes: 30 additions & 29 deletions wfe-core/src/main/java/ru/runa/wfe/audit/hierarchy.txt
Original file line number Diff line number Diff line change
@@ -1,35 +1,36 @@

<!-- A : ru.runa.bpm.log.ActionLog -->
<!-- B : ru.runa.bpm.log.SubprocessStartLog -->
<!-- C : ru.runa.bpm.log.CreateTimerLog -->
<!-- D : ru.runa.bpm.log.VariableDeleteLog -->
<!-- E : ru.runa.bpm.log.AdminActionLog -->
<!-- F : ru.runa.bpm.log.TaskDelegationLog -->
<!-- H : ru.runa.bpm.log.NodeErrorLog -->
<!-- I : ru.runa.bpm.log.ProcessCreateLog -->
<!-- K : ru.runa.bpm.log.TaskEndByAdminLog -->
<!-- L : ru.runa.bpm.log.NodeLeaveLog -->
<!-- M : ru.runa.bpm.log.TaskRemovedOnProcessEndLog -->
<!-- N : ru.runa.bpm.log.NodeEnterLog -->
<!-- O : ru.runa.bpm.log.TaskCancelledLog -->
<!-- P : -->
<!-- R : ru.runa.bpm.log.VariableCreateLog -->
<!-- S : ru.runa.bpm.log.TaskEndBySubstitutorLog -->
<!-- T : ru.runa.bpm.log.TransitionLog -->
<!-- A : ru.runa.wfe.audit.ActionLog -->
<!-- B : ru.runa.wfe.audit.SubprocessStartLog -->
<!-- C : ru.runa.wfe.audit.CreateTimerLog -->
<!-- D : ru.runa.wfe.audit.VariableDeleteLog -->
<!-- E : ru.runa.wfe.audit.AdminActionLog -->
<!-- F : ru.runa.wfe.audit.TaskDelegationLog -->
<!-- H : ru.runa.wfe.audit.NodeErrorLog -->
<!-- I : ru.runa.wfe.audit.ProcessCreateLog -->
<!-- J : ru.runa.wfe.audit.NodeInfoLog -->
<!-- K : ru.runa.wfe.audit.TaskEndByAdminLog -->
<!-- L : ru.runa.wfe.audit.NodeLeaveLog -->
<!-- M : ru.runa.wfe.audit.TaskRemovedOnProcessEndLog -->
<!-- N : ru.runa.wfe.audit.NodeEnterLog -->
<!-- O : ru.runa.wfe.audit.TaskCancelledLog -->
<!-- P : ru.runa.wfe.audit.TaskRemovedOnEmbeddedSubprocessEndLog -->
<!-- R : ru.runa.wfe.audit.VariableCreateLog -->
<!-- S : ru.runa.wfe.audit.TaskEndBySubstitutorLog -->
<!-- T : ru.runa.wfe.audit.TransitionLog -->
<!-- U : ru.runa.wfe.audit.ProcessActivateLog -->
<!-- V : ru.runa.wfe.audit.ProcessSuspendLog -->
<!-- W : ru.runa.bpm.log.VariableUpdateLog -->
<!-- X : ru.runa.bpm.log.ProcessEndLog -->
<!-- Y : ru.runa.bpm.log.ProcessCancelLog -->
<!-- Z : ru.runa.bpm.log.SubprocessEndLog -->
<!-- W : ru.runa.wfe.audit.VariableUpdateLog -->
<!-- X : ru.runa.wfe.audit.ProcessEndLog -->
<!-- Y : ru.runa.wfe.audit.ProcessCancelLog -->
<!-- Z : ru.runa.wfe.audit.SubprocessEndLog -->
<!-- 0 : ru.runa.wfe.audit.ProcessLog & abstract subclasses -->
<!-- 1 : ru.runa.bpm.log.TaskCreateLog -->
<!-- 2 : ru.runa.bpm.log.TaskAssignLog -->
<!-- 3 : ru.runa.bpm.log.TaskEndLog -->
<!-- 4 : ru.runa.bpm.log.SwimlaneAssignLog -->
<!-- 5 : ru.runa.bpm.log.TaskEscalationLog -->
<!-- 1 : ru.runa.wfe.audit.TaskCreateLog -->
<!-- 2 : ru.runa.wfe.audit.TaskAssignLog -->
<!-- 3 : ru.runa.wfe.audit.TaskEndLog -->
<!-- 4 : ru.runa.wfe.audit.SwimlaneAssignLog -->
<!-- 5 : ru.runa.wfe.audit.TaskEscalationLog -->
<!-- 6 : -->
<!-- 7 : ru.runa.bpm.log.SendMessageLog -->
<!-- 8 : ru.runa.bpm.log.ReceiveMessageLog -->
<!-- 9 : ru.runa.bpm.log.TaskExpiredLog -->
<!-- 7 : ru.runa.wfe.audit.SendMessageLog -->
<!-- 8 : ru.runa.wfe.audit.ReceiveMessageLog -->
<!-- 9 : ru.runa.wfe.audit.TaskExpiredLog -->

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package ru.runa.wfe.commons;

import ru.runa.wfe.audit.NodeInfoLog;
import ru.runa.wfe.audit.Severity;
import ru.runa.wfe.execution.ExecutionContext;

public class GroovyNodeInfoLogExecutor {
private final ExecutionContext executionContext;

public GroovyNodeInfoLogExecutor(ExecutionContext executionContext) {
this.executionContext = executionContext;
}

public void debug(String message) {
executionContext.addLog(new NodeInfoLog(executionContext.getNode(), Severity.DEBUG, message));
}

public void info(String message) {
executionContext.addLog(new NodeInfoLog(executionContext.getNode(), Severity.INFO, message));
}
}
Loading

0 comments on commit 1796ec5

Please sign in to comment.