Skip to content

Commit

Permalink
Merge pull request #52 from thehyve/issue-274
Browse files Browse the repository at this point in the history
hiding tables - Issue 274
  • Loading branch information
EIjo authored Aug 27, 2024
2 parents 93642d7 + e7f844b commit 55bc9c0
Show file tree
Hide file tree
Showing 9 changed files with 519 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,20 @@ public enum CDMVersion {
private String dbName = "";
private static final String CONCEPT_ID_HINTS_FILE_NAME = "CDMConceptIDHints.csv";
public String conceptIdHintsVocabularyVersion;
private List<Integer> selectedIndices;

public List<Table> getTables() {
if(selectedIndices != null){
List<Table> maskedTables = new ArrayList<>();
for (Integer selectedIndex : selectedIndices) {
maskedTables.add(tables.get(selectedIndex));
}
return maskedTables;
}
return tables;
}

public List<Table> getUnmaskedTables() {
return tables;
}

Expand All @@ -79,6 +91,20 @@ public String getDbName() {
return dbName;
}

public void setSelectedIndices(List<Integer> tableMask) {
this.selectedIndices = tableMask;
}

public List<Integer> getSelectedIndices() {
if(selectedIndices == null){
selectedIndices = new ArrayList<>();
for(int i = 0; i < tables.size(); i++){
selectedIndices.add(i);
}
}
return selectedIndices;
}

public static Database generateCDMModel(CDMVersion cdmVersion) throws IOException {
return Database.generateModelFromCSV(Database.class.getResourceAsStream(cdmVersion.fileName), cdmVersion.fileName);
}
Expand Down
104 changes: 86 additions & 18 deletions rabbitinahat/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,34 @@
<programs>
<program>
<mainClass>org.ohdsi.rabbitInAHat.RabbitInAHatMain</mainClass>
<id>rabbitInAHat</id>
<id>rabbitinahat</id>
</program>
</programs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<!-- version>3.2.2</version -->
<configuration>
<forkCount>1</forkCount>
<reuseForks>false</reuseForks>
<skipTests>${skipUnitTests}</skipTests>
<systemPropertyVariables>
<java.awt.headless>false</java.awt.headless>
<awt.toolkit>com.github.caciocavallosilano.cacio.ctc.CTCToolkit</awt.toolkit>
<java.awt.graphicsenv>com.github.caciocavallosilano.cacio.ctc.CTCGraphicsEnvironment</java.awt.graphicsenv>
</systemPropertyVariables>
<argLine>
-Doracle.jdbc.timezoneAsRegion=false
-XX:+EnableDynamicAgentLoading
<!-- Line(s) below are needed to keep TestSourceDataScan.updateEnv() working in java 17+
This is considered an acceptable hack since it only affects test code -->
--add-exports=java.base/java.util=ALL-UNNAMED
--add-opens=java.base/java.util=ALL-UNNAMED
<!-- suppress exceptions from cacio-tta, see https://github.com/CaciocavalloSilano/caciocavallo -->
--add-opens java.base/java.lang.reflect=ALL-UNNAMED
--add-exports java.base/java.lang.reflect=ALL-UNNAMED
--add-exports=java.desktop/java.awt=ALL-UNNAMED
--add-exports=java.desktop/java.awt.peer=ALL-UNNAMED
--add-exports=java.desktop/sun.awt.image=ALL-UNNAMED
Expand All @@ -56,14 +69,64 @@
--add-opens=java.desktop/java.awt=ALL-UNNAMED
--add-opens=java.desktop/sun.java2d=ALL-UNNAMED
--add-opens=java.base/java.lang.reflect=ALL-UNNAMED
--add-opens java.base/java.lang=ALL-UNNAMED
</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.2.2</version>
<configuration>
<systemPropertyVariables>
<propertyName>propertyValue</propertyName>
<projectBuildDirectory>${project.build.directory}</projectBuildDirectory>
<java.awt.headless>false</java.awt.headless>
</systemPropertyVariables>
<forkCount>1</forkCount>
<reuseForks>false</reuseForks>
<includes>
<include>**/*IT.java</include>
</includes>
<skipTests>${skipIntegrationTests}</skipTests>
<argLine>
-XX:+EnableDynamicAgentLoading
<!-- experimental workaround for Snowflake JDBC issue,
see https://community.snowflake.com/s/article/JDBC-Driver-Compatibility-Issue-With-JDK-16-and-Later -->
--add-opens java.base/java.nio=ALL-UNNAMED
<!-- suppress exceptions from cacio-tta, see https://github.com/CaciocavalloSilano/caciocavallo -->
--add-opens java.base/java.lang.reflect=ALL-UNNAMED
--add-exports java.base/java.lang.reflect=ALL-UNNAMED
--add-exports=java.desktop/java.awt=ALL-UNNAMED
--add-exports=java.desktop/java.awt.peer=ALL-UNNAMED
--add-exports=java.desktop/sun.awt.image=ALL-UNNAMED
--add-exports=java.desktop/sun.java2d=ALL-UNNAMED
--add-exports=java.desktop/java.awt.dnd.peer=ALL-UNNAMED
--add-exports=java.desktop/sun.awt=ALL-UNNAMED
--add-exports=java.desktop/sun.awt.event=ALL-UNNAMED
--add-exports=java.desktop/sun.awt.datatransfer=ALL-UNNAMED
--add-exports=java.base/sun.security.action=ALL-UNNAMED
--add-opens=java.base/java.util=ALL-UNNAMED
--add-opens=java.desktop/java.awt=ALL-UNNAMED
--add-opens=java.desktop/sun.java2d=ALL-UNNAMED
--add-opens=java.base/java.lang.reflect=ALL-UNNAMED
--add-opens java.base/java.lang=ALL-UNNAMED
</argLine>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- unpack the examples zip so that the contents can be used as test resources -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.1.0</version>
<version>3.1.0</version>
<executions>
<execution>
<phase>process-test-resources</phase>
Expand All @@ -78,15 +141,6 @@
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.1</version>
<configuration>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>csv</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</plugin>
<plugin>
<!-- enforce that the used dependencies support Java 1.8 -->
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -130,10 +184,17 @@
<artifactId>rabbit-core</artifactId>
<version>${project.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.10.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.10.1</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -143,6 +204,12 @@
<scope>test</scope>
</dependency>
<!-- causes warning for CVE-2020-15250 but is only used in test scope -->
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-swing</artifactId>
<version>3.17.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-swing-junit</artifactId>
Expand All @@ -152,9 +219,10 @@
<dependency>
<groupId>com.github.caciocavallosilano</groupId>
<artifactId>cacio-tta</artifactId>
<version>1.17.3</version>
<version>1.18</version>
<scope>test</scope>
</dependency>

<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-antrun-plugin -->
<dependency>
<groupId>org.apache.maven.plugins</groupId>
Expand All @@ -163,9 +231,9 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.10.1</version>
<groupId>org.ohdsi</groupId>
<artifactId>whiterabbit</artifactId>
<version>1.0.0</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ private static void addTargetTableSection(CustomXWPFDocument document, ETL etl,
createDocumentParagraph(document, targetTable.getComment());

for (ItemToItemMap tableToTableMap : etl.getTableToTableMapping().getSourceToTargetMaps())
if (tableToTableMap.getTargetItem() == targetTable) {
if (tableToTableMap.getTargetItem() == targetTable && etl.isSelectedTable(tableToTableMap.getSourceItem())) {
Table sourceTable = (Table) tableToTableMap.getSourceItem();
Mapping<Field> fieldtoFieldMapping = etl.getFieldToFieldMapping(sourceTable, targetTable);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,13 @@ private void renderModel() {
cdmComponents.clear();
arrows.clear();
for (MappableItem item : mapping.getSourceItems()) {
if (!showOnlyConnectedItems || isConnected(item)) {
if (item.isStem())
sourceComponents.add(new LabeledRectangle(0, 400, ITEM_WIDTH, ITEM_HEIGHT, item, new Color(160, 0, 160)));
else
sourceComponents.add(new LabeledRectangle(0, 400, ITEM_WIDTH, ITEM_HEIGHT, item, new Color(255, 128, 0)));
if (ObjectExchange.etl.isSelectedTable(item)) {
if (!showOnlyConnectedItems || isConnected(item)) {
if (item.isStem())
sourceComponents.add(new LabeledRectangle(0, 400, ITEM_WIDTH, ITEM_HEIGHT, item, new Color(160, 0, 160)));
else
sourceComponents.add(new LabeledRectangle(0, 400, ITEM_WIDTH, ITEM_HEIGHT, item, new Color(255, 128, 0)));
}
}
}
for (MappableItem item : mapping.getTargetItems()) {
Expand All @@ -182,9 +184,11 @@ private void renderModel() {
}
}
for (ItemToItemMap map : mapping.getSourceToTargetMaps()) {
Arrow component = new Arrow(getComponentWithItem(map.getSourceItem(), sourceComponents), getComponentWithItem(map.getTargetItem(), cdmComponents),
map);
arrows.add(component);
if (ObjectExchange.etl.isSelectedTable(map.getSourceItem())) {
Arrow component = new Arrow(getComponentWithItem(map.getSourceItem(), sourceComponents), getComponentWithItem(map.getTargetItem(), cdmComponents),
map);
arrows.add(component);
}
}
layoutItems();
repaint();
Expand Down
Loading

0 comments on commit 55bc9c0

Please sign in to comment.