Skip to content

Commit a3a4eb0

Browse files
committed
make importer take transformation into account when considering which schema will be generated
1 parent 71fe9a9 commit a3a4eb0

1 file changed

Lines changed: 19 additions & 11 deletions

File tree

web/src/main/java/org/fao/geonet/kernel/mef/Importer.java

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -169,21 +169,29 @@ public void handleMetadataFiles(DirectoryStream<Path> metadataXmlFiles, Element
169169
// Important folder name to identify metadata should be ../../
170170
lastUnknownMetadataFolderName = file.getParent().getParent().relativize(file);
171171

172-
try {
173-
String metadataSchema = metadataSchemaUtils.autodetectSchema(metadata, null);
174-
// If local node doesn't know metadata
175-
// schema try to load next xml file.
176-
if (metadataSchema == null) {
177-
continue;
172+
String metadataSchema = null;
173+
174+
if (style.equals("schema:iso19115-3.2018.che:convert/fromISO19139.che") &&
175+
"CHE_MD_Metadata".equals(metadata.getName()) &&
176+
"http://www.geocat.ch/2008/che".equals(metadata.getNamespace().getURI())) {
177+
metadataSchema = "iso19115-3.2018.che";
178+
infoSchema = "iso19115-3.2018.che";
179+
}
180+
if (metadataSchema == null) {
181+
try {
182+
metadataSchema = metadataSchemaUtils.autodetectSchema(metadata, null);
183+
} catch (NoSchemaMatchesException e) {
184+
Log.debug(Geonet.MEF, "No schema match for " + lastUnknownMetadataFolderName + ".");
178185
}
186+
}
187+
if (metadataSchema == null) {
188+
continue;
189+
}
179190

180-
String currFile = "Found metadata file " + file.getParent().getParent().relativize(file);
191+
String currFile = "Found metadata file " + file.getParent().getParent().relativize(file);
181192

182-
mdFiles.put(metadataSchema, Pair.read(currFile, metadata));
193+
mdFiles.put(metadataSchema, Pair.read(currFile, metadata));
183194

184-
} catch (NoSchemaMatchesException e) {
185-
Log.debug(Geonet.MEF, "No schema match for " + lastUnknownMetadataFolderName + ".");
186-
}
187195
}
188196
}
189197

0 commit comments

Comments
 (0)