Skip to content

Commit

Permalink
Fix NullPointer when adding static rules
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikriemer committed Oct 23, 2023
1 parent 4b84368 commit 5f54f9a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ export class EventSchemaComponent implements OnChanges {
eventProperty.runtimeType = this.dataTypesService.getStringTypeUrl();
eventProperty.domainProperties = [];
eventProperty.propertyScope = 'DIMENSION_PROPERTY';
eventProperty.additionalMetadata = {};

this.targetSchema.eventProperties.push(eventProperty);
this.refreshTree();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,18 @@ export class EditEventPropertyComponent implements OnInit {
);

result.measurementUnit = ep.measurementUnit;
result.additionalMetadata.correctionValue =
ep.additionalMetadata.correctionValue || undefined;
result.additionalMetadata.operator =
ep.additionalMetadata.operator || undefined;

result.additionalMetadata.mode = ep.additionalMetadata.mode;
result.additionalMetadata.formatString =
ep.additionalMetadata.formatString;
result.additionalMetadata.multiplier =
ep.additionalMetadata.multiplier;
if (ep.additionalMetadata) {
result.additionalMetadata.correctionValue =
ep.additionalMetadata.correctionValue || undefined;
result.additionalMetadata.operator =
ep.additionalMetadata.operator || undefined;

result.additionalMetadata.mode = ep.additionalMetadata.mode;
result.additionalMetadata.formatString =
ep.additionalMetadata.formatString;
result.additionalMetadata.multiplier =
ep.additionalMetadata.multiplier;
}

(result as any).staticValue = (ep as any).staticValue;

Expand Down
17 changes: 11 additions & 6 deletions ui/src/app/connect/services/transformation-rule.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -661,13 +661,18 @@ export class TransformationRuleService {
new CorrectionValueTransformationRuleDescription();
rule['@class'] =
'org.apache.streampipes.model.connect.rules.value.CorrectionValueTransformationRuleDescription';
rule.runtimeKey = keyNew;
rule.correctionValue =
eventPropertyPrimitive.additionalMetadata.correctionValue;
rule.operator =
eventPropertyPrimitive.additionalMetadata.operator;
if (
eventPropertyPrimitive.additionalMetadata &&
eventPropertyPrimitive.additionalMetadata.correctionValue
) {
rule.runtimeKey = keyNew;
rule.correctionValue =
eventPropertyPrimitive.additionalMetadata.correctionValue;
rule.operator =
eventPropertyPrimitive.additionalMetadata.operator;

result.push(rule);
result.push(rule);
}
} else if (eventProperty instanceof EventPropertyNested) {
const tmpResults: CorrectionValueTransformationRuleDescription[] =
this.getCorrectionValueRules(
Expand Down

0 comments on commit 5f54f9a

Please sign in to comment.