@Component public class Utils extends Object
| Constructor and Description |
|---|
Utils() |
| Modifier and Type | Method and Description |
|---|---|
List<DSpaceObject> |
constructDSpaceObjectList(Context context,
List<String> list)
This method will construct a List of DSpaceObjects by executing the method
Utils#readFromRequest(HttpServletRequest) and fetching the List of Strings from the request. |
static File |
getFile(org.springframework.web.multipart.MultipartFile multipartFile,
String prefixTempName,
String suffixTempName)
Create a temporary file from a multipart file upload
|
static String |
getFileName(org.springframework.web.multipart.MultipartFile multipartFile)
Return the filename part from a multipartFile upload that could eventually contains the fullpath on the client
filesystem
|
LinkRestRepository |
getLinkResourceRepository(String apiCategory,
String modelPlural,
String rel)
Retrieve the LinkRestRepository associated with a specific link from the
apiCategory and model specified in the parameters.
|
LinkRest |
getLinkRest(String rel,
Class<RestAddressableModel> domainClass) |
String |
getMetadataKey(String schema,
String element,
String qualifier)
Build the canonical representation of a metadata key in DSpace.
|
<T> org.springframework.data.domain.Page<T> |
getPage(List<T> fullContents,
org.springframework.data.domain.Pageable pageable) |
String[] |
getRepositories() |
DSpaceRestRepository |
getResourceRepository(String apiCategory,
String modelPlural) |
List<String> |
getStringListFromRequest(javax.servlet.http.HttpServletRequest request)
This method will retrieve a list of DSpaceObjects from the Request by reading in the Request's InputStream
with a Scanner and searching the InputStream for UUIDs which will then be resolved to a DSpaceObject.
|
org.springframework.hateoas.Link |
linkToSingleResource(DSpaceResource r,
String rel) |
org.springframework.hateoas.Link |
linkToSingleResource(RestAddressableModel data,
String rel) |
org.springframework.hateoas.Link |
linkToSubResource(RestAddressableModel data,
String rel) |
org.springframework.hateoas.Link |
linkToSubResource(RestAddressableModel data,
String rel,
String path) |
static String |
makeSingular(String modelPlural) |
public <T> org.springframework.data.domain.Page<T> getPage(List<T> fullContents, org.springframework.data.domain.Pageable pageable)
public org.springframework.hateoas.Link linkToSingleResource(DSpaceResource r, String rel)
public org.springframework.hateoas.Link linkToSingleResource(RestAddressableModel data, String rel)
public org.springframework.hateoas.Link linkToSubResource(RestAddressableModel data, String rel)
public org.springframework.hateoas.Link linkToSubResource(RestAddressableModel data, String rel, String path)
public DSpaceRestRepository getResourceRepository(String apiCategory, String modelPlural)
public String[] getRepositories()
public LinkRestRepository getLinkResourceRepository(String apiCategory, String modelPlural, String rel)
apiCategory - the apiCategorymodelPlural - the model name in its plural formrel - the name of the relationpublic LinkRest getLinkRest(String rel, Class<RestAddressableModel> domainClass)
rel - domainClass - public String getMetadataKey(String schema, String element, String qualifier)
schema - element - object - public static File getFile(org.springframework.web.multipart.MultipartFile multipartFile, String prefixTempName, String suffixTempName) throws IOException, FileNotFoundException
multipartFile - the multipartFile representing the uploaded file. Please note that it is a complex object including
additional information other than the binary like the orginal file name and the mimetypeprefixTempName - the prefix to use to generate the filename of the temporary filesuffixTempName - the suffic to use to generate the filename of the temporary fileIOExceptionFileNotFoundExceptionpublic static String getFileName(org.springframework.web.multipart.MultipartFile multipartFile) throws IOException, FileNotFoundException
multipartFile - the file uploadedIOExceptionFileNotFoundExceptionpublic List<DSpaceObject> constructDSpaceObjectList(Context context, List<String> list)
Utils#readFromRequest(HttpServletRequest) and fetching the List of Strings from the request.
The method will iterate over this list of Strings and parse the String to retrieve the UUID from it.
It will then look through all the DSpaceObjectServices to try and match this UUID to a DSpaceObject.
If one is found, this DSpaceObject is added to the List of DSpaceObjects that we will return.context - The relevant DSpace contextrequest - The request out of which we'll create the List of DSpaceObjectspublic List<String> getStringListFromRequest(javax.servlet.http.HttpServletRequest request)
request - The request of which the InputStream will be usedIOException - If something goes wrongCopyright © 2019 DuraSpace. All rights reserved.