Spaces:
Build error
Build error
| package com.dalab.policyengine.model; | |
| import java.time.Instant; | |
| import java.util.Map; | |
| import java.util.UUID; | |
| import org.hibernate.annotations.JdbcTypeCode; | |
| import org.hibernate.type.SqlTypes; | |
| import jakarta.persistence.*; | |
| import jakarta.validation.constraints.NotBlank; | |
| import jakarta.validation.constraints.Size; | |
| public class PolicyRule { | |
| private UUID id; | |
| private String name; // A unique name for the rule within the policy, e.g., "rule1", "checkPII" | |
| private String description; | |
| private String condition; // MVEL expression, e.g., "asset.assetType == 'S3_BUCKET' && asset.tags.contains('PII')" | |
| // Rules with lower numbers have higher priority | |
| private int priority = 1; | |
| // Optional: Actions specific to this rule, if different from policy-level actions or to augment them | |
| private Map<String, Object> actions; | |
| private Policy policy; | |
| private Instant createdAt; | |
| private Instant updatedAt; | |
| // Getters and Setters | |
| public UUID getId() { | |
| return id; | |
| } | |
| public void setId(UUID id) { | |
| this.id = id; | |
| } | |
| public String getName() { | |
| return name; | |
| } | |
| public void setName(String name) { | |
| this.name = name; | |
| } | |
| public String getDescription() { | |
| return description; | |
| } | |
| public void setDescription(String description) { | |
| this.description = description; | |
| } | |
| public String getCondition() { | |
| return condition; | |
| } | |
| public void setCondition(String condition) { | |
| this.condition = condition; | |
| } | |
| public int getPriority() { | |
| return priority; | |
| } | |
| public void setPriority(int priority) { | |
| this.priority = priority; | |
| } | |
| public Map<String, Object> getActions() { | |
| return actions; | |
| } | |
| public void setActions(Map<String, Object> actions) { | |
| this.actions = actions; | |
| } | |
| public Policy getPolicy() { | |
| return policy; | |
| } | |
| public void setPolicy(Policy policy) { | |
| this.policy = policy; | |
| } | |
| public Instant getCreatedAt() { | |
| return createdAt; | |
| } | |
| public void setCreatedAt(Instant createdAt) { | |
| this.createdAt = createdAt; | |
| } | |
| public Instant getUpdatedAt() { | |
| return updatedAt; | |
| } | |
| public void setUpdatedAt(Instant updatedAt) { | |
| this.updatedAt = updatedAt; | |
| } | |
| protected void onCreate() { | |
| createdAt = Instant.now(); | |
| updatedAt = Instant.now(); | |
| } | |
| protected void onUpdate() { | |
| updatedAt = Instant.now(); | |
| } | |
| } |