Tony CHEMIT pushed to branch develop-9 at ultreiaio / ird-observe
Commits:
-
b2f727e2
by Tony Chemit at 2021-03-17T09:02:44+01:00
-
529f80e2
by Tony Chemit at 2021-03-17T09:02:44+01:00
12 changed files:
- client/datasource/editor/api-test/pom.xml
- client/datasource/editor/api-test/src/main/java/fr/ird/observe/client/datasource/editor/api/NavigationModelNodeTestSupport.java
- client/datasource/editor/common/src/test/java/fr/ird/observe/client/datasource/editor/content/CommonNavigationModelNodeTest.java
- client/datasource/editor/ll/src/test/java/fr/ird/observe/client/datasource/editor/ll/LlNavigationModelNodeTest.java
- client/datasource/editor/ps/src/test/java/fr/ird/observe/client/datasource/editor/ps/PsNavigationTreeNodeTest.java
- client/runner/src/test/java/fr/ird/observe/client/datasource/editor/content/AllNavigationModelNodeTest.java
- models/dto/definition/src/main/models/Observe/dto/06-referential-ps-localmarket.model
- models/dto/java/src/main/java/fr/ird/observe/spi/module/ObserveBusinessModule.java
- models/persistence/definition/src/main/models/Observe/persistence/03-referential-ps-observation.model
- models/persistence/definition/src/main/models/Observe/persistence/06-referential-ps-localmarket.model
- models/persistence/definition/src/main/models/Observe/persistence/class/entity.properties
- models/persistence/definition/src/main/models/Observe/persistence/package/entity.properties
Changes:
| ... | ... | @@ -42,12 +42,21 @@ |
| 42 | 42 |
<artifactId>client-datasource-editor-api</artifactId>
|
| 43 | 43 |
<version>${project.version}</version>
|
| 44 | 44 |
</dependency>
|
| 45 |
+ <dependency>
|
|
| 46 |
+ <groupId>${project.groupId}</groupId>
|
|
| 47 |
+ <artifactId>models-dto-java</artifactId>
|
|
| 48 |
+ <version>${project.version}</version>
|
|
| 49 |
+ </dependency>
|
|
| 45 | 50 |
<dependency>
|
| 46 | 51 |
<groupId>${project.groupId}</groupId>
|
| 47 | 52 |
<artifactId>test</artifactId>
|
| 48 | 53 |
<version>${project.version}</version>
|
| 49 | 54 |
<scope>test</scope>
|
| 50 | 55 |
</dependency>
|
| 56 |
+ <dependency>
|
|
| 57 |
+ <groupId>io.ultreia.java4all</groupId>
|
|
| 58 |
+ <artifactId>java-lang</artifactId>
|
|
| 59 |
+ </dependency>
|
|
| 51 | 60 |
|
| 52 | 61 |
<dependency>
|
| 53 | 62 |
<groupId>org.apache.logging.log4j</groupId>
|
| ... | ... | @@ -39,6 +39,8 @@ import fr.ird.observe.client.datasource.editor.api.navigation.tree.NavigationSco |
| 39 | 39 |
import fr.ird.observe.client.datasource.editor.api.navigation.tree.NavigationScopes;
|
| 40 | 40 |
import fr.ird.observe.dto.data.DataDto;
|
| 41 | 41 |
import fr.ird.observe.dto.reference.DataDtoReference;
|
| 42 |
+import fr.ird.observe.spi.module.ObserveBusinessModule;
|
|
| 43 |
+import io.ultreia.java4all.lang.Objects2;
|
|
| 42 | 44 |
import org.apache.logging.log4j.LogManager;
|
| 43 | 45 |
import org.apache.logging.log4j.Logger;
|
| 44 | 46 |
import org.junit.Assert;
|
| ... | ... | @@ -55,22 +57,23 @@ import java.util.Set; |
| 55 | 57 |
public abstract class NavigationModelNodeTestSupport {
|
| 56 | 58 |
private static final Logger log = LogManager.getLogger(NavigationModelNodeTestSupport.class);
|
| 57 | 59 |
|
| 58 |
- protected final int expectedNodeCount;
|
|
| 59 |
- protected final int expectedScopeCount;
|
|
| 60 |
- protected final int expectedScopeBuilderCount = 8;
|
|
| 60 |
+ protected final int expectedCount;
|
|
| 61 | 61 |
|
| 62 |
- protected NavigationModelNodeTestSupport(int expectedNodeCount) {
|
|
| 63 |
- this.expectedNodeCount = expectedNodeCount;
|
|
| 64 |
- this.expectedScopeCount = this.expectedNodeCount;
|
|
| 62 |
+ protected NavigationModelNodeTestSupport(ObserveBusinessModule... businessModule) {
|
|
| 63 |
+ int expectedCount = 1; // root node
|
|
| 64 |
+ for (ObserveBusinessModule module : businessModule) {
|
|
| 65 |
+ expectedCount += module.computeNodeCount();
|
|
| 66 |
+ }
|
|
| 67 |
+ this.expectedCount = expectedCount;
|
|
| 65 | 68 |
}
|
| 66 | 69 |
|
| 67 | 70 |
@Test
|
| 68 |
- public void loadNodes() throws IllegalAccessException, InstantiationException {
|
|
| 71 |
+ public void loadNodes() {
|
|
| 69 | 72 |
Set<Class<? extends NavigationNode>> nodeTypes = NavigationNodes.get().getNodes();
|
| 70 | 73 |
log.info(String.format("Load %d node(s).", nodeTypes.size()));
|
| 71 |
- Assert.assertEquals(expectedNodeCount, nodeTypes.size());
|
|
| 74 |
+ Assert.assertEquals(expectedCount, nodeTypes.size());
|
|
| 72 | 75 |
for (Class<? extends NavigationNode> nodeType : nodeTypes) {
|
| 73 |
- NavigationNode instance = nodeType.newInstance();
|
|
| 76 |
+ NavigationNode instance = Objects2.newInstance(nodeType);
|
|
| 74 | 77 |
Assert.assertNotNull(instance);
|
| 75 | 78 |
}
|
| 76 | 79 |
}
|
| ... | ... | @@ -79,7 +82,7 @@ public abstract class NavigationModelNodeTestSupport { |
| 79 | 82 |
public void loadScopes() {
|
| 80 | 83 |
ImmutableMap<Class<? extends NavigationNode>, NavigationScope> scopes = NavigationScopes.get().getScopes();
|
| 81 | 84 |
log.info(String.format("Load %d scopes(s).", scopes.size()));
|
| 82 |
- Assert.assertEquals(expectedScopeCount, scopes.size());
|
|
| 85 |
+ Assert.assertEquals(expectedCount, scopes.size());
|
|
| 83 | 86 |
}
|
| 84 | 87 |
|
| 85 | 88 |
protected void assertOpenableNode(ContentOpenableUINavigationNode node, Class<? extends DataDto> expectedDtoType, Class<? extends DataDtoReference> expectedReferenceType, Class<? extends ContentOpenableUI<?, ?>> expectedUiType) {
|
| ... | ... | @@ -105,8 +108,8 @@ public abstract class NavigationModelNodeTestSupport { |
| 105 | 108 |
Assert.assertEquals(node.getScope().getContentUiType(), expectedUiType);
|
| 106 | 109 |
}
|
| 107 | 110 |
|
| 108 |
- protected void assertTableNode(ContentTableUINavigationNode node, Class<? extends DataDto> expectedDtoDtpye, Class<? extends ContentTableUI<?, ?, ?>> expectedUiType) {
|
|
| 109 |
- Assert.assertEquals(node.getScope().getNodeDataType(), expectedDtoDtpye);
|
|
| 111 |
+ protected void assertTableNode(ContentTableUINavigationNode node, Class<? extends DataDto> expectedDtoType, Class<? extends ContentTableUI<?, ?, ?>> expectedUiType) {
|
|
| 112 |
+ Assert.assertEquals(node.getScope().getNodeDataType(), expectedDtoType);
|
|
| 110 | 113 |
Assert.assertEquals(node.getScope().getContentUiType(), expectedUiType);
|
| 111 | 114 |
}
|
| 112 | 115 |
}
|
| ... | ... | @@ -23,6 +23,7 @@ package fr.ird.observe.client.datasource.editor.content; |
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 | 25 |
import fr.ird.observe.client.datasource.editor.api.NavigationModelNodeTestSupport;
|
| 26 |
+import fr.ird.observe.spi.module.common.BusinessModule;
|
|
| 26 | 27 |
|
| 27 | 28 |
/**
|
| 28 | 29 |
* Created on 19/10/2020.
|
| ... | ... | @@ -33,7 +34,7 @@ import fr.ird.observe.client.datasource.editor.api.NavigationModelNodeTestSuppor |
| 33 | 34 |
public class CommonNavigationModelNodeTest extends NavigationModelNodeTestSupport {
|
| 34 | 35 |
|
| 35 | 36 |
public CommonNavigationModelNodeTest() {
|
| 36 |
- super(28 + 1);
|
|
| 37 |
+ super(BusinessModule.get());
|
|
| 37 | 38 |
}
|
| 38 | 39 |
|
| 39 | 40 |
}
|
| ... | ... | @@ -23,6 +23,7 @@ package fr.ird.observe.client.datasource.editor.ll; |
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 | 25 |
import fr.ird.observe.client.datasource.editor.api.NavigationModelNodeTestSupport;
|
| 26 |
+import fr.ird.observe.spi.module.ll.BusinessModule;
|
|
| 26 | 27 |
import org.junit.Test;
|
| 27 | 28 |
|
| 28 | 29 |
/**
|
| ... | ... | @@ -34,7 +35,7 @@ import org.junit.Test; |
| 34 | 35 |
public class LlNavigationModelNodeTest extends NavigationModelNodeTestSupport {
|
| 35 | 36 |
|
| 36 | 37 |
public LlNavigationModelNodeTest() {
|
| 37 |
- super(65 + 1);
|
|
| 38 |
+ super(BusinessModule.get());
|
|
| 38 | 39 |
}
|
| 39 | 40 |
|
| 40 | 41 |
@Test
|
| ... | ... | @@ -23,6 +23,7 @@ package fr.ird.observe.client.datasource.editor.ps; |
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 | 25 |
import fr.ird.observe.client.datasource.editor.api.NavigationModelNodeTestSupport;
|
| 26 |
+import fr.ird.observe.spi.module.ps.BusinessModule;
|
|
| 26 | 27 |
import org.junit.Test;
|
| 27 | 28 |
|
| 28 | 29 |
/**
|
| ... | ... | @@ -34,7 +35,7 @@ import org.junit.Test; |
| 34 | 35 |
public class PsNavigationTreeNodeTest extends NavigationModelNodeTestSupport {
|
| 35 | 36 |
|
| 36 | 37 |
public PsNavigationTreeNodeTest() {
|
| 37 |
- super(51 + 1);
|
|
| 38 |
+ super(BusinessModule.get());
|
|
| 38 | 39 |
}
|
| 39 | 40 |
|
| 40 | 41 |
@Test
|
| ... | ... | @@ -33,7 +33,11 @@ import fr.ird.observe.client.datasource.editor.api.NavigationModelNodeTestSuppor |
| 33 | 33 |
public class AllNavigationModelNodeTest extends NavigationModelNodeTestSupport {
|
| 34 | 34 |
|
| 35 | 35 |
public AllNavigationModelNodeTest() {
|
| 36 |
- super(1 + 28 + 51 + 65);
|
|
| 36 |
+ super(
|
|
| 37 |
+ fr.ird.observe.spi.module.common.BusinessModule.get(),
|
|
| 38 |
+ fr.ird.observe.spi.module.ps.BusinessModule.get(),
|
|
| 39 |
+ fr.ird.observe.spi.module.ll.BusinessModule.get()
|
|
| 40 |
+ );
|
|
| 37 | 41 |
}
|
| 38 | 42 |
|
| 39 | 43 |
}
|
| 1 |
-package fr.ird.observe.dto.referential.ps.localmarket | form=self packagePriority=7
|
|
| 1 |
+package fr.ird.observe.dto.referential.ps.localmarket
|
|
| 2 | 2 |
|
| 3 | 3 |
referential.ps.localmarket.BatchComposition > referential.I18nReferential
|
| 4 | 4 |
|
| 5 | 5 |
referential.ps.localmarket.BatchWeightType > referential.I18nReferential
|
| 6 | 6 |
|
| 7 |
-referential.ps.localmarket.Packaging > referential.I18nReferential >> WithStartEndDate | references=uri,code,label,batchComposition,batchWeightType,harbour,startDate,endDate
|
|
| 8 |
-batchComposition {*:1} fr.ird.observe.dto.referential.ps.localmarket.BatchCompositionReference | notNull
|
|
| 9 |
-batchWeightType {*:1} fr.ird.observe.dto.referential.ps.localmarket.BatchWeightTypeReference | notNull
|
|
| 7 |
+referential.ps.localmarket.Packaging > referential.I18nReferential >> WithStartEndDate
|
|
| 8 |
+batchComposition {*:1} fr.ird.observe.dto.referential.ps.localmarket.BatchCompositionReference
|
|
| 9 |
+batchWeightType {*:1} fr.ird.observe.dto.referential.ps.localmarket.BatchWeightTypeReference
|
|
| 10 | 10 |
startDate + {*:1} Date
|
| 11 | 11 |
endDate + {*:1} Date
|
| 12 | 12 |
meanWeight + {*:1} Float
|
| 13 |
-harbour {*:0..1} fr.ird.observe.dto.referential.common.HarbourReference | notNull
|
|
| \ No newline at end of file | ||
| 13 |
+harbour {*:0..1} fr.ird.observe.dto.referential.common.HarbourReference
|
|
| \ No newline at end of file |
| ... | ... | @@ -22,10 +22,16 @@ package fr.ird.observe.spi.module; |
| 22 | 22 |
* #L%
|
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 |
+import com.google.common.collect.ImmutableSet;
|
|
| 26 |
+import fr.ird.observe.dto.data.DataDto;
|
|
| 27 |
+import fr.ird.observe.dto.data.ll.observation.BranchlineDto;
|
|
| 28 |
+import fr.ird.observe.dto.referential.ReferentialDto;
|
|
| 25 | 29 |
import fr.ird.observe.dto.referential.common.GearType;
|
| 26 | 30 |
import fr.ird.observe.dto.referential.common.ProgramReference;
|
| 27 | 31 |
|
| 32 |
+import java.util.LinkedHashSet;
|
|
| 28 | 33 |
import java.util.Objects;
|
| 34 |
+import java.util.Set;
|
|
| 29 | 35 |
|
| 30 | 36 |
/**
|
| 31 | 37 |
* Created on 14/01/2021.
|
| ... | ... | @@ -46,4 +52,41 @@ public interface ObserveBusinessModule { |
| 46 | 52 |
default GearType getGearType() {
|
| 47 | 53 |
return null;
|
| 48 | 54 |
}
|
| 55 |
+ |
|
| 56 |
+ default int computeNodeCount() {
|
|
| 57 |
+ int expectedNodeCount = 0;
|
|
| 58 |
+ for (BusinessSubModule subModule : ((BusinessModule)this).getSubModules()) {
|
|
| 59 |
+ ImmutableSet<Class<? extends ReferentialDto>> referentialTypes = subModule.getReferentialTypes();
|
|
| 60 |
+ int tmp = expectedNodeCount;
|
|
| 61 |
+ int referentialSize = referentialTypes.size();
|
|
| 62 |
+ if (referentialSize > 0) {
|
|
| 63 |
+ expectedNodeCount += 1 + referentialSize; // home referential + one for each referential type
|
|
| 64 |
+ }
|
|
| 65 |
+ tmp = expectedNodeCount;
|
|
| 66 |
+ Set<Class<? extends DataDto>> dataTypes = new LinkedHashSet<>(subModule.getDataTypes());
|
|
| 67 |
+ |
|
| 68 |
+ dataTypes.removeAll(subModule.getOpenableDataTypes());
|
|
| 69 |
+ dataTypes.removeAll(subModule.getEditableDataTypes());
|
|
| 70 |
+ dataTypes.removeAll(subModule.getSimpleDataTypes());
|
|
| 71 |
+ dataTypes.removeAll(subModule.getContainerDataTypes());
|
|
| 72 |
+ |
|
| 73 |
+ dataTypes.removeIf(next -> !next.getSimpleName().endsWith("PartDto") && !next.getSimpleName().endsWith("CompositionDto"));
|
|
| 74 |
+ dataTypes.removeIf(next -> next.getSimpleName().endsWith("ObjectPartDto"));
|
|
| 75 |
+ int openableSize = subModule.getOpenableDataTypes().size();
|
|
| 76 |
+ int editableSize = subModule.getEditableDataTypes().size();
|
|
| 77 |
+ int simpleSize = subModule.getSimpleDataTypes().size();
|
|
| 78 |
+ int containerSize = subModule.getContainerDataTypes().size();
|
|
| 79 |
+ expectedNodeCount += 2 * openableSize; // list + open form
|
|
| 80 |
+ expectedNodeCount += editableSize; // edit form
|
|
| 81 |
+ expectedNodeCount += simpleSize; // simple form
|
|
| 82 |
+ expectedNodeCount += containerSize; // container form
|
|
| 83 |
+ expectedNodeCount += dataTypes.size(); // other forms
|
|
| 84 |
+ |
|
| 85 |
+ if (subModule.getSimpleDataTypes().contains(BranchlineDto.class)) {
|
|
| 86 |
+ // the only simple data without form (should FIX this : dto should not be simple, but just normal...)
|
|
| 87 |
+ expectedNodeCount--;
|
|
| 88 |
+ }
|
|
| 89 |
+ }
|
|
| 90 |
+ return expectedNodeCount;
|
|
| 91 |
+ }
|
|
| 49 | 92 |
}
|
| ... | ... | @@ -4,7 +4,7 @@ enum !fr.ird.observe.dto.data.ps.NonTargetCatchReleaseStatus |
| 4 | 4 |
|
| 5 | 5 |
referential.ps.observation.DetectionMode > referential.I18nReferentialEntity
|
| 6 | 6 |
|
| 7 |
-referential.ps.observation.InformationSource > referential.I18nReferentialEntity | entity
|
|
| 7 |
+referential.ps.observation.InformationSource > referential.I18nReferentialEntity
|
|
| 8 | 8 |
|
| 9 | 9 |
referential.ps.observation.NonTargetCatchReleaseConformity > referential.I18nReferentialEntity
|
| 10 | 10 |
|
| 1 |
-package fr.ird.observe.entities.referential.ps.localmarket | entity dbSchema=ps_localmarket
|
|
| 1 |
+package fr.ird.observe.entities.referential.ps.localmarket
|
|
| 2 | 2 |
|
| 3 |
-referential.ps.localmarket.BatchComposition > referential.I18nReferentialEntity | entity
|
|
| 3 |
+referential.ps.localmarket.BatchComposition > referential.I18nReferentialEntity
|
|
| 4 | 4 |
|
| 5 |
-referential.ps.localmarket.BatchWeightType > referential.I18nReferentialEntity | entity
|
|
| 5 |
+referential.ps.localmarket.BatchWeightType > referential.I18nReferentialEntity
|
|
| 6 | 6 |
|
| 7 |
-referential.ps.localmarket.Packaging > referential.I18nReferentialEntity >> fr.ird.observe.dto.WithStartEndDate | entity
|
|
| 7 |
+referential.ps.localmarket.Packaging > referential.I18nReferentialEntity >> fr.ird.observe.dto.WithStartEndDate
|
|
| 8 | 8 |
batchComposition {*:1} referential.ps.localmarket.BatchComposition
|
| 9 | 9 |
batchWeightType {*:1} referential.ps.localmarket.BatchWeightType
|
| 10 | 10 |
startDate + {*:1} Date
|
| 11 | 11 |
endDate + {*:1} Date
|
| 12 |
-meanWeight + {*:1} Float | sqlType=numeric digits=4
|
|
| 12 |
+meanWeight + {*:1} Float
|
|
| 13 | 13 |
harbour {*:0..1} referential.common.Harbour
|
| 14 | 14 |
acceptHarbour(harbour referential.common.Harbour) boolean
|
| \ No newline at end of file |
| ... | ... | @@ -22,13 +22,3 @@ |
| 22 | 22 |
Entity=true
|
| 23 | 23 |
LastUpdateDate=true
|
| 24 | 24 |
data.DataEntity=true
|
| 25 |
-referential.ps.landing.Fate=true
|
|
| 26 |
-referential.ps.landing.WeightCategory=true
|
|
| 27 |
-referential.ps.localmarket.BatchComposition=true
|
|
| 28 |
-referential.ps.localmarket.BatchWeightType=true
|
|
| 29 |
-referential.ps.localmarket.Packaging=true
|
|
| 30 |
-referential.ps.logbook.SampleQuality=true
|
|
| 31 |
-referential.ps.logbook.SampleType=true
|
|
| 32 |
-referential.ps.logbook.WeightCategory=true
|
|
| 33 |
-referential.ps.logbook.WellsState=true
|
|
| 34 |
-referential.ps.observation.InformationSource=true
|
| ... | ... | @@ -22,5 +22,3 @@ |
| 22 | 22 |
data.ll=true
|
| 23 | 23 |
data.ps=true
|
| 24 | 24 |
referential=true
|
| 25 |
-referential.ps.landing=true
|
|
| 26 |
-referential.ps.localmarket=true
|