diff --git a/src/main/java/beamline/events/BEvent.java b/src/main/java/beamline/events/BEvent.java index 1af8ae5f15a08dfb59de90da256e90fe971627b0..6cf55bb935e1c880db632f0b8507ea22206585fe 100644 --- a/src/main/java/beamline/events/BEvent.java +++ b/src/main/java/beamline/events/BEvent.java @@ -31,7 +31,7 @@ public class BEvent implements Serializable, Comparable<BEvent> { private Map<String, Serializable> eventAttributes; private Map<String, Serializable> traceAttributes; - private Map<String, Serializable> logAttributes; + private Map<String, Serializable> processAttributes; /** * Constructor of a new event @@ -39,7 +39,7 @@ public class BEvent implements Serializable, Comparable<BEvent> { public BEvent() { this.eventAttributes = new HashMap<>(); this.traceAttributes = new HashMap<>(); - this.logAttributes = new HashMap<>(); + this.processAttributes = new HashMap<>(); } // @@ -59,8 +59,8 @@ public class BEvent implements Serializable, Comparable<BEvent> { */ public static BEvent create( String processName, - String activityName, String caseId, + String activityName, Date time, Collection<Pair<String, String>> eventAttributes) throws EventException { if (processName == null || activityName == null || caseId == null) { @@ -96,8 +96,8 @@ public class BEvent implements Serializable, Comparable<BEvent> { * @throws EventException this exception is thrown is incomplete information * is provided */ - public static BEvent create(String processName, String activityName, String caseId, Date time) throws EventException { - return create(processName, activityName, caseId, time, null); + public static BEvent create(String processName, String caseId, String activityName, Date time) throws EventException { + return create(processName, caseId, activityName, time, null); } /** @@ -111,19 +111,19 @@ public class BEvent implements Serializable, Comparable<BEvent> { * @throws EventException this exception is thrown is incomplete information * is provided */ - public static BEvent create(String processName, String activityName, String caseId) throws EventException { - return create(processName, activityName, caseId, null, null); + public static BEvent create(String processName, String caseId, String activityName) throws EventException { + return create(processName, caseId, activityName, null, null); } // // Specific methods // public void setProcessName(String name) { - setLogAttribute(XConceptExtension.KEY_NAME, name); + setProcessAttribute(XConceptExtension.KEY_NAME, name); } public String getProcessName() { - return (String) logAttributes.get(XConceptExtension.KEY_NAME); + return (String) processAttributes.get(XConceptExtension.KEY_NAME); } public void setTraceName(String name) { @@ -162,8 +162,8 @@ public class BEvent implements Serializable, Comparable<BEvent> { return traceAttributes; } - public Map<String, Serializable> getLogAttributes() { - return logAttributes; + public Map<String, Serializable> getProcessAttributes() { + return processAttributes; } public void setEventAttribute(String name, Serializable value) { @@ -182,12 +182,12 @@ public class BEvent implements Serializable, Comparable<BEvent> { setAttributeFromXAttribute(traceAttributes, name, value); } - public void setLogAttribute(String name, Serializable value) { - logAttributes.put(name, value); + public void setProcessAttribute(String name, Serializable value) { + processAttributes.put(name, value); } - public void setLogAttribute(String name, XAttribute value) { - setAttributeFromXAttribute(logAttributes, name, value); + public void setProcessAttribute(String name, XAttribute value) { + setAttributeFromXAttribute(processAttributes, name, value); } // @@ -196,7 +196,7 @@ public class BEvent implements Serializable, Comparable<BEvent> { @Override public String toString() { - return logAttributes.toString() + " - " + traceAttributes.toString() + " - " + eventAttributes.toString(); + return processAttributes.toString() + " - " + traceAttributes.toString() + " - " + eventAttributes.toString(); } @Override @@ -220,8 +220,7 @@ public class BEvent implements Serializable, Comparable<BEvent> { } BEvent other = (BEvent) obj; return new EqualsBuilder() - .appendSuper(super.equals(obj)) - .append(logAttributes, other.logAttributes) + .append(processAttributes, other.processAttributes) .append(traceAttributes, other.traceAttributes) .append(eventAttributes, other.eventAttributes) .isEquals(); @@ -231,7 +230,7 @@ public class BEvent implements Serializable, Comparable<BEvent> { @Override public int hashCode() { return new HashCodeBuilder(17, 37) - .append(logAttributes) + .append(processAttributes) .append(traceAttributes) .append(eventAttributes) .toHashCode(); @@ -244,14 +243,14 @@ public class BEvent implements Serializable, Comparable<BEvent> { private void setAttributeFromXAttribute(Map<String, Serializable> map, String name, XAttribute value) { if (value instanceof XAttributeBoolean) { map.put(name, ((XAttributeBoolean) value).getValue()); + } else if (value instanceof XAttributeTimestamp) { + map.put(name, ((XAttributeTimestamp) value).getValue()); } else if (value instanceof XAttributeContinuous) { map.put(name, ((XAttributeContinuous) value).getValue()); } else if (value instanceof XAttributeDiscrete) { map.put(name, ((XAttributeDiscrete) value).getValue()); } else if (value instanceof XAttributeLiteral) { map.put(name, ((XAttributeLiteral) value).getValue()); - } else if (value instanceof XAttributeTimestamp) { - map.put(name, ((XAttributeTimestamp) value).getValue()); } } } diff --git a/src/main/java/beamline/sources/CSVLogSource.java b/src/main/java/beamline/sources/CSVLogSource.java index 1c46f974da4aec7c3ce64ffbfe61b083196571d5..4cfb0d7c3984cbb1c00fbf7980b8d74d5c3255f5 100644 --- a/src/main/java/beamline/sources/CSVLogSource.java +++ b/src/main/java/beamline/sources/CSVLogSource.java @@ -84,7 +84,7 @@ public class CSVLogSource extends BeamlineAbstractSource { attributes.add(Pair.of("attribute_" + i, line[i])); } synchronized (ctx.getCheckpointLock()) { - ctx.collect(BEvent.create(filename, line[activityNameColumn], line[caseIdColumn], null, attributes)); + ctx.collect(BEvent.create(filename, line[caseIdColumn], line[activityNameColumn], null, attributes)); } } } catch (IOException e) { diff --git a/src/main/java/beamline/sources/MQTTXesSource.java b/src/main/java/beamline/sources/MQTTXesSource.java index ef820e1f88745e31423e08bfe8705c7af84940e8..6a89e8b0a612501c34c6c8130b7d1faf3442afea 100644 --- a/src/main/java/beamline/sources/MQTTXesSource.java +++ b/src/main/java/beamline/sources/MQTTXesSource.java @@ -69,7 +69,7 @@ public class MQTTXesSource extends BeamlineAbstractSource { String partBeforeActName = topic.substring(0, posLastSlash); String activityName = topic.substring(posLastSlash + 1); String caseId = partBeforeActName.substring(partBeforeActName.lastIndexOf("/") + 1); - BEvent b = BEvent.create(processName, activityName, caseId); + BEvent b = BEvent.create(processName, caseId, activityName); buffer.add(b); } diff --git a/src/main/java/beamline/sources/StringTestSource.java b/src/main/java/beamline/sources/StringTestSource.java index 613adb619066291ccf56c9c379344a73f6fe7a23..71881613c8ffe864ffeaa2ed3c66a76650ee6a08 100644 --- a/src/main/java/beamline/sources/StringTestSource.java +++ b/src/main/java/beamline/sources/StringTestSource.java @@ -15,7 +15,7 @@ public class StringTestSource extends BeamlineAbstractSource { public void run(SourceContext<BEvent> ctx) throws Exception { for (int j = 0; j < traces.length; j++) { for (int i = 0; i < traces[j].length(); i++) { - ctx.collect(BEvent.create("test-process", traces[j].substring(i, i+1), "case-"+j)); + ctx.collect(BEvent.create("test-process", "case-"+j, traces[j].substring(i, i+1))); } } } diff --git a/src/main/java/beamline/sources/XesLogSource.java b/src/main/java/beamline/sources/XesLogSource.java index 3d6a1cfc4a1fb969c718e8a82a6f875250659076..792f34746e3557870fae407201e3a0da3f0172ac 100644 --- a/src/main/java/beamline/sources/XesLogSource.java +++ b/src/main/java/beamline/sources/XesLogSource.java @@ -128,13 +128,13 @@ public class XesLogSource extends BeamlineAbstractSource { for (XEvent e : t) { BEvent be = BEvent.create( processName, - XConceptExtension.instance().extractName(e), XConceptExtension.instance().extractName(t), + XConceptExtension.instance().extractName(e), XTimeExtension.instance().extractTimestamp(e)); // log attributes for (Map.Entry<String, XAttribute> v : log.getAttributes().entrySet()) { - be.setLogAttribute(v.getKey(), v.getValue()); + be.setProcessAttribute(v.getKey(), v.getValue()); } // trace attributes