Skip to content

Commit

Permalink
more changes
Browse files Browse the repository at this point in the history
  • Loading branch information
wistefan committed Jun 21, 2024
1 parent b881390 commit 46d08e6
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/main/java/org/fiware/odrl/BundleResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public Response getPolicies() {
String mainPolicy = getMainPolicy(policies);

var toZip = policies.entrySet().stream()
.collect(Collectors.toMap(e -> String.format("policy.%s", e.getKey()), e -> e.getValue().rego().policy(), (e1, e2) -> e1));
.collect(Collectors.toMap(e -> String.format("policy.%s", e.getKey()), e -> e.getValue().rego().getPolicy(), (e1, e2) -> e1));
toZip.put("policy.main", mainPolicy);
try {
return Response.ok(zipMap(toZip, "rego", objectMapper.writeValueAsString(getManifest(toZip)))).build();
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/org/fiware/odrl/PolicyResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ public Response getPolicies(Integer page, Integer pageSize) {
.stream()
.map(policyEntry -> new Policy()
.id(policyEntry.getKey())
.odrl(policyEntry.getValue().odrl().policy())
.rego(policyEntry.getValue().rego().policy())).toList();
.odrl(policyEntry.getValue().odrl().getPolicy())
.rego(policyEntry.getValue().rego().getPolicy())).toList();

return Response.ok(policyList).build();
}
Expand All @@ -91,8 +91,8 @@ public Response getPolicyById(String id) {
.getPolicy(id)
.map(pw -> new Policy()
.id(id)
.odrl(pw.odrl().policy())
.rego(pw.rego().policy()))
.odrl(pw.odrl().getPolicy())
.rego(pw.rego().getPolicy()))
.map(Response::ok)
.map(Response.ResponseBuilder::build)
.orElse(Response.status(Response.Status.NOT_FOUND).build());
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/fiware/odrl/mapping/EntityMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public class EntityMapper {
public PolicyEntity map(String id, PolicyWrapper policyWrapper) {
PolicyEntity policy = new PolicyEntity();
policy.setPolicyId(id);
policy.setRego(policyWrapper.rego().policy());
policy.setOdrl(policyWrapper.odrl().policy());
policy.setRego(policyWrapper.rego());
policy.setOdrl(policyWrapper.odrl());
return policy;
}

Expand Down
7 changes: 6 additions & 1 deletion src/main/java/org/fiware/odrl/rego/OdrlPolicy.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
package org.fiware.odrl.rego;

import io.quarkus.runtime.annotations.RegisterForReflection;
import lombok.AllArgsConstructor;
import lombok.Data;

/**
* @author <a href="https://github.com/wistefan">Stefan Wiedemann</a>
*/
@RegisterForReflection
public record OdrlPolicy(String policy) {
@Data
@AllArgsConstructor
public class OdrlPolicy {
private String policy;
}
7 changes: 6 additions & 1 deletion src/main/java/org/fiware/odrl/rego/RegoPolicy.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
package org.fiware.odrl.rego;

import io.quarkus.runtime.annotations.RegisterForReflection;
import lombok.AllArgsConstructor;
import lombok.Data;

/**
* @author <a href="https://github.com/wistefan">Stefan Wiedemann</a>
*/
@RegisterForReflection
public record RegoPolicy(String policy) {
@Data
@AllArgsConstructor
public class RegoPolicy {
private String policy;
}

0 comments on commit 46d08e6

Please sign in to comment.