From 9cc8d1119603314d2877cf691d16f40ad262d745 Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Mon, 27 Feb 2023 15:05:52 +0100 Subject: [PATCH] Fixed documentation generation --- is-model.rst | 164 ++++++++++++++++-- .../generator/ModelKnowledgeGenerator.java | 19 +- 2 files changed, 166 insertions(+), 17 deletions(-) diff --git a/is-model.rst b/is-model.rst index 394cf43..dfb6e9d 100644 --- a/is-model.rst +++ b/is-model.rst @@ -2,23 +2,19 @@ Property ======== - -Encrypted ---------- - -This type is used to properly manage encrypted values across contexts. +This is the base type for any Property -.. table:: **Encrypted** ``extends`` **Property** +.. table:: **Property** - +-------+--------+--------------------------------------------------------+----------------------------------------+ - | Name | Type | Attributes | Description | - +=======+========+========================================================+========================================+ - | value | String | ``Mandatory:true`` ``ReadOnly:false`` ``NotNull:true`` | The value to store encrypted in the IS | - +-------+--------+--------------------------------------------------------+----------------------------------------+ + +------------------------------------------------------+------+------------+-------------+ + | Name | Type | Attributes | Description | + +======================================================+======+============+=============+ + | This type does not define any additional attributes. | + +------------------------------------------------------+------+------------+-------------+ -The **Encrypted** current version is 1.0.0. +The **Property** current version is 1.0.0. Changelog: @@ -82,6 +78,28 @@ Changelog: * **1.0.0**: First Version; +Vault +----- + +This type is used to properly manage values must be stored safely (e.g. encrypted) in the IS. + + +.. table:: **Vault** ``extends`` **Property** + + +-------+--------+--------------------------------------------------------+-------------------------------------+ + | Name | Type | Attributes | Description | + +=======+========+========================================================+=====================================+ + | value | String | ``Mandatory:true`` ``ReadOnly:false`` ``NotNull:true`` | The value to store safely in the IS | + +-------+--------+--------------------------------------------------------+-------------------------------------+ + + +The **Vault** current version is 1.0.0. + +Changelog: + +* **1.0.0**: First Version. + + Entity ====== @@ -107,11 +125,61 @@ Changelog: Resource -======== +-------- + +This is the base type for any Resource + + +.. table:: **Resource** ``extends`` **Entity** + + +-------------------------------------------------------+----------+--------------+--------+-------------+ + | Source | Relation | Multiplicity | Target | Description | + +=======================================================+==========+==============+========+=============+ + | **Facets** | + +-------------------------------------------------------+----------+--------------+--------+-------------+ + | No specific facets usage defined for this type. | + +-------------------------------------------------------+----------+--------------+--------+-------------+ + | **Resource Relations** | + +-------------------------------------------------------+----------+--------------+--------+-------------+ + | No specific Resource relations defined for this type. | + +-------------------------------------------------------+----------+--------------+--------+-------------+ + + +The **Resource** current version is 1.0.0. + +Changelog: + +* **1.0.0**: First Version. Facet -===== +----- + +This is the base type for any Facet + + +.. table:: **Facet** ``extends`` **Entity** + + +------------------------------------------------------+--------------+------------------+-----------------+-----------------+ + | Properties | + +======================================================+==============+==================+=================+=================+ + | **Name** | **Type** | **Attributes** | **Description** | + +------------------------------------------------------+--------------+------------------+-----------------+-----------------+ + | This type does not define any additional attributes. | + +------------------------------------------------------+--------------+------------------+-----------------+-----------------+ + | **Known Usage** | + +------------------------------------------------------+--------------+------------------+-----------------+-----------------+ + | **Source** | **Relation** | **Multiplicity** | **Target** | **Description** | + +------------------------------------------------------+--------------+------------------+-----------------+-----------------+ + | No specific known usage for this type. | + +------------------------------------------------------+--------------+------------------+-----------------+-----------------+ + + +The **Facet** current version is 1.0.0. + +Changelog: + +* **1.0.0**: First Version. Relation @@ -145,9 +213,73 @@ Changelog: IsRelatedTo -=========== +----------- + +This is the base type for any IsRelatedTo relation + + +.. table:: **IsRelatedTo** ``extends`` **Relation** + + +------------------------------------------------------+--------------+------------------+-----------------+----------------------------------------------------+ + | **Definition** | + +======================================================+==============+==================+=================+====================================================+ + | **Source** | **Relation** | **Multiplicity** | **Target** | **Description** | + +------------------------------------------------------+--------------+------------------+-----------------+----------------------------------------------------+ + | Resource | IsRelatedTo | 0..n | Resource | This is the base type for any IsRelatedTo relation | + +------------------------------------------------------+--------------+------------------+-----------------+----------------------------------------------------+ + | **Properties** | + +------------------------------------------------------+--------------+------------------+-----------------+----------------------------------------------------+ + | **Name** | **Type** | **Attributes** | **Description** | + +------------------------------------------------------+--------------+------------------+-----------------+----------------------------------------------------+ + | This type does not define any additional attributes. | + +------------------------------------------------------+--------------+------------------+-----------------+----------------------------------------------------+ + | **Known Usage** | + +------------------------------------------------------+--------------+------------------+-----------------+----------------------------------------------------+ + | **Source** | **Relation** | **Multiplicity** | **Target** | **Description** | + +------------------------------------------------------+--------------+------------------+-----------------+----------------------------------------------------+ + | No specific known usage for this type. | + +------------------------------------------------------+--------------+------------------+-----------------+----------------------------------------------------+ + + +The **IsRelatedTo** current version is 1.0.0. + +Changelog: + +* **1.0.0**: First Version. ConsistsOf -========== +---------- + +This is the base type for any ConsistsOf relation + + +.. table:: **ConsistsOf** ``extends`` **Relation** + + +------------------------------------------------------+--------------+------------------+-----------------+---------------------------------------------------+ + | **Definition** | + +======================================================+==============+==================+=================+===================================================+ + | **Source** | **Relation** | **Multiplicity** | **Target** | **Description** | + +------------------------------------------------------+--------------+------------------+-----------------+---------------------------------------------------+ + | Resource | ConsistsOf | 0..n | Facet | This is the base type for any ConsistsOf relation | + +------------------------------------------------------+--------------+------------------+-----------------+---------------------------------------------------+ + | **Properties** | + +------------------------------------------------------+--------------+------------------+-----------------+---------------------------------------------------+ + | **Name** | **Type** | **Attributes** | **Description** | + +------------------------------------------------------+--------------+------------------+-----------------+---------------------------------------------------+ + | This type does not define any additional attributes. | + +------------------------------------------------------+--------------+------------------+-----------------+---------------------------------------------------+ + | **Known Usage** | + +------------------------------------------------------+--------------+------------------+-----------------+---------------------------------------------------+ + | **Source** | **Relation** | **Multiplicity** | **Target** | **Description** | + +------------------------------------------------------+--------------+------------------+-----------------+---------------------------------------------------+ + | No specific known usage for this type. | + +------------------------------------------------------+--------------+------------------+-----------------+---------------------------------------------------+ + + +The **ConsistsOf** current version is 1.0.0. + +Changelog: + +* **1.0.0**: First Version. diff --git a/src/main/java/org/gcube/informationsystem/utils/documentation/generator/ModelKnowledgeGenerator.java b/src/main/java/org/gcube/informationsystem/utils/documentation/generator/ModelKnowledgeGenerator.java index f70f5a9..b55e71e 100644 --- a/src/main/java/org/gcube/informationsystem/utils/documentation/generator/ModelKnowledgeGenerator.java +++ b/src/main/java/org/gcube/informationsystem/utils/documentation/generator/ModelKnowledgeGenerator.java @@ -8,6 +8,10 @@ import org.gcube.informationsystem.base.reference.Element; import org.gcube.informationsystem.discovery.ISModelRegistrationProvider; import org.gcube.informationsystem.discovery.RegistrationProvider; import org.gcube.informationsystem.discovery.knowledge.Knowledge; +import org.gcube.informationsystem.model.reference.entities.Facet; +import org.gcube.informationsystem.model.reference.entities.Resource; +import org.gcube.informationsystem.model.reference.relations.ConsistsOf; +import org.gcube.informationsystem.model.reference.relations.IsRelatedTo; import org.gcube.informationsystem.tree.Node; import org.gcube.informationsystem.tree.NodeElaborator; import org.gcube.informationsystem.tree.Tree; @@ -67,13 +71,26 @@ public class ModelKnowledgeGenerator extends DocumentationGenerator { return; } Type type = TypeMapper.createTypeDefinition(clz); - if(level==0) { + if(level==0 && !(rp instanceof ISModelRegistrationProvider)) { /* * Root node has been already documented in IS_MODEL_FILENAME * Going to skip it */ writeSectionOnly(type, file, level); } else { + if(rp instanceof ISModelRegistrationProvider) { + switch (type.getName()) { + case Resource.NAME: + case Facet.NAME: + case IsRelatedTo.NAME: + case ConsistsOf.NAME: + level++; + break; + + default: + break; + } + } writeTypeToFile(type, file, level); }