Skip to content

Feature/policies speichern verwalten - #15

Open
rgalan-dev wants to merge 25 commits into
mainfrom
feature/policies-speichern-verwalten
Open

Feature/policies speichern verwalten#15
rgalan-dev wants to merge 25 commits into
mainfrom
feature/policies-speichern-verwalten

Conversation

@rgalan-dev

Copy link
Copy Markdown

Description

Adds the backend foundation for centrally storing, managing, validating, and retrieving policies.

This includes:

  • CRUD operations for policies
  • Construct-X example policies as seed data
  • consistent validation and error responses
  • OpenAPI documentation aligned with the frontend contract
  • ODRL generation and retrieval for connector usage
  • support for combined constraints, including date ranges

Linked Issue(s)

@rgalan-dev
rgalan-dev requested a review from gostev-p August 3, 2026 19:09
import java.util.List;
import java.util.UUID;

@Tag(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Für mich wäre es besser lesbar, wenn ihr die Swagger Annotationen in einer anderen Datei auslagert, z. B. PolicyApi als Interface.

@UpdateTimestamp
@Column(name = "updated_at", nullable = false)
private Instant updatedAt;
private Instant updatedAt;;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ein ';' zu viel :)

import java.util.UUID;

@Service
public class PolicyService {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Für diese Klasse fehlen noch die Tests

description = "Policies returned successfully"
)
@GetMapping
public ResponseEntity<List<PolicyResponse>> getAllPolicies() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ich würde lieber für diese Methode Pagination anweden.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Meinst du mit Pagination, dass sich auch der API-Response auf ein paginiertes Format wie Page<PolicyResponse> ändern soll? Dann müsste soweit ich das sehen kann noch was im Frontend angepasst werden, da dort noch Policy[] erwartet wird. Oder wäre es für dich ausreichend, intern mit Pageable zu arbeiten und nach außen weiterhin die Liste zurückzugeben?

@gostev-p gostev-p Aug 12, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ja, genau, so meinte ich das mit Page<PolicyResponse>. Frontend wird dann eventuell entsprechend angepasst


private final PolicyService policyService;

public PolicyController(PolicyService policyService) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hier könnte man auch die Lombok Annotation anwenden

private final OdrlPolicyMapper odrlPolicyService;

public PolicyService(PolicyRepository policyRepository, PolicyMapper policyMapper) {
public PolicyService(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hier könnte man die Lombok Annotation anwenden

@@ -0,0 +1,8 @@
package org.constructx.policyhub.policies.domain;

public enum ConstraintType {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Für mich wäre es doch besser, wenn ihr eine kurze Beschreibung über diesen Konstanten einfügt. Ggf. Verweis auf die entsprechende Doku.

@@ -0,0 +1,6 @@
package org.constructx.policyhub.policies.domain;

public enum PolicyCategory {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hier auch eine kurze Beschreibung, was diese beiden Policy Kategorien sind.

@Schema(
description = """
Ordered list of policy constraints. Supported types are
MEMBERSHIP, USE_CASE, END_DATE and FRAMEWORK_AGREEMENT.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Es wurde erkannt, dass bei PolicyValidator.SUPPORTED_TYPES kein Typ wie "END_DATE" nicht existiert. Vielleicht meint ihr "DATE_RANGE"?

private final PolicyRepository policyRepository;
private final PolicyMapper policyMapper;
private final PolicyValidator policyValidator;
private final OdrlPolicyMapper odrlPolicyService;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bitte hier den Attributnamen auf odrlPolicyMapper umbenennen

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