Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Database batch edit improvements #8435

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2001-2016 Food and Agriculture Organization of the
* Copyright (C) 2001-2024 Food and Agriculture Organization of the
* United Nations (FAO-UN), United Nations World Food Programme (WFP)
* and United Nations Environment Programme (UNEP)
*
Expand All @@ -26,24 +26,17 @@
import jeeves.server.context.ServiceContext;
import org.apache.commons.lang.StringUtils;
import org.fao.geonet.api.processing.report.MetadataReplacementProcessingReport;
import org.fao.geonet.api.processing.report.XsltMetadataProcessingReport;
import org.fao.geonet.domain.AbstractMetadata;
import org.fao.geonet.domain.ISODate;
import org.fao.geonet.kernel.AccessManager;
import org.fao.geonet.kernel.DataManager;
import org.fao.geonet.kernel.SchemaManager;
import org.fao.geonet.kernel.datamanager.IMetadataManager;
import org.fao.geonet.kernel.datamanager.IMetadataSchemaUtils;
import org.fao.geonet.kernel.datamanager.IMetadataUtils;
import org.fao.geonet.kernel.search.IndexingMode;
import org.fao.geonet.kernel.setting.SettingManager;
import org.fao.geonet.lib.Lib;
import org.fao.geonet.repository.MetadataRepository;
import org.fao.geonet.repository.MetadataValidationRepository;
import org.fao.geonet.utils.Xml;
import org.jdom.Element;

import java.util.Map;

public class DatabaseProcessUtils {
/**
Expand Down Expand Up @@ -72,7 +65,7 @@ public static Element process(ServiceContext context, String id,
return null;
}

int iId = Integer.valueOf(id);
int iId = Integer.parseInt(id);
AbstractMetadata info = metadataUtils.findOne(id);


Expand Down Expand Up @@ -108,16 +101,12 @@ public static Element process(ServiceContext context, String id,
boolean ufo = true;
String language = context.getLanguage();

dataMan.updateMetadata(context, id, wellFormedXml, validate, ufo, language, new ISODate().toString(),
AbstractMetadata metadata = dataMan.updateMetadata(context, id, wellFormedXml, validate, ufo, language, new ISODate().toString(),
updateDateStamp, index ? IndexingMode.full : IndexingMode.none);
if (index) {
dataMan.indexMetadata(id, true);
}
wellFormedXml = Xml.loadString(metadata.getData(), false);
}
}



report.addMetadataId(iId);
// TODO : it could be relevant to list at least
// if there was any change in the record or not.
Expand Down