Skip to content

Commit

Permalink
Merged in task/dspace-cris-2023_02_x/DSC-2108 (pull request DSpace#3232)
Browse files Browse the repository at this point in the history
[DSC-2108]

Approved-by: Stefano Maffei
  • Loading branch information
vins01-4science committed Dec 23, 2024
2 parents 731e0d9 + a1cba28 commit 3146725
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import java.util.List;
import java.util.Objects;
import java.util.UUID;
import javax.ws.rs.NotAuthorizedException;

import de.undercouch.citeproc.helper.oauth.UnauthorizedException;
import org.dspace.content.DCDate;
import org.dspace.content.Item;
import org.dspace.content.MetadataValue;
Expand Down Expand Up @@ -70,7 +70,7 @@ public Version createNewVersion(Context c, Item item) {
public Version createNewVersion(Context c, Item item, String summary) {
try {
if (!itemService.canCreateNewVersion(c, item)) {
throw new UnauthorizedException("Current User is not allowed to create a new version of this item");
throw new NotAuthorizedException("Current User is not allowed to create a new version of this item");
}
VersionHistory vh = versionHistoryService.findByItem(c, item);
if (vh == null) {
Expand Down Expand Up @@ -199,10 +199,10 @@ public Version getVersion(Context c, Item item) throws SQLException {

@Override
public Version createNewVersion(Context context, VersionHistory history, Item item, String summary, Date date,
int versionNumber) throws UnauthorizedException {
int versionNumber) {
try {
if (!itemService.canCreateNewVersion(context, item)) {
throw new UnauthorizedException("Current User is not allowed to create a new version of this item");
throw new NotAuthorizedException("Current User is not allowed to create a new version of this item");
}
Version version = versionDAO.create(context, new Version());
if (versionNumber > 0 && !isVersionExist(context, item, versionNumber)) {
Expand Down Expand Up @@ -248,7 +248,7 @@ public List<Version> getVersionsByHistoryWithItems(Context c, VersionHistory vh,
// **** PROTECTED METHODS!!

protected Version createVersion(Context c, VersionHistory vh, Item item, String summary, Date date)
throws SQLException, UnauthorizedException {
throws SQLException {
return createNewVersion(c, vh, item, summary, date, getNextVersionNumer(c, vh));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import java.util.List;
import java.util.UUID;

import de.undercouch.citeproc.helper.oauth.UnauthorizedException;
import org.dspace.content.Item;
import org.dspace.core.Context;
import org.dspace.versioning.Version;
Expand Down Expand Up @@ -80,7 +79,7 @@ List<Version> getVersionsByHistoryWithItems(Context c, VersionHistory vh, int of
Version getVersion(Context c, Item item) throws SQLException;

Version createNewVersion(Context context, VersionHistory history, Item item, String summary, Date date,
int versionNumber) throws UnauthorizedException;
int versionNumber);

/**
* Update the Version
Expand Down

0 comments on commit 3146725

Please sign in to comment.