DS-3651: Fixing imports and authors

This commit is contained in:
Tom Desair
2017-11-18 10:32:23 +01:00
committed by Tom Desair
parent 8fe17da0cf
commit 14e9bce865
44 changed files with 119 additions and 58 deletions

View File

@@ -7,6 +7,11 @@
*/
package org.dspace.content;
import java.io.InputStream;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import org.dspace.content.factory.ContentServiceFactory;
import org.dspace.content.service.BitstreamService;
import org.dspace.core.Constants;
@@ -14,10 +19,6 @@ import org.dspace.core.Context;
import org.hibernate.proxy.HibernateProxyHelper;
import javax.persistence.*;
import java.io.InputStream;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
/**
* Class representing bitstreams stored in the DSpace system.

View File

@@ -27,7 +27,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import java.io.IOException;
import java.io.InputStream;
import java.sql.SQLException;
import java.util.*;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
/**
* Service implementation for the Bitstream object.

View File

@@ -8,14 +8,6 @@
package org.dspace.google;
import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
@@ -29,12 +21,18 @@ import org.dspace.content.factory.ContentServiceFactory;
import org.dspace.core.ConfigurationManager;
import org.dspace.core.Constants;
import org.dspace.services.ConfigurationService;
import org.dspace.services.factory.DSpaceServicesFactory;
import org.dspace.services.model.Event;
import org.dspace.usage.AbstractUsageEventListener;
import org.dspace.usage.UsageEvent;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/**
* User: Robin Taylor

View File

@@ -10,7 +10,6 @@ package org.dspace.statistics;
import org.apache.log4j.Logger;
import org.dspace.eperson.EPerson;
import org.dspace.services.model.Event;
import org.dspace.statistics.factory.StatisticsServiceFactory;
import org.dspace.statistics.service.SolrLoggerService;
import org.dspace.usage.AbstractUsageEventListener;
import org.dspace.usage.UsageEvent;
@@ -78,4 +77,5 @@ public class SolrLoggerUsageEventListener extends AbstractUsageEventListener {
}
}
}

View File

@@ -7,16 +7,16 @@
*/
package org.dspace.storage.bitstore.service;
import org.dspace.authorize.AuthorizeException;
import org.dspace.content.Bitstream;
import org.dspace.core.Context;
import java.io.IOException;
import java.io.InputStream;
import java.sql.SQLException;
import java.util.Map;
import java.util.UUID;
import org.dspace.authorize.AuthorizeException;
import org.dspace.content.Bitstream;
import org.dspace.core.Context;
/**
* <P>
* Stores, retrieves and deletes bitstreams.

View File

@@ -211,7 +211,6 @@ public final class SpringServiceManager implements ServiceManagerSystem {
}
}
}
String[] allPaths = pathList.toArray(new String[pathList.size()]);
applicationContext = new ClassPathXmlApplicationContext(allPaths, false);
// Make sure that the spring files from the config directoy can override the spring files from our jars

View File

@@ -38,6 +38,10 @@ import org.springframework.web.bind.annotation.RestController;
/**
* This is a specialized controller to provide access to the bitstream binary content
*
* @author Andrea Bollini (andrea.bollini at 4science.it)
* @author Atmire NV (info at atmire dot com)
*
*/
@RestController
@RequestMapping("/api/"+BitstreamRest.CATEGORY +"/"+ BitstreamRest.PLURAL_NAME + "/{uuid:[0-9a-fxA-FX]{8}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{12}}/content")

View File

