diff --git a/pipeline/pipeline.engines.fiftyone/src/main/java/fiftyone/pipeline/engines/fiftyone/flowelements/SequenceElement.java b/pipeline/pipeline.engines.fiftyone/src/main/java/fiftyone/pipeline/engines/fiftyone/flowelements/SequenceElement.java
index 79a70b91..588f1947 100644
--- a/pipeline/pipeline.engines.fiftyone/src/main/java/fiftyone/pipeline/engines/fiftyone/flowelements/SequenceElement.java
+++ b/pipeline/pipeline.engines.fiftyone/src/main/java/fiftyone/pipeline/engines/fiftyone/flowelements/SequenceElement.java
@@ -146,9 +146,16 @@ private static Integer toSequence(Object sequence) {
Integer.valueOf((int) value) : null;
}
+ /**
+ * The key the Element Data is stored under in the Flow Data, unless a
+ * subclass gives another from {@link #getElementDataKey()}.
+ * @see Specification
+ */
+ public static final String DEFAULT_ELEMENT_DATA_KEY = "sequence";
+
@Override
public String getElementDataKey() {
- return "sequence";
+ return DEFAULT_ELEMENT_DATA_KEY;
}
@Override
diff --git a/pipeline/pipeline.javascriptbuilder/src/main/java/fiftyone/pipeline/javascriptbuilder/flowelements/JavaScriptBuilderElement.java b/pipeline/pipeline.javascriptbuilder/src/main/java/fiftyone/pipeline/javascriptbuilder/flowelements/JavaScriptBuilderElement.java
index 782c9fa7..509fc1b0 100644
--- a/pipeline/pipeline.javascriptbuilder/src/main/java/fiftyone/pipeline/javascriptbuilder/flowelements/JavaScriptBuilderElement.java
+++ b/pipeline/pipeline.javascriptbuilder/src/main/java/fiftyone/pipeline/javascriptbuilder/flowelements/JavaScriptBuilderElement.java
@@ -32,6 +32,8 @@
import fiftyone.pipeline.core.flowelements.FlowElementBase;
import fiftyone.pipeline.engines.data.AspectPropertyValue;
import fiftyone.pipeline.engines.exceptions.PropertyMissingException;
+import fiftyone.pipeline.engines.fiftyone.data.SequenceData;
+import fiftyone.pipeline.engines.fiftyone.flowelements.SequenceElement;
import fiftyone.pipeline.javascriptbuilder.Constants;
import fiftyone.pipeline.javascriptbuilder.data.JavaScriptBuilderData;
import fiftyone.pipeline.javascriptbuilder.templates.JavaScriptResource;
@@ -243,8 +245,9 @@ protected void processInternal(FlowData data) throws Exception {
String url = getUrl(reqProtocol, reqHost);
- String sessionId = getSessionId(data);
- int sequence = getSequence(data);
+ ElementData sequenceData = getSequenceData(data);
+ String sessionId = getSessionId(sequenceData);
+ int sequence = getSequence(sequenceData);
String serializedParameters = serializeParameters(parameters);
// With the gathered resources, build a new JavaScriptResource.
@@ -473,52 +476,77 @@ private String getPath() {
/**
* Gets the session id to write into the script. This is the session id
- * evidence, set by the Sequence Element or by the request, when it
- * matches SESSION_ID_PATTERN, and an empty string otherwise.
- * @param data the flow data
+ * the Sequence Element wrote, when it matches SESSION_ID_PATTERN, and an
+ * empty string otherwise, including when the pipeline has no Sequence
+ * Element.
+ * @param sequenceData the Sequence Element's data, or null
* @return the session id, or an empty string
*/
- private String getSessionId(FlowData data) {
- TryGetResult