diff --git a/.gitignore b/.gitignore index bf30e8ec..60b6d410 100644 --- a/.gitignore +++ b/.gitignore @@ -21,4 +21,5 @@ archiva_credentials.xml .gradle .classpath .project -.settings \ No newline at end of file +.settings +.vscode/settings.json diff --git a/core/src/main/java/i5/las2peer/api/Context.java b/core/src/main/java/i5/las2peer/api/Context.java index 3184db0b..39c0862a 100644 --- a/core/src/main/java/i5/las2peer/api/Context.java +++ b/core/src/main/java/i5/las2peer/api/Context.java @@ -602,9 +602,11 @@ public Serializable invokeInternally(ServiceNameVersion service, String method, * @param activityName The activity name of the XES event. * @param resourceId The resource id of the XES event. * @param resourceType The resource type of the XES event. + * @param lifecyclePhase The lifecycle of the XES event. */ + public void monitorXESEvent(MonitoringEvent event, String message, String caseId, String activityName, - String resourceId, String resourceType); + String resourceId, String resourceType, String lifecyclePhase, Long timeOfEvent); // Class loading diff --git a/core/src/main/java/i5/las2peer/execution/ExecutionContext.java b/core/src/main/java/i5/las2peer/execution/ExecutionContext.java index 562a7424..393d40ae 100644 --- a/core/src/main/java/i5/las2peer/execution/ExecutionContext.java +++ b/core/src/main/java/i5/las2peer/execution/ExecutionContext.java @@ -220,10 +220,10 @@ public void monitorEvent(Object from, MonitoringEvent event, String message, boo @Override public void monitorXESEvent(MonitoringEvent event, String message, String caseId, String activityName, - String resourceId, String resourceType) { + String resourceId, String resourceType, String lifecyclePhase, Long timeOfEvent) { String sourceAgentId = serviceAgent != null ? serviceAgent.getIdentifier() : null; node.observerNotice(event, node.getNodeId(), sourceAgentId, null, null, message, caseId, activityName, - resourceId, resourceType); + resourceId, resourceType, lifecyclePhase, timeOfEvent); } @Override diff --git a/core/src/main/java/i5/las2peer/logging/L2pLogger.java b/core/src/main/java/i5/las2peer/logging/L2pLogger.java index 7b261a24..1f212f47 100644 --- a/core/src/main/java/i5/las2peer/logging/L2pLogger.java +++ b/core/src/main/java/i5/las2peer/logging/L2pLogger.java @@ -528,7 +528,7 @@ public void log(Long timestamp, MonitoringEvent event, String sourceNode, String @Override public void logXESEvent(Long timestamp, MonitoringEvent event, String sourceNode, String sourceAgentId, String destinationNode, String destinationAgentId, String remarks, String caseId, String activityName, - String resourceId, String resourceType) { + String resourceId, String resourceType, String lifecyclePhase, Long timeOfEvent) { StringBuilder logLine = new StringBuilder(); logLine.append(event + " (" + event.getCode() + ")\t"); logLine.append(appendPart(sourceNode)); @@ -540,6 +540,8 @@ public void logXESEvent(Long timestamp, MonitoringEvent event, String sourceNode logLine.append(appendPart(activityName)); logLine.append(appendPart(resourceId)); logLine.append(appendPart(resourceType)); + logLine.append(appendPart(lifecyclePhase)); + logLine.append(appendPart(timeOfEvent)); // with default levels this hides the output from console and only writes it to // logfile log(observerLevel, logLine.toString()); diff --git a/core/src/main/java/i5/las2peer/logging/NodeObserver.java b/core/src/main/java/i5/las2peer/logging/NodeObserver.java index 6df47cb0..e37801c9 100644 --- a/core/src/main/java/i5/las2peer/logging/NodeObserver.java +++ b/core/src/main/java/i5/las2peer/logging/NodeObserver.java @@ -52,6 +52,6 @@ public void log(Long timestamp, MonitoringEvent event, String sourceNode, String */ public void logXESEvent(Long timestamp, MonitoringEvent event, String sourceNode, String sourceAgentId, String destinationNode, String destinationAgentId, String remarks, String caseId, String activityName, - String resourceId, String resourceType); + String resourceId, String resourceType, String lifecyclePhase, Long timeOfEvent); } \ No newline at end of file diff --git a/core/src/main/java/i5/las2peer/logging/monitoring/MonitoringObserver.java b/core/src/main/java/i5/las2peer/logging/monitoring/MonitoringObserver.java index a81012fd..064234cd 100644 --- a/core/src/main/java/i5/las2peer/logging/monitoring/MonitoringObserver.java +++ b/core/src/main/java/i5/las2peer/logging/monitoring/MonitoringObserver.java @@ -249,7 +249,7 @@ public void log(Long timestamp, MonitoringEvent event, String sourceNode, String @Override public void logXESEvent(Long timestamp, MonitoringEvent event, String sourceNode, String sourceAgentId, String destinationNode, String destinationAgentId, String remarks, String caseId, String activityName, - String resourceId, String resourceType) { + String resourceId, String resourceType, String lifecyclePhase,Long timeOfEvent) { if (sourceNode == null) { return; // We do not log events without a source node into a database with different // sources;-) @@ -268,7 +268,8 @@ public void logXESEvent(Long timestamp, MonitoringEvent event, String sourceNode } monitoringMessages[messagesCount++] = new XESEventMessage(timestamp, event, sourceNode, sourceAgentId, - destinationNode, destinationAgentId, remarks, caseId, activityName, resourceId, resourceType); + destinationNode, destinationAgentId, remarks, caseId, activityName, resourceId, resourceType, + lifecyclePhase, timeOfEvent); if (readyToSend()) { checkInit(); diff --git a/core/src/main/java/i5/las2peer/logging/monitoring/XESEventMessage.java b/core/src/main/java/i5/las2peer/logging/monitoring/XESEventMessage.java index 1e5285c8..e7ec16a3 100644 --- a/core/src/main/java/i5/las2peer/logging/monitoring/XESEventMessage.java +++ b/core/src/main/java/i5/las2peer/logging/monitoring/XESEventMessage.java @@ -20,6 +20,9 @@ public class XESEventMessage extends MonitoringMessage { private String activityName; private String resourceId; private String resourceType; + private String lifecyclePhase; + + private Long timeOfEvent; /** * @@ -39,16 +42,19 @@ public class XESEventMessage extends MonitoringMessage { * @param resourceId resourceId of the event * @param resourceType resourceType of the event (e.g. user, service, bot, * etc.) + * @param lifecyclePhase lifecyclePhase of the event (e.g. start, complete, + * etc.) */ public XESEventMessage(Long timestamp, MonitoringEvent event, String sourceNode, String sourceAgentId, String destinationNode, String destinationAgentId, String remarks, String caseId, String activityName, - String resourceId, String resourceType) { + String resourceId, String resourceType, String lifecyclePhase, Long timeOfEvent) { super(timestamp, event, sourceNode, sourceAgentId, destinationNode, destinationAgentId, remarks); - this.caseId = caseId; this.activityName = activityName; this.resourceId = resourceId; this.resourceType = resourceType; + this.lifecyclePhase = lifecyclePhase; + this.timeOfEvent = timeOfEvent; } public String getCaseId() { @@ -67,4 +73,12 @@ public String getResourceType() { return resourceType; } + public String getLifecyclePhase() { + return lifecyclePhase; + } + + public Long getTimeOfEvent() { + return timeOfEvent; + } + } diff --git a/core/src/main/java/i5/las2peer/p2p/Node.java b/core/src/main/java/i5/las2peer/p2p/Node.java index 24eac60a..a26cc2a9 100644 --- a/core/src/main/java/i5/las2peer/p2p/Node.java +++ b/core/src/main/java/i5/las2peer/p2p/Node.java @@ -442,6 +442,28 @@ public void observerNotice(MonitoringEvent event, Object sourceNode, String sour public void observerNotice(MonitoringEvent event, Object sourceNode, String sourceAgentId, Object destinationNode, String destinationAgentId, String remarks, String caseId, String activityName, String resourceId, String resourceType) { + observerNotice(event, sourceNode, sourceAgentId, destinationNode, destinationAgentId, remarks, caseId, + activityName, resourceId, resourceType, null, null); + } + + /** + * Logs an event to all observers. + * + * @param event The event for this notification. + * @param sourceNode A source node for this event + * @param sourceAgentId A source agent id for this event + * @param destinationNode A destination node for this event + * @param destinationAgentId A destination agent id for this event + * @param remarks Some free text note or description about this + * event. + * @param caseId caseId of the event + * @param activityName activityName of the event + * @param resourceId resourceId of the event + * @param resourceType resourceType of the event + */ + public void observerNotice(MonitoringEvent event, Object sourceNode, String sourceAgentId, Object destinationNode, + String destinationAgentId, String remarks, String caseId, String activityName, String resourceId, + String resourceType, String lifecyclePhase, Long timeOfEvent) { long timestamp = new Date().getTime(); String sourceNodeRepresentation = getNodeRepresentation(sourceNode); String destinationNodeRepresentation = getNodeRepresentation(destinationNode); @@ -451,7 +473,8 @@ public void observerNotice(MonitoringEvent event, Object sourceNode, String sour continue; } ob.logXESEvent(timestamp, event, sourceNodeRepresentation, sourceAgentId, destinationNodeRepresentation, - destinationAgentId, remarks, caseId, activityName, resourceId, resourceType); + destinationAgentId, remarks, caseId, activityName, resourceId, resourceType, lifecyclePhase, + timeOfEvent); } } diff --git a/core/src/test/java/i5/las2peer/execution/ExecutionContextTest.java b/core/src/test/java/i5/las2peer/execution/ExecutionContextTest.java index 7aa5a42f..943926df 100644 --- a/core/src/test/java/i5/las2peer/execution/ExecutionContextTest.java +++ b/core/src/test/java/i5/las2peer/execution/ExecutionContextTest.java @@ -481,7 +481,7 @@ public void log(Long timestamp, MonitoringEvent event, String sourceNode, String public void logXESEvent(Long timestamp, MonitoringEvent event, String sourceNode, String sourceAgentId, String destinationNode, String destinationAgentId, String remarks, String caseId, String activityName, - String resourceId, String resourceType) { + String resourceId, String resourceType, String lifecyclePhase, Long timeOfEvent) { // TODO Auto-generated method stub } }); diff --git a/gradle.properties b/gradle.properties index 102da9a5..40b672d5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ las2peer.revision=1.3 -las2peer.build.number=0 +las2peer.build.number=1 java.version=17 junit.version=4.13.1 jersey.version=2.35