Skip to content

Commit

Permalink
Merge pull request #25 from laurentC35/master
Browse files Browse the repository at this point in the history
Change the model (switch content of variables and responses object)
  • Loading branch information
laurentC35 authored Jun 2, 2020
2 parents ea55ade + 41ec19b commit 5bc7e91
Show file tree
Hide file tree
Showing 20 changed files with 8,372 additions and 25,392 deletions.
14 changes: 4 additions & 10 deletions docs/fr/components/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Tous les composants (excepté Sequence et Subsequence) ont au moins ces attribut
"label":"label",
"declarations":[...],
"conditionFilter":"...",
"bindingsDependency": true/false,
"mandatory":true
}
```
Expand All @@ -47,6 +48,7 @@ Tous les composants (excepté Sequence et Subsequence) ont au moins ces attribut
- `label` : label de la question associée au composant
- `declarations` : liste des déclarations éventuelles associées au composant.
- `conditionFilter` : filtre écrit dans le langage VTL pour savoir s'il faut afficher ou non le questionnaire.
- `bindingsDependency` : boolean : true si le composant (ses labels, filtres, declarations) est dépendant de variables (autre que celles qui collecte lui-même)
- `mandatory` : booléen qui définit si la réponse est obligatoire ou non

---
Expand Down Expand Up @@ -86,16 +88,8 @@ Les composants qui ont pour but de collecter des réponses ont un attribut "resp
```json
"response" :
{
"name" : "idVariable",
"valueState" :
[
{ "valueType" : "PREVIOUS", "value" : null },
{ "valueType" : "COLLECTED", "value" : null },
{ "valueType" : "FORCED", "value" : null },
{ "valueType" : "EDITED", "value" : null },
{ "valueType" : "INPUTED", "value" : null },
]
"name" : "idVariable"
}
```

L'attribut `name` faisant référence à l'attribut `responseRef` d'une variable dans le tableau `variables` en fin de questionnaire.
L'attribut `name` faisant référence à l'attribut `name` d'une variable dans le tableau `variables` en fin de questionnaire.
12 changes: 10 additions & 2 deletions docs/fr/components/Variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,16 @@ Strucure du tableau `variables` :
{
"variableType": "COLLECTED",
"name": "FAVOURITE_CHARACTERS",
"responseRef": "FAVOURITE_CHARACTERS"
},
"componentRef": "FAVOURITE_CHARACTERS_COMPONENT",
"valueState" :
[
{ "valueType" : "PREVIOUS", "value" : null },
{ "valueType" : "COLLECTED", "value" : null },
{ "valueType" : "FORCED", "value" : null },
{ "valueType" : "EDITED", "value" : null },
{ "valueType" : "INPUTED", "value" : null }
]
},
{
"variableType": "CALCULATED",
"name": "SUM_EXPENSES",
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<groupId>fr.insee.lunatic</groupId>
<artifactId>lunatic-model</artifactId>
<packaging>jar</packaging>
<version>1.0.2</version>
<version>2.0.0-rc</version>
<name>Lunatic Model</name>
<description>Classes and converters for the Lunatic model</description>
<url>http://www.insee.fr</url>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/fr/insee/lunatic/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ private Constants() {
public static final String TEMP_FOLDER_PATH = System.getProperty("java.io.tmpdir")+"/"+"lunatic-test";
public static final Path TEMP_FOLDER= getTempDir(TEMP_FOLDER_PATH);
public static final String RESOURCES_FOLDER_PATH = "src/test/resources/examples";
public static final String RESOURCES_FOLDER_JSONF_2_XMLF_PATH = RESOURCES_FOLDER_PATH +"/jsonf-2-xmlf";
public static final String RESOURCES_FOLDER_DUMMY_PATH = "src/test/resources/dummy";
public static final String RESOURCES_FOLDER_XMLF_2_JSONF_PATH = RESOURCES_FOLDER_PATH +"/xmlf-2-jsonf";
public static final String RESOURCES_FOLDER_XMLH_2_XMLF_PATH = RESOURCES_FOLDER_PATH +"/xmlh-2-xmlf";
public static final String RESOURCES_FOLDER_XMLH_2_JSONF_PATH = RESOURCES_FOLDER_PATH +"/xmlh-2-jsonf";
Expand Down
99 changes: 22 additions & 77 deletions src/main/resources/xsd/LunaticModel.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@
<xs:element name="label" type="xs:string"/>
</xs:sequence>
</xs:complexType>

<xs:complexType name="VariableType">
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="responseRef" type="xs:string" minOccurs="0"/>
<xs:element name="componentRef" type="xs:string" minOccurs="0"/>
<xs:element name="value" type="xs:string" nillable="true" minOccurs="0"/>
<xs:element name="expression" type="xs:string" minOccurs="0"/>
<xs:element name="values" type="ValuesType" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
<xs:attribute name="variableType" type="VariableTypeEnum"/>
</xs:complexType>
Expand Down Expand Up @@ -71,6 +72,7 @@
<xs:element name="declarations" type="DeclarationType" minOccurs="0" maxOccurs="unbounded"/>
<!-- Warning : To validate the name -->
<xs:element name="conditionFilter" type="xs:string" minOccurs="0"/>
<xs:element name="bindingsDependency" type="xs:boolean" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="id" type="xs:ID" use="required"/>
<xs:attribute name="componentType" type="ComponentTypeEnum"/>
Expand All @@ -95,77 +97,20 @@
</xs:restriction>
</xs:simpleType>

<xs:complexType name="ReponseContainerInterface" abstract="true"/>

<xs:complexType name="ResponseContainerString">
<xs:complexContent>
<xs:extension base="ReponseContainerInterface">
<xs:sequence>
<xs:element name="valueState" type="ResponseTypeString" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="name" type="xs:string"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>

<xs:complexType name="ResponseContainerInt">
<xs:complexContent>
<xs:extension base="ReponseContainerInterface">
<xs:sequence>
<xs:element name="valueState" type="ResponseTypeInt" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="name" type="xs:string"/>
</xs:extension>
</xs:complexContent>
<xs:complexType name="ResponseType">
<xs:attribute name="name" type="xs:string"/>
</xs:complexType>

<xs:complexType name="ResponseContainerBoolean">
<xs:complexContent>
<xs:extension base="ReponseContainerInterface">
<xs:sequence>
<xs:element name="valueState" type="ResponseTypeBoolean" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="name" type="xs:string"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>

<xs:complexType name="ResponseTypeBoolean">
<xs:complexType name="ValuesType">
<xs:sequence>
<xs:element name="value" type="xs:boolean" nillable="true"/>
<xs:element name="responseComment" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="PREVIOUS" type="xs:string" nillable="true"/>
<xs:element name="COLLECTED" type="xs:string" nillable="true"/>
<xs:element name="FORCED" type="xs:string" nillable="true"/>
<xs:element name="EDITED" type="xs:string" nillable="true"/>
<xs:element name="INPUTED" type="xs:string" nillable="true"/>
</xs:sequence>
<xs:attribute name="valueType" type="ResponseTypeEnum"/>
</xs:complexType>

<xs:complexType name="ResponseTypeInt">
<xs:sequence>
<xs:element name="value" type="xs:integer" nillable="true"/>
<xs:element name="responseComment" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="valueType" type="ResponseTypeEnum"/>
</xs:complexType>

<xs:complexType name="ResponseTypeString">
<xs:sequence>
<xs:element name="value" type="xs:string" nillable="true"/>
<xs:element name="responseComment" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="valueType" type="ResponseTypeEnum"/>
</xs:complexType>

<xs:simpleType name="ResponseTypeEnum">
<xs:restriction base="xs:token">
<xs:enumeration value="PREVIOUS"/>
<xs:enumeration value="COLLECTED"/>
<!-- FORCED: automatic correction -->
<xs:enumeration value="FORCED"/>
<!-- EDITED: value edited by an expert -->
<xs:enumeration value="EDITED"/>
<xs:enumeration value="INPUTED"/>
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="VariableTypeEnum">
<xs:restriction base="xs:token">
<xs:enumeration value="EXTERNAL"/>
Expand All @@ -178,7 +123,7 @@
<xs:complexContent>
<xs:extension base="ComponentType">
<xs:sequence>
<xs:element name="response" type="ResponseContainerString"/>
<xs:element name="response" type="ResponseType"/>
</xs:sequence>
<xs:attribute name="maxLength" type="xs:integer"/>
</xs:extension>
Expand All @@ -189,7 +134,7 @@
<xs:complexContent>
<xs:extension base="ComponentType">
<xs:sequence>
<xs:element name="response" type="ResponseContainerString"/>
<xs:element name="response" type="ResponseType"/>
</xs:sequence>
<xs:attribute name="maxLength" type="xs:integer"/>
</xs:extension>
Expand All @@ -201,7 +146,7 @@
<xs:extension base="ComponentType">
<xs:sequence>
<xs:element name="unit" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="response" type="ResponseContainerString"/>
<xs:element name="response" type="ResponseType"/>
</xs:sequence>
<xs:attribute name="min" type="xs:double" use="optional"/>
<xs:attribute name="max" type="xs:double" use="optional"/>
Expand All @@ -215,7 +160,7 @@
<xs:extension base="ComponentType">
<xs:sequence>
<xs:element name="dateFormat" type="xs:string" />
<xs:element name="response" type="ResponseContainerString"/>
<xs:element name="response" type="ResponseType"/>
</xs:sequence>
<xs:attribute name="min" type="xs:string" use="optional"/>
<xs:attribute name="max" type="xs:string" use="optional"/>
Expand All @@ -227,7 +172,7 @@
<xs:complexContent>
<xs:extension base="ComponentType">
<xs:sequence>
<xs:element name="response" type="ResponseContainerBoolean"/>
<xs:element name="response" type="ResponseType"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
Expand All @@ -238,7 +183,7 @@
<xs:extension base="ComponentType">
<xs:sequence>
<xs:element name="options" type="Options" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="response" type="ResponseContainerString"/>
<xs:element name="response" type="ResponseType"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
Expand All @@ -249,7 +194,7 @@
<xs:extension base="ComponentType">
<xs:sequence>
<xs:element name="options" type="Options" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="response" type="ResponseContainerString"/>
<xs:element name="response" type="ResponseType"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
Expand All @@ -260,7 +205,7 @@
<xs:extension base="ComponentType">
<xs:sequence>
<xs:element name="options" type="Options" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="response" type="ResponseContainerString"/>
<xs:element name="response" type="ResponseType"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
Expand Down Expand Up @@ -310,7 +255,7 @@
<xs:element name="dateFormat" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="unit" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="options" type="Options" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="response" type="ReponseContainerInterface" minOccurs="0" maxOccurs="1"/>
<xs:element name="response" type="ResponseType" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
<xs:attribute name="componentType" type="xs:string" use="optional"/>
<xs:attribute name="maxLength" type="xs:integer" use="optional"/>
Expand All @@ -331,7 +276,7 @@
<xs:complexType name="ResponsesCheckboxGroup">
<xs:sequence>
<xs:element name="label" type="xs:string"/>
<xs:element name="response" type="ResponseContainerBoolean"/>
<xs:element name="response" type="ResponseType"/>
</xs:sequence>
<xs:attribute name="id" type="xs:ID" use="required"/>
</xs:complexType>
Expand Down
Loading

0 comments on commit 5bc7e91

Please sign in to comment.