-
Notifications
You must be signed in to change notification settings - Fork 226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[KOGITO-8330] ForEach and subprocess #2715
Merged
Merged
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
106ef69
[KOGITO-8330] Ensuring listener uniqueness
fjtirado 9bdfc3c
[KOGITO-8330] Fixing recursivity issue by cloning
fjtirado 6f9c943
[KOGITO-8330] Passing iterationParam to subprocess
fjtirado 02f1bc6
[KOGITO-8330] Id should not be part of the generated map
fjtirado b61b3c3
[KOGITO-8330] Sonar
fjtirado 58bbac7
[KOGITO-8330] Fixing broken example
fjtirado 0cd7194
Fixing recursivity
fjtirado a6d2e09
[KOGITO-8330] Fixing recursivity issue
fjtirado fae63e8
[KOGITO-8330] Adding integration tests
fjtirado File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
33 changes: 33 additions & 0 deletions
33
...flow/src/main/java/org/jbpm/process/core/datatype/impl/coverter/DataTypeDeserializer.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,33 @@ | ||
/* | ||
* Copyright 2023 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* 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 org.jbpm.process.core.datatype.impl.coverter; | ||
|
||
import java.io.IOException; | ||
|
||
import org.jbpm.process.core.datatype.DataType; | ||
import org.jbpm.process.core.datatype.DataTypeResolver; | ||
|
||
import com.fasterxml.jackson.core.JsonParser; | ||
import com.fasterxml.jackson.databind.DeserializationContext; | ||
import com.fasterxml.jackson.databind.JsonDeserializer; | ||
|
||
public class DataTypeDeserializer extends JsonDeserializer<DataType> { | ||
|
||
@Override | ||
public DataType deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { | ||
return DataTypeResolver.fromType(p.getValueAsString(), Thread.currentThread().getContextClassLoader()); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...m-flow/src/main/java/org/jbpm/process/core/datatype/impl/coverter/DataTypeSerializer.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,32 @@ | ||||||
/* | ||||||
* Copyright 2023 Red Hat, Inc. and/or its affiliates. | ||||||
* | ||||||
* 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 org.jbpm.process.core.datatype.impl.coverter; | ||||||
|
||||||
import java.io.IOException; | ||||||
|
||||||
import org.jbpm.process.core.datatype.DataType; | ||||||
|
||||||
import com.fasterxml.jackson.core.JsonGenerator; | ||||||
import com.fasterxml.jackson.databind.JsonSerializer; | ||||||
import com.fasterxml.jackson.databind.SerializerProvider; | ||||||
|
||||||
public class DataTypeSerializer extends JsonSerializer<DataType> { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
@Override | ||||||
public void serialize(DataType value, JsonGenerator gen, SerializerProvider serializers) throws IOException { | ||||||
gen.writeString(value.getStringType()); | ||||||
} | ||||||
} |
40 changes: 40 additions & 0 deletions
40
...bpm-flow/src/main/java/org/jbpm/process/core/datatype/impl/coverter/JacksonConverter.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,40 @@ | ||||||
/* | ||||||
* Copyright 2023 Red Hat, Inc. and/or its affiliates. | ||||||
* | ||||||
* 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 org.jbpm.process.core.datatype.impl.coverter; | ||||||
|
||||||
import java.util.function.Function; | ||||||
|
||||||
import org.kie.kogito.jackson.utils.ObjectMapperFactory; | ||||||
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException; | ||||||
|
||||||
public class JacksonConverter<T> implements Function<String, T> { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
private Class<T> clazz; | ||||||
fjtirado marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
public JacksonConverter(Class<T> clazz) { | ||||||
this.clazz = clazz; | ||||||
} | ||||||
|
||||||
@Override | ||||||
public T apply(String t) { | ||||||
try { | ||||||
return ObjectMapperFactory.get().readValue(t, clazz); | ||||||
} catch (JsonProcessingException e) { | ||||||
throw new IllegalArgumentException(e); | ||||||
} | ||||||
} | ||||||
} |
34 changes: 34 additions & 0 deletions
34
...m-flow/src/main/java/org/jbpm/process/core/datatype/impl/coverter/JacksonUnconverter.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 2023 Red Hat, Inc. and/or its affiliates. | ||||||
* | ||||||
* 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 org.jbpm.process.core.datatype.impl.coverter; | ||||||
|
||||||
import java.util.function.Function; | ||||||
|
||||||
import org.kie.kogito.jackson.utils.ObjectMapperFactory; | ||||||
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException; | ||||||
|
||||||
public class JacksonUnconverter<T> implements Function<T, String> { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
@Override | ||||||
public String apply(T t) { | ||||||
try { | ||||||
return ObjectMapperFactory.get().writeValueAsString(t); | ||||||
} catch (JsonProcessingException e) { | ||||||
throw new IllegalArgumentException(e); | ||||||
} | ||||||
} | ||||||
} |
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
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmmm, why changing public to final?
I agree most classes that are public probably should not be public, but in these cases, these serializers might be extended (Im not saying they will, but that we are not 100% sure is not the case, we are not particularly interested on preventing inheritance)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then it's fine to leave it as public.
I thought it was an implementation detail. That's why I suggested reducing visibility.