mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
Merged in CST-12463-coar-fix-checkstyle-issues (pull request #1246)
CST-12463 checkstyle! Approved-by: Andrea Bollini
This commit is contained in:
@@ -10,9 +10,8 @@ package org.dspace.app.rest.model;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
import org.dspace.app.rest.RestResourceController;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import org.dspace.app.rest.RestResourceController;
|
||||
|
||||
/**
|
||||
* The NotifyServiceEntity REST Resource
|
||||
@@ -113,6 +112,5 @@ public class NotifyServiceRest extends BaseObjectRest<Integer> {
|
||||
public void setScore(BigDecimal score) {
|
||||
this.score = score;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@@ -13,12 +13,10 @@ import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.List;
|
||||
import javax.servlet.ServletInputStream;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import org.dspace.app.ldn.NotifyServiceEntity;
|
||||
import org.dspace.app.ldn.NotifyServiceInboundPattern;
|
||||
import org.dspace.app.ldn.NotifyServiceOutboundPattern;
|
||||
@@ -39,10 +37,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.rest.webmvc.ResourceNotFoundException;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.server.ResponseStatusException;
|
||||
|
||||
/**
|
||||
* This is the repository responsible to manage NotifyService Rest object
|
||||
@@ -102,21 +98,21 @@ public class NotifyServiceRestRepository extends DSpaceRestRepository<NotifyServ
|
||||
throw new UnprocessableEntityException("Error parsing request body", e1);
|
||||
}
|
||||
|
||||
if(notifyServiceRest.getScore() != null) {
|
||||
if(notifyServiceRest.getScore().compareTo(java.math.BigDecimal.ZERO) == -1 ||
|
||||
if (notifyServiceRest.getScore() != null) {
|
||||
if (notifyServiceRest.getScore().compareTo(java.math.BigDecimal.ZERO) == -1 ||
|
||||
notifyServiceRest.getScore().compareTo(java.math.BigDecimal.ONE) == 1) {
|
||||
throw new UnprocessableEntityException(format("Score out of range [0, 1] %s",
|
||||
notifyServiceRest.getScore().setScale(4).toPlainString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NotifyServiceEntity notifyServiceEntity = notifyService.create(context);
|
||||
notifyServiceEntity.setName(notifyServiceRest.getName());
|
||||
notifyServiceEntity.setDescription(notifyServiceRest.getDescription());
|
||||
notifyServiceEntity.setUrl(notifyServiceRest.getUrl());
|
||||
notifyServiceEntity.setLdnUrl(notifyServiceRest.getLdnUrl());
|
||||
notifyServiceEntity.setEnabled(notifyServiceRest.isEnabled());
|
||||
|
||||
|
||||
if (notifyServiceRest.getNotifyServiceInboundPatterns() != null) {
|
||||
appendNotifyServiceInboundPatterns(context, notifyServiceEntity,
|
||||
notifyServiceRest.getNotifyServiceInboundPatterns());
|
||||
|
@@ -56,10 +56,10 @@ public class NotifyServiceScoreAddOperation extends PatchOperation<NotifyService
|
||||
BigDecimal scoreBigDecimal = null;
|
||||
try {
|
||||
scoreBigDecimal = new BigDecimal(score.toString());
|
||||
}catch(Exception e) {
|
||||
} catch (Exception e) {
|
||||
throw new DSpaceBadRequestException(format("Score out of range [0, 1] %s", score.toString()));
|
||||
}
|
||||
if(scoreBigDecimal.compareTo(java.math.BigDecimal.ZERO) == -1 ||
|
||||
if (scoreBigDecimal.compareTo(java.math.BigDecimal.ZERO) == -1 ||
|
||||
scoreBigDecimal.compareTo(java.math.BigDecimal.ONE) == 1) {
|
||||
throw new UnprocessableEntityException(format("Score out of range [0, 1] %s",
|
||||
scoreBigDecimal.setScale(4).toPlainString()));
|
||||
|
@@ -54,11 +54,11 @@ public class NotifyServiceScoreReplaceOperation extends PatchOperation<NotifySer
|
||||
}
|
||||
BigDecimal scoreBigDecimal = null;
|
||||
try {
|
||||
scoreBigDecimal = new BigDecimal(score.toString());
|
||||
}catch(Exception e) {
|
||||
scoreBigDecimal = new BigDecimal(score.toString());
|
||||
} catch (Exception e) {
|
||||
throw new DSpaceBadRequestException(format("Score out of range [0, 1] %s", score));
|
||||
}
|
||||
if(scoreBigDecimal.compareTo(java.math.BigDecimal.ZERO) == -1 ||
|
||||
if (scoreBigDecimal.compareTo(java.math.BigDecimal.ZERO) == -1 ||
|
||||
scoreBigDecimal.compareTo(java.math.BigDecimal.ONE) == 1) {
|
||||
throw new UnprocessableEntityException(format("Score out of range [0, 1] %s", score));
|
||||
}
|
||||
|
@@ -31,9 +31,9 @@ import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.apache.commons.lang3.RandomUtils;
|
||||
import org.dspace.app.ldn.NotifyServiceEntity;
|
||||
import org.dspace.app.rest.model.NotifyServiceInboundPatternRest;
|
||||
@@ -49,8 +49,6 @@ import org.dspace.builder.NotifyServiceBuilder;
|
||||
import org.dspace.builder.NotifyServiceInboundPatternBuilder;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
/**
|
||||
* Integration test class for {@link NotifyServiceRestRepository}.
|
||||
*
|
||||
|
Reference in New Issue
Block a user