Skip to content
Draft
Show file tree
Hide file tree
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
24 changes: 21 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.mycore</groupId>
<artifactId>mycore-parent</artifactId>
<version>57</version>
<version>58</version>
</parent>

<groupId>org.mycore.ubo</groupId>
Expand Down Expand Up @@ -44,17 +44,18 @@
<MCR.AppName>ubo</MCR.AppName>
<axis1.version>1.4</axis1.version>
<bootstrap-select.version>1.13.18</bootstrap-select.version>
<bootstrap.version>4.4.1</bootstrap.version>
<bootstrap.version>5.3.8</bootstrap.version>
<cargo.container>tomcat10x</cargo.container>
<charts.common.version>2.3</charts.common.version>
<font-awesome.version>5.13.0</font-awesome.version>
<jakarta.xml.bind.version>3.0.1</jakarta.xml.bind.version>
<jquery.ui.version>1.13.2</jquery.ui.version>
<jquery.version>3.5.1</jquery.version>
<maven.compiler.arg />
<maven.compiler.release>21</maven.compiler.release>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<mycore.version>2024.06.3-SNAPSHOT</mycore.version>
<mycore.version>2025.12.2-SNAPSHOT</mycore.version>
<node.version>v20.11.0</node.version>
<pica2mods.version>2.13</pica2mods.version>
<sortpom.sortDeps>scope,groupId,artifactId</sortpom.sortDeps>
Expand Down Expand Up @@ -300,6 +301,11 @@
<artifactId>bcprov-jdk18on</artifactId>
<version>1.83</version>
</dependency>
<dependency>
<groupId>org.dspace</groupId>
<artifactId>orcid-model-jakarta</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>org.mycore</groupId>
<artifactId>mycore-classifications</artifactId>
Expand Down Expand Up @@ -365,6 +371,18 @@
<artifactId>xml-apis</artifactId>
<version>1.4.01</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mycore</groupId>
<artifactId>mycore-junit4</artifactId>
<version>${mycore.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down
9 changes: 9 additions & 0 deletions ubo-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,10 @@
<groupId>org.citationstyles</groupId>
<artifactId>styles</artifactId>
</dependency>
<dependency>
<groupId>org.dspace</groupId>
<artifactId>orcid-model-jakarta</artifactId>
</dependency>
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom2</artifactId>
Expand Down Expand Up @@ -511,5 +515,10 @@
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mycore</groupId>
<artifactId>mycore-junit4</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.mycore.datamodel.metadata.MCRMetadataManager;
import org.mycore.datamodel.metadata.MCRObject;
import org.mycore.datamodel.metadata.MCRObjectID;
import org.mycore.datamodel.metadata.MCRObjectStructure;
import org.mycore.frontend.MCRFrontendUtil;
import org.mycore.frontend.servlets.MCRServlet;
import org.mycore.frontend.servlets.MCRServletJob;
Expand Down Expand Up @@ -104,7 +105,8 @@ private void deleteEntry(HttpServletRequest req, HttpServletResponse res) throws
MCRObject obj = MCRMetadataManager.retrieveMCRObject(oid);

// do not delete entries that have linked children, otherwise the children would be deleted too
List<MCRMetaLinkID> children = obj.getStructure().getChildren();
List<MCRMetaLinkID> children = MCRMetadataManager.retrieveMCRExpandedObject(obj.getId()).getStructure().getChildren();

if (!children.isEmpty()) {
res.sendError(HttpServletResponse.SC_CONFLICT, "entry has " + children.size() + " child(ren)");
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import org.apache.solr.client.solrj.request.QueryRequest;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrDocumentList;
import org.apache.solr.common.util.NamedList;
import org.jdom2.Document;
import org.jdom2.Element;
import org.jdom2.Namespace;
Expand All @@ -38,7 +37,6 @@
import org.mycore.solr.MCRSolrUtils;
import org.mycore.solr.auth.MCRSolrAuthenticationLevel;
import org.mycore.solr.auth.MCRSolrAuthenticationManager;
import org.mycore.solr.auth.MCRSolrPropertyAuthenticationManager;
import org.mycore.ubo.dedup.DeDupCriteriaBuilder;
import org.mycore.ubo.dedup.DeDupCriterion;
import org.mycore.ubo.dedup.jpa.DeduplicationKey;
Expand Down Expand Up @@ -133,7 +131,7 @@ private String buildQuery(Element mods) {
Set<DeDupCriterion> criteria = new DeDupCriteriaBuilder().buildFromMODS(mods);

String[] keys = criteria.stream().map(DeDupCriterion::getKey).toArray(String[]::new);
List<DeduplicationKey> duplicates = DeduplicationKeyManager.getInstance().getDuplicates(keys);
List<DeduplicationKey> duplicates = DeduplicationKeyManager.obtainInstance().getDuplicates(keys);

if (!duplicates.isEmpty()) {
String ids = duplicates.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ private static Set<DeDupGroup> findOtherMatchingGroups(Map<DeDupCriterion, DeDup
}

public static void printDuplicates(){
for (PossibleDuplicate duplicate : DeduplicationKeyManager.getInstance().getDuplicates(DeduplicationKeyManager.SortOrder.ASC, DeduplicationKeyManager.SortOrder.NONE, null)) {
for (PossibleDuplicate duplicate : DeduplicationKeyManager.obtainInstance().getDuplicates(DeduplicationKeyManager.SortOrder.ASC, DeduplicationKeyManager.SortOrder.NONE, null)) {
LOGGER.info(duplicate);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void updateDeDupCriteria(Element mods, MCRObjectID id) {
}
}

DeduplicationKeyManager deduplicationKeyManager = DeduplicationKeyManager.getInstance();
DeduplicationKeyManager deduplicationKeyManager = DeduplicationKeyManager.obtainInstance();

if (mods.getName().equals("mods") || mods.getAttributeValue("href", MCRConstants.XLINK_NAMESPACE) != null) {
deduplicationKeyManager.clearDeduplicationKeys(id.toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

public class DeDupEventHandler extends MCREventHandlerBase {

private final static Logger LOGGER = LogManager.getLogger(DeDupEventHandler.class);
private final static Logger LOGGER = LogManager.getLogger();

@Override
protected void handleObjectCreated(MCREvent evt, MCRObject obj) {
Expand All @@ -30,14 +30,13 @@ protected void handleObjectRepaired(MCREvent evt, MCRObject obj) {

@Override
protected void handleObjectDeleted(MCREvent evt, MCRObject obj) {
LOGGER.info("clearing deduplication keys and no duplicates for object " + obj.getId().toString());
DeduplicationKeyManager.getInstance().clearDeduplicationKeys(obj.getId().toString());
DeduplicationKeyManager.getInstance().clearNoDuplicates(obj.getId().toString());

LOGGER.info("Clearing deduplication keys and no duplicates for object {}", obj.getId());
DeduplicationKeyManager.obtainInstance().clearDeduplicationKeys(obj.getId().toString());
DeduplicationKeyManager.obtainInstance().clearNoDuplicates(obj.getId().toString());
}

private void updateDeDupCriteria(MCRObject obj) {
LOGGER.info("updating deduplication keys for object " + obj.getId().toString());
LOGGER.info("Updating deduplication keys for object {}", obj.getId());
Element mods = new MCRMODSWrapper(obj).getMODS();
new DeDupCriteriaBuilder().updateDeDupCriteria(mods, obj.getId());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public Response listDedup(@QueryParam("idSort") String idSortStr, @QueryParam("t
default -> throw new BadRequestException("Invalid sort order: " + typeSortStr);
};

List<PossibleDuplicate> duplicates = DeduplicationKeyManager.getInstance().getDuplicates(idSort, typeSort, type);
List<PossibleDuplicate> duplicates = DeduplicationKeyManager.obtainInstance().getDuplicates(idSort, typeSort, type);
String json = new Gson().toJson(duplicates.toArray(), PossibleDuplicate[].class);
return Response.ok(json)
.header("Access-Control-Allow-Origin", "*")
Expand All @@ -63,7 +63,7 @@ public Response deleteNoDuplicate(@PathParam("id") int id) {
throw new BadRequestException("Invalid id: " + id);
}

DeduplicationKeyManager.getInstance().removeNoDuplicate(id);
DeduplicationKeyManager.obtainInstance().removeNoDuplicate(id);
return Response.ok().build();
}

Expand Down Expand Up @@ -92,7 +92,7 @@ public Response listNoDedup(@QueryParam("sortBy") String sortByStr, @QueryParam(
default -> throw new BadRequestException("Invalid sort direction: " + sortOrderStr);
};

List<DeduplicationNoDuplicate> noDuplicates = DeduplicationKeyManager.getInstance().getNoDuplicates(sortOrder, sortBy);
List<DeduplicationNoDuplicate> noDuplicates = DeduplicationKeyManager.obtainInstance().getNoDuplicates(sortOrder, sortBy);

List<NoDuplicate> noDuplicatesList = noDuplicates.stream()
.map(nd -> new NoDuplicate(nd.getId(), nd.getMcrId1(), nd.getMcrId2(), nd.getCreator(), nd.getCreationDate()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public Source resolve(String href, String base) throws TransformerException {
if(Objects.equals("base", relation) || Objects.equals("parent", relation)) {
Set<DeDupCriterion> criteria = deDupCriteriaBuilder.buildFromMODS(mods);
criteria.forEach(criterion -> {
possibleDuplicates.addAll(DeduplicationKeyManager.getInstance().getDuplicates(id.toString(), criterion.getType(), criterion.getKey()));
possibleDuplicates.addAll(DeduplicationKeyManager.obtainInstance().getDuplicates(id.toString(), criterion.getType(), criterion.getKey()));
});
} else {
for (Element host : deDupCriteriaBuilder.getNodes(mods, "mods:relatedItem[@type='host']")) {
Expand All @@ -90,7 +90,7 @@ public Source resolve(String href, String base) throws TransformerException {
continue;
}
deDupCriteriaBuilder.buildFromMODS(host).forEach(criterion -> {
possibleDuplicates.addAll(DeduplicationKeyManager.getInstance().getDuplicates(id.toString(), criterion.getType(), criterion.getKey()));
possibleDuplicates.addAll(DeduplicationKeyManager.obtainInstance().getDuplicates(id.toString(), criterion.getType(), criterion.getKey()));
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class DeduplicationKeyManager {
public DeduplicationKeyManager() {
}

public static DeduplicationKeyManager getInstance() {
public static DeduplicationKeyManager obtainInstance() {
return MCRConfiguration2.getSingleInstanceOf(DeduplicationKeyManager.class, "UBO.DeduplicationKeyManager")
.get();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ public abstract class ImportJob {

private List<Document> publications = new ArrayList<Document>();

private ImportIdProvider importIdProvider = ((ImportIdProvider) MCRConfiguration2
.instantiateClass(MCRConfiguration2.getStringOrThrow("UBO.Importer.ImportIdProvider.ListImport")));
private ImportIdProvider importIdProvider = (MCRConfiguration2.instantiateClass(ImportIdProvider.class,
MCRConfiguration2.getStringOrThrow("UBO.Importer.ImportIdProvider.ListImport")));

public String getID() {
return importIdProvider.getImportId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ private void sendMail(ImportJob importJob) {
return;
}

String eMailAddress = mcrUser.getEMailAddress();
String eMailAddress = mcrUser.getEMail();

if (eMailAddress == null) {
LOGGER.warn("Cannot send e-mail to user {} as user has no e-mail address", userName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class ScopusImporter {

public ScopusImporter() {
String className = MCRConfiguration2.getStringOrThrow("UBO.Importer.ImportIdProvider.Scopus");
importIdProvider = MCRConfiguration2.instantiateClass(className);
importIdProvider = MCRConfiguration2.instantiateClass(ImportIdProvider.class, className);
}

public MCRObject doImport(String scopusID) throws MCRPersistenceException, MCRAccessException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ public PersonSearchResult searchPerson(String query, MCRRealm realm) {
personSearchResult.lastName = attrVal;
});

if (user.getEMailAddress() != null) {
if (user.getEMail() != null) {
personSearchResult.information = new ArrayList<>();
personSearchResult.information.add(user.getEMailAddress());
personSearchResult.information.add(user.getEMail());
}

return personSearchResult;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void runJob() {

LOGGER.info("{} emails sent", preparedEmails.size());
return null;
}, MCRSystemUserInformation.getSystemUserInstance()).call();
}, MCRSystemUserInformation.SYSTEM_USER).call();
} catch (Exception e) {
LOGGER.error("Failed to send emails: {}", e.getMessage());
}
Expand Down Expand Up @@ -108,7 +108,7 @@ private List<PreparedEmail> prepareEmails() throws TransformerException, IOExcep
}

private String resolveURI(String uri, String filetype, String prefix) throws IOException, TransformerException {
MCRSourceContent content = MCRSourceContent.getInstance(uri);
MCRSourceContent content = MCRSourceContent.createInstance(uri);

Path tempFile = Files.createTempFile("att_" + prefix + "_", "." + filetype);
try (InputStream inputStream = content.getContentInputStream();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class SolrRequireResultsResolver implements URIResolver {
public Source resolve(String href, String base) throws TransformerException {
final String subHref = href.substring(href.indexOf(":") + 1);

Element solrResults = MCRURIResolver.instance().resolve(subHref);
Element solrResults = MCRURIResolver.obtainInstance().resolve(subHref);
Element result = solrResults.getChild("result");
if (result == null) {
throw new MCRException("There were no search results for " + subHref);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ public static void setStaticMCRUserAttributes(MCRUser mcrUser, LDAPObject ldapUs

private static void setUserEMail(MCRUser user, String attributeID, String attributeValue) {
String mapEMail = MCRConfiguration2.getString(CONFIG_PREFIX + "Mapping.E-Mail").get();
if (attributeID.equals(mapEMail) && (user.getEMailAddress() == null)) {
if (attributeID.equals(mapEMail) && (user.getEMail() == null)) {
LOGGER.debug("User " + user.getUserName() + " e-mail = " + attributeValue);
user.setEMail(attributeValue);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.jdom2.Element;
import org.mycore.common.MCRConstants;
import org.mycore.datamodel.common.MCRXMLMetadataManager;
import org.mycore.datamodel.metadata.MCRExpandedObjectStructure;
import org.mycore.datamodel.metadata.MCRMetaLinkID;
import org.mycore.datamodel.metadata.MCRMetadataManager;
import org.mycore.datamodel.metadata.MCRObject;
Expand Down Expand Up @@ -75,9 +76,9 @@ public static void checkRelations(String id, String sRepair) {
public ParentChildRelationChecker(MCRObjectID oid, boolean shouldRepair) {
this.oid = oid;
this.obj = MCRMetadataManager.retrieveMCRObject(oid);
this.structure = obj.getStructure();
this.structure = MCRMetadataManager.retrieveMCRExpandedObject(obj.getId()).getStructure();
this.parentID = obj.getParent();
this.childLinks = structure.getChildren();
this.childLinks = MCRMetadataManager.retrieveMCRExpandedObject(obj.getId()).getStructure().getChildren();
this.hosts = getHostRelations(obj);
this.shouldRepair = shouldRepair;
}
Expand Down Expand Up @@ -159,7 +160,8 @@ private void checkForNonExistingChild(MCRMetaLinkID childLink) {

private void checkForParentMissingChild() {
MCRObject parent = MCRMetadataManager.retrieveMCRObject(parentID);
MCRObjectStructure parentStructure = parent.getStructure();
MCRExpandedObjectStructure parentStructure = MCRMetadataManager.retrieveMCRExpandedObject(parent.getId())
.getStructure();

if (!parentStructure.getChildren().stream().anyMatch(c -> c.getXLinkHrefID().equals(oid))) {
if (shouldRepair) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ private void deleteIfNoChildren(HttpServletResponse res, MCRObjectID oid)
LOGGER.info("UBO delete entry " + oid);
MCRObject obj = MCRMetadataManager.retrieveMCRObject(oid);

if (!obj.getStructure().getChildren().isEmpty()) {
if (!MCRMetadataManager.retrieveMCRExpandedObject(obj.getId()).getStructure().getChildren().isEmpty()) {
res.sendError(HttpServletResponse.SC_CONFLICT, "entry has child(ren), wont delete");
} else {
new ParentChildRelationChecker(oid, false).check();
Expand Down Expand Up @@ -178,7 +178,7 @@ private void markAsFalseDuplicate(HttpServletRequest req, HttpServletResponse re

String userID = MCRSessionMgr.getCurrentSession().getUserInformation().getUserID();

DeduplicationKeyManager.getInstance().addNoDuplicate(id.toString(), duplicateOf.toString(), userID, new Date());
DeduplicationKeyManager.obtainInstance().addNoDuplicate(id.toString(), duplicateOf.toString(), userID, new Date());
}


Expand Down Expand Up @@ -211,7 +211,8 @@ private void adoptChildren(HttpServletRequest req, HttpServletResponse res) thro

MCRObject objFrom = MCRMetadataManager.retrieveMCRObject(fromID);

List<MCRMetaLinkID> childrenToAdopt = objFrom.getStructure().getChildren();
List<MCRMetaLinkID> childrenToAdopt = MCRMetadataManager.retrieveMCRExpandedObject(objFrom.getId())
.getStructure().getChildren();
while (!childrenToAdopt.isEmpty()) {
MCRMetaLinkID childLink = childrenToAdopt.get(0);
childrenToAdopt.remove(childLink);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ public Response search(@QueryParam("query") String searchQuery) {
}

String classPrefix = MCRConfiguration2.getStringOrThrow(STRATEGY_CONFIG_STRING);
IdentityService service = (IdentityService) MCRConfiguration2.instantiateClass(classPrefix + STRATEGY_CLASS_SUFFIX);
IdentityService service = MCRConfiguration2.instantiateClass(IdentityService.class,
classPrefix + STRATEGY_CLASS_SUFFIX);


try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
Unsere Postanschrift lautet:
</p>

<p class="border-left pl-5">
<p class="border-left ps-5">
Universitätsbibliothek Duisburg-Essen<br />
Universitätsstr. 9 - 11<br />
D-45141 Essen
Expand Down Expand Up @@ -98,7 +98,7 @@
aus und senden ihn per
<a href="mailto:ombudsstelle-barrierefreie-it@mags.nrw.de" title="E-Mail Ombudsstelle">E-Mail</a> an die Ombudsstelle.
</p>
<p class="border-left pl-5">
<p class="border-left ps-5">
Ombudsstelle für barrierefreie In­for­ma­ti­ons­tech­nik<br/>
des Landes Nordrhein-Westfalen bei der<br/>
Landesbeauftragten für Men­schen mit Be­hin­de­run­gen<br/>
Expand Down
Loading
Loading