Skip to content

Commit

Permalink
MEF export - withheld elements in additional formats export
Browse files Browse the repository at this point in the history
  • Loading branch information
josegar74 committed Mar 9, 2023
1 parent ee51470 commit e0cb16b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions core/src/main/java/org/fao/geonet/kernel/mef/ExportFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import java.util.Set;

import org.fao.geonet.GeonetContext;
import org.fao.geonet.constants.Edit;
import org.fao.geonet.constants.Geonet;
import org.fao.geonet.domain.AbstractMetadata;
import org.fao.geonet.domain.Metadata;
Expand Down Expand Up @@ -72,7 +73,7 @@ public static Iterable<Pair<String, String>> getFormats(ServiceContext context,
String outputFileName = entry.getValue();
Path path = metadataSchema.getSchemaDir().resolve(xslFileName);
if (Files.isRegularFile(path)) {
String outputData = formatData(metadata, true, path);
String outputData = formatData(context, metadata, true, path);
allExports.add(Pair.read(outputFileName, outputData));
} else {
// A conversion that does not exist
Expand All @@ -96,10 +97,9 @@ public static Iterable<Pair<String, String>> getFormats(ServiceContext context,
*
* @return ByteArrayInputStream
*/
public static String formatData(AbstractMetadata metadata, boolean transform, Path stylePath) throws Exception {
String xmlData = metadata.getData();

Element md = Xml.loadString(xmlData, false);
public static String formatData(ServiceContext context, AbstractMetadata metadata, boolean transform, Path stylePath) throws Exception {
Element md = context.getBean(DataManager.class).getMetadata(context, metadata.getId() + "", false, false, true);
md.removeChild("info", Edit.NAMESPACE);

// Apply a stylesheet transformation when schema is ISO profil
if (transform) {
Expand Down

0 comments on commit e0cb16b

Please sign in to comment.