Commit 7deb9686 authored by Matija Obreza's avatar Matija Obreza

Merge branch 'release-1.0' into 'master'

Release 1.0

See merge request !25
parents e1fc24c2 54b5cc9d
# Changelog
## 1.0 Release
September 19, 2018.
- 4e1e57a Updated javadoc
- 08036e3 FTP: `CanBeAnythingFile` updated with date and dir/file type
- 7c85407 Execute FTP calls with Spring Security context configured for FtpUser
- a431f13 `@Transient` getters were not serialized to JSON
- 237b4ad Fix table names for `hibernate.ejb.naming_strategy=org.hibernate.cfg.ImprovedNamingStrategy`
- 5d0ada7 Updates for Postgres
- 4079e5e Moved Spring Security annotations to service implementation
- 6063bca Use default JPA names for tables and columns
- 9425a0e `RepositoryService` method signatures updated
- ee79457 Image galleries with ACL support
- 0df9094 Enabled ACL support on `RepositoryFile`
- 72794bf Descriptions as `@Lob`
## 0.9 Release
- 1fd22f7 `RepositoryFile#apply` method should not modify internal values
......
......@@ -2,8 +2,3 @@
The project implements a very simple DublinCore based file repository system.
# Migration
## From 0.8
Version **0.9** introduces a breaking change in dependencies. Replace `file-repository` dependency with `file-repository-core`.
......@@ -20,7 +20,7 @@
<parent>
<groupId>org.genesys-pgr</groupId>
<artifactId>file-repository</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.1-SNAPSHOT</version>
</parent>
<artifactId>file-repository-core</artifactId>
<name>Genesys File Repository</name>
......@@ -170,7 +170,7 @@
<dependency>
<groupId>org.genesys-pgr</groupId>
<artifactId>application-blocks-security</artifactId>
<version>${application.blocks.version}</version>
<version>1.5-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.querydsl</groupId>
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -318,11 +318,12 @@ public class S3StorageServiceImpl implements BytesStorageService, InitializingBe
}
/**
* Sorted by query parameter name
* Sorted by query parameter name.
*
* @param query the S3 query string
* @return a sorted, normalized list of query parameters
* @throws UnsupportedEncodingException when query parameter cannot be encoded as US-ASCII
* @throws UnsupportedEncodingException when query parameter cannot be encoded
* as US-ASCII
*/
public static String buildQueryString(String query) throws UnsupportedEncodingException {
LOG.trace("Encoding query string: {}", query);
......@@ -353,11 +354,24 @@ public class S3StorageServiceImpl implements BytesStorageService, InitializingBe
return result;
}
/**
* Hash sha 256.
*
* @param bytes the bytes
* @return the byte[]
* @throws NoSuchAlgorithmException the no such algorithm exception
*/
public static byte[] hashSha256(final byte[] bytes) throws NoSuchAlgorithmException {
final MessageDigest digest = MessageDigest.getInstance("SHA-256");
return digest.digest(bytes);
}
/**
* Prints the hex.
*
* @param bytes the bytes
* @return the string
*/
public static String printHex(final byte[] bytes) {
return DatatypeConverter.printHexBinary(bytes).toLowerCase();
}
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -128,6 +128,11 @@ public class ServiceBeanConfig {
return new ImageGalleryAspectsImpl();
}
/**
* Metadata in storage aspect.
*
* @return the metadata in storage aspect
*/
@Bean
public MetadataInStorageAspect metadataInStorageAspect() {
return new MetadataInStorageAspect();
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -71,7 +71,7 @@ public class FileRepositoryAddTest {
* @throws InvalidRepositoryPathException the invalid repository path exception
* @throws InvalidRepositoryFileDataException the invalid repository file data
* exception
* @throws IOException
* @throws IOException Signals that an I/O exception has occurred.
*/
@Test
public void addFile() throws InvalidRepositoryPathException, InvalidRepositoryFileDataException, IOException {
......@@ -91,7 +91,7 @@ public class FileRepositoryAddTest {
* @throws InvalidRepositoryPathException the invalid repository path exception
* @throws InvalidRepositoryFileDataException the invalid repository file data
* exception
* @throws IOException
* @throws IOException Signals that an I/O exception has occurred.
*/
@Test
public void addFileWithMetadata() throws InvalidRepositoryPathException, InvalidRepositoryFileDataException, IOException {
......@@ -146,7 +146,7 @@ public class FileRepositoryAddTest {
* @throws InvalidRepositoryFileDataException the invalid repository file data
* exception
* @throws InvalidRepositoryPathException the invalid repository path exception
* @throws IOException
* @throws IOException Signals that an I/O exception has occurred.
*/
@Test(expected = InvalidRepositoryFileDataException.class)
public void invalidMissingOriginalFilename() throws InvalidRepositoryFileDataException, InvalidRepositoryPathException, IOException {
......@@ -159,7 +159,7 @@ public class FileRepositoryAddTest {
* @throws InvalidRepositoryFileDataException the invalid repository file data
* exception
* @throws InvalidRepositoryPathException the invalid repository path exception
* @throws IOException
* @throws IOException Signals that an I/O exception has occurred.
*/
@Test
public void defaultContentType() throws InvalidRepositoryFileDataException, InvalidRepositoryPathException, IOException {
......@@ -173,7 +173,7 @@ public class FileRepositoryAddTest {
* @throws InvalidRepositoryFileDataException the invalid repository file data
* exception
* @throws InvalidRepositoryPathException the invalid repository path exception
* @throws IOException
* @throws IOException Signals that an I/O exception has occurred.
*/
@Test(expected = InvalidRepositoryFileDataException.class)
public void invalidMissingBytes() throws InvalidRepositoryFileDataException, InvalidRepositoryPathException, IOException {
......@@ -187,7 +187,7 @@ public class FileRepositoryAddTest {
* @throws InvalidRepositoryPathException the invalid repository path exception
* @throws InvalidRepositoryFileDataException the invalid repository file data
* exception
* @throws IOException
* @throws IOException Signals that an I/O exception has occurred.
*/
@Test(expected = InvalidRepositoryPathException.class)
public void invalidAddNullPath() throws NoSuchRepositoryFileException, InvalidRepositoryPathException, InvalidRepositoryFileDataException, IOException {
......@@ -201,7 +201,7 @@ public class FileRepositoryAddTest {
* @throws InvalidRepositoryPathException the invalid repository path exception
* @throws InvalidRepositoryFileDataException the invalid repository file data
* exception
* @throws IOException
* @throws IOException Signals that an I/O exception has occurred.
*/
@Test(expected = InvalidRepositoryPathException.class)
public void invalidAddBlankPath() throws NoSuchRepositoryFileException, InvalidRepositoryPathException, InvalidRepositoryFileDataException, IOException {
......@@ -215,7 +215,7 @@ public class FileRepositoryAddTest {
* @throws InvalidRepositoryPathException the invalid repository path exception
* @throws InvalidRepositoryFileDataException the invalid repository file data
* exception
* @throws IOException
* @throws IOException Signals that an I/O exception has occurred.
*/
@Test(expected = InvalidRepositoryPathException.class)
public void invalidAddDoubleSlashPath() throws NoSuchRepositoryFileException, InvalidRepositoryPathException, InvalidRepositoryFileDataException, IOException {
......@@ -228,7 +228,7 @@ public class FileRepositoryAddTest {
* @throws InvalidRepositoryPathException the invalid repository path exception
* @throws InvalidRepositoryFileDataException the invalid repository file data
* exception
* @throws IOException
* @throws IOException Signals that an I/O exception has occurred.
*/
@Test(expected = InvalidRepositoryPathException.class)
public void invalidAddMissingStartSlash() throws InvalidRepositoryPathException, InvalidRepositoryFileDataException, IOException {
......@@ -242,7 +242,7 @@ public class FileRepositoryAddTest {
* @throws InvalidRepositoryPathException the invalid repository path exception
* @throws InvalidRepositoryFileDataException the invalid repository file data
* exception
* @throws IOException
* @throws IOException Signals that an I/O exception has occurred.
*/
@Test(expected = InvalidRepositoryPathException.class)
public void invalidAddMissingEndSlash() throws NoSuchRepositoryFileException, InvalidRepositoryPathException, InvalidRepositoryFileDataException, IOException {
......@@ -250,13 +250,13 @@ public class FileRepositoryAddTest {
}
/**
* Path can contain spaces
* Path can contain spaces.
*
* @throws NoSuchRepositoryFileException the no such repository file exception
* @throws InvalidRepositoryPathException the invalid repository path exception
* @throws InvalidRepositoryFileDataException the invalid repository file data
* exception
* @throws IOException
* @throws IOException Signals that an I/O exception has occurred.
*/
@Test
public void validSpacesInPath() throws NoSuchRepositoryFileException, InvalidRepositoryPathException, InvalidRepositoryFileDataException, IOException {
......@@ -272,13 +272,13 @@ public class FileRepositoryAddTest {
}
/**
* Path can contain spaces, but not next to /
* Path can contain spaces, but not next to /.
*
* @throws NoSuchRepositoryFileException the no such repository file exception
* @throws InvalidRepositoryPathException the invalid repository path exception
* @throws InvalidRepositoryFileDataException the invalid repository file data
* exception
* @throws IOException
* @throws IOException Signals that an I/O exception has occurred.
*/
@Test(expected = InvalidRepositoryPathException.class)
public void invalidSpaceNextToSlashInPath1() throws NoSuchRepositoryFileException, InvalidRepositoryPathException, InvalidRepositoryFileDataException, IOException {
......@@ -286,13 +286,13 @@ public class FileRepositoryAddTest {
}
/**
* Path can contain spaces, but not next to /
* Path can contain spaces, but not next to /.
*
* @throws NoSuchRepositoryFileException the no such repository file exception
* @throws InvalidRepositoryPathException the invalid repository path exception
* @throws InvalidRepositoryFileDataException the invalid repository file data
* exception
* @throws IOException
* @throws IOException Signals that an I/O exception has occurred.
*/
@Test(expected = InvalidRepositoryPathException.class)
public void invalidSpaceNextToSlashInPath2() throws NoSuchRepositoryFileException, InvalidRepositoryPathException, InvalidRepositoryFileDataException, IOException {
......@@ -300,12 +300,13 @@ public class FileRepositoryAddTest {