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