mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-19 07:53:08 +00:00
Replace miscellaneous rarely-used deprecateds. [#2956]
This commit is contained in:
@@ -12,8 +12,8 @@ import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.content.Item;
|
||||
@@ -349,11 +349,12 @@ public class DOIIdentifierProvider
|
||||
throw new DOIIdentifierException("Unable to find DOI.",
|
||||
DOIIdentifierException.DOI_DOES_NOT_EXIST);
|
||||
}
|
||||
if (!ObjectUtils.equals(doiRow.getDSpaceObject(), dso)) {
|
||||
if (!Objects.equals(doiRow.getDSpaceObject(), dso)) {
|
||||
log.error("Refuse to update metadata of DOI {} with the metadata of "
|
||||
+ " an object ({}/{}) the DOI is not dedicated to.",
|
||||
new String[] {doi, contentServiceFactory.getDSpaceObjectService(dso).getTypeText(dso), dso
|
||||
.getID().toString()});
|
||||
doi,
|
||||
contentServiceFactory.getDSpaceObjectService(dso).getTypeText(dso),
|
||||
dso.getID().toString());
|
||||
throw new DOIIdentifierException("Cannot update DOI metadata: "
|
||||
+ "DOI and DSpaceObject does not match!",
|
||||
DOIIdentifierException.MISMATCH);
|
||||
@@ -517,7 +518,7 @@ public class DOIIdentifierProvider
|
||||
|
||||
// check if DOI belongs to dso
|
||||
if (null != doiRow) {
|
||||
if (!ObjectUtils.equals(dso, doiRow.getDSpaceObject())) {
|
||||
if (!Objects.equals(dso, doiRow.getDSpaceObject())) {
|
||||
throw new DOIIdentifierException("Trying to delete a DOI out of "
|
||||
+ "an object that is not addressed by the DOI.",
|
||||
DOIIdentifierException.MISMATCH);
|
||||
@@ -793,9 +794,7 @@ public class DOIIdentifierProvider
|
||||
.addMetadata(context, item, MD_SCHEMA, DOI_ELEMENT, DOI_QUALIFIER, null, doiService.DOIToExternalForm(doi));
|
||||
try {
|
||||
itemService.update(context, item);
|
||||
} catch (SQLException ex) {
|
||||
throw ex;
|
||||
} catch (AuthorizeException ex) {
|
||||
} catch (SQLException | AuthorizeException ex) {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
@@ -821,7 +820,7 @@ public class DOIIdentifierProvider
|
||||
Item item = (Item) dso;
|
||||
|
||||
List<MetadataValue> metadata = itemService.getMetadata(item, MD_SCHEMA, DOI_ELEMENT, DOI_QUALIFIER, null);
|
||||
List<String> remainder = new ArrayList<String>();
|
||||
List<String> remainder = new ArrayList<>();
|
||||
|
||||
for (MetadataValue id : metadata) {
|
||||
if (!id.getValue().equals(doiService.DOIToExternalForm(doi))) {
|
||||
|
Reference in New Issue
Block a user