Commit 6656119c authored by Matija Obreza's avatar Matija Obreza
Browse files

Merge branch '168-release-1-9' into 'master'

Resolve "Release 1.9"

Closes #168

See merge request !159
parents 073b8dbf 3f23dfca
variables:
IMAGE_VERSION: "1.9-SNAPSHOT"
IMAGE_VERSION: "2.0-SNAPSHOT"
DOCKER_HOST: "genesys1.swarm.genesys-pgr.org"
ARTIFACTS: "genesys-catalog-server/target/*.war"
......@@ -47,7 +47,7 @@ package master or tag:
image: docker:latest
before_script:
- echo Building docker image ${CI_REGISTRY_IMAGE}:${IMAGE_VERSION} on ${DOCKER_HOST}
- echo Registry ${CI_REGISTRY} user=${CI_REGISTRY_USER} ${CI_REGISTRY_PASSWORD}
- echo Registry ${CI_REGISTRY} user=${CI_REGISTRY_USER}
script:
# Configuration
- TLS_PATH=~/.docker/${DOCKER_HOST}/certs && mkdir -p ${TLS_PATH}
......
# Changelog
## 1.9 Release
- Facilitated search API endpoints
- Reindex entities on application startup (off by default)
- Enable elasticsearch indexing for annotated entities
- Annotated entities for ES indexing
- Entity filters inherit from UuidModelFilter
- Updated Catalog data model
- Maintenance
- Allow user to unpublish
- FIX: User cannot change password
- Allow lengthy JSON filter to be minimized
- Updated roles of dataset contributors
- Creator lookup
- mysql UTF8 index length at 250
- Liquibase: mysql index on `short_filter.json` limited to 300 characters
- FIX: JUnit tests for `ShortFilter#json`
- FIX: Use index instead of unique key on `ShortFilter#json`
- ShortFilter: code quietly not generated for JSON exceeding database column length limit
- Added tests for new methods in controllers
- Using short filter code in controllers with `FilteredPage` replacing `Page<T>`
- New entity ShortFilter; New service for generating shortNames for provided filters.
- Java 10 needs `javax.annotation-api`
- `app-blocks 1.4` uses bcrypt'd OAuth client secrets
- Gitlab CI: Docker image version up dated
- Source code cleanup
- Moved Spring Security annotations to service implementations
- Cleanup logging in tests
- Scale descriptor types require a list of vocabulary terms (labels)
- Replaced DELETE with POST when using request body
- Replaced DELETE with POST method where applicable
- Publish descriptors when publishing descriptor List
- BUG: Fixed parameter names for Spring Security annotations
- Partner contact information
## 1.8 Release
- BUG: Fixed parameter names for Spring Security annotations
......
......@@ -20,7 +20,7 @@
<groupId>org.genesys-pgr</groupId>
<artifactId>genesys-catalog-parent</artifactId>
<relativePath>../genesys-catalog-parent/pom.xml</relativePath>
<version>1.9-SNAPSHOT</version>
<version>2.0-SNAPSHOT</version>
</parent>
<artifactId>genesys-catalog-core</artifactId>
<packaging>jar</packaging>
......
/*
* 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.
......@@ -91,7 +91,7 @@ public interface DatasetCreatorService {
/**
* Load list DatasetCreators by Dataset UUID.
*
* @param datasetUuid Dataset UUID
* @param dataset the dataset
* @return List of DatasetCreator
* @throws NotFoundElement throws if don't match the version
*/
......@@ -108,9 +108,9 @@ public interface DatasetCreatorService {
DatasetCreator updateDatasetCreator(Dataset dataset, DatasetCreator datasetCreator) throws NotFoundElement;
/**
* Autocomplete creators
* Autocomplete creators.
*
* @param text
* @param text the text
* @return list of matched creators
*/
List<DatasetCreator> autocompleteCreators(String text);
......
......@@ -28,10 +28,11 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
public interface MetadataService {
/**
* generate JSON with Excel metadata
* generate JSON with Excel metadata.
*
* @param file
* @param file the file
* @return generated JSON object with Excel metadata
* @throws IOException Signals that an I/O exception has occurred.
*/
ObjectNode getExcelMetadata(File file) throws IOException;
}
/*
* 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.
......
......@@ -21,20 +21,23 @@ import org.genesys.blocks.model.filters.BasicModelFilter;
import org.genesys.common.model.ShortFilter;
/**
* The Interface ShortFilterService.
*
* @author Maxym Borodenko
*/
public interface ShortFilterService {
/**
* Normalize the filter
* Normalize the filter.
*
* @param filter object to be normalized
* @return string with normalized filter
* @throws IOException Signals that an I/O exception has occurred.
*/
String normalizeFilter(BasicModelFilter filter) throws IOException;
/**
* Load short filter or create a new code
* Load short filter or create a new code.
*
* @param filter original filter object
* @return found or created name of the shortened filter object
......@@ -42,7 +45,7 @@ public interface ShortFilterService {
String getCode(BasicModelFilter filter);
/**
* Load ShortFilter by short name
* Load ShortFilter by short name.
*
* @param code short name of ShortFilter
* @return found ShortFilter
......@@ -50,7 +53,7 @@ public interface ShortFilterService {
ShortFilter loadByCode(String code);
/**
* Load ShortFilter by json filters
* Load ShortFilter by json filters.
*
* @param json json filters of ShortFilter
* @return found ShortFilter
......@@ -58,7 +61,7 @@ public interface ShortFilterService {
ShortFilter loadByJSON(String json);
/**
* Load ShortFilter by json filters or short name
* Load ShortFilter by json filters or short name.
*
* @param searchString json filters or short name of ShortFilter
* @return found ShortFilter
......@@ -72,7 +75,7 @@ public interface ShortFilterService {
* @param code the filter code
* @param clazz the clazz
* @return the Instance of type T with data from JSON
* @throws IOException
* @throws IOException Signals that an I/O exception has occurred.
*/
<T> T filterByCode(String code, Class<T> clazz) throws IOException;
......
/*
* 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.
......@@ -31,7 +31,7 @@ import org.springframework.data.domain.Pageable;
public interface UserService extends BasicUserService<UserRole, User> {
/**
* Get user by uuid
* Get user by uuid.
*
* @param uuid user's uuid
* @return the user
......
......@@ -16,12 +16,12 @@
package org.genesys.catalog.service;
/**
* The Version Manager
* The Version Manager.
*/
public interface VersionManager {
/**
* Next major version
* Next major version.
*
* @param versionTag the version tag
* @return the string
......@@ -29,7 +29,7 @@ public interface VersionManager {
String nextMajor(String versionTag);
/**
* Next minor version
* Next minor version.
*
* @param versionTag the version tag
* @return the string
......
/*
* 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.
......@@ -95,24 +95,25 @@ public interface VocabularyService {
* @param vocabularyUuid the vocabulary uuid
* @param code the code
* @return the vocabulary term
* @throws NotFoundElement the not found element
*/
VocabularyTerm getVocabularyTerm(UUID vocabularyUuid, String code) throws NotFoundElement;
/**
* Autocomplete vocabulary term
* Autocomplete vocabulary term.
*
* @param vocabularyUuid
* @param text
* @return
* @param vocabularyUuid the vocabulary uuid
* @param text the text
* @return the list
*/
List<VocabularyTerm> autocompleteTerms(UUID vocabularyUuid, String text);
/**
* List terms in the vocabulary
* List terms in the vocabulary.
*
* @param vocabulary
* @param page
* @return
* @param vocabulary the vocabulary
* @param page the page
* @return the page
*/
// @PreAuthorize("hasRole('ADMINISTRATOR') or hasPermission(#vocabulary,
// 'read')")
......
......@@ -29,7 +29,8 @@ public abstract class FilterHelpers {
private static final Pattern pattern = Pattern.compile("[^\\w]+", Pattern.UNICODE_CHARACTER_CLASS);
/**
* Create a boolean expression where the string path matches any of the keywords
* Create a boolean expression where the string path matches any of the
* keywords.
*
* @param stringPath the string path
* @param keywords the keywords
......@@ -45,7 +46,7 @@ public abstract class FilterHelpers {
/**
* Constructs an array of predicates where each string path matches any of the
* keywords
* keywords.
*
* @param text the text to split into keywords
* @param stringPaths the string paths
......@@ -61,7 +62,7 @@ public abstract class FilterHelpers {
}
/**
* Create a boolean expression where the string path contains all keywords
* Create a boolean expression where the string path contains all keywords.
*
* @param stringPath the string path
* @param keywords the keywords
......@@ -77,9 +78,9 @@ public abstract class FilterHelpers {
/**
* Constructs an array of predicates where each string path contains every
* keyword keywords
* keyword keywords.
*
* @param text the text to split into keywords
* @param _text the text
* @param stringPaths the string paths
* @return the predicate[]
*/
......@@ -94,7 +95,7 @@ public abstract class FilterHelpers {
}
/**
* Split the input text into keywords
* Split the input text into keywords.
*
* @param text text to split into keywords
* @return array of non-null, non-blank, no-special-chars keywords
......
......@@ -18,6 +18,8 @@ package org.genesys.catalog.util;
import java.util.Random;
/**
* The Class RandomPasswordUtil.
*
* @author Maxym Borodenko
*/
public class RandomPasswordUtil {
......@@ -25,9 +27,9 @@ public class RandomPasswordUtil {
/**
* This method generates a random password that consists of at least one special
* character, one number, one lowercase letter and one uppercase letter
* character, one number, one lowercase letter and one uppercase letter.
*
* @param random
* @param random the random
* @param length the password length that should be generated
* @return string with generated password
* @throws IllegalArgumentException if the 'length' parameter is lower than 4
......
......@@ -19,7 +19,7 @@
<parent>
<groupId>org.genesys-pgr</groupId>
<artifactId>genesys-catalog</artifactId>
<version>1.9-SNAPSHOT</version>
<version>2.0-SNAPSHOT</version>
</parent>
<artifactId>genesys-catalog-parent</artifactId>
<packaging>pom</packaging>
......
......@@ -4,7 +4,7 @@
<groupId>org.genesys-pgr</groupId>
<artifactId>genesys-catalog-parent</artifactId>
<relativePath>../genesys-catalog-parent/pom.xml</relativePath>
<version>1.9-SNAPSHOT</version>
<version>2.0-SNAPSHOT</version>
</parent>
<artifactId>genesys-catalog-server</artifactId>
<packaging>war</packaging>
......@@ -93,7 +93,7 @@
<dependency>
<groupId>org.genesys-pgr</groupId>
<artifactId>genesys-catalog-core</artifactId>
<version>1.9-SNAPSHOT</version>
<version>2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.security.oauth</groupId>
......@@ -166,7 +166,7 @@
<dependency>
<groupId>org.genesys-pgr</groupId>
<artifactId>genesys-catalog-core</artifactId>
<version>1.9-SNAPSHOT</version>
<version>2.0-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>commons-lang3</artifactId>
......
......@@ -35,13 +35,8 @@ import org.springframework.stereotype.Component;
import com.hazelcast.core.IQueue;
/**
* The listener interface for receiving elasticJPA events. The class that is
* interested in processing a elasticJPA event implements this interface, and
* the object created with that class is registered with a component using the
* component's <code>addElasticJPAListener<code> method. When the elasticJPA
* event occurs, that object's appropriate method is invoked.
*
* @see ElasticJPAEvent
* AspectJ powered listener on repository save and delete operations
* adds indexed entities to re-index queue, handled by {@link ElasticReindexProcessor}.
*/
@Aspect
@Component
......
/*
* 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.
......@@ -32,6 +32,9 @@ import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource;
/**
* The Class ApplicationConfig.
*/
@Configuration
@Import({ FileRepositoryConfig.class })
@ComponentScan({ "org.genesys.catalog.service.impl", "org.genesys.catalog.service.worker", "org.genesys.catalog.util", "org.genesys.blocks.security.service.*",
......@@ -39,6 +42,11 @@ import org.springframework.core.io.Resource;
@EnableAspectJAutoProxy
public class ApplicationConfig {
/**
* Property placeholder configurer.
*
* @return the property placeholder configurer
*/
@Bean
@Order(Integer.MIN_VALUE)
public static PropertyPlaceholderConfigurer propertyPlaceholderConfigurer() {
......@@ -68,6 +76,11 @@ public class ApplicationConfig {
return propertyPlaceholderConfigurer;
}
/**
* Current application context.
*
* @return the current application context
*/
@Bean
@Order(Integer.MIN_VALUE)
public CurrentApplicationContext currentApplicationContext() {
......
/*
* 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.
......@@ -36,6 +36,8 @@ import org.springframework.web.servlet.support.AbstractDispatcherServletInitiali
import com.hazelcast.web.SessionListener;
/**
* The Class ApplicationInit.
*
* @author Andrey Lugovskoy
*/
public class ApplicationInit extends AbstractDispatcherServletInitializer {
......
......@@ -49,7 +49,7 @@ import org.springframework.stereotype.Component;
import com.google.common.collect.Sets;
/**
* Run things at startup and after application context is initialized
* Run things at startup and after application context is initialized.
*/
@Component
public class ApplicationStartup implements InitializingBean, ApplicationListener<ContextRefreshedEvent> {
......@@ -109,6 +109,9 @@ public class ApplicationStartup implements InitializingBean, ApplicationListener
}
}
/**
* Startup.
*/
@Transactional
void startup() {
try {
......@@ -119,6 +122,9 @@ public class ApplicationStartup implements InitializingBean, ApplicationListener
ensure1OAuthClient();
}
/**
* Ensure 1 O auth client.
*/
public void ensure1OAuthClient() {
if (oauthClientRepository.count() == 0) {
LOG.warn("Creating default OAuth client my-trusted-client");
......@@ -139,6 +145,13 @@ public class ApplicationStartup implements InitializingBean, ApplicationListener
}
}
/**
* Ensure 1 admin.
*
* @throws NotUniqueUserException the not unique user exception
* @throws PasswordPolicyException the password policy exception
* @throws UserException the user exception
*/
public void ensure1Admin() throws NotUniqueUserException, PasswordPolicyException, UserException {
LOG.info("Startup initializer checking stuff");
......
......@@ -30,11 +30,21 @@ import org.springframework.context.annotation.Configuration;
@Configuration
public class AuditConfig {
/**
* Class pk service.
*
* @return the class PK service
*/
@Bean
public ClassPKService classPkService() {
return new ClassPKServiceImpl();
}
/**
* Audit trail service.
*
* @return the audit trail service
*/
@Bean
public AuditTrailService auditTrailService() {
return new AuditTrailServiceImpl();
......
/*
* 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.
......@@ -35,10 +35,15 @@ import com.hazelcast.spring.cache.HazelcastCacheManager;
import com.hazelcast.web.WebFilter;
import com.hazelcast.web.spring.SpringAwareWebFilter;
/**
* The Class CacheConfig.
*/
@Configuration
@EnableCaching
@Import({ HazelcastConfig.class })
public class CacheConfig {
/** The instance name. */
@Value("${hazelcast.instanceName}")
protected String instanceName = "genesys";
......@@ -51,45 +56,91 @@ public class CacheConfig {
@Value("${base.cookie-http-only}")
private String cookieHttpOnly;
/**
* Cache manager.
*
* @param hazelcastInstance the hazelcast instance
* @return the hazelcast cache manager
*/
@Bean
public HazelcastCacheManager cacheManager(final HazelcastInstance hazelcastInstance) {
final HazelcastCacheManager cm = new HazelcastCacheManager(hazelcastInstance);
return cm;
}
/**
* Tileserver map.
*
* @param hazelcast the hazelcast
* @return the i map
*/
@Bean
public IMap<Object, Object> tileserverMap(final HazelcastInstance hazelcast) {
final IMap<Object, Object> x = hazelcast.getMap("tileserver");
return x;
}
/**
* Elastic remove queue.
*
* @param hazelcast the hazelcast
* @return the i queue
*/
@Bean
public IQueue<Object> elasticRemoveQueue(final HazelcastInstance hazelcast) {
return hazelcast.getQueue("es-remove");
}
/**
* Elastic update queue.
*
* @param hazelcast the hazelcast
* @return the i queue
*/
@Bean
public IQueue<Object> elasticUpdateQueue(final HazelcastInstance hazelcast) {
return hazelcast.getQueue("es-update");
}
/**
* Distributed executor.
*
* @param hazelcast the hazelcast
* @return the i executor service
*/
@Bean
public IExecutorService distributedExecutor(final HazelcastInstance hazelcast) {
final IExecutorService executorService = hazelcast.getExecutorService("hazel-exec");
return executorService;
}
/**
* Account lockout map.
*
* @param hazelcast the hazelcast
* @return the i map
*/
@Bean
public IMap<String, AttemptStatistics> accountLockoutMap(final HazelcastInstance hazelcast) {
final IMap<String, AttemptStatistics> x = hazelcast.getMap("accountLocks");
return x;