forked from serverlessworkflow/sdk-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fix serverlessworkflow#463] Supporting runtime expressions
Signed-off-by: Francisco Javier Tirado Sarti <[email protected]>
- Loading branch information
Showing
21 changed files
with
513 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
impl/core/src/main/java/io/serverlessworkflow/impl/ListWorkflowPosition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* Copyright 2020-Present The Serverless Workflow Specification Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.serverlessworkflow.impl; | ||
|
||
import java.util.Deque; | ||
import java.util.LinkedList; | ||
import java.util.stream.Collectors; | ||
|
||
public class ListWorkflowPosition implements WorkflowPosition { | ||
|
||
private Deque<Object> list; | ||
|
||
ListWorkflowPosition() { | ||
this(new LinkedList<>()); | ||
} | ||
|
||
private ListWorkflowPosition(Deque<Object> list) { | ||
this.list = list; | ||
} | ||
|
||
public ListWorkflowPosition copy() { | ||
return new ListWorkflowPosition(this.list); | ||
} | ||
|
||
@Override | ||
public WorkflowPosition addIndex(int index) { | ||
list.add(index); | ||
return this; | ||
} | ||
|
||
@Override | ||
public WorkflowPosition addProperty(String prop) { | ||
list.add(prop); | ||
return this; | ||
} | ||
|
||
@Override | ||
public String jsonPointer() { | ||
return list.stream().map(Object::toString).collect(Collectors.joining("/")); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "ListWorkflowPosition [list=" + list + "]"; | ||
} | ||
|
||
@Override | ||
public WorkflowPosition back() { | ||
list.removeLast(); | ||
return this; | ||
} | ||
|
||
@Override | ||
public Object last() { | ||
return list.pollLast(); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
impl/core/src/main/java/io/serverlessworkflow/impl/RuntimeDescriptorFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright 2020-Present The Serverless Workflow Specification Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.serverlessworkflow.impl; | ||
|
||
import io.serverlessworkflow.impl.expressions.RuntimeDescriptor; | ||
import java.util.function.Supplier; | ||
|
||
@FunctionalInterface | ||
public interface RuntimeDescriptorFactory extends Supplier<RuntimeDescriptor> {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
impl/core/src/main/java/io/serverlessworkflow/impl/ULIDFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright 2020-Present The Serverless Workflow Specification Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.serverlessworkflow.impl; | ||
|
||
import com.github.f4b6a3.ulid.UlidCreator; | ||
|
||
public class ULIDFactory implements WorkflowIdFactory { | ||
|
||
private static ULIDFactory instance = new ULIDFactory(); | ||
|
||
public static WorkflowIdFactory get() { | ||
return instance; | ||
} | ||
|
||
private ULIDFactory() {} | ||
|
||
@Override | ||
public String id() { | ||
return UlidCreator.getMonotonicUlid().toString(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.