diff --git a/docs/adl.main.html b/docs/adl.main.html
index 6989ec2..7c8aea4 100644
--- a/docs/adl.main.html
+++ b/docs/adl.main.html
@@ -1,10 +1,10 @@
-
adl.main
Application Description Language - command line invocation.
-
-main
(-main & args)
Parses options and arguments. Expects as args the path-name of one or
-more ADL files.
adl->canonical
A function which takes ADL text as its single argument and returns
-canonicalised ADL text as its result.
canonicalise
(canonicalise filepath)
Canonicalise the ADL document indicated by this `filepath` (if it is not
-already canonical) and return a path to the canonical version.
cli-options
Command-line interface options
-
process
(process options)
Process these parsed `options`.
-
usage
(usage parsed-options)
\ No newline at end of file
+adl.to-cache
Application Description Language: generate caching layer for database requests.
-
handler
(handler query)
Generate declarations for handlers for this `query`. Cache handlers are needed only for select queries.
-
to-cache
(to-cache application)
Generate a `/cache.clj` file for this `application`.
-
\ No newline at end of file
+adl.to-hugsql-queries
Application Description Language - generate HUGSQL queries file.
-
delete-query
(delete-query entity)
Generate an appropriate `delete` query for this `entity`
-
foreign-queries
(foreign-queries entity application)
Generate any foreign entity queries for this `entity` of this `application`.
-
generate-documentation
(generate-documentation query)
Generate, as a string, appropriate documentation for a function wrapping this `query` map.
-
insert-query
(insert-query entity)
Generate an appropriate `insert` query for this `entity`.
-TODO: this depends on the idea that system-unique properties
-are not insertable, which is... dodgy.
list-query
(list-query entity)
Generate a query to list records in the table represented by this `entity`.
-Parameters `:limit` and `:offset` may be supplied. If not present limit defaults
-to 100 and offset to 0.
order-by-clause
(order-by-clause entity)
(order-by-clause entity prefix)
(order-by-clause entity prefix expanded?)
Generate an appropriate `order by` clause for queries on this `entity`
-
queries
(queries application entity)
(queries application)
Generate all standard queries for this `entity` in this `application`; if
-no entity is specified, generate all queries for the application.
search-query
(search-query entity application)
select-query
(select-query entity properties)
(select-query entity)
Generate an appropriate `select` query for this `entity`
-
to-hugsql-queries
(to-hugsql-queries application)
update-query
(update-query entity)
Generate an appropriate `update` query for this `entity`
-
where-clause
(where-clause entity)
(where-clause entity properties)
Generate an appropriate `where` clause for queries on this `entity`;
-if `properties` are passed, filter on those properties, otherwise the key
-properties.
\ No newline at end of file
+adl.to-hugsql-queries
Application Description Language - generate HUGSQL queries file.
+
delete-query
(delete-query entity)
Generate an appropriate delete
query for this entity
+
foreign-queries
(foreign-queries entity application)
Generate any foreign entity queries for this entity
of this application
.
+
generate-documentation
(generate-documentation query)
Generate, as a string, appropriate documentation for a function wrapping this query
map.
+
insert-query
(insert-query entity)
Generate an appropriate insert
query for this entity
. TODO: this depends on the idea that system-unique properties are not insertable, which is… dodgy.
+
list-query
(list-query entity)
Generate a query to list records in the table represented by this entity
. Parameters :limit
and :offset
may be supplied. If not present limit defaults to 100 and offset to 0.
+
order-by-clause
(order-by-clause entity)
(order-by-clause entity prefix)
(order-by-clause entity prefix expanded?)
Generate an appropriate order by
clause for queries on this entity
+
queries
(queries application entity)
(queries application)
Generate all standard queries for this entity
in this application
; if no entity is specified, generate all queries for the application.
+
search-query
(search-query entity _)
(search-query entity)
Generate an appropriate search query for string fields of this entity
.
+
Unused second argument was application
, and is retained for backward compatibility.
+
select-query
(select-query entity properties)
(select-query entity)
Generate an appropriate select
query for this entity
+
to-hugsql-queries
(to-hugsql-queries application)
Generate all HugSQL queries implied by this ADL application
spec.
+
update-query
(update-query entity)
Generate an appropriate update
query for this entity
+
where-clause
(where-clause entity)
(where-clause entity properties)
Generate an appropriate where
clause for queries on this entity
; if properties
are passed, filter on those properties, otherwise the key properties.
+
\ No newline at end of file
diff --git a/docs/adl.to-json-routes.html b/docs/adl.to-json-routes.html
index 8783709..916a080 100644
--- a/docs/adl.to-json-routes.html
+++ b/docs/adl.to-json-routes.html
@@ -1,13 +1,12 @@
-adl.to-json-routes
Application Description Language: generate RING routes for REST requests.
-
declarations
(declarations handlers-map)
Generate a forward declaration of all JSON route handlers we're going to
-generate for this `application`.
defroutes
(defroutes handlers-map)
Generate JSON routes for all queries implied by this ADL `application` spec.
-
generate-handler-body
(generate-handler-body query)
Generate and return the function body for the handler for this `query`.
-
generate-handler-src
(generate-handler-src handler-name query-map method)
Generate and return the handler for this `query`.
-
handler
(handler query-key queries-map application)
Generate declarations for handlers from query with this `query-key` in this `queries-map`
-taken from within this `application`. This method must follow the structure of
-`to-hugsql-queries/queries` quite closely, because we must generate the same names.
make-handlers-map
(make-handlers-map application)
Analyse this `application` and generate from it a map of the handlers to be output.
-
to-json-routes
(to-json-routes application)
Generate a `/routes/auto-json.clj` file for this `application`.
-
\ No newline at end of file
+adl.to-json-routes
Application Description Language: generate RING routes for REST requests.
+
declarations
(declarations handlers-map)
Generate a forward declaration of all JSON route handlers we’re going to generate for this application
.
+
defroutes
(defroutes handlers-map)
Generate JSON routes for all queries implied by this ADL application
spec.
+
generate-handler-body
(generate-handler-body query)
Generate and return the function body for the handler for this query
.
+
generate-handler-src
(generate-handler-src handler-name query-map method)
Generate and return the handler for this query
.
+
handler
(handler query-key queries-map application)
Generate declarations for handlers from query with this query-key
in this queries-map
taken from within this application
. This method must follow the structure of to-hugsql-queries/queries
quite closely, because we must generate the same names.
+
make-handlers-map
(make-handlers-map application)
Analyse this application
and generate from it a map of the handlers to be output.
+
to-json-routes
(to-json-routes application)
Generate a /routes/auto-json.clj
file for this application
.
+
\ No newline at end of file
diff --git a/docs/adl.to-psql.html b/docs/adl.to-psql.html
index 1b81eac..34be32e 100644
--- a/docs/adl.to-psql.html
+++ b/docs/adl.to-psql.html
@@ -1,32 +1,26 @@
-adl.to-psql
Application Description Language: generate Postgres database definition.
-
compose-convenience-entity-field
(compose-convenience-entity-field field entity application)
compose-convenience-view-select-list
(compose-convenience-view-select-list entity application top-level?)
Compose the body of an SQL `SELECT` statement for a convenience view of this
-`entity` within this `application`, recursively. `top-level?` should be set
-only on first invocation.
compose-convenience-where-clause
(compose-convenience-where-clause entity application top-level?)
Compose an SQL `WHERE` clause for a convenience view of this
-`entity` within this `application`.
-TODO: does not correctly compose links at one stage down the tree.
-See `lv_electors`, `lv_followuprequests` for examples of the problem.
construct-link-property
(construct-link-property entity)
Create a dummy property for a link-table referencing this `entity`, in order
-that the field generation functions already defined may be applied to it.
emit-application
(emit-application application)
Emit all SQL declarations required to initialise a Postgres database for
-this `application`.
emit-convenience-entity-field
(emit-convenience-entity-field field entity application)
emit-convenience-view
(emit-convenience-view entity application)
Emit a convenience view of this `entity` of this `application` for use in generating lists,
-menus, et cetera.
emit-defined-field-type
(emit-defined-field-type property application)
Generate appropriate field type and constraints for this `property`
-given this `typedef`.
emit-entity-field-type
(emit-entity-field-type property application)
Emit an appropriate field type for this `property`, expected to reference an entity, in this `application`.
-
emit-field-type
(emit-field-type property entity application key?)
Emit an appropriate field type for this `property`, expected to belong to
-this `entity` within this `application`.
emit-group-declaration
(emit-group-declaration group application)
Emit a declaration for this authorisation `group` within this `application`.
-
emit-link-field
(emit-link-field property entity application)
Emit an appropriate link field for this `property` of this `entity`
-within this `application`.
emit-link-table
(emit-link-table property e1 application emitted-link-tables)
Emit a link table for the specified `property` of the entity `e1` within
-this `application`, provided that such a table has not already been emitted
-from the other end. The argument `emitted-link-tables` contains an atom
-which references a set of the names of all those link tables which have
-already been emitted, and this is modified in the execution of this function.
emit-link-tables
(emit-link-tables entity application emitted-link-tables)
(emit-link-tables application emitted-link-tables)
Emit all required link tables for this `entity` within this `application`,
-given these `emitted-link-tables` which have already been emitted.
emit-permissions-grant
(emit-permissions-grant table-name privilege permissions)
Emit an appropriate grant of permissions on this `table-name` at this
-`privilege` level given these `permissions`. `privilege` is expected
-to be one of #{:SELECT :INSERT :UPDATE :DELETE}.
-TODO: more thought needed here.
emit-property
(emit-property property entity application)
(emit-property property entity application key?)
Emit a field declaration representing this `property` of this `entity` within this `application`.
-
emit-referential-integrity-link
(emit-referential-integrity-link property nearside application)
Emit a referential integrity link for this `property` of the entity
-`nearside` within this `application`.
emit-referential-integrity-links
(emit-referential-integrity-links entity application)
(emit-referential-integrity-links application)
Emit all appropriate referential integrity links for this `entity`
-within this `application`.
emit-table
(emit-table entity application doc-comment)
(emit-table entity application)
Emit a table declaration for this `entity` of this `application`,
-documented with this `doc-comment` if specified.
field-name
(field-name property)
Return the appropriate field name for this `property`.
-TODO: really belongs in `adl-support.utils`.
to-psql
(to-psql application)
Generate a complete Postgres database initialisation script for this `application`.
-
\ No newline at end of file
+adl.to-psql
Application Description Language: generate Postgres database definition.
+
compose-convenience-entity-field
(compose-convenience-entity-field field entity application)
(compose-convenience-entity-field field entity application table-alias)
compose-convenience-view-from-list
(compose-convenience-view-from-list entity application top-level?)
Compose the FROM list of an SQL SELECT
statement for a convenience view of this entity
within this application
, recursively. top-level?
should be set only on first invocation.
+
compose-convenience-where-clause
(compose-convenience-where-clause entity application top-level?)
Compose an SQL WHERE
clause for a convenience view of this entity
within this application
. TODO: does not correctly compose links at one stage down the tree. See lv_electors
, lv_followuprequests
for examples of the problem.
+
construct-link-property
(construct-link-property entity)
Create a dummy property for a link-table referencing this entity
, in order that the field generation functions already defined may be applied to it.
+
emit-application
(emit-application application)
Emit all SQL declarations required to initialise a Postgres database for this application
.
+
emit-convenience-entity-field
(emit-convenience-entity-field property entity application)
(emit-convenience-entity-field property entity application table-alias)
emit-convenience-view
(emit-convenience-view entity application)
Emit a convenience view of this entity
of this application
for use in generating lists, menus, et cetera.
+
emit-defined-field-type
(emit-defined-field-type property application)
Generate appropriate field type and constraints for this property
given this typedef
.
+
emit-entity-field-type
(emit-entity-field-type property application)
Emit an appropriate field type for this property
, expected to reference an entity, in this application
.
+
emit-field-type
(emit-field-type property entity application key?)
Emit an appropriate field type for this property
, expected to belong to this entity
within this application
.
+
emit-group-declaration
(emit-group-declaration group)
Emit a declaration for this authorisation group
.
+
emit-link-field
(emit-link-field property entity application)
Emit an appropriate link field for this property
of this entity
within this application
.
+
emit-link-table
(emit-link-table property e1 application emitted-link-tables)
Emit a link table for the specified property
of the entity e1
within this application
, provided that such a table has not already been emitted from the other end. The argument emitted-link-tables
contains an atom which references a set of the names of all those link tables which have already been emitted, and this is modified in the execution of this function.
+
emit-link-tables
(emit-link-tables entity application emitted-link-tables)
(emit-link-tables application emitted-link-tables)
Emit all required link tables for this entity
within this application
, given these emitted-link-tables
which have already been emitted.
+
emit-permissions-grant
(emit-permissions-grant table-name privilege permissions)
Emit an appropriate grant of permissions on this table-name
at this privilege
level given these permissions
. privilege
is expected to be one of #{:SELECT :INSERT :UPDATE :DELETE}. TODO: more thought needed here.
+
emit-property
(emit-property property entity application)
(emit-property property entity application key?)
Emit a field declaration representing this property
of this entity
within this application
.
+
emit-referential-integrity-link
(emit-referential-integrity-link property nearside application)
Emit a referential integrity link for this property
of the entity nearside
within this application
.
+
emit-referential-integrity-links
(emit-referential-integrity-links entity application)
(emit-referential-integrity-links application)
Emit all appropriate referential integrity links for this entity
within this application
.
+
emit-table
(emit-table entity application doc-comment)
(emit-table entity application)
Emit a table declaration for this entity
of this application
, documented with this doc-comment
if specified.
+
field-name
(field-name property)
Return the appropriate field name for this property
. TODO: really belongs in adl-support.utils
.
+
to-psql
(to-psql application)
Generate a complete Postgres database initialisation script for this application
.
+
\ No newline at end of file
diff --git a/docs/adl.to-reframe.html b/docs/adl.to-reframe.html
index c479abd..be3171e 100644
--- a/docs/adl.to-reframe.html
+++ b/docs/adl.to-reframe.html
@@ -1,7 +1,7 @@
-adl.to-reframe
Application Description Language: generate re-frame UI. TODO: doesn't even nearly work yet.
-
\ No newline at end of file
+adl.to-reframe
Application Description Language: generate re-frame UI. TODO: doesn’t even nearly work yet.
+
\ No newline at end of file
diff --git a/docs/adl.to-selmer-routes.html b/docs/adl.to-selmer-routes.html
index 3a6e1b5..50dcd41 100644
--- a/docs/adl.to-selmer-routes.html
+++ b/docs/adl.to-selmer-routes.html
@@ -1,30 +1,21 @@
-adl.to-selmer-routes
Application Description Language: generate routes for user interface requests.
-
compose-fetch-auxlist-data
(compose-fetch-auxlist-data auxlist entity application)
Compose Clojure code to fetch data to populate this `auxlist` of a form
-editing a record of this `entity` within this `application`.
compose-fetch-record
(compose-fetch-record e a)
Compose Clojure code to retrieve a single record of entity `e` in application `a`; in addition
-to the fields of the record in the database, the record should also contain the values of
-the `link` and `list` properties of the entity, retrieved from their tables.
-TODO: what about `entity` properties?.
generate-handler-resolver
(generate-handler-resolver application)
Dodgy, dodgy, dodgy. Generate code which will look up functions in the
-manual and in this namespace. I'm sure someone who really knew what they
-were doing could write this more elegantly.
handler-name
(handler-name f e a m)
Generate the name of the appropriate handler function for form `f` of
-entity `e` of application `a` for method `m`, where `f`, `e`, and `a`
-are expected to be elements and `m` is expected to be one of the keywords
-`:put` `:get`.
make-defroutes
(make-defroutes application)
Generate a `defroutes` declaration for all routes of all forms, pages and
-lists within this `application`.
make-form-get-handler-content
(make-form-get-handler-content f e a n)
Compose Clojure code to form body of an HTTP `GET` handler for the form
-`f` of the entity `e` within application `a`. The argument `n`
-is not used.
make-form-post-handler-content
(make-form-post-handler-content f e a n)
Generate the body of the post handler for the form `f` of
-entity `e` in application `a`. The argument `n` is bound to the name
-of the function, but is not currently used.
-
-Literally the only thing the post handler has to do is to
-execute the database store operation. Then it can hand off
-to the get handler.
make-get-handler
(make-get-handler f e a)
Generate a Clojure function to handle HTTP `GET` requests for form, list or
-page `f` of entity `e` within application `a`.
make-handlers
(make-handlers e application)
Generate all the Selmer route handlers for all the forms, lists and pages
-of the entity `e` within this `application`.
make-list-get-handler-content
(make-list-get-handler-content f e a n)
Compose Clojure code to form body of an HTTP `GET` handler for the list
-`f` of the entity `e` within application `a`. The argument `n` is ignored.
make-page-get-handler-content
(make-page-get-handler-content f e a n)
Compose Clojure code to form body of an HTTP `GET` handler for the page
-`f` of the entity `e` within application `a`. The argument `n` is ignored.
make-post-handler
(make-post-handler f e a)
Generate an HTTP `POST` handler for the page, form or list `f` of the
-entity `e` of application `a`.
make-route
(make-route m n)
Make a route for method `m` to request the resource with name `n`.
-
to-selmer-routes
(to-selmer-routes application)
Generate a `/routes/auto.clj` file for this `application`.
-
\ No newline at end of file
+adl.to-selmer-routes
Application Description Language: generate routes for user interface requests.
+
compose-fetch-auxlist-data
(compose-fetch-auxlist-data auxlist entity application)
Compose Clojure code to fetch data to populate this auxlist
of a form editing a record of this entity
within this application
.
+
compose-fetch-record
(compose-fetch-record e a)
Compose Clojure code to retrieve a single record of entity e
in application a
; in addition to the fields of the record in the database, the record should also contain the values of the link
and list
properties of the entity, retrieved from their tables. TODO: what about entity
properties?.
+
generate-handler-resolver
(generate-handler-resolver application)
Dodgy, dodgy, dodgy. Generate code which will look up functions in the manual and in this namespace. I’m sure someone who really knew what they were doing could write this more elegantly.
+
handler-name
(handler-name f e a m)
Generate the name of the appropriate handler function for form f
of entity e
of application a
for method m
, where f
, e
, and a
are expected to be elements and m
is expected to be one of the keywords :put
:get
.
+
make-defroutes
(make-defroutes application)
Generate a defroutes
declaration for all routes of all forms, pages and lists within this application
.
+
make-form-get-handler-content
(make-form-get-handler-content f e a n)
Compose Clojure code to form body of an HTTP GET
handler for the form f
of the entity e
within application a
. The argument n
is not used.
+
make-form-post-handler-content
(make-form-post-handler-content f e a n)
Generate the body of the post handler for the form f
of entity e
in application a
. The argument n
is bound to the name of the function, but is not currently used.
+
Literally the only thing the post handler has to do is to execute the database store operation. Then it can hand off to the get handler.
+
make-get-handler
(make-get-handler f e a)
Generate a Clojure function to handle HTTP GET
requests for form, list or page f
of entity e
within application a
.
+
make-handlers
(make-handlers e application)
Generate all the Selmer route handlers for all the forms, lists and pages of the entity e
within this application
.
+
make-list-get-handler-content
(make-list-get-handler-content f e a n)
Compose Clojure code to form body of an HTTP GET
handler for the list f
of the entity e
within application a
. The argument n
is ignored.
+
make-page-get-handler-content
(make-page-get-handler-content f e a n)
Compose Clojure code to form body of an HTTP GET
handler for the page f
of the entity e
within application a
. The argument n
is ignored.
+
make-post-handler
(make-post-handler f e a)
Generate an HTTP POST
handler for the page, form or list f
of the entity e
of application a
.
+
make-route
(make-route m n)
Make a route for method m
to request the resource with name n
.
+
to-selmer-routes
(to-selmer-routes application)
Generate a /routes/auto.clj
file for this application
.
+
\ No newline at end of file
diff --git a/docs/adl.to-selmer-templates.html b/docs/adl.to-selmer-templates.html
index 0772454..9067370 100644
--- a/docs/adl.to-selmer-templates.html
+++ b/docs/adl.to-selmer-templates.html
@@ -1,57 +1,43 @@
-adl.to-selmer-templates
Application Description Language - generate Selmer templates for
-the HTML pages implied by an ADL file.
application-to-template
(application-to-template application)
back-link
(back-link content url)
Generate a retrograde primary navigation link with this `content` to this
-`url`, indicating a backward move through the appliication.
big-link
(big-link content url)
Generate a primary navigation link with this `content` to this `url`.
-TODO: should be renamed. `primary-link` would be better.
compose-form-content
(compose-form-content form entity application)
Compose the content for this `form` of this `entity` within this `application`.
-
compose-if-member-of-tag
(compose-if-member-of-tag privilege & elts)
Generate an appropriate `ifmemberof` tag (see `adl-support.tags`) given this
-`privilege` for the ADL elements listed in `elts`, which may be fields,
-properties, list, forms, pages or entities.
compose-readable-or-not-authorised
(compose-readable-or-not-authorised p f e a w)
Compose content to emit if the user is not authorised to write, or
-not authorised to read, property `p` in form, list or page `f` of
-entity `e` within application `a`, while generating a widget with id
-`w`.
edit-link
(edit-link source entity application parameters)
embed-script-fragment
(embed-script-fragment resource-path substitutions)
(embed-script-fragment resource-path)
Return the content of the file at `resource-path`, with these
-`substitutions` made into it in order. Substitutions should be pairs
-[`pattern` `value`], where `pattern` is a string, a char, or a regular
-expression.
emit-content
(emit-content content)
(emit-content filename application k)
(emit-content filename spec entity application k)
emit-entity-dd
(emit-entity-dd entity application)
emit-entity-dt
(emit-entity-dt entity application)
entity-to-templates
(entity-to-templates entity application)
Generate one or more templates for editing instances of this
-`entity` in this `application`
get-options
(get-options property form entity application)
Produce template code to get options for this `property` of this `entity`
-taken from this `application`.
list-tbody
(list-tbody source list-spec entity application)
Return a table body element for the list view for this `list-spec` of
-this `entity` within this `application`, using data from this `source`.
list-to-template
(list-to-template list-spec entity application)
Generate a template as specified by this `list` element for this `entity`,
-taken from this `application`. If `list` is nill, generate a default list
-template for the entity.
page-to-template
(page-to-template page entity application)
Generate a template as specified by this `page` element for this `entity`,
-taken from this `application`. If `page` is nil, generate a default page
-template for the entity.
-
-TODO: not yet written.
select-field-name
(select-field-name entity)
select-property
(select-property entity)
Return the property on which we will by default do a user search on this
-`entity`.
to-selmer-templates
(to-selmer-templates application)
wrap-in-if-member-of
(wrap-in-if-member-of content privilege & context)
Wrap this `content` in an if-member-of tag; if `writeable?` is true,
-allow those groups by whom it is writeable, else those by whom it is
-readable. `context` should be a sequence of adl elements from which
-permissions may be obtained.
write-template-file
(write-template-file filename template application)
Write a template file with this `filename` from this `template` in the
-context of this `application`.
\ No newline at end of file
+adl.to-selmer-templates
Application Description Language - generate Selmer templates for the HTML pages implied by an ADL file.
+
application-to-template
(application-to-template application)
back-link
(back-link content url)
Generate a retrograde primary navigation link with this content
to this url
, indicating a backward move through the appliication.
+
big-link
(big-link content url)
Generate a primary navigation link with this content
to this url
. TODO: should be renamed. primary-link
would be better.
+
compose-form-content
(compose-form-content form entity application)
Compose the content for this form
of this entity
within this application
.
+
compose-if-member-of-tag
(compose-if-member-of-tag privilege & elts)
Generate an appropriate ifmemberof
tag (see adl-support.tags
) given this privilege
for the ADL elements listed in elts
, which may be fields, properties, list, forms, pages or entities.
+
compose-readable-or-not-authorised
(compose-readable-or-not-authorised p f e a w)
Compose content to emit if the user is not authorised to write, or not authorised to read, property p
in form, list or page f
of entity e
within application a
, while generating a widget with id w
.
+
edit-link
(edit-link source entity application parameters)
embed-script-fragment
(embed-script-fragment resource-path substitutions)
(embed-script-fragment resource-path)
Return the content of the file at resource-path
, with these substitutions
made into it in order. Substitutions should be pairs pattern
value
, where pattern
is a string, a char, or a regular expression.
+
emit-content
(emit-content content)
(emit-content filename application k)
(emit-content filename spec entity application k)
emit-entity-dd
(emit-entity-dd entity application)
emit-entity-dt
(emit-entity-dt entity application)
entity-to-templates
(entity-to-templates entity application)
Generate one or more templates for editing instances of this entity
in this application
+
get-options
(get-options property form entity application)
Produce template code to get options for this property
of this entity
taken from this application
.
+
list-tbody
(list-tbody source list-spec entity application)
Return a table body element for the list view for this list-spec
of this entity
within this application
, using data from this source
.
+
list-to-template
(list-to-template list-spec entity application)
Generate a template as specified by this list
element for this entity
, taken from this application
. If list
is nill, generate a default list template for the entity.
+
page-to-template
(page-to-template page entity application)
Generate a template as specified by this page
element for this entity
, taken from this application
. If page
is nil, generate a default page template for the entity.
+
TODO: not yet written.
+
select-field-name
(select-field-name entity)
select-property
(select-property entity)
Return the property on which we will by default do a user search on this entity
.
+
to-selmer-templates
(to-selmer-templates application)
Generate all Selmer templates implied by this ADL application
spec.
+
wrap-in-if-member-of
(wrap-in-if-member-of content privilege & context)
Wrap this content
in an if-member-of tag; if writeable?
is true, allow those groups by whom it is writeable, else those by whom it is readable. context
should be a sequence of adl elements from which permissions may be obtained.
+
write-template-file
(write-template-file filename template application)
Write a template file with this filename
from this template
in the context of this application
.
+
\ No newline at end of file
diff --git a/docs/adl.to-swagger.html b/docs/adl.to-swagger.html
index 56c56e1..9df3d9b 100644
--- a/docs/adl.to-swagger.html
+++ b/docs/adl.to-swagger.html
@@ -1,5 +1,5 @@
-adl.to-swagger
Application Description Language: generate swagger routes.
-
\ No newline at end of file
+adl.validator
Application Description Language: validator for ADL structure.
-TODO: this is at present largely a failed experiment.
auxlist-validations
a subsidiary list, on which entities related to primary
-entities in the enclosing page or list are listed
-
-* `property`: the property of the enclosing entity that this
- list displays (obviously, must be of type='list')
-* `onselect`: the form or page of the listed entity to call
- when an item from the list is selected
-* `canadd`: true if the user should be able to add records
- to this list
cascade-actions
actions which should be cascaded to dependent objects. All these values except
-'manual' are taken from Hibernate and should be passed through the adl2hibernate
-mapping transparently. Relevent only for properties with type='entity', type='link'
-and type='list'
-
-* `all`: cascade delete, save and update
-* `all-delete-orphan`: see hibernate documentation; relates to transient objects only
-* `delete`: cascade delete actions, but not save and update
-* `manual`: cascading will be handled in manually managed code, code to
- handle cascading should not be generated
-* `save-update`: cascade save and update actions, but not delete.
complex-data-types
data types which are more complex than SimpleDataTypes...
-* `entity` : a foreign key link to another entity (i.e. the 'many' end of a
- one-to-many link);
-* `list` : a list of some other entity that links to me (i.e. the 'one' end of
- a one-to-many link);
-* `link` : a many to many link (via a link table);
-* `defined` : a type defined by a typedef.
content
content, for things like pages (i.e. forms, lists, pages)
-
defineable-data-types
data types which can be used in a typedef to provide validation -
-e.g. a string can be used with a regexp or a scalar can be used with
-min and max values
-* `string`: varchar java.sql.Types.VARCHAR
-* `integer`: int java.sql.Types.INTEGER
-* `real`: double java.sql.Types.DOUBLE
-* `money`: money java.sql.Types.INTEGER
-* `date`: date java.sql.Types.DATE
-* `time`: time java.sql.Types.TIME
-* `timestamp`: timestamp java.sql.Types.TIMESTAMP
-* `uploadable`: varchar java.sql.Types.VARCHAR
-* `image`: varchar java.sql.Types.VARCHAR
-
-uploadable is as string but points to an uploaded file; image is as
-uploadable but points to an uploadable graphical image file.
disjunct-valid?
macro
(disjunct-valid? o & validations)
Yes, this is a horrible hack. I should be returning the error structure
-not printing it. But I can't see how to make that work with `bouncer`.
-OK, so: most of the validators will (usually) fail, and that's OK. How
-do we identify the one which ought not to have failed?
documentation-validations
contains documentation on the element which immediately contains it. TODO:
-should HTML markup within a documentation element be allowed? If so, are
-there restrictions?
entity-validations
an entity which has properties and relationships; maps onto a database
-table or a Java serialisable class - or, of course, various other things
-
- * `name`: obviously, the name of this entity
- * `natural-key`: if present, the name of a property of this entity which forms
- a natural primary key [NOTE: Only partly implemented. NOTE: much of
- the present implementation assumes all primary keys will be
- integers. This needs to be fixed!] DEPRECATED: remove; replace with the
- 'key' element, below.
- * `table`: the name of the table in which this entity is stored. Defaults to same
- as name of entity. Strongly recommend this is not used unless it needs
- to be different from the name of the entity
- * `foreign`: this entity is part of some other system; no code will be generated
- for it, although code which links to it will be generated
field-validations
a field in a form or page
-
-* `property`: the property which this field displays/edits.
fieldgroup-validations
a group of fields and other controls within a form or list, which the
-renderer might render as a single pane in a tabbed display, for example.
generator-validations
marks a property which is auto-generated by some part of the system.
-This is based on the Hibernate construct, except that the Hibernate
-implementation folds both its internal generators and custom generators
-onto the same attribute. This separates them onto two attributes so we
-can police values for Hibernate's 'builtin' generators.
-
-* `action`: one of the supported Hibernate builtin generators, or
- 'manual'. 'native' is strongly recommended in most instances
-* `class`: if action is 'manual', the name of a manually maintained
- class conforming to the Hibernate IdentifierGenerator
- interface, or its equivalent in other languages.
group-validations
a group of people with similar permissions to one another
-
-* `name`: the name of this group
-* `parent`: the name of a group of which this group is subset
head-validations
content to place in the head of the generated document; normally HTML.
-
help-validations
helptext about a property of an entity, or a field of a page, form or
-list, or a typedef. Typically there will be only one of these per property
- per locale; if there are more than one all those matching the locale may
- be concatenated, or just one may be used.
-
-* `locale`: the locale in which to prefer this prompt
ifmissing-validations
helpful text to be shown if a property value is missing, typically when
- a form is submitted. Typically there will be only one of these per property
- per locale; if there are more than one all those matching the locale may
- be concatenated, or just one may be used. Later there may be more sophisticated
- behaviour here.
-
-* `locale`: the locale in which to prefer this prompt
in-implementation-validations
information about how to translate a type into types known to different target
-languages. TODO: Once again I'm not wholly comfortable with the name; I'm not
-really comfortable that this belongs in ADL at all.
-
-* `target`: the target language
-* `value`: the type to use in that target language
-* `kind`: OK, I confess I don't understand this, but Andrew needs it...
list-validations
a list on which entities of a given type are listed
-
-* `onselect`: name of form/page/list to go to when
- a selection is made from the list
option-validations
one of an explicit list of optional values a property may have
-NOTE: whether options get encoded at application layer or at database layer
-is UNDEFINED; either behaviour is correct. If at database layer it's also
-UNDEFINED whether they're encoded as a single reference data table or as
-separate reference data tables for each property.
-
-* `value`: the value of this option.
order-validations
an ordering or records in a list
-* `property`: the property on which to order
-* `sequence`: the sequence in which to order
page-validations
a page on which an entity may be displayed
-
param-validations
A parameter passed to the generator. Again, based on the Hibernate
-implementation.
-
-* `name`: the name of this parameter.
permission-validations
permissions policy on an entity, a page, form, list or field
-
-* `group`: the group to which permission is granted
-* `permission`: the permission which is granted to that group
permissions
permissions a group may have on an entity, list, page, form or field
-permissions are deemed to increase as you go right. A group cannot
-have greater permission on a field than on the form it is in, or
-greater permission on form than the entity it belongs to
-
-* `none`: none
-* `read`: select
-* `insert`: insert
-* `noedit`: select, insert
-* `edit`: select, insert, update
-* `all`: select, insert, update, delete
pragma-validations
pragmatic advice to generators of lists and forms, in the form of
-name/value pairs which may contain anything. Over time some pragmas
-will become 'well known', but the whole point of having a pragma
-architecture is that it is extensible.
prompt-validations
a prompt for a property or field; used as the prompt text for a widget
-which edits it. Typically there will be only one of these per property
- per locale; if there are more than one all those matching the locale may
- be concatenated, or just one may be used.
-
-* `prompt`: the prompt to use
-* `locale`: the locale in which to prefer this prompt.
property-validations
a property (field) of an entity (table)
-
-* `name`: the name of this property.
-* `type`: the type of this property.
-* `default`: the default value of this property. There will probably be
- magic values of this!
-* `typedef`: name of the typedef to use, it type = 'defined'.
-* `distinct`: distinct='system' required that every value in the system
- will be distinct (i.e. natural primary key);
- distinct='user' implies that the value may be used by users
- in distinguishing entities even if values are not formally
- unique;
- distinct='all' implies that the values are formally unique
- /and/ are user friendly (NOTE: not implemented).
-* `entity`: if type='entity', the name of the entity this property is
- a foreign key link to.
- if type='list', the name of the entity that has a foreign
- key link to this entity
-* `farkey`: if type='list', the name of farside key in the listed
- entity; if type='entity' and the farside field to join to
- is not the farside primary key, then the name of that
- farside field
-* `required`: whether this propery is required (i.e. 'not null').
-* `immutable`: if true, once a value has been set it cannot be changed.
-* `size`: fieldwidth of the property if specified.
-* `concrete`: if set to 'false', this property is not stored in the
- database but must be computed (manually written code must
- be provided to support this)
-* `cascade`: what action(s) on the parent entity should be cascaded to
- entitie(s) linked on this property. Valid only if type='entity',
- type='link' or type='list'.
-* `column`: name of the column in a SQL database table in which this property
- is stored. TODO: Think about this.
-* `unsaved-value`:
- of a property whose persistent value is set on first being
- committed to persistent store, the value which it holds before
- it has been committed
reference-validations
The 'specification' and 'reference' elements are for documentation only,
-and do not contribute to the engineering of the application described.
-
-A reference element is a reference to a specifying document.
-
-* `abbr`: The abbreviated name of the specification to which this
- reference refers
-* `section`: The 'anchor part' (part following a hash character) which,
- when appended to the URL, will locate the exact section
- referenced.
-* `entity`: A reference to another entity within this ADL document
-* `property`: A reference to another property within this ADL document;
- if entity is also specified then of that entity, else of
- the ancestor entity if any
simple-data-types
data types which are fairly straightforward translations of JDBC data types
-* `boolean`: boolean java.sql.Types.BIT or char(1) java.sql.Types.CHAR
-* `text`: text or java.sql.Types.LONGVARCHAR
-memo java.sql.Types.CLOB
special-data-types
data types which require special handling - which don't simply map onto
-common SQL data types
-* `geopos` : a latitude/longitude pair (experimental and not yet implemented)
-* `image` : a raster image file, in jpeg, gif, or png format (experimental, not yet implemented)
-* `message` : an internationalised message, having different translations for different locales
specification-validations
The 'specification' and 'reference' elements are for documentation only,
-and do not contribute to the engineering of the application described.
-
-A specification element is intended chiefly to declare the reference
-documents which may be used in documentation elements later in the
-document.
-
-* `url`: The URL from which the document referenced can be retrieved
-* `name`: The full name (title) given to this document
-* `abbr`: A convenient abbreviated name.
top-validations
content to place in the top of the body of the generated document;
-this is any HTML block or inline level element.
try-validate
(try-validate o validation)
Pass this `validation` and the object `o` to bouncer
-
typedef-validations
the definition of a defined type. At this stage a defined type is either
-* a string in which case it must have size and pattern, or
-* a scalar in which case it must have minimum and/or maximum
-pattern must be a regular expression as interpreted by org.apache.regexp.RE
-minimum and maximum must be of appropriate format for the datatype specified.
-Validation may be done client-side and/or server-side at application layer
-and/or server side at database layer.
-
- * `name`: the name of this typedef
- * `type`: the simple type on which this defined type is based; must be
- present unless in-implementation children are supplied
- * `size`: the data size of this defined type
- * `pattern`: a regular expression which values for this type must match
- * `minimum`: the minimum value for this type (if base type is scalar)
- * `maximum`: the maximum value for this type (if base type is scalar)
valid-adl?
(valid-adl? src)
Return `true` if `src` is syntactically valid ADL.
-
validate-adl
(validate-adl src)
validate-adl-file
(validate-adl-file filepath)
verb-validations
a verb is something that may be done through a form. Probably the verbs 'store'
-and 'delete' are implied, but maybe they need to be explicitly declared. The 'verb'
-attribute of the verb is what gets returned to the controller
-
-* `verb` what gets returned to the controller when this verb is selected
-* `dangerous` true if this verb causes a destructive change.
\ No newline at end of file
+adl.validator
Application Description Language: validator for ADL structure. TODO: this is at present largely a failed experiment.
+
auxlist-validations
a subsidiary list, on which entities related to primary entities in the enclosing page or list are listed
+
+property
: the property of the enclosing entity that this list displays (obviously, must be of type=‘list’)
+onselect
: the form or page of the listed entity to call when an item from the list is selected
+canadd
: true if the user should be able to add records to this list
+
+
cascade-actions
actions which should be cascaded to dependent objects. All these values except ‘manual’ are taken from Hibernate and should be passed through the adl2hibernate mapping transparently. Relevent only for properties with type=‘entity’, type=‘link’ and type=‘list’
+
+all
: cascade delete, save and update
+all-delete-orphan
: see hibernate documentation; relates to transient objects only
+delete
: cascade delete actions, but not save and update
+manual
: cascading will be handled in manually managed code, code to handle cascading should not be generated
+save-update
: cascade save and update actions, but not delete.
+
+
complex-data-types
data types which are more complex than SimpleDataTypes… * entity
: a foreign key link to another entity (i.e. the ‘many’ end of a one-to-many link); * list
: a list of some other entity that links to me (i.e. the ‘one’ end of a one-to-many link); * link
: a many to many link (via a link table); * defined
: a type defined by a typedef.
+
content
content, for things like pages (i.e. forms, lists, pages)
+
defineable-data-types
data types which can be used in a typedef to provide validation - e.g. a string can be used with a regexp or a scalar can be used with min and max values * string
: varchar java.sql.Types.VARCHAR * integer
: int java.sql.Types.INTEGER * real
: double java.sql.Types.DOUBLE * money
: money java.sql.Types.INTEGER * date
: date java.sql.Types.DATE * time
: time java.sql.Types.TIME * timestamp
: timestamp java.sql.Types.TIMESTAMP * uploadable
: varchar java.sql.Types.VARCHAR * image
: varchar java.sql.Types.VARCHAR
+
uploadable is as string but points to an uploaded file; image is as uploadable but points to an uploadable graphical image file.
+
disjunct-valid?
(disjunct-valid? o & validations)
Yes, this is a horrible hack. I should be returning the error structure not printing it. But I can’t see how to make that work with bouncer
. OK, so: most of the validators will (usually) fail, and that’s OK. How do we identify the one which ought not to have failed?
+
documentation-validations
contains documentation on the element which immediately contains it. For the time being, HTML markup is not permitted within documentation, but Markdown (which may include a string representation of HTML markup) should be.
+
entity-validations
an entity which has properties and relationships; maps onto a database table or a Java serialisable class - or, of course, various other things
+
+
field-validations
a field in a form or page
+
+property
: the property which this field displays/edits.
+
+
fieldgroup-validations
a group of fields and other controls within a form or list, which the renderer might render as a single pane in a tabbed display, for example.
+
generator-validations
marks a property which is auto-generated by some part of the system. This is based on the Hibernate construct, except that the Hibernate implementation folds both its internal generators and custom generators onto the same attribute. This separates them onto two attributes so we can police values for Hibernate’s ‘builtin’ generators.
+
+action
: one of the supported Hibernate builtin generators, or ‘manual’. ‘native’ is strongly recommended in most instances
+class
: if action is ‘manual’, the name of a manually maintained class conforming to the Hibernate IdentifierGenerator interface, or its equivalent in other languages.
+
+
group-validations
a group of people with similar permissions to one another
+
+name
: the name of this group
+parent
: the name of a group of which this group is subset
+
+
head-validations
content to place in the head of the generated document; normally HTML.
+
help-validations
helptext about a property of an entity, or a field of a page, form or list, or a typedef. Typically there will be only one of these per property per locale; if there are more than one all those matching the locale may be concatenated, or just one may be used.
+
+locale
: the locale in which to prefer this prompt
+
+
ifmissing-validations
helpful text to be shown if a property value is missing, typically when a form is submitted. Typically there will be only one of these per property per locale; if there are more than one all those matching the locale may be concatenated, or just one may be used. Later there may be more sophisticated behaviour here.
+
+locale
: the locale in which to prefer this prompt
+
+
in-implementation-validations
information about how to translate a type into types known to different target languages. TODO: Once again I’m not wholly comfortable with the name; I’m not really comfortable that this belongs in ADL at all.
+
+target
: the target language
+value
: the type to use in that target language
+kind
: OK, I confess I don’t understand this, but Andrew needs it…
+
+
list-validations
a list on which entities of a given type are listed
+
+onselect
: name of form/page/list to go to when a selection is made from the list
+
+
option-validations
one of an explicit list of optional values a property may have NOTE: whether options get encoded at application layer or at database layer is UNDEFINED; either behaviour is correct. If at database layer it’s also UNDEFINED whether they’re encoded as a single reference data table or as separate reference data tables for each property.
+
+value
: the value of this option.
+
+
order-validations
an ordering or records in a list * property
: the property on which to order * sequence
: the sequence in which to order
+
page-validations
a page on which an entity may be displayed
+
param-validations
A parameter passed to the generator. Again, based on the Hibernate implementation.
+
+name
: the name of this parameter.
+
+
permission-validations
permissions policy on an entity, a page, form, list or field
+
+group
: the group to which permission is granted
+permission
: the permission which is granted to that group
+
+
permissions
permissions a group may have on an entity, list, page, form or field permissions are deemed to increase as you go right. A group cannot have greater permission on a field than on the form it is in, or greater permission on form than the entity it belongs to
+
+none
: none
+read
: select
+insert
: insert
+noedit
: select, insert
+edit
: select, insert, update
+all
: select, insert, update, delete
+
+
pragma-validations
pragmatic advice to generators of lists and forms, in the form of name/value pairs which may contain anything. Over time some pragmas will become ‘well known’, but the whole point of having a pragma architecture is that it is extensible.
+
prompt-validations
a prompt for a property or field; used as the prompt text for a widget which edits it. Typically there will be only one of these per property per locale; if there are more than one all those matching the locale may be concatenated, or just one may be used.
+
+prompt
: the prompt to use
+locale
: the locale in which to prefer this prompt.
+
+
property-validations
a property (field) of an entity (table)
+
+name
: the name of this property.
+type
: the type of this property.
+default
: the default value of this property. There will probably be magic values of this!
+typedef
: name of the typedef to use, it type = ‘defined’.
+distinct
: distinct=‘system’ required that every value in the system will be distinct (i.e. natural primary key); distinct=‘user’ implies that the value may be used by users in distinguishing entities even if values are not formally unique; distinct=‘all’ implies that the values are formally unique /and/ are user friendly (NOTE: not implemented).
+entity
: if type=‘entity’, the name of the entity this property is a foreign key link to. if type=‘list’, the name of the entity that has a foreign key link to this entity
+farkey
: if type=‘list’, the name of farside key in the listed entity; if type=‘entity’ and the farside field to join to is not the farside primary key, then the name of that farside field
+required
: whether this propery is required (i.e. ‘not null’).
+immutable
: if true, once a value has been set it cannot be changed.
+size
: fieldwidth of the property if specified.
+concrete
: if set to ‘false’, this property is not stored in the database but must be computed (manually written code must be provided to support this)
+cascade
: what action(s) on the parent entity should be cascaded to entitie(s) linked on this property. Valid only if type=‘entity’, type=‘link’ or type=‘list’.
+column
: name of the column in a SQL database table in which this property is stored. TODO: Think about this.
+unsaved-value
: of a property whose persistent value is set on first being committed to persistent store, the value which it holds before it has been committed
+
+
reference-validations
The ‘specification’ and ‘reference’ elements are for documentation only, and do not contribute to the engineering of the application described.
+
A reference element is a reference to a specifying document.
+
+abbr
: The abbreviated name of the specification to which this reference refers
+section
: The ‘anchor part’ (part following a hash character) which, when appended to the URL, will locate the exact section referenced.
+entity
: A reference to another entity within this ADL document
+property
: A reference to another property within this ADL document; if entity is also specified then of that entity, else of the ancestor entity if any
+
+
simple-data-types
data types which are fairly straightforward translations of JDBC data types * boolean
: boolean java.sql.Types.BIT or char(1) java.sql.Types.CHAR * text
: text or java.sql.Types.LONGVARCHAR memo java.sql.Types.CLOB
+
special-data-types
data types which require special handling - which don’t simply map onto common SQL data types * geopos
: a latitude/longitude pair (experimental and not yet implemented) * image
: a raster image file, in jpeg, gif, or png format (experimental, not yet implemented) * message
: an internationalised message, having different translations for different locales
+
specification-validations
The ‘specification’ and ‘reference’ elements are for documentation only, and do not contribute to the engineering of the application described.
+
A specification element is intended chiefly to declare the reference documents which may be used in documentation elements later in the document.
+
+url
: The URL from which the document referenced can be retrieved
+name
: The full name (title) given to this document
+abbr
: A convenient abbreviated name.
+
+
top-validations
content to place in the top of the body of the generated document; this is any HTML block or inline level element.
+
try-validate
(try-validate o validation)
Pass this validation
and the object o
to bouncer
+
typedef-validations
the definition of a defined type. At this stage a defined type is either * a string in which case it must have size and pattern, or * a scalar in which case it must have minimum and/or maximum pattern must be a regular expression as interpreted by org.apache.regexp.RE minimum and maximum must be of appropriate format for the datatype specified. Validation may be done client-side and/or server-side at application layer and/or server side at database layer.
+
+name
: the name of this typedef
+type
: the simple type on which this defined type is based; must be present unless in-implementation children are supplied
+size
: the data size of this defined type
+pattern
: a regular expression which values for this type must match
+minimum
: the minimum value for this type (if base type is scalar)
+maximum
: the maximum value for this type (if base type is scalar)
+
+
valid-adl?
(valid-adl? src)
Return true
if src
is syntactically valid ADL.
+
validate-adl
(validate-adl src)
validate-adl-file
(validate-adl-file filepath)
verb-validations
a verb is something that may be done through a form. Probably the verbs ‘store’ and ‘delete’ are implied, but maybe they need to be explicitly declared. The ‘verb’ attribute of the verb is what gets returned to the controller
+
+verb
what gets returned to the controller when this verb is selected
+dangerous
true if this verb causes a destructive change.
+
+
\ No newline at end of file
diff --git a/docs/index.html b/docs/index.html
index 000ecec..276f9eb 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -1,6 +1,14 @@
-