Fix dspace-api module per new code style

This commit is contained in:
Tim Donohue
2018-02-14 10:53:46 -06:00
parent 8ffc97f7f9
commit 8a48f782ea
1051 changed files with 53347 additions and 63373 deletions

View File

@@ -28,9 +28,10 @@ import org.springframework.beans.factory.annotation.Autowired;
* @author Robert Tansley
* @version $Revision$
*/
public class SubscribeServiceImpl implements SubscribeService
{
/** log4j logger */
public class SubscribeServiceImpl implements SubscribeService {
/**
* log4j logger
*/
private Logger log = Logger.getLogger(SubscribeServiceImpl.class);
@Autowired(required = true)
@@ -41,8 +42,7 @@ public class SubscribeServiceImpl implements SubscribeService
@Autowired(required = true)
protected CollectionService collectionService;
protected SubscribeServiceImpl()
{
protected SubscribeServiceImpl() {
}
@@ -53,77 +53,62 @@ public class SubscribeServiceImpl implements SubscribeService
@Override
public void subscribe(Context context, EPerson eperson,
Collection collection) throws SQLException, AuthorizeException
{
Collection collection) throws SQLException, AuthorizeException {
// Check authorisation. Must be administrator, or the eperson.
if (authorizeService.isAdmin(context)
|| ((context.getCurrentUser() != null) && (context
.getCurrentUser().getID().equals(eperson.getID()))))
{
|| ((context.getCurrentUser() != null) && (context
.getCurrentUser().getID().equals(eperson.getID())))) {
if (!isSubscribed(context, eperson, collection)) {
Subscription subscription = subscriptionDAO.create(context, new Subscription());
subscription.setCollection(collection);
subscription.setePerson(eperson);
}
}
else
{
} else {
throw new AuthorizeException(
"Only admin or e-person themselves can subscribe");
"Only admin or e-person themselves can subscribe");
}
}
@Override
public void unsubscribe(Context context, EPerson eperson,
Collection collection) throws SQLException, AuthorizeException
{
Collection collection) throws SQLException, AuthorizeException {
// Check authorisation. Must be administrator, or the eperson.
if (authorizeService.isAdmin(context)
|| ((context.getCurrentUser() != null) && (context
.getCurrentUser().getID().equals(eperson.getID()))))
{
if (collection == null)
{
|| ((context.getCurrentUser() != null) && (context
.getCurrentUser().getID().equals(eperson.getID())))) {
if (collection == null) {
// Unsubscribe from all
subscriptionDAO.deleteByEPerson(context, eperson);
}
else
{
} else {
subscriptionDAO.deleteByCollectionAndEPerson(context, collection, eperson);
log.info(LogManager.getHeader(context, "unsubscribe",
"eperson_id=" + eperson.getID() + ",collection_id="
+ collection.getID()));
"eperson_id=" + eperson.getID() + ",collection_id="
+ collection.getID()));
}
}
else
{
} else {
throw new AuthorizeException(
"Only admin or e-person themselves can unsubscribe");
"Only admin or e-person themselves can unsubscribe");
}
}
@Override
public List<Subscription> getSubscriptions(Context context, EPerson eperson)
throws SQLException
{
throws SQLException {
return subscriptionDAO.findByEPerson(context, eperson);
}
@Override
public List<Collection> getAvailableSubscriptions(Context context)
throws SQLException
{
throws SQLException {
return getAvailableSubscriptions(context, null);
}
@Override
public List<Collection> getAvailableSubscriptions(Context context, EPerson eperson)
throws SQLException
{
throws SQLException {
List<Collection> collections;
if (eperson != null)
{
if (eperson != null) {
context.setCurrentUser(eperson);
}
collections = collectionService.findAuthorized(context, null, Constants.ADD);
@@ -133,8 +118,7 @@ public class SubscribeServiceImpl implements SubscribeService
@Override
public boolean isSubscribed(Context context, EPerson eperson,
Collection collection) throws SQLException
{
Collection collection) throws SQLException {
return subscriptionDAO.findByCollectionAndEPerson(context, eperson, collection) != null;
}
@@ -147,4 +131,4 @@ public class SubscribeServiceImpl implements SubscribeService
public void deleteByEPerson(Context context, EPerson ePerson) throws SQLException {
subscriptionDAO.deleteByEPerson(context, ePerson);
}
}
}