Skip to content

Commit 2101d87

Browse files
authored
Mica without Opal (#4393)
* #4376 WIP. StudyTableSource interface added. New property sourceURN replaces opal project/table in dataset's study tables and variables. Requires ES index config update. * sourceURN property/getter/setter renamed to source * source package added, with unit tests * Excel table source added, reads excel from Mica's file system * Edit/create study tables with opal or file source. WIP. * File path can be copied. Study table's file source can be relative to the dataset's folder * Study table context added. Opal dtos (aggregations) are not exposed in the source plugin interface. * Deferred init of excel datasource. Less verbose log messages when study table source operation is not supported * SPI mica-source testing * Deferred attachment stream extraction * Handle disposable table sources * Mica source plugin could be an Initialisable * #4381 Variable taxonomies service added to support other taxonomies providers, in addition to the opal one * mica-source plugin type renamed to mica-tables. Ne plugin type: mica-taxonomies for loading taxonomies provider services. * Taxonomy of taxonomies is configurable. Added attribute to have a taxonomy declared but not visible. * Variable taxonomies can be read from local folder: MICA_HOME/conf/taxonomies/variable * AbstractTaxonomiesProviderService added * Caching of taxonomies refactored, not functional yet * Variable taxonomies are cached * Fix dataset taxonomy init * Opal taxonomies cache replaced by generic variable taxonomies cache. Variable taxonomies are decorated with variable attributes * Code cleaning: Opal service helper merged into opal service * classifications administration * make sure variable taxo title/description in the meta taxo matches the one of the original taxo * hide instead of remove a target vocabulary if type is disabled * Plugins REST API added * Plugin REST API added * Service Plugin REST API added * Update the search plugin in the upgrade procedure * ng-obiba-mica version * No server error when opal projects cannot be retrieved * Fix some wording and showVariableStatistics template setting added * Fix some wording and showVariableStatistics template setting added * Fix harmonized variable id encoding for url * Fix harmonized variable id encoding for url for reverse proxy * NoSuchTableSourceException added with their web service mapper * ng-obiba-mica latest release * prepare for upgrade to 5.2 * StudyTableSource does not need to return the table name, this is implementation specific * Modifying the meta txonomy requires admin role * Plugin management requires admin role * Clean Opal projects web services * Helper class to read a taxonomy in YAML format from a stream * Other study table source handled in the admin
1 parent 6ea5af8 commit 2101d87

File tree

150 files changed

+4633
-2587
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

150 files changed

+4633
-2587
lines changed

mica-core/pom.xml

+4
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@
3434
<groupId>org.obiba.mica</groupId>
3535
<artifactId>mica-web-model</artifactId>
3636
</dependency>
37+
<dependency>
38+
<groupId>org.obiba.magma</groupId>
39+
<artifactId>magma-datasource-excel</artifactId>
40+
</dependency>
3741
<dependency>
3842
<groupId>com.codahale.metrics</groupId>
3943
<artifactId>metrics-core</artifactId>

mica-core/src/main/java/org/obiba/mica/access/service/DataAccessEntityService.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
import org.obiba.mica.core.service.MailService;
4848
import org.obiba.mica.core.service.SchemaFormContentFileService;
4949
import org.obiba.mica.core.support.IdentifierGenerator;
50-
import org.obiba.mica.core.support.YamlClassPathResourceReader;
50+
import org.obiba.mica.core.support.YamlResourceReader;
5151
import org.obiba.mica.dataset.service.VariableSetService;
5252
import org.obiba.mica.micaConfig.domain.DataAccessConfig;
5353
import org.obiba.mica.micaConfig.service.DataAccessConfigService;
@@ -396,7 +396,7 @@ protected void setAndLogStatus(T request, DataAccessEntityStatus to) {
396396
protected String generateId() {
397397
DataAccessConfig dataAccessConfig = dataAccessConfigService.getOrCreateConfig();
398398

399-
Object exclusions = YamlClassPathResourceReader.read(EXCLUSION_IDS_YAML_RESOURCE_PATH, Map.class).get("exclusions");
399+
Object exclusions = YamlResourceReader.readClassPath(EXCLUSION_IDS_YAML_RESOURCE_PATH, Map.class).get("exclusions");
400400

401401
IdentifierGenerator.Builder builder = IdentifierGenerator.newBuilder().prefix(dataAccessConfig.getIdPrefix())
402402
.size(dataAccessConfig.getIdLength());

mica-core/src/main/java/org/obiba/mica/config/UpgradeConfiguration.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
import org.obiba.mica.core.upgrade.Mica460Upgrade;
1818
import org.obiba.mica.core.upgrade.Mica500Upgrade;
19-
import org.obiba.mica.core.upgrade.Mica510upgrade;
19+
import org.obiba.mica.core.upgrade.Mica520upgrade;
2020
import org.obiba.mica.core.upgrade.MicaVersionModifier;
2121
import org.obiba.mica.core.upgrade.RuntimeVersionProvider;
2222
import org.obiba.runtime.upgrade.UpgradeManager;
@@ -31,8 +31,8 @@ public class UpgradeConfiguration {
3131

3232
private List<UpgradeStep> upgradeSteps;
3333

34-
public UpgradeConfiguration(Mica460Upgrade mica460Upgrade, Mica500Upgrade mica500Upgrade, Mica510upgrade mica510upgrade) {
35-
upgradeSteps = Arrays.asList(mica460Upgrade, mica500Upgrade, mica510upgrade);
34+
public UpgradeConfiguration(Mica460Upgrade mica460Upgrade, Mica500Upgrade mica500Upgrade, Mica520upgrade mica520upgrade) {
35+
upgradeSteps = Arrays.asList(mica460Upgrade, mica500Upgrade, mica520upgrade);
3636
}
3737

3838
@Bean

mica-core/src/main/java/org/obiba/mica/core/domain/BaseStudyTable.java

+75-7
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,32 @@
1212

1313
import com.google.common.base.MoreObjects;
1414
import com.google.common.base.Strings;
15+
import org.obiba.mica.core.source.OpalTableSource;
1516

16-
import java.io.Serializable;
17-
18-
public class BaseStudyTable extends OpalTable {
17+
public class BaseStudyTable {
1918

2019
protected String studyId;
2120

2221
protected String populationId;
2322

2423
protected int populationWeight;
2524

25+
private LocalizedString name;
26+
27+
private LocalizedString description;
28+
29+
private LocalizedString additionalInformation;
30+
31+
private int weight;
32+
33+
private String source;
34+
35+
// legacy
36+
private String project;
37+
38+
// legacy
39+
private String table;
40+
2641
public String getStudyId() {
2742
return studyId;
2843
}
@@ -72,13 +87,66 @@ public void setPopulationWeight(int populationWeight) {
7287

7388
@Override
7489
public String toString() {
75-
return MoreObjects.toStringHelper(this).add("project", getProject()).add("table", getTable())
90+
return MoreObjects.toStringHelper(this).add("source", getSource())
7691
.add("studyId", getStudyId()).add("populationId", getPopulationId())
7792
.toString();
7893
}
7994

80-
@Override
81-
protected String getEntityId() {
82-
return studyId;
95+
public void setName(LocalizedString name) {
96+
this.name = name;
97+
}
98+
99+
public LocalizedString getName() {
100+
return name;
101+
}
102+
103+
public void setDescription(LocalizedString description) {
104+
this.description = description;
105+
}
106+
107+
public LocalizedString getDescription() {
108+
return description;
109+
}
110+
111+
public LocalizedString getAdditionalInformation() {
112+
return additionalInformation;
113+
}
114+
115+
public void setAdditionalInformation(LocalizedString additionalInformation) {
116+
this.additionalInformation = additionalInformation;
117+
}
118+
119+
public int getWeight() {
120+
return weight;
121+
}
122+
123+
public void setWeight(int weight) {
124+
this.weight = weight;
125+
}
126+
127+
public boolean isFor(String studyId, String source) {
128+
return this.studyId.equals(studyId) && getSource().equals(source);
129+
}
130+
131+
public void setSource(String source) {
132+
this.source = source;
133+
}
134+
135+
public String getSource() {
136+
// legacy
137+
if (Strings.isNullOrEmpty(source)) {
138+
this.source = OpalTableSource.newSource(project, table).getURN();
139+
}
140+
return source;
141+
}
142+
143+
@Deprecated
144+
public void setProject(String project) {
145+
this.project = project;
146+
}
147+
148+
@Deprecated
149+
public void setTable(String table) {
150+
this.table = table;
83151
}
84152
}

mica-core/src/main/java/org/obiba/mica/core/domain/OpalTable.java

-88
This file was deleted.

mica-core/src/main/java/org/obiba/mica/core/domain/StudyTable.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010

1111
package org.obiba.mica.core.domain;
1212

13-
import java.io.Serializable;
14-
1513
import com.google.common.base.MoreObjects;
1614

15+
import java.io.Serializable;
16+
1717
/**
1818
* Represents a opal table that is associated to a {@link org.obiba.mica.study.domain.Study}
1919
* {@link org.obiba.mica.study.domain.Population} {@link org.obiba.mica.study.domain.DataCollectionEvent}.
@@ -63,7 +63,7 @@ public boolean appliesTo(String studyId, String populationId, String dataCollect
6363

6464
@Override
6565
public String toString() {
66-
return MoreObjects.toStringHelper(this).add("project", getProject()).add("table", getTable())
66+
return MoreObjects.toStringHelper(this).add("source", getSource())
6767
.add("dceId", getDataCollectionEventUId()).toString();
6868
}
6969

0 commit comments

Comments
 (0)