You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(pid): change business logic for DataverseServiceBean.wantsDatasetVersionPids
- Incorporate feedback from first review
- Switch to model where admin sets limits but the collections can override but not exceed the limit
- Use admin settings as defaults if collection chain does not provide a choice now
- Also add unit testing for business logic
See also #9462 (comment)
See also #9462 (comment)
// Check the collection itself; and potentially it's ancestors
955
+
Dataversec = collection;
956
+
while (c != null) {
957
+
// Note: the default behavior is INHERIT for the model class
958
+
switch (c.getDatasetVersionPidConduct()) {
959
+
caseSKIP:
960
+
logger.log(Level.FINE, "Collection {0} makes {1} skip version PIDs", newString[]{c.getAlias(), collection.getAlias()});
961
+
returnfalse;
962
+
caseMAJOR:
963
+
logger.log(Level.FINE, "Collection {0} allows its sub {1} PIDs for major versions", newString[]{c.getAlias(), collection.getAlias()});
964
+
return !willBeMinorVersion;
965
+
caseMINOR:
966
+
if (vpm.equals(VersionPidMode.ALLOW_MINOR)) {
967
+
logger.log(Level.FINE, "Collection {0} allows its sub {1} PIDs for minor versions", newString[]{c.getAlias(), collection.getAlias()});
968
+
returntrue;
969
+
} else {
970
+
// In some cases, an admin might have switched the setting after someone already activated it.
971
+
// The collection's conduct mode should be updated - we will still cap it as admin says no.
972
+
logger.log(Level.INFO, "Collection {0} allows its sub {1} PIDs for minor versions, which is disabled globally. Please update conduct mode of {0}.", newString[]{c.getAlias(), collection.getAlias()});
973
+
return !willBeMinorVersion;
974
+
}
975
+
caseINHERIT:
976
+
// Note: root dataverse has no owner, which will break the loop condition
977
+
c = c.getOwner();
978
+
}
965
979
}
966
-
returnfalse;
980
+
981
+
// If the root dataverse did also not have a policy set, use what the admin configured.
982
+
// Note: one could argue we should just return true here, as the below boolean expression is just the
983
+
// negation of the one at the top and the collections didn't intervene. But better safe than sorry...
0 commit comments