From 44ace0dd4a826b4e98a8ff449d213d3555c210d4 Mon Sep 17 00:00:00 2001 From: Thomas Scheffler Date: Fri, 13 Oct 2023 11:01:28 +0200 Subject: [PATCH] MCR-2647 fix static metamodel and some jql queries deprecate MCRCategoryID.getID() --- .../mcr/acl/accesskey/model/MCRAccessKey.java | 2 ++ .../condition/fact/MCRStateCondition.java | 4 +-- .../backend/jpa/access/MCRJPARuleStore.java | 22 ++++++++-------- .../classifications2/MCRCategoryID.java | 25 +++++++++++++------ .../impl/MCRCategLinkServiceImpl.java | 2 +- .../impl/MCRCategoryDAOImpl.java | 6 ++--- .../impl/MCRCategoryImpl.java | 6 ++--- .../model/MCRClassCategory.java | 2 +- .../utils/MCRCategoryTransformer.java | 6 ++--- .../utils/MCRSkosTransformer.java | 2 +- .../language/MCRLanguageFactory.java | 2 +- .../MCRDerivateDefaultClassEventHandler.java | 2 +- .../MCREditableMetaEnrichedLinkID.java | 2 +- .../metadata/MCRMetaClassification.java | 4 +-- .../datamodel/metadata/MCRObjectService.java | 6 ++--- .../history/MCRMetadataHistoryManager.java | 2 +- .../cli/MCRClassification2Commands.java | 2 +- .../frontend/cli/MCRDerivateCommands.java | 4 +-- .../frontend/fileupload/MCRUploadHelper.java | 2 +- .../classifications2/MCRCategoryIDTest.java | 2 +- .../servlets/MCRClassificationBrowser2.java | 6 ++--- .../classeditor/MCRCategoryIDTypeAdapter.java | 2 +- .../MCRClassificationEditorResource.java | 2 +- .../classeditor/utils/MCRCategUtils.java | 2 +- .../MCRClassificationEditorResourceTest.java | 2 +- .../classification/MCRAuthorityWithURI.java | 2 +- .../mods/classification/MCRClassMapper.java | 4 +-- .../MCRMODSClassificationSupport.java | 4 +-- .../MCRModsClassificationURIResolver.java | 2 +- .../mods/csl/MCRModsItemDataProvider.java | 2 +- .../java/org/mycore/orcid2/MCRORCIDUtils.java | 2 +- .../pi/condition/MCRPIStatePredicateBase.java | 2 +- .../mycore/restapi/v2/MCREventHandler.java | 2 +- .../org/mycore/restapi/v2/MCRRestObjects.java | 2 +- .../solr/classification/MCRSolrCategory.java | 2 +- .../java/org/mycore/user2/MCRRoleManager.java | 2 +- .../java/org/mycore/user2/MCRRoleServlet.java | 4 +-- .../java/org/mycore/user2/MCRUserManager.java | 2 +- .../actionmapping/MCRCategoryCondition.java | 4 +-- .../actionmapping/MCRClassificationUtils.java | 2 +- .../wfc/actionmapping/MCRURLRetriever.java | 2 +- 41 files changed, 85 insertions(+), 74 deletions(-) diff --git a/mycore-acl/src/main/java/org/mycore/mcr/acl/accesskey/model/MCRAccessKey.java b/mycore-acl/src/main/java/org/mycore/mcr/acl/accesskey/model/MCRAccessKey.java index 11d1a194a5..3a2c8b786c 100644 --- a/mycore-acl/src/main/java/org/mycore/mcr/acl/accesskey/model/MCRAccessKey.java +++ b/mycore-acl/src/main/java/org/mycore/mcr/acl/accesskey/model/MCRAccessKey.java @@ -20,6 +20,7 @@ import java.util.Date; +import jakarta.persistence.Basic; import org.mycore.backend.jpa.MCRObjectIDConverter; import org.mycore.datamodel.metadata.MCRObjectID; @@ -127,6 +128,7 @@ public MCRAccessKey(final String secret, final String type) { length = MCRObjectID.MAX_LENGTH, nullable = false) @Convert(converter = MCRObjectIDConverter.class) + @Basic public MCRObjectID getObjectId() { return objectId; } diff --git a/mycore-base/src/main/java/org/mycore/access/facts/condition/fact/MCRStateCondition.java b/mycore-base/src/main/java/org/mycore/access/facts/condition/fact/MCRStateCondition.java index 66923c26a6..3b22c7cb24 100644 --- a/mycore-base/src/main/java/org/mycore/access/facts/condition/fact/MCRStateCondition.java +++ b/mycore-base/src/main/java/org/mycore/access/facts/condition/fact/MCRStateCondition.java @@ -60,9 +60,9 @@ public Optional computeFact(MCRFactsHolder facts) { Optional optMcrObj = idc.get().getObject(); if (optMcrObj.isPresent()) { MCRCategoryID state = optMcrObj.get().getService().getState(); - if (getTerm().equals(state.getID())) { + if (getTerm().equals(state.getId())) { MCRStringFact fact = new MCRStringFact(getFactName(), getTerm()); - fact.setValue(state.getID()); + fact.setValue(state.getId()); facts.add(fact); return Optional.of(fact); } diff --git a/mycore-base/src/main/java/org/mycore/backend/jpa/access/MCRJPARuleStore.java b/mycore-base/src/main/java/org/mycore/backend/jpa/access/MCRJPARuleStore.java index 1c3b28e5ec..d9f95718f0 100644 --- a/mycore-base/src/main/java/org/mycore/backend/jpa/access/MCRJPARuleStore.java +++ b/mycore-base/src/main/java/org/mycore/backend/jpa/access/MCRJPARuleStore.java @@ -139,7 +139,9 @@ public void updateRule(MCRAccessRule rule) { @Override public void deleteRule(String ruleid) { EntityManager em = MCREntityManagerProvider.getCurrentEntityManager(); - em.createQuery("delete MCRACCESSRULE where RID = '" + ruleid + "'").executeUpdate(); + em.createQuery("delete MCRACCESSRULE where rid = :rid") + .setParameter("rid", ruleid) + .executeUpdate(); ruleCache.invalidate(ruleid); } @@ -185,19 +187,17 @@ public int getNextFreeRuleID(String prefix) { int ret = 1; EntityManager em = MCREntityManagerProvider.getCurrentEntityManager(); List l = em - .createQuery("select max(rid) from MCRACCESSRULE where rid like '" + prefix + "%'", String.class) + .createQuery("select max(rid) from MCRACCESSRULE where rid like :like", String.class) + .setParameter("like", prefix + "%") .getResultList(); - if (l.size() > 0) { - String max = l.get(0); - if (max == null) { - ret = 1; - } else { - int lastNumber = Integer.parseInt(max.substring(prefix.length())); - ret = lastNumber + 1; - } - } else { + if (l.isEmpty()) { return 1; } + String max = l.get(0); + if (max != null) { + int lastNumber = Integer.parseInt(max.substring(prefix.length())); + ret = lastNumber + 1; + } return ret; } } diff --git a/mycore-base/src/main/java/org/mycore/datamodel/classifications2/MCRCategoryID.java b/mycore-base/src/main/java/org/mycore/datamodel/classifications2/MCRCategoryID.java index 6d4a4ee6f1..6a056bfa1e 100644 --- a/mycore-base/src/main/java/org/mycore/datamodel/classifications2/MCRCategoryID.java +++ b/mycore-base/src/main/java/org/mycore/datamodel/classifications2/MCRCategoryID.java @@ -81,7 +81,7 @@ private MCRCategoryID() { */ public MCRCategoryID(String rootID, String id) { this(); - setID(id); + setId(id); setRootID(rootID); } @@ -109,7 +109,7 @@ public static MCRCategoryID fromString(String categoryId) { @Transient public boolean isRootID() { - return id == null || id.equals(""); + return id == null || id.isEmpty(); } /* @@ -144,10 +144,10 @@ public boolean equals(Object obj) { } final MCRCategoryID other = (MCRCategoryID) obj; if (id == null) { - if (other.id != null && other.id.length() > 0) { + if (other.id != null && !other.id.isEmpty()) { return false; } - } else if (!id.equals(other.id) && (id.length() > 0 || other.id != null && other.id.length() >= 0)) { + } else if (!id.equals(other.id) && (!id.isEmpty() || other.id != null && other.id.length() >= 0)) { return false; } if (rootID == null) { @@ -157,10 +157,19 @@ public boolean equals(Object obj) { } } + /** + * @deprecated Use {@link #getId()} instead. + */ + @Deprecated + @Transient + public String getID(){ + return getId(); + } + /** * @return the ID */ - public String getID() { + public String getId() { return id == null ? "" : id; } @@ -168,8 +177,8 @@ public String getID() { * @param id * the ID to set */ - private void setID(String id) { - if (id != null && id.length() > 0) { + private void setId(String id) { + if (id != null && !id.isEmpty()) { if (!VALID_ID.matcher(id).matches()) { throw new MCRException("category ID '" + id + "' is invalid and does not match: " + VALID_ID); } @@ -229,7 +238,7 @@ private void setRootID(String rootID) { @Override @JsonValue public String toString() { - if (id == null || id.length() == 0) { + if (id == null || id.isEmpty()) { return rootID; } return rootID + ':' + id; diff --git a/mycore-base/src/main/java/org/mycore/datamodel/classifications2/impl/MCRCategLinkServiceImpl.java b/mycore-base/src/main/java/org/mycore/datamodel/classifications2/impl/MCRCategLinkServiceImpl.java index 0c3da8f708..d7cbe0d0b7 100644 --- a/mycore-base/src/main/java/org/mycore/datamodel/classifications2/impl/MCRCategLinkServiceImpl.java +++ b/mycore-base/src/main/java/org/mycore/datamodel/classifications2/impl/MCRCategLinkServiceImpl.java @@ -346,7 +346,7 @@ public boolean isInCategory(MCRCategLinkReference reference, MCRCategoryID id) { setCacheable(q); setReadOnly(q); q.setParameter("rootID", id.getRootID()); - q.setParameter("categID", id.getID()); + q.setParameter("categID", id.getId()); q.setParameter("objectID", reference.getObjectID()); q.setParameter("type", reference.getType()); return !q.getResultList().isEmpty(); diff --git a/mycore-base/src/main/java/org/mycore/datamodel/classifications2/impl/MCRCategoryDAOImpl.java b/mycore-base/src/main/java/org/mycore/datamodel/classifications2/impl/MCRCategoryDAOImpl.java index 38742ebe32..4dc1fe3b9b 100644 --- a/mycore-base/src/main/java/org/mycore/datamodel/classifications2/impl/MCRCategoryDAOImpl.java +++ b/mycore-base/src/main/java/org/mycore/datamodel/classifications2/impl/MCRCategoryDAOImpl.java @@ -264,7 +264,7 @@ public List getParents(MCRCategoryID id) { Query parentQuery = entityManager .createNamedQuery(NAMED_QUERY_NAMESPACE + "parentQuery") .setParameter("classID", id.getRootID()) - .setParameter("categID", id.getID()) + .setParameter("categID", id.getId()) .setParameter("left", leftRight.leftValue) .setParameter("right", leftRight.rightValue); @SuppressWarnings("unchecked") @@ -616,7 +616,7 @@ public static MCRCategoryImpl getByNaturalID(EntityManager entityManager, MCRCat TypedQuery naturalIDQuery = entityManager .createNamedQuery(NAMED_QUERY_NAMESPACE + "byNaturalId", MCRCategoryImpl.class) .setParameter("classID", id.getRootID()) - .setParameter("categID", id.getID()); + .setParameter("categID", id.getId()); return getSingleResult(naturalIDQuery); } @@ -650,7 +650,7 @@ private static int getNumberOfChildren(EntityManager entityManager, MCRCategoryI return getSingleResult(entityManager .createNamedQuery(NAMED_QUERY_NAMESPACE + "childCount") .setParameter("classID", id.getRootID()) - .setParameter("categID", id.getID())); + .setParameter("categID", id.getId())); } private static void updateLeftRightValue(EntityManager entityManager, String classID, int left, diff --git a/mycore-base/src/main/java/org/mycore/datamodel/classifications2/impl/MCRCategoryImpl.java b/mycore-base/src/main/java/org/mycore/datamodel/classifications2/impl/MCRCategoryImpl.java index e38ec25e9a..f4ce1a783d 100644 --- a/mycore-base/src/main/java/org/mycore/datamodel/classifications2/impl/MCRCategoryImpl.java +++ b/mycore-base/src/main/java/org/mycore/datamodel/classifications2/impl/MCRCategoryImpl.java @@ -269,7 +269,7 @@ private int getPositionInParentByID() { .getChildren() .stream() .map(MCRCategory::getId) - .map(MCRCategoryID::getID) + .map(MCRCategoryID::getId) .collect(Collectors.joining(", "))); } @@ -465,14 +465,14 @@ public void setRootID(String rootID) { if (getId() == null) { setId(MCRCategoryID.rootID(rootID)); } else if (!getId().getRootID().equals(rootID)) { - setId(new MCRCategoryID(rootID, getId().getID())); + setId(new MCRCategoryID(rootID, getId().getId())); } } public void setCategID(String categID) { if (getId() == null) { setId(new MCRCategoryID(null, categID)); - } else if (!getId().getID().equals(categID)) { + } else if (!getId().getId().equals(categID)) { setId(new MCRCategoryID(getId().getRootID(), categID)); } } diff --git a/mycore-base/src/main/java/org/mycore/datamodel/classifications2/model/MCRClassCategory.java b/mycore-base/src/main/java/org/mycore/datamodel/classifications2/model/MCRClassCategory.java index 8a66522ee0..139a00107c 100644 --- a/mycore-base/src/main/java/org/mycore/datamodel/classifications2/model/MCRClassCategory.java +++ b/mycore-base/src/main/java/org/mycore/datamodel/classifications2/model/MCRClassCategory.java @@ -100,7 +100,7 @@ public void setID(String value) { public static MCRClassCategory getInstance(MCRCategory from) { MCRClassCategory categ = new MCRClassCategory(); MCRCategoryID categoryID = from.getId(); - categ.setID(categoryID.isRootID() ? categoryID.getRootID() : categoryID.getID()); + categ.setID(categoryID.isRootID() ? categoryID.getRootID() : categoryID.getId()); categ.setUrl(MCRClassURL.getInstance(from.getURI())); categ.getCategory() .addAll(getInstance(from.getChildren())); diff --git a/mycore-base/src/main/java/org/mycore/datamodel/classifications2/utils/MCRCategoryTransformer.java b/mycore-base/src/main/java/org/mycore/datamodel/classifications2/utils/MCRCategoryTransformer.java index d1e0c443a5..d19cc5f487 100644 --- a/mycore-base/src/main/java/org/mycore/datamodel/classifications2/utils/MCRCategoryTransformer.java +++ b/mycore-base/src/main/java/org/mycore/datamodel/classifications2/utils/MCRCategoryTransformer.java @@ -151,7 +151,7 @@ static Document getDocument(MCRCategory cl, Map countMap) static Element getElement(MCRCategory category, Map countMap) { Element ce = new Element("category"); - ce.setAttribute("ID", category.getId().getID()); + ce.setAttribute("ID", category.getId().getId()); Number number = countMap == null ? null : countMap.get(category.getId()); if (number != null) { ce.setAttribute("counter", Integer.toString(number.intValue())); @@ -246,7 +246,7 @@ void addChildren(Element parent, MCRCategory category) { } Element ce = new Element("item"); - ce.setAttribute("value", completeId ? category.getId().toString() : category.getId().getID()); + ce.setAttribute("value", completeId ? category.getId().toString() : category.getId().getId()); parent.addContent(ce); for (MCRLabel label : category.getLabels()) { @@ -273,7 +273,7 @@ void addLabel(Element item, MCRLabel label, MCRCategory cat) { } catch (RuntimeException e) { throw new RuntimeException("Error while inserting '" + labtext + "' into: " + labelFormat, e); } - text = ID_PATTERN.matcher(text).replaceAll(cat.getId().getID()); + text = ID_PATTERN.matcher(text).replaceAll(cat.getId().getId()); text = DESCR_PATTERN.matcher(text) .replaceAll(label.getDescription().replace("\\", "\\\\").replace("$", "\\$")); int num = countMap == null ? -1 : countMap.get(cat.getId()).intValue(); diff --git a/mycore-base/src/main/java/org/mycore/datamodel/classifications2/utils/MCRSkosTransformer.java b/mycore-base/src/main/java/org/mycore/datamodel/classifications2/utils/MCRSkosTransformer.java index b93f1895a5..4deaf4abcf 100644 --- a/mycore-base/src/main/java/org/mycore/datamodel/classifications2/utils/MCRSkosTransformer.java +++ b/mycore-base/src/main/java/org/mycore/datamodel/classifications2/utils/MCRSkosTransformer.java @@ -177,7 +177,7 @@ private static String retrieveURI(MCRCategory categ) { return MCRFrontendUtil.getBaseURL() + "open-data/classification/" + categ.getId().getRootID(); } return MCRFrontendUtil.getBaseURL() + "open-data/classification/" + categ.getId().getRootID() + "/" - + categ.getId().getID(); + + categ.getId().getId(); } } diff --git a/mycore-base/src/main/java/org/mycore/datamodel/language/MCRLanguageFactory.java b/mycore-base/src/main/java/org/mycore/datamodel/language/MCRLanguageFactory.java index e46dd14a5c..9cd4586199 100644 --- a/mycore-base/src/main/java/org/mycore/datamodel/language/MCRLanguageFactory.java +++ b/mycore-base/src/main/java/org/mycore/datamodel/language/MCRLanguageFactory.java @@ -249,7 +249,7 @@ private void buildLanguagesFromClassification() { * Builds a new language object from the given category */ private void buildLanguage(MCRCategory category) { - String xmlCode = category.getId().getID(); + String xmlCode = category.getId().getId(); String termCode = category.getLabel("x-term").map(MCRLabel::getText).orElse(null); String biblCode = category.getLabel("x-bibl").map(MCRLabel::getText).orElse(termCode); diff --git a/mycore-base/src/main/java/org/mycore/datamodel/metadata/MCRDerivateDefaultClassEventHandler.java b/mycore-base/src/main/java/org/mycore/datamodel/metadata/MCRDerivateDefaultClassEventHandler.java index 0708a264c4..41d69d5bde 100644 --- a/mycore-base/src/main/java/org/mycore/datamodel/metadata/MCRDerivateDefaultClassEventHandler.java +++ b/mycore-base/src/main/java/org/mycore/datamodel/metadata/MCRDerivateDefaultClassEventHandler.java @@ -44,7 +44,7 @@ public class MCRDerivateDefaultClassEventHandler extends MCREventHandlerBase { private static MCRMetaClassification asMetaClassification(MCRCategoryID categoryId) { return new MCRMetaClassification("classification", 0, null, - categoryId.getRootID(), categoryId.getID()); + categoryId.getRootID(), categoryId.getId()); } @Override diff --git a/mycore-base/src/main/java/org/mycore/datamodel/metadata/MCREditableMetaEnrichedLinkID.java b/mycore-base/src/main/java/org/mycore/datamodel/metadata/MCREditableMetaEnrichedLinkID.java index 876353f389..694b428dac 100644 --- a/mycore-base/src/main/java/org/mycore/datamodel/metadata/MCREditableMetaEnrichedLinkID.java +++ b/mycore-base/src/main/java/org/mycore/datamodel/metadata/MCREditableMetaEnrichedLinkID.java @@ -39,7 +39,7 @@ public void setClassifications(List list) { list.stream().map(clazz -> { final Element classElement = new Element(CLASSIFICATION_ELEMENT_NAME); classElement.setAttribute(CLASSID_ATTRIBUTE_NAME, clazz.getRootID()); - classElement.setAttribute(CATEGID_ATTRIBUTE_NAME, clazz.getID()); + classElement.setAttribute(CATEGID_ATTRIBUTE_NAME, clazz.getId()); return classElement; }).forEach(getContentList()::add); } diff --git a/mycore-base/src/main/java/org/mycore/datamodel/metadata/MCRMetaClassification.java b/mycore-base/src/main/java/org/mycore/datamodel/metadata/MCRMetaClassification.java index af7808a056..2e409491b1 100644 --- a/mycore-base/src/main/java/org/mycore/datamodel/metadata/MCRMetaClassification.java +++ b/mycore-base/src/main/java/org/mycore/datamodel/metadata/MCRMetaClassification.java @@ -116,7 +116,7 @@ public final String getClassId() { * @return the categId */ public final String getCategId() { - return category.getID(); + return category.getId(); } /** @@ -186,7 +186,7 @@ public Element createXML() throws MCRException { public JsonObject createJSON() { JsonObject obj = super.createJSON(); obj.addProperty("classid", category.getRootID()); - obj.addProperty("categid", category.getID()); + obj.addProperty("categid", category.getId()); return obj; } diff --git a/mycore-base/src/main/java/org/mycore/datamodel/metadata/MCRObjectService.java b/mycore-base/src/main/java/org/mycore/datamodel/metadata/MCRObjectService.java index e53c612823..bc78698ccb 100644 --- a/mycore-base/src/main/java/org/mycore/datamodel/metadata/MCRObjectService.java +++ b/mycore-base/src/main/java/org/mycore/datamodel/metadata/MCRObjectService.java @@ -856,8 +856,8 @@ public final JsonObject createJSON() { // state Optional.ofNullable(getState()).ifPresent(stateId -> { JsonObject state = new JsonObject(); - if (stateId.getID() != null) { - state.addProperty("id", stateId.getID()); + if (stateId.getId() != null) { + state.addProperty("id", stateId.getId()); } state.addProperty("rootId", stateId.getRootID()); }); @@ -1262,7 +1262,7 @@ public final void addClassification(String type, MCRCategoryID value) { */ public final void replaceClassification(int index, MCRCategoryID value) throws IndexOutOfBoundsException { updateClassification(index, - classificationValue -> classificationValue.setValue(value.getRootID(), value.getID())); + classificationValue -> classificationValue.setValue(value.getRootID(), value.getId())); } /** diff --git a/mycore-base/src/main/java/org/mycore/datamodel/metadata/history/MCRMetadataHistoryManager.java b/mycore-base/src/main/java/org/mycore/datamodel/metadata/history/MCRMetadataHistoryManager.java index 9cb557ec0c..5df0bcc93b 100644 --- a/mycore-base/src/main/java/org/mycore/datamodel/metadata/history/MCRMetadataHistoryManager.java +++ b/mycore-base/src/main/java/org/mycore/datamodel/metadata/history/MCRMetadataHistoryManager.java @@ -187,7 +187,7 @@ static boolean objectIsHidden(MCRObject obj) { LogManager.getLogger().debug("{} is visible as it does not use a service state.", obj.getId()); return false; } - boolean hidden = !"published".equals(state.getID()); + boolean hidden = !"published".equals(state.getId()); LogManager.getLogger().debug("{} is hidden due to service state '{}': {}", obj.getId(), state, hidden); return hidden; } diff --git a/mycore-base/src/main/java/org/mycore/frontend/cli/MCRClassification2Commands.java b/mycore-base/src/main/java/org/mycore/frontend/cli/MCRClassification2Commands.java index 25fae8d300..77097b336b 100644 --- a/mycore-base/src/main/java/org/mycore/frontend/cli/MCRClassification2Commands.java +++ b/mycore-base/src/main/java/org/mycore/frontend/cli/MCRClassification2Commands.java @@ -360,7 +360,7 @@ private static void listCategory(MCRCategory categ) { int level = categ.getLevel(); String space = " ".repeat(level * 2); if (categ.isCategory()) { - LOGGER.info("{} ID : {}", space, categ.getId().getID()); + LOGGER.info("{} ID : {}", space, categ.getId().getId()); } for (MCRLabel label : categ.getLabels()) { LOGGER.info("{} Label : ({}) {}", space, label.getLang(), label.getText()); diff --git a/mycore-base/src/main/java/org/mycore/frontend/cli/MCRDerivateCommands.java b/mycore-base/src/main/java/org/mycore/frontend/cli/MCRDerivateCommands.java index 2a5e9aeece..d2c32299e2 100644 --- a/mycore-base/src/main/java/org/mycore/frontend/cli/MCRDerivateCommands.java +++ b/mycore-base/src/main/java/org/mycore/frontend/cli/MCRDerivateCommands.java @@ -847,7 +847,7 @@ public static void setClassificationOfDerivate(String derivateIDStr, String cate final String nonExistingCategoriesCommaList = derivateTypes.stream() .filter(Predicate.not(categoryDAO::exist)) - .map(MCRCategoryID::getID) + .map(MCRCategoryID::getId) .collect(Collectors.joining(", ")); if (!nonExistingCategoriesCommaList.isEmpty()) { throw new MCRPersistenceException("Categories do not exist: " + nonExistingCategoriesCommaList); @@ -860,7 +860,7 @@ public static void setClassificationOfDerivate(String derivateIDStr, String cate .addAll( derivateTypes.stream() .map(categoryID -> new MCRMetaClassification("classification", 0, null, categoryID.getRootID(), - categoryID.getID())) + categoryID.getId())) .collect(Collectors.toList())); MCRMetadataManager.update(derivate); } diff --git a/mycore-base/src/main/java/org/mycore/frontend/fileupload/MCRUploadHelper.java b/mycore-base/src/main/java/org/mycore/frontend/fileupload/MCRUploadHelper.java index db52e9a401..99b843d6c1 100644 --- a/mycore-base/src/main/java/org/mycore/frontend/fileupload/MCRUploadHelper.java +++ b/mycore-base/src/main/java/org/mycore/frontend/fileupload/MCRUploadHelper.java @@ -323,7 +323,7 @@ public static List getClassifications(String classificati return categoryIDS.stream() .map(category -> new MCRMetaClassification("classification", 0, null, category.getRootID(), - category.getID())) + category.getId())) .collect(Collectors.toList()); } diff --git a/mycore-base/src/test/java/org/mycore/datamodel/classifications2/MCRCategoryIDTest.java b/mycore-base/src/test/java/org/mycore/datamodel/classifications2/MCRCategoryIDTest.java index 01aeb08a4c..e9491a526d 100644 --- a/mycore-base/src/test/java/org/mycore/datamodel/classifications2/MCRCategoryIDTest.java +++ b/mycore-base/src/test/java/org/mycore/datamodel/classifications2/MCRCategoryIDTest.java @@ -48,7 +48,7 @@ public void testMCRCategoryIDStringString() { MCRCategoryID categID; categID = new MCRCategoryID(validRootID, validCategID); assertEquals("RootIDs do not match", validRootID, categID.getRootID()); - assertEquals("CategIDs do not match", validCategID, categID.getID()); + assertEquals("CategIDs do not match", validCategID, categID.getId()); } @Test diff --git a/mycore-classbrowser/src/main/java/org/mycore/frontend/servlets/MCRClassificationBrowser2.java b/mycore-classbrowser/src/main/java/org/mycore/frontend/servlets/MCRClassificationBrowser2.java index a70c7f367d..06e01f46ba 100644 --- a/mycore-classbrowser/src/main/java/org/mycore/frontend/servlets/MCRClassificationBrowser2.java +++ b/mycore-classbrowser/src/main/java/org/mycore/frontend/servlets/MCRClassificationBrowser2.java @@ -104,7 +104,7 @@ private Element getClassificationBrowserData(HttpServletRequest req, Settings se Optional queryAdapter = configureQueryAdapter(req, settings, xml); Function toIdSearchValue = settings.addClassId() ? MCRCategoryID::toString - : MCRCategoryID::getID; + : MCRCategoryID::getId; List data = new ArrayList<>(); for (MCRCategory child : category.getChildren()) { queryAdapter.ifPresent(qa -> qa.setCategory(toIdSearchValue.apply(child.getId()))); @@ -116,7 +116,7 @@ private Element getClassificationBrowserData(HttpServletRequest req, Settings se if ((settings.removeEmptyLeaves()) && (numResults < 1)) { continue; } - if(settings.excludeCategories().contains(child.getId().getID())) { + if(settings.excludeCategories().contains(child.getId().getId())) { continue; } @@ -139,7 +139,7 @@ private Element getCategoryElement(MCRCategory category, long numResults, categoryE.setAttribute("numResults", String.valueOf(numResults)); } - categoryE.setAttribute("id", category.getId().getID()); + categoryE.setAttribute("id", category.getId().getId()); categoryE.setAttribute("children", Boolean.toString(category.hasChildren())); if (settings.addUri() && (category.getURI() != null)) { diff --git a/mycore-classeditor/src/main/java/org/mycore/frontend/classeditor/MCRCategoryIDTypeAdapter.java b/mycore-classeditor/src/main/java/org/mycore/frontend/classeditor/MCRCategoryIDTypeAdapter.java index ab98111c44..7240acf324 100644 --- a/mycore-classeditor/src/main/java/org/mycore/frontend/classeditor/MCRCategoryIDTypeAdapter.java +++ b/mycore-classeditor/src/main/java/org/mycore/frontend/classeditor/MCRCategoryIDTypeAdapter.java @@ -50,7 +50,7 @@ public MCRCategoryID deserialize(JsonElement json, Type typeOfT, JsonDeserializa @Override public JsonElement serialize(MCRCategoryID id, Type typeOfSrc, JsonSerializationContext context) { String rootID = id.getRootID(); - String categID = id.getID(); + String categID = id.getId(); JsonObject idJsonObj = new JsonObject(); idJsonObj.addProperty(PROP_ROOTID, rootID); diff --git a/mycore-classeditor/src/main/java/org/mycore/frontend/classeditor/resources/MCRClassificationEditorResource.java b/mycore-classeditor/src/main/java/org/mycore/frontend/classeditor/resources/MCRClassificationEditorResource.java index 05df27277b..7fd498e051 100644 --- a/mycore-classeditor/src/main/java/org/mycore/frontend/classeditor/resources/MCRClassificationEditorResource.java +++ b/mycore-classeditor/src/main/java/org/mycore/frontend/classeditor/resources/MCRClassificationEditorResource.java @@ -373,7 +373,7 @@ protected String buildJsonError(String errorType, MCRCategoryID mcrCategoryID) { JsonObject error = new JsonObject(); error.addProperty("type", errorType); error.addProperty("rootid", mcrCategoryID.getRootID()); - error.addProperty("categid", mcrCategoryID.getID()); + error.addProperty("categid", mcrCategoryID.getId()); return gson.toJson(error); } diff --git a/mycore-classeditor/src/main/java/org/mycore/frontend/classeditor/utils/MCRCategUtils.java b/mycore-classeditor/src/main/java/org/mycore/frontend/classeditor/utils/MCRCategUtils.java index 8e24ce1320..f5607d0ead 100644 --- a/mycore-classeditor/src/main/java/org/mycore/frontend/classeditor/utils/MCRCategUtils.java +++ b/mycore-classeditor/src/main/java/org/mycore/frontend/classeditor/utils/MCRCategUtils.java @@ -43,7 +43,7 @@ public static MCRCategory newCategory(MCRCategoryID id, SortedSet labe public static String maskCategID(MCRCategoryID categoryID) { String rootID = categoryID.getRootID(); - String id = categoryID.getID(); + String id = categoryID.getId(); return rootID + "." + (id == null ? "" : id); } diff --git a/mycore-classeditor/src/test/java/org/mycore/frontend/classeditor/resources/MCRClassificationEditorResourceTest.java b/mycore-classeditor/src/test/java/org/mycore/frontend/classeditor/resources/MCRClassificationEditorResourceTest.java index 5fc34d23ba..976d0ce0e4 100644 --- a/mycore-classeditor/src/test/java/org/mycore/frontend/classeditor/resources/MCRClassificationEditorResourceTest.java +++ b/mycore-classeditor/src/test/java/org/mycore/frontend/classeditor/resources/MCRClassificationEditorResourceTest.java @@ -144,7 +144,7 @@ public void getSingleCategory() { for (MCRCategory mcrCategory : categs) { MCRCategoryID id = mcrCategory.getId(); String path = id.getRootID(); - String categID = id.getID(); + String categID = id.getId(); if (categID != null && !Objects.equals(categID, "")) { path = path + "/" + categID; } diff --git a/mycore-mods/src/main/java/org/mycore/mods/classification/MCRAuthorityWithURI.java b/mycore-mods/src/main/java/org/mycore/mods/classification/MCRAuthorityWithURI.java index bc49a4274e..87d10f8d36 100644 --- a/mycore-mods/src/main/java/org/mycore/mods/classification/MCRAuthorityWithURI.java +++ b/mycore-mods/src/main/java/org/mycore/mods/classification/MCRAuthorityWithURI.java @@ -118,7 +118,7 @@ static Collection getCategoryByURI(final String uri) { * Returns the value URI for the given category and authority URI */ protected static String getValueURI(MCRCategory category, String authorityURI) { - String defaultURI = authorityURI + "#" + category.getId().getID(); + String defaultURI = authorityURI + "#" + category.getId().getId(); return getLabel(category, LABEL_LANG_URI, defaultURI); } diff --git a/mycore-mods/src/main/java/org/mycore/mods/classification/MCRClassMapper.java b/mycore-mods/src/main/java/org/mycore/mods/classification/MCRClassMapper.java index 4bdcea1de0..1439c0053e 100644 --- a/mycore-mods/src/main/java/org/mycore/mods/classification/MCRClassMapper.java +++ b/mycore-mods/src/main/java/org/mycore/mods/classification/MCRClassMapper.java @@ -156,7 +156,7 @@ private static MCRAuthorityInfo getAuthInfo(MCRCategoryID categID, String elemen if (authInfo == null) { if (elementLocalName.equals(TYPE_OF_RESOURCE) && categID.getRootID().equals(MCRTypeOfResource.TYPE_OF_RESOURCE)) { - authInfo = new MCRTypeOfResource(categID.getID().replace('_', ' ')); + authInfo = new MCRTypeOfResource(categID.getId().replace('_', ' ')); } else if (elementLocalName.equals(ACCESS_CONDITION)) { String authURI = getAuthorityURI(categID.getRootID()); String valueURI = MCRAuthorityWithURI.getValueURI(DAO.getCategory(categID, 0), authURI); @@ -164,7 +164,7 @@ private static MCRAuthorityInfo getAuthInfo(MCRCategoryID categID, String elemen } else if (SUPPORTED.contains(elementLocalName)) { String authority = getAuthority(categID.getRootID()); if (authority != null) { - authInfo = new MCRAuthorityAndCode(authority, categID.getID()); + authInfo = new MCRAuthorityAndCode(authority, categID.getId()); } else { String authURI = getAuthorityURI(categID.getRootID()); String valueURI = MCRAuthorityWithURI.getValueURI(DAO.getCategory(categID, 0), authURI); diff --git a/mycore-mods/src/main/java/org/mycore/mods/classification/MCRMODSClassificationSupport.java b/mycore-mods/src/main/java/org/mycore/mods/classification/MCRMODSClassificationSupport.java index 94fbd2f723..4549df1c50 100644 --- a/mycore-mods/src/main/java/org/mycore/mods/classification/MCRMODSClassificationSupport.java +++ b/mycore-mods/src/main/java/org/mycore/mods/classification/MCRMODSClassificationSupport.java @@ -110,7 +110,7 @@ public static String getClassCategLink(final NodeList sources) { String id; try { - id = MCRXMLFunctions.encodeURIPath(category.getID()); + id = MCRXMLFunctions.encodeURIPath(category.getId()); } catch (URISyntaxException e) { /* This should be impossible! */ throw new MCRException(e); @@ -133,7 +133,7 @@ public static String getClassCategParentLink(final NodeList sources) { String id; try { - id = MCRXMLFunctions.encodeURIPath(category.getID()); + id = MCRXMLFunctions.encodeURIPath(category.getId()); } catch (URISyntaxException e) { /* This should be impossible! */ throw new MCRException(e); diff --git a/mycore-mods/src/main/java/org/mycore/mods/classification/MCRModsClassificationURIResolver.java b/mycore-mods/src/main/java/org/mycore/mods/classification/MCRModsClassificationURIResolver.java index 9e77a13c54..4b99d4de03 100644 --- a/mycore-mods/src/main/java/org/mycore/mods/classification/MCRModsClassificationURIResolver.java +++ b/mycore-mods/src/main/java/org/mycore/mods/classification/MCRModsClassificationURIResolver.java @@ -130,7 +130,7 @@ public Source resolve(String href, String base) throws TransformerException { final Optional categoryURI = getAuthorityInfo(href) .map(MCRAuthorityInfo::getCategoryID) .map(category -> String.format(Locale.ROOT, "classification:metadata:0:parents:%s:%s", category.getRootID(), - category.getID())); + category.getId())); if (categoryURI.isPresent()) { LOGGER.debug("{} -> {}", href, categoryURI.get()); return MCRURIResolver.instance().resolve(categoryURI.get(), base); diff --git a/mycore-mods/src/main/java/org/mycore/mods/csl/MCRModsItemDataProvider.java b/mycore-mods/src/main/java/org/mycore/mods/csl/MCRModsItemDataProvider.java index 398bfbb5e6..f68e708495 100644 --- a/mycore-mods/src/main/java/org/mycore/mods/csl/MCRModsItemDataProvider.java +++ b/mycore-mods/src/main/java/org/mycore/mods/csl/MCRModsItemDataProvider.java @@ -320,7 +320,7 @@ protected String getGenreStringFromElement(Element genre) { if (categoryID == null) { return null; } - return categoryID.getID(); + return categoryID.getId(); } else { return genre.getText(); } diff --git a/mycore-orcid2/src/main/java/org/mycore/orcid2/MCRORCIDUtils.java b/mycore-orcid2/src/main/java/org/mycore/orcid2/MCRORCIDUtils.java index d56d76bc93..92f0203b1a 100644 --- a/mycore-orcid2/src/main/java/org/mycore/orcid2/MCRORCIDUtils.java +++ b/mycore-orcid2/src/main/java/org/mycore/orcid2/MCRORCIDUtils.java @@ -213,6 +213,6 @@ private static MCRIdentifier getIdentfierFromElement(Element element) { } private static Optional getStateValue(MCRObject object) { - return Optional.ofNullable(object.getService().getState()).map(MCRCategoryID::getID); + return Optional.ofNullable(object.getService().getState()).map(MCRCategoryID::getId); } } diff --git a/mycore-pi/src/main/java/org/mycore/pi/condition/MCRPIStatePredicateBase.java b/mycore-pi/src/main/java/org/mycore/pi/condition/MCRPIStatePredicateBase.java index 75af004cb3..34a3b8fd4c 100644 --- a/mycore-pi/src/main/java/org/mycore/pi/condition/MCRPIStatePredicateBase.java +++ b/mycore-pi/src/main/java/org/mycore/pi/condition/MCRPIStatePredicateBase.java @@ -30,7 +30,7 @@ public abstract class MCRPIStatePredicateBase extends MCRPIPredicateBase @Override public final boolean test(MCRBase base) { return Optional.ofNullable(base.getService().getState()) - .map(state -> state.getID().equals(getRequiredState())) + .map(state -> state.getId().equals(getRequiredState())) .orElse(false); } diff --git a/mycore-restapi/src/main/java/org/mycore/restapi/v2/MCREventHandler.java b/mycore-restapi/src/main/java/org/mycore/restapi/v2/MCREventHandler.java index 329d70c13f..17a5ff961a 100644 --- a/mycore-restapi/src/main/java/org/mycore/restapi/v2/MCREventHandler.java +++ b/mycore-restapi/src/main/java/org/mycore/restapi/v2/MCREventHandler.java @@ -144,7 +144,7 @@ private JsonObject getData(MCRObject obj) { event.addProperty("id", obj.getId().toString()); event.addProperty("uri", uriResolver.apply(getPathURI("objects/" + obj.getId())).toString()); Optional.ofNullable(obj.getService().getState()) - .ifPresent(s -> event.addProperty("state", s.getID())); + .ifPresent(s -> event.addProperty("state", s.getId())); copyFlagToProperty(obj, event, "createdby", "createdBy"); copyServiceDateToProperty(obj, event, "createdate", "created"); copyFlagToProperty(obj, event, "modifiedby", "modifiedBy"); diff --git a/mycore-restapi/src/main/java/org/mycore/restapi/v2/MCRRestObjects.java b/mycore-restapi/src/main/java/org/mycore/restapi/v2/MCRRestObjects.java index 86a9d5570a..cd2c378600 100644 --- a/mycore-restapi/src/main/java/org/mycore/restapi/v2/MCRRestObjects.java +++ b/mycore-restapi/src/main/java/org/mycore/restapi/v2/MCRRestObjects.java @@ -870,7 +870,7 @@ public Response getState(@PathParam(PARAM_MCRID) MCRObjectID id) { return Response.noContent().build(); } return Response.temporaryRedirect( - uriInfo.resolve(URI.create("classifications/" + state.getRootID() + "/" + state.getID()))) + uriInfo.resolve(URI.create("classifications/" + state.getRootID() + "/" + state.getId()))) .build(); } diff --git a/mycore-solr/src/main/java/org/mycore/solr/classification/MCRSolrCategory.java b/mycore-solr/src/main/java/org/mycore/solr/classification/MCRSolrCategory.java index 06d5e12824..e2487d34b8 100644 --- a/mycore-solr/src/main/java/org/mycore/solr/classification/MCRSolrCategory.java +++ b/mycore-solr/src/main/java/org/mycore/solr/classification/MCRSolrCategory.java @@ -44,7 +44,7 @@ public SolrInputDocument toSolrDocument() { doc.setField("classification", id.getRootID()); doc.setField("type", "node"); if (category.isCategory()) { - doc.setField("category", id.getID()); + doc.setField("category", id.getId()); } // labels Set labels = category.getLabels(); diff --git a/mycore-user2/src/main/java/org/mycore/user2/MCRRoleManager.java b/mycore-user2/src/main/java/org/mycore/user2/MCRRoleManager.java index cdd6cb8693..7be4bb629f 100644 --- a/mycore-user2/src/main/java/org/mycore/user2/MCRRoleManager.java +++ b/mycore-user2/src/main/java/org/mycore/user2/MCRRoleManager.java @@ -75,7 +75,7 @@ private static void loadSystemRoles() { rolesList.clear(); if (roleCategory != null) { for (MCRCategory child : roleCategory.getChildren()) { - String name = child.getId().getID(); + String name = child.getId().getId(); MCRRole role = new MCRRole(name, child.getLabels()); rolesByName.put(name, role); rolesList.add(role); diff --git a/mycore-user2/src/main/java/org/mycore/user2/MCRRoleServlet.java b/mycore-user2/src/main/java/org/mycore/user2/MCRRoleServlet.java index 94c1fbe823..c315631a02 100644 --- a/mycore-user2/src/main/java/org/mycore/user2/MCRRoleServlet.java +++ b/mycore-user2/src/main/java/org/mycore/user2/MCRRoleServlet.java @@ -119,7 +119,7 @@ private Collection getRoleElements() { if (category == null) { continue; } - role.setAttribute("label", category.getCurrentLabel().map(MCRLabel::getText).orElse(categID.getID())); + role.setAttribute("label", category.getCurrentLabel().map(MCRLabel::getText).orElse(categID.getId())); list.add(role); } return list; @@ -143,7 +143,7 @@ private static void chooseCategory(HttpServletRequest request) { Element rootElement = getRootElement(request); rootElement.setAttribute("classID", categoryID.getRootID()); if (!categoryID.isRootID()) { - rootElement.setAttribute("categID", categoryID.getID()); + rootElement.setAttribute("categID", categoryID.getId()); } request.setAttribute(LAYOUT_ELEMENT_KEY, new Document(rootElement)); } diff --git a/mycore-user2/src/main/java/org/mycore/user2/MCRUserManager.java b/mycore-user2/src/main/java/org/mycore/user2/MCRUserManager.java index dfa755666f..8ece4f353d 100644 --- a/mycore-user2/src/main/java/org/mycore/user2/MCRUserManager.java +++ b/mycore-user2/src/main/java/org/mycore/user2/MCRUserManager.java @@ -153,7 +153,7 @@ private static MCRUser setRoles(MCRUser mcrUser) { mcrUser.getExternalRoleIDs().clear(); for (MCRCategoryID roleID : roleIDs) { if (roleID.getRootID().equals(MCRUser2Constants.ROLE_CLASSID.getRootID())) { - mcrUser.getSystemRoleIDs().add(roleID.getID()); + mcrUser.getSystemRoleIDs().add(roleID.getId()); } else { mcrUser.getExternalRoleIDs().add(roleID.toString()); } diff --git a/mycore-wfc/src/main/java/org/mycore/wfc/actionmapping/MCRCategoryCondition.java b/mycore-wfc/src/main/java/org/mycore/wfc/actionmapping/MCRCategoryCondition.java index 5edf4c59b2..e1687d207b 100644 --- a/mycore-wfc/src/main/java/org/mycore/wfc/actionmapping/MCRCategoryCondition.java +++ b/mycore-wfc/src/main/java/org/mycore/wfc/actionmapping/MCRCategoryCondition.java @@ -64,7 +64,7 @@ public boolean evaluate(MCRWorkflowData workflowData) { @Override public String toString() { - return fieldName + (not ? " != " : " = ") + mcrCategoryID.getID() + " "; + return fieldName + (not ? " != " : " = ") + mcrCategoryID.getId() + " "; } /* (non-Javadoc) @@ -75,7 +75,7 @@ public Element toXML() { Element cond = new Element("condition"); cond.setAttribute("field", fieldName); cond.setAttribute("operator", (not ? "!=" : "=")); - cond.setAttribute("value", mcrCategoryID.getID()); + cond.setAttribute("value", mcrCategoryID.getId()); return cond; } diff --git a/mycore-wfc/src/main/java/org/mycore/wfc/actionmapping/MCRClassificationUtils.java b/mycore-wfc/src/main/java/org/mycore/wfc/actionmapping/MCRClassificationUtils.java index 538c980a7c..bd19ed4e06 100644 --- a/mycore-wfc/src/main/java/org/mycore/wfc/actionmapping/MCRClassificationUtils.java +++ b/mycore-wfc/src/main/java/org/mycore/wfc/actionmapping/MCRClassificationUtils.java @@ -60,7 +60,7 @@ private static String getCollectionFromObject(MCRObjectID mcrObjectID) { .filter(categID -> categID.getRootID() .equals(MCRConstants.COLLECTION_CLASS_ID.getRootID())) .findFirst() - .map(MCRCategoryID::getID) + .map(MCRCategoryID::getId) .orElse(null); } diff --git a/mycore-wfc/src/main/java/org/mycore/wfc/actionmapping/MCRURLRetriever.java b/mycore-wfc/src/main/java/org/mycore/wfc/actionmapping/MCRURLRetriever.java index be684a9142..e113248db9 100644 --- a/mycore-wfc/src/main/java/org/mycore/wfc/actionmapping/MCRURLRetriever.java +++ b/mycore-wfc/src/main/java/org/mycore/wfc/actionmapping/MCRURLRetriever.java @@ -148,6 +148,6 @@ private static String getParentCollection(String collection) { if (parents == null || parents.isEmpty()) { return null; } - return parents.iterator().next().getId().getID(); + return parents.iterator().next().getId().getId(); } }