File tree Expand file tree Collapse file tree 5 files changed +22
-18
lines changed
agentic/src/main/java/io/serverlessworkflow/impl/expressions/agentic
lambda/src/main/java/io/serverlessworkflow/impl/expressions/func
core/src/main/java/io/serverlessworkflow/impl
jackson/src/main/java/io/serverlessworkflow/impl/expressions/jq Expand file tree Collapse file tree 5 files changed +22
-18
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,11 @@ class AgenticModel extends JavaModel {
3232 this .cognisphere = cognisphere ;
3333 }
3434
35+ @ Override
36+ public void setObject (Object obj ) {
37+ super .setObject (obj );
38+ }
39+
3540 @ Override
3641 public Collection <WorkflowModel > asCollection () {
3742 return object instanceof Collection value
Original file line number Diff line number Diff line change 2626import java .util .Map ;
2727
2828class AgenticModelFactory implements WorkflowModelFactory {
29- private final Cognisphere cognisphere = CognisphereRegistry .createEphemeralCognisphere ();
29+
30+ private Cognisphere cognisphere = CognisphereRegistry .createEphemeralCognisphere ();
3031
3132 private final AgenticModel TrueModel = new AgenticModel (Boolean .TRUE , cognisphere );
3233 private final AgenticModel FalseModel = new AgenticModel (Boolean .FALSE , cognisphere );
3334 private final AgenticModel NullModel = new AgenticModel (null , cognisphere );
3435
36+ public void setCognishere (Cognisphere cognisphere ) {
37+ this .cognisphere = cognisphere ;
38+ }
39+
40+ @ Override
41+ public WorkflowModel fromAny (WorkflowModel prev , Object obj ) {
42+ ((AgenticModel ) prev ).setObject (obj );
43+ return prev ;
44+ }
45+
3546 @ Override
3647 public WorkflowModel combine (Map <String , WorkflowModel > workflowVariables ) {
3748 return new AgenticModel (workflowVariables , cognisphere );
Original file line number Diff line number Diff line change 1515 */
1616package io .serverlessworkflow .impl .expressions .func ;
1717
18- import io .cloudevents .CloudEventData ;
1918import io .serverlessworkflow .impl .WorkflowModel ;
2019import java .time .OffsetDateTime ;
2120import java .util .Collection ;
2827
2928public class JavaModel implements WorkflowModel {
3029
31- protected final Object object ;
30+ protected Object object ;
3231
3332 protected JavaModel (Object object ) {
3433 this .object = asJavaObject (object );
3534 }
3635
36+ protected void setObject (Object object ) {
37+ this .object = object ;
38+ }
39+
3740 @ Override
3841 public void forEach (BiConsumer <String , WorkflowModel > consumer ) {
3942 asMap ()
@@ -72,11 +75,6 @@ public Optional<Number> asNumber() {
7275 return object instanceof Number value ? Optional .of (value ) : Optional .empty ();
7376 }
7477
75- @ Override
76- public Optional <CloudEventData > asCloudEventData () {
77- return object instanceof CloudEventData value ? Optional .of (value ) : Optional .empty ();
78- }
79-
8078 @ Override
8179 public Optional <Map <String , Object >> asMap () {
8280 return object instanceof Map ? Optional .of ((Map <String , Object >) object ) : Optional .empty ();
Original file line number Diff line number Diff line change 1515 */
1616package io .serverlessworkflow .impl ;
1717
18- import io .cloudevents .CloudEventData ;
1918import java .time .OffsetDateTime ;
2019import java .util .Collection ;
2120import java .util .Map ;
@@ -36,8 +35,6 @@ public interface WorkflowModel {
3635
3736 Optional <Number > asNumber ();
3837
39- Optional <CloudEventData > asCloudEventData ();
40-
4138 Optional <Map <String , Object >> asMap ();
4239
4340 Object asJavaObject ();
Original file line number Diff line number Diff line change 2020import com .fasterxml .jackson .databind .node .ArrayNode ;
2121import com .fasterxml .jackson .databind .node .BooleanNode ;
2222import com .fasterxml .jackson .databind .node .NullNode ;
23- import io .cloudevents .CloudEventData ;
24- import io .cloudevents .jackson .JsonCloudEventData ;
2523import io .serverlessworkflow .impl .WorkflowModel ;
2624import io .serverlessworkflow .impl .jackson .JsonUtils ;
2725import java .time .OffsetDateTime ;
@@ -74,11 +72,6 @@ public Optional<Number> asNumber() {
7472 return node .isNumber () ? Optional .of (node .asLong ()) : Optional .empty ();
7573 }
7674
77- @ Override
78- public Optional <CloudEventData > asCloudEventData () {
79- return node .isObject () ? Optional .of (JsonCloudEventData .wrap (node )) : Optional .empty ();
80- }
81-
8275 @ Override
8376 public <T > Optional <T > as (Class <T > clazz ) {
8477 return clazz .isAssignableFrom (node .getClass ())
You can’t perform that action at this time.
0 commit comments