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 {
32
32
this .cognisphere = cognisphere ;
33
33
}
34
34
35
+ @ Override
36
+ public void setObject (Object obj ) {
37
+ super .setObject (obj );
38
+ }
39
+
35
40
@ Override
36
41
public Collection <WorkflowModel > asCollection () {
37
42
return object instanceof Collection value
Original file line number Diff line number Diff line change 26
26
import java .util .Map ;
27
27
28
28
class AgenticModelFactory implements WorkflowModelFactory {
29
- private final Cognisphere cognisphere = CognisphereRegistry .createEphemeralCognisphere ();
29
+
30
+ private Cognisphere cognisphere = CognisphereRegistry .createEphemeralCognisphere ();
30
31
31
32
private final AgenticModel TrueModel = new AgenticModel (Boolean .TRUE , cognisphere );
32
33
private final AgenticModel FalseModel = new AgenticModel (Boolean .FALSE , cognisphere );
33
34
private final AgenticModel NullModel = new AgenticModel (null , cognisphere );
34
35
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
+
35
46
@ Override
36
47
public WorkflowModel combine (Map <String , WorkflowModel > workflowVariables ) {
37
48
return new AgenticModel (workflowVariables , cognisphere );
Original file line number Diff line number Diff line change 15
15
*/
16
16
package io .serverlessworkflow .impl .expressions .func ;
17
17
18
- import io .cloudevents .CloudEventData ;
19
18
import io .serverlessworkflow .impl .WorkflowModel ;
20
19
import java .time .OffsetDateTime ;
21
20
import java .util .Collection ;
28
27
29
28
public class JavaModel implements WorkflowModel {
30
29
31
- protected final Object object ;
30
+ protected Object object ;
32
31
33
32
protected JavaModel (Object object ) {
34
33
this .object = asJavaObject (object );
35
34
}
36
35
36
+ protected void setObject (Object object ) {
37
+ this .object = object ;
38
+ }
39
+
37
40
@ Override
38
41
public void forEach (BiConsumer <String , WorkflowModel > consumer ) {
39
42
asMap ()
@@ -72,11 +75,6 @@ public Optional<Number> asNumber() {
72
75
return object instanceof Number value ? Optional .of (value ) : Optional .empty ();
73
76
}
74
77
75
- @ Override
76
- public Optional <CloudEventData > asCloudEventData () {
77
- return object instanceof CloudEventData value ? Optional .of (value ) : Optional .empty ();
78
- }
79
-
80
78
@ Override
81
79
public Optional <Map <String , Object >> asMap () {
82
80
return object instanceof Map ? Optional .of ((Map <String , Object >) object ) : Optional .empty ();
Original file line number Diff line number Diff line change 15
15
*/
16
16
package io .serverlessworkflow .impl ;
17
17
18
- import io .cloudevents .CloudEventData ;
19
18
import java .time .OffsetDateTime ;
20
19
import java .util .Collection ;
21
20
import java .util .Map ;
@@ -36,8 +35,6 @@ public interface WorkflowModel {
36
35
37
36
Optional <Number > asNumber ();
38
37
39
- Optional <CloudEventData > asCloudEventData ();
40
-
41
38
Optional <Map <String , Object >> asMap ();
42
39
43
40
Object asJavaObject ();
Original file line number Diff line number Diff line change 20
20
import com .fasterxml .jackson .databind .node .ArrayNode ;
21
21
import com .fasterxml .jackson .databind .node .BooleanNode ;
22
22
import com .fasterxml .jackson .databind .node .NullNode ;
23
- import io .cloudevents .CloudEventData ;
24
- import io .cloudevents .jackson .JsonCloudEventData ;
25
23
import io .serverlessworkflow .impl .WorkflowModel ;
26
24
import io .serverlessworkflow .impl .jackson .JsonUtils ;
27
25
import java .time .OffsetDateTime ;
@@ -74,11 +72,6 @@ public Optional<Number> asNumber() {
74
72
return node .isNumber () ? Optional .of (node .asLong ()) : Optional .empty ();
75
73
}
76
74
77
- @ Override
78
- public Optional <CloudEventData > asCloudEventData () {
79
- return node .isObject () ? Optional .of (JsonCloudEventData .wrap (node )) : Optional .empty ();
80
- }
81
-
82
75
@ Override
83
76
public <T > Optional <T > as (Class <T > clazz ) {
84
77
return clazz .isAssignableFrom (node .getClass ())
You can’t perform that action at this time.
0 commit comments