mchades commented on code in PR #7821:
URL: https://github.com/apache/gravitino/pull/7821#discussion_r2258831655


##########
common/src/main/java/org/apache/gravitino/dto/util/DTOConverters.java:
##########
@@ -1188,4 +1244,25 @@ public static JobTemplate fromDTO(JobTemplateDTO 
jobTemplateDTO) {
             "Unsupported job template type: " + jobTemplateDTO.jobType());
     }
   }
+
+  /**
+   * Converts a PolicyContentDTO to a PolicyContent.
+   *
+   * @param policyContentDTO The policy content DTO to be converted.
+   * @return The policy content.
+   */
+  public static PolicyContent fromDTO(PolicyContentDTO policyContentDTO) {
+    if (policyContentDTO == null) {
+      return null;
+    }
+
+    if (policyContentDTO instanceof PolicyContentDTO.CustomContentDTO) {
+      PolicyContentDTO.CustomContentDTO customContentDTO =
+          (PolicyContentDTO.CustomContentDTO) policyContentDTO;
+      return PolicyContents.custom(customContentDTO.customRules(), 
customContentDTO.properties());
+    }
+
+    throw new IllegalArgumentException(

Review Comment:
   `PolicyContentDTO` is the base class



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to