Skip to content

Commit

Permalink
bug: #xxx fix edc policy creation by sending empty lists as null
Browse files Browse the repository at this point in the history
  • Loading branch information
ds-lcapellino committed Jul 22, 2024
1 parent 5d023c7 commit 470fd6f
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.eclipse.tractusx.traceability.policies.application.mapper;

import lombok.experimental.UtilityClass;
import org.apache.commons.collections4.CollectionUtils;
import org.eclipse.tractusx.irs.edc.client.asset.model.Context;
import org.eclipse.tractusx.irs.edc.client.contract.model.EdcOperator;
import org.eclipse.tractusx.irs.edc.client.policy.model.EdcCreatePolicyDefinitionRequest;
Expand Down Expand Up @@ -73,7 +74,7 @@ private static EdcPolicyPermissionConstraint mapToConstraint(ConstraintsResponse
}

private static List<EdcPolicyPermissionConstraintExpression> mapToConstraintExpression(List<ConstraintResponse> constraints) {
return emptyIfNull(constraints).stream().map(constraint -> EdcPolicyPermissionConstraintExpression.builder()
List<EdcPolicyPermissionConstraintExpression> constraintList = emptyIfNull(constraints).stream().map(constraint -> EdcPolicyPermissionConstraintExpression.builder()
.type("Constraint")
.leftOperand(constraint.leftOperand())
.rightOperand(constraint.rightOperand())
Expand All @@ -82,5 +83,6 @@ private static List<EdcPolicyPermissionConstraintExpression> mapToConstraintExpr
.build())
.build())
.toList();
return CollectionUtils.isEmpty(constraintList) ? null : constraintList;
}
}

0 comments on commit 470fd6f

Please sign in to comment.