Skip to content

Commit

Permalink
clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
edigonzales committed Jul 2, 2023
1 parent a6bd635 commit 2e06470
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 67 deletions.
6 changes: 0 additions & 6 deletions src/main/java/ch/so/agi/csv2parquet/IoxWkfConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,4 @@ private IoxWkfConfig() {}
public final static String INI_VALUESEPARATOR = "valueSeparator";
public final static String INI_ENCODING = "encoding";
public final static String INI_MODELS = "models";
// public final static String SETTING_TRANSFERDESCRIPTION = "transferDescription";
// public final static String INI_META_TITLE = "title";
// public final static String INI_META_DESCRIPTION = "description";
// public final static String INI_META_PARENT_TITLE = "parentTitle";
// public final static String INI_META_PARENT_DESCRIPTION = "parentDescription";

}
63 changes: 2 additions & 61 deletions src/main/java/ch/so/agi/csv2parquet/SettingsMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,39 +41,8 @@ public static Settings run(File configFile, String identifier) throws IOExceptio
setSettingsFromTomlTable(resourceTable, settings);
}

// // TODO wird erst interessant, wenn wir neben tool-config-Daten auch Metadatenauslesen.
//
// // In der Methode wird also immer der identifier (oder falls null irgendeins) verwendet.
// // Falls ein parentTable vorhanden ist, muss man diesen noch behandeln. Gewisse Teile
// // werden überschrieben? / verschoben?
// if (parentTable != null) {
// // Theme title von parent
// // ...
// String title = parentTable.getString(IoxWkfConfig.INI_META_TITLE);
// if (title != null) {
// settings.setValue(IoxWkfConfig.INI_META_PARENT_TITLE, title);
// }
//
// String description = parentTable.getString(IoxWkfConfig.INI_META_DESCRIPTION);
// if (description != null) {
// settings.setValue(IoxWkfConfig.INI_META_PARENT_DESCRIPTION, description);
// }
// }
}

// if (settings.getValue(Validator.SETTING_MODELNAMES) != null) {
// TransferDescription td = getTransferDescriptionFromModelName(settings.getValue(Validator.SETTING_MODELNAMES), configFile.getParentFile().toPath());
// settings.setTransientObject(IoxWkfConfig.SETTING_TRANSFERDESCRIPTION, td);
// }
//
//
// System.out.println(settings);

// TomlMapper tomlMapper = new TomlMapper();
// tomlMapper.registerModule(new JavaTimeModule());
// Map<String, Object> tomlMap = tomlMapper.readValue(configFile, Map.class);
// System.out.println(tomlMap);

return settings;
}

Expand Down Expand Up @@ -114,35 +83,7 @@ private static void setSettingsFromTomlTable(TomlTable tomlTable, Settings setti
if (encoding != null) {
settings.setValue(CsvReader.ENCODING, encoding);
}
}

// if (key.endsWith(IoxWkfConfig.INI_META_TITLE)) {
// String title = tomlTable.getString(key);
// if (title != null) {
// settings.setValue(IoxWkfConfig.INI_META_TITLE, title);
// }
// }

//...
}
}
}

private static TransferDescription getTransferDescriptionFromModelName(String iliModelName, Path additionalRepository) throws Ili2cException {
IliManager manager = new IliManager();
String ilidirs = IoxWkfConfig.SETTING_ILIDIRS_DEFAULT + additionalRepository;
String repositories[] = ilidirs.split(";");
manager.setRepositories(repositories);
ArrayList<String> modelNames = new ArrayList<String>();
modelNames.add(iliModelName);
Configuration config = manager.getConfig(modelNames, 2.3);
TransferDescription td = Ili2c.runCompiler(config);

if (td == null) {
throw new IllegalArgumentException("INTERLIS compiler failed"); // TODO: can this be tested?
}

return td;
}


}
}

0 comments on commit 2e06470

Please sign in to comment.