Skip to content

Commit

Permalink
add ilidata logic to ili2pgimport
Browse files Browse the repository at this point in the history
  • Loading branch information
edigonzales committed Oct 26, 2023
1 parent 1c16a3d commit 673f0e9
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 14 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<Grundstuecksnummer>1505</Grundstuecksnummer>
<EGRID>CH940632814686</EGRID>
<NBIdent>SO0200002580</NBIdent>
<Datum_Meldung>2023-10-23</Datum_Meldung>
<Datum_Meldung>2023-10-26</Datum_Meldung>
<Meldegrund>Anbau</Meldegrund>
<Baujahr>2009</Baujahr>
<Gebaeudebezeichnung>Reine Wohngebäude (Wohnnutzung ausschliesslich)</Gebaeudebezeichnung>
Expand Down
55 changes: 42 additions & 13 deletions gretl/src/main/java/ch/so/agi/gretl/tasks/Ili2pgImport.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,50 @@ public void importData() {
if (dataFile == null) {
return;
}
FileCollection dataFilesCollection=null;
if(dataFile instanceof FileCollection) {
dataFilesCollection=(FileCollection)dataFile;
}else {
dataFilesCollection=getProject().files(dataFile);
}
if (dataFilesCollection == null || dataFilesCollection.isEmpty()) {
return;
}

// Liste mit saemtlicheen Dateipfaeden oder ilidata-Ids.
List<String> files = new ArrayList<String>();
for (java.io.File fileObj : dataFilesCollection) {
String fileName = fileObj.getPath();
files.add(fileName);

FileCollection dataFilesCollection = null;
if(dataFile instanceof FileCollection) {
dataFilesCollection = (FileCollection) dataFile;

if (dataFilesCollection == null || dataFilesCollection.isEmpty()) {
return;
}

for (File fileObj : dataFilesCollection) {
String fileName = fileObj.getPath();
files.add(fileName);
}
} else if(dataFile instanceof File) {
File file = (File) dataFile;
files.add(file.getAbsolutePath());
} else if(dataFile instanceof String) {
String fileName = (String) dataFile;
if (fileName.startsWith("ilidata")) {
files.add(fileName);
} else {
File file = this.getProject().file(fileName);
files.add(file.getAbsolutePath());
}
} else {
List<String> dataFileList = (ArrayList) dataFile;
for (String fileName : dataFileList) {

if (fileName.startsWith("ilidata")) {
files.add(fileName);
} else {
File file = this.getProject().file(fileName);
files.add(file.getAbsolutePath());
}
}
if (files.size() == 0) {
return;
}
}
java.util.List<String> datasetNames=null;

List<String> datasetNames = null;
if (dataset != null) {
if(dataset instanceof String) {
datasetNames=new ArrayList<String>();
Expand Down

0 comments on commit 673f0e9

Please sign in to comment.