Skip to content

Commit

Permalink
UBO-353 FSU040THUL-4126 Do not copy connection id of the replaced author
Browse files Browse the repository at this point in the history
  • Loading branch information
Possommi committed Aug 23, 2024
1 parent 947f32e commit f1019b4
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,14 @@

package org.mycore.ubo.basket;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.jdom2.Document;
import org.jdom2.Element;
import org.mycore.common.MCRConstants;
import org.mycore.common.config.MCRConfiguration2;
import org.mycore.datamodel.metadata.MCRMetadataManager;
import org.mycore.datamodel.metadata.MCRObject;
import org.mycore.frontend.basket.MCRBasket;
Expand All @@ -29,6 +26,10 @@
import org.mycore.ubo.AccessControl;
import org.mycore.ubo.DozBibEntryServlet;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
* Servlet invoked by edit-contributors.xml to
* change contributor name and pid entries in the basket of bibliography entries
Expand Down Expand Up @@ -99,6 +100,12 @@ private void changeContributorInBasket(NameEntry nameEntryFromBasket, NameEntry
contributor.removeChildren("nameIdentifier", MCRConstants.MODS_NAMESPACE);

for (Element child : nameEntryEdited.getModsName().getChildren()) {
// retain all nameIdentifier elements, except of type 'connection'
String typeAttr = child.getAttributeValue("type");
if ("nameIdentifier".equals(child.getName()) && "connection".equals(typeAttr)) {
continue;
}

if ("namePart".equals(child.getName()) || "nameIdentifier".equals(child.getName())) {
if (!child.getTextTrim().isEmpty()) {
contributor.addContent(child.clone());
Expand Down

0 comments on commit f1019b4

Please sign in to comment.