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

UBO-353 FSU040THUL-4126 Do not copy connection id of the replaced author #414

Merged
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
Expand Up @@ -9,10 +9,6 @@

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;
Expand All @@ -29,6 +25,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 +99,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
Loading