@@ -7,8 +7,6 @@
*/
package org.dspace.app.rest;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.hateoas.Link;
import org.springframework.hateoas.ResourceSupport;
@@ -16,6 +14,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
/**
* This is the main entry point of the new REST API. Its responsibility is to
* provide a consistent behaviors for all the exposed resources in terms of

View File

@@ -15,6 +15,8 @@ import org.dspace.services.ConfigurationService;
/**
* Utility class that will load the Spring XML configuration files related to the REST webapp
*
* @author Atmire NV (info at atmire dot com)
*/
public class RESTSpringLoader implements SpringLoader {

View File

@@ -10,6 +10,7 @@ package org.dspace.app.rest.converter;
import java.util.ArrayList;
import java.util.List;
import org.dspace.app.rest.model.BitstreamRest;
import org.dspace.app.rest.model.CollectionRest;
import org.dspace.app.rest.model.CommunityRest;
import org.dspace.content.Bitstream;

View File

@@ -13,6 +13,7 @@ import java.util.List;
import org.dspace.app.rest.model.MetadataEntryRest;
import org.dspace.content.DSpaceObject;
import org.dspace.content.MetadataValue;
import org.springframework.core.convert.converter.Converter;
/**
*

View File

@@ -11,8 +11,8 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
import org.dspace.app.rest.model.EPersonRest;
import org.dspace.app.rest.model.GroupRest;
import org.dspace.app.rest.model.EPersonRest;
import org.dspace.eperson.EPerson;
import org.dspace.eperson.Group;
import org.springframework.beans.factory.annotation.Autowired;

View File

@@ -9,9 +9,10 @@ package org.dspace.app.rest.model;
import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.springframework.hateoas.Identifiable;
import com.fasterxml.jackson.annotation.JsonIgnore;
/**
* Base class for any REST resource that need to be addressable
*

View File

@@ -9,9 +9,10 @@ package org.dspace.app.rest.model;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.dspace.app.rest.RestResourceController;
import com.fasterxml.jackson.annotation.JsonIgnore;
/**
* The BitstreamFormat REST Resource
*

View File

@@ -9,9 +9,10 @@ package org.dspace.app.rest.model;
import java.util.List;
import org.dspace.app.rest.RestResourceController;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.dspace.app.rest.RestResourceController;
/**
* The Browse Index REST Resource

View File

@@ -9,9 +9,10 @@ package org.dspace.app.rest.model;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.dspace.app.rest.RestResourceController;
import com.fasterxml.jackson.annotation.JsonIgnore;
/**
* The Group REST Resource
*

View File

@@ -11,6 +11,8 @@ import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty.Access;
/**
* The Item REST Resource

View File

@@ -7,9 +7,10 @@
*/
package org.dspace.app.rest.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.dspace.app.rest.RestResourceController;
import com.fasterxml.jackson.annotation.JsonIgnore;
/**
* The MetadataField REST Resource
*

View File

@@ -7,8 +7,12 @@
*/
package org.dspace.app.rest.model;
import java.util.List;
import org.dspace.app.rest.RestResourceController;
import com.fasterxml.jackson.annotation.JsonIgnore;
/**
* The MetadataSchema REST Resource
*

View File

@@ -10,7 +10,6 @@ package org.dspace.app.rest.model.hateoas;
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn;
import com.fasterxml.jackson.annotation.JsonUnwrapped;
import org.atteo.evo.inflector.English;
import org.dspace.app.rest.RestResourceController;
import org.dspace.app.rest.model.BrowseEntryRest;
@@ -20,6 +19,8 @@ import org.springframework.hateoas.Link;
import org.springframework.hateoas.ResourceSupport;
import org.springframework.web.util.UriComponentsBuilder;
import com.fasterxml.jackson.annotation.JsonUnwrapped;
/**
* Browse Entry Rest HAL Resource. The HAL Resource wraps the REST Resource
* adding support for the links and embedded resources

View File

@@ -7,22 +7,23 @@
*/
package org.dspace.app.rest.model.hateoas;
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonUnwrapped;
import org.apache.commons.lang3.StringUtils;
import org.atteo.evo.inflector.English;
import org.dspace.app.rest.model.BaseObjectRest;
import org.dspace.app.rest.model.LinkRest;
import org.dspace.app.rest.model.LinksRest;
@@ -32,8 +33,17 @@ import org.dspace.app.rest.repository.LinkRestRepository;
import org.dspace.app.rest.utils.Utils;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.rest.webmvc.EmbeddedResourcesAssembler;
import org.springframework.hateoas.Link;
import org.springframework.hateoas.PagedResources;
import org.springframework.hateoas.ResourceSupport;
import org.springframework.hateoas.core.EmbeddedWrappers;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonUnwrapped;
/**
* A base class for DSpace Rest HAL Resource. The HAL Resource wraps the REST

View File

@@ -11,11 +11,12 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.springframework.data.domain.Page;
import org.springframework.web.util.UriComponentsBuilder;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
public class EmbeddedPage {
private Page page;

View File

@@ -110,5 +110,4 @@ public class BitstreamRestRepository extends DSpaceRestRepository<BitstreamRest,
context.abort();
return is;
}
}

View File

@@ -12,7 +12,6 @@ import java.util.Arrays;
import java.util.Iterator;
import java.util.UUID;
import java.util.function.Consumer;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;

View File

@@ -7,12 +7,16 @@
*/
package org.dspace.app.rest.repository;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import org.dspace.app.rest.converter.BrowseIndexConverter;
import org.dspace.app.rest.converter.CollectionConverter;
import org.dspace.app.rest.model.BrowseIndexRest;
import org.dspace.app.rest.model.CollectionRest;
import org.dspace.app.rest.model.hateoas.BrowseIndexResource;
import org.dspace.app.rest.model.hateoas.CollectionResource;
import org.dspace.browse.BrowseException;
import org.dspace.browse.BrowseIndex;
import org.dspace.core.Context;
@@ -20,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.data.rest.webmvc.ResourceNotFoundException;
import org.springframework.stereotype.Component;
/**

View File

@@ -10,7 +10,6 @@ package org.dspace.app.rest.repository;
import java.sql.SQLException;
import java.util.Iterator;
import java.util.UUID;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;

View File

@@ -11,7 +11,13 @@ import java.io.Serializable;
import org.dspace.app.rest.model.RestModel;
import org.dspace.app.rest.model.hateoas.DSpaceResource;
import org.dspace.app.rest.utils.ContextUtil;
import org.dspace.app.rest.utils.Utils;
import org.dspace.core.Context;
import org.dspace.services.RequestService;
import org.dspace.services.model.Request;
import org.dspace.utils.DSpace;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;

View File

@@ -8,10 +8,8 @@
package org.dspace.app.rest.utils;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import org.apache.log4j.Logger;
import org.dspace.core.Context;

View File

@@ -29,6 +29,9 @@ import org.slf4j.LoggerFactory;
/**
* Utility class to send an input stream with Range header and ETag support.
* Based on https://github.com/davinkevin/Podcast-Server/blob/v1.0.0/src/main/java/lan/dk/podcastserver/service/MultiPartFileSenderService.java
*
* @author Atmire NV (info at atmire dot com)
*
*/
public class MultipartFileSender {

View File

@@ -40,6 +40,8 @@ import org.junit.Test;
/**
* Integration test to test the /api/core/bitstreams/[id]/content endpoint
*
* @author Atmire NV (info at atmire dot com)
*/
public class BitstreamContentRestControllerIT extends AbstractControllerIntegrationTest {

View File

@@ -36,6 +36,8 @@ import org.springframework.test.web.servlet.result.MockMvcResultHandlers;
/**
* Integration test to test the /api/discover/browses endpoint
* (Class has to start or end with IT to be picked up by the failsafe plugin)
*
* @author Atmire NV (info at atmire dot com)
*/
public class BrowsesResourceControllerIT extends AbstractControllerIntegrationTest {

View File

@@ -9,9 +9,7 @@ package org.dspace.app.rest;
import static org.hamcrest.Matchers.startsWith;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
import org.dspace.app.rest.test.AbstractControllerIntegrationTest;
import org.junit.Test;
@@ -19,6 +17,8 @@ import org.junit.Test;
/**
* Integration test for the {@link RootRestResourceController}
*
* @author Atmire NV (info at atmire dot com)
*/
public class RootRestResourceControllerIT extends AbstractControllerIntegrationTest {

View File

@@ -7,10 +7,6 @@
*/
package org.dspace.app.rest.builder;
import java.io.IOException;
import java.sql.SQLException;
import java.util.Date;
import org.apache.log4j.Logger;
import org.dspace.authorize.AuthorizeException;
import org.dspace.authorize.ResourcePolicy;
@@ -20,15 +16,7 @@ import org.dspace.authorize.service.ResourcePolicyService;
import org.dspace.content.DSpaceObject;
import org.dspace.content.Item;
import org.dspace.content.factory.ContentServiceFactory;
import org.dspace.content.service.BitstreamFormatService;
import org.dspace.content.service.BitstreamService;
import org.dspace.content.service.BundleService;
import org.dspace.content.service.CollectionService;
import org.dspace.content.service.CommunityService;
import org.dspace.content.service.DSpaceObjectService;
import org.dspace.content.service.InstallItemService;
import org.dspace.content.service.ItemService;
import org.dspace.content.service.WorkspaceItemService;
import org.dspace.content.service.*;
import org.dspace.core.Constants;
import org.dspace.core.Context;
import org.dspace.discovery.IndexingService;
@@ -42,8 +30,14 @@ import org.joda.time.DateTimeZone;
import org.joda.time.MutablePeriod;
import org.joda.time.format.PeriodFormat;
import java.io.IOException;
import java.sql.SQLException;
import java.util.Date;
/**
* Abstract builder to construct DSpace Objects
*
* @author Atmire NV (info at atmire dot com)
*/
public abstract class AbstractBuilder<T extends DSpaceObject> {
@@ -157,10 +151,8 @@ public abstract class AbstractBuilder<T extends DSpaceObject> {
Context c = new Context();
c.turnOffAuthorisationSystem();
T attachedDso = c.reloadEntity(dso);
if(attachedDso != null) {
getDsoService().delete(c, attachedDso);
}
}
}

View File

@@ -23,6 +23,8 @@ import org.dspace.eperson.Group;
/**
* Builder class to build bitstreams in test cases
*
* @author Atmire NV (info at atmire dot com)
*/
public class BitstreamBuilder extends AbstractBuilder<Bitstream>{

View File

@@ -15,6 +15,8 @@ import org.dspace.core.Context;
/**
* Builder to construct Collection objects
*
* @author Atmire NV (info at atmire dot com)
*/
public class CollectionBuilder extends AbstractBuilder<Collection> {

View File

@@ -14,6 +14,8 @@ import org.dspace.core.Context;
/**
* Builder to construct Community objects
*
* @author Atmire NV (info at atmire dot com)
*/
public class CommunityBuilder extends AbstractBuilder<Community> {

View File

@@ -14,6 +14,8 @@ import org.dspace.eperson.Group;
/**
* Builder to construct Group objects
*
* @author Atmire NV (info at atmire dot com)
*/
public class GroupBuilder extends AbstractBuilder<Group> {

View File

@@ -18,6 +18,8 @@ import org.dspace.eperson.Group;
/**
* Builder to construct Item objects
*
* @author Atmire NV (info at atmire dot com)
*/
public class ItemBuilder extends AbstractBuilder<Item> {

View File

@@ -15,6 +15,11 @@ import static org.hamcrest.Matchers.startsWith;
import org.hamcrest.Matcher;
/**
* Class to match JSON browse entries in ITs
*
* @author Atmire NV (info at atmire dot com)
*/
public class BrowseEntryResourceMatcher {
public static Matcher<? super Object> matchBrowseEntry(String value, int expectedCount) {
return allOf(

View File

@@ -20,6 +20,8 @@ import org.hamcrest.Matchers;
/**
* Utility class to construct a Matcher for a browse index
*
* @author Atmire NV (info at atmire dot com)
*/
public class BrowseIndexMatcher {

View File

@@ -20,6 +20,8 @@ import org.hamcrest.Matcher;
/**
* Utility class to construct a Matcher for an item
*
* @author Atmire NV (info at atmire dot com)
*/
public class ItemMatcher {

View File

@@ -40,6 +40,8 @@ import org.springframework.web.context.WebApplicationContext;
/**
* Abstract controller integration test class that will take care of setting up the
* environment to run the integration test
*
* @author Atmire NV (info at atmire dot com)
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = {Application.class, ApplicationConfig.class})

View File

@@ -16,6 +16,8 @@ import org.springframework.test.context.ContextCustomizerFactory;
/**
* Context customizer factory to set the parent context of our Spring Boot application in TEST mode
*
* @author Atmire NV (info at atmire dot com)
*/
public class DSpaceKernelContextCustomizerFactory implements ContextCustomizerFactory {

View File

@@ -33,6 +33,8 @@ import org.springframework.web.util.ContentCachingResponseWrapper;
/**
* Test class for MultipartFileSender
*
* @author Atmire NV (info at atmire dot com)
*/
public class MultipartFileSenderTest {