From 8fbeaa55e30de647327847adb82f07a06c6c7865 Mon Sep 17 00:00:00 2001 From: Simon Brooke Date: Sun, 5 Aug 2018 14:52:26 +0100 Subject: [PATCH] Working through getting record creation going --- src/adl_support/utils.clj | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/adl_support/utils.clj b/src/adl_support/utils.clj index 45a3a2b..f692422 100644 --- a/src/adl_support/utils.clj +++ b/src/adl_support/utils.clj @@ -474,9 +474,9 @@ "Return `true` it the value of this `property` may be set from user-supplied data." [property] (and - (= (:tag property) :property) - (not (#{"link"} (:type (:attrs property)))) - (not (system-generated? property)))) + (= (:tag property) :property) + (not (#{"link" "list"} (:type (:attrs property)))) + (not (system-generated? property)))) (defmacro all-properties @@ -509,6 +509,17 @@ (all-properties ~entity))) +(defn required-properties + "Return the properties of this `entity` which are required and are not + system generated." + [entity] + (filter + #(and + (= (:required (:attrs %)) "true") + (not (system-generated? %))) + (descendants-with-tag entity :property))) + + (defmacro key-properties [entity] `(children-with-tag (first (children-with-tag ~entity :key)) :property))