Skip to content
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

Fix properties #251

Merged
merged 11 commits into from
Dec 6, 2022
Merged

Fix properties #251

merged 11 commits into from
Dec 6, 2022

Conversation

amhudson
Copy link
Member

Closes #

#250

Changelog

New

  • N/A

Changed

  • Aligned webhook-triggered activity properties to align with other trigger types.

Removed

  • Removed CloudEvent labels causing webhook-triggered workflows to fail.

Testing / Reviewing

Tested and verified with flow.service.workflow 3.4.83

@amhudson amhudson requested a review from gchickma November 14, 2022 13:41
@amhudson amhudson self-assigned this Nov 14, 2022
Copy link
Member

@gchickma gchickma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx @amhudson

@@ -199,7 +204,7 @@ private EventResponse processEvent(CloudEvent<AttributesImpl, JsonNode> event, S
property.setKey("eventId");
property.setValue(event.getAttributes().getId());
cloudEventLabels.add(property);
executionRequest.setLabels(cloudEventLabels);
// executionRequest.setLabels(cloudEventLabels);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amhudson how does not setting the labels on a CloudEvent (listener triggered) execution affect the webhook?

Comment on lines 281 to 300
ObjectMapper mapper = new ObjectMapper();
Map<String, String> payloadProperties =
mapper.convertValue(eventData.get("properties"), new TypeReference<Map<String, String>>() {});
properties.putAll(payloadProperties);

// properties.put("eventPayload", eventData.toString());

WorkflowEntity workflow = workflowService.getWorkflow(workflowId);

List<KeyValuePair> propertyList = ParameterMapper.mapToKeyValuePairList(properties);
Map<String, WorkflowProperty> workflowPropMap = workflow.getProperties().stream()
.collect(Collectors.toMap(WorkflowProperty::getKey, WorkflowProperty -> WorkflowProperty));
// Use default value for password-type parameter when user input value is null when executing
// workflow.
propertyList.stream().forEach(p -> {
if (workflowPropMap.get(p.getKey()) != null
&& FieldType.PASSWORD.value().equals(workflowPropMap.get(p.getKey()).getType())
&& p.getValue() == null) {
p.setValue(workflowPropMap.get(p.getKey()).getDefaultValue());
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the parameter resoluton around defaults be resolved in the Workflow Execution Service and not the EventProcessor

@tlawrie tlawrie merged commit 7d57b11 into main Dec 6, 2022
@tlawrie tlawrie deleted the fix_properties branch December 6, 2022 01:59
florentinvintila pushed a commit that referenced this pull request Jan 20, 2023
* fix properties

* remove CE labels

* fix workflow password parameters

* fix conversion

* fix conversion

* fix conversion

* refactor

* fix conversion

* fix npe

* update property processing

* upgrade jacoco version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants