Commit ffa655be authored by Matija Obreza's avatar Matija Obreza
Browse files

Merge branch 'release-1.4' into 'master'

Release 1.4

See merge request genesys-pgr/application-blocks!34
parents cabd3831 149f457d
/*
* 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.
......@@ -65,8 +65,8 @@ public class JsonViews {
}
/**
* Marks fields that may not be serialized by default (in lieu of {@link JsonIgnore})
* TBD: check {@link Root}
* Marks fields that may not be serialized by default (in lieu of
* {@link JsonIgnore}) TBD: check {@link Root}.
*/
public static interface Indexed extends Internal {
......
/*
* 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.
......
......@@ -28,6 +28,9 @@ import org.springframework.util.ReflectionUtils.FieldFilter;
*/
public interface SelfCleaning {
/**
* Trim strings to null.
*/
default void trimStringsToNull() {
// System.err.println("Self-cleanup of " + this);
ReflectionUtils.doWithFields(this.getClass(), field -> {
......
/*
* 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.
......@@ -28,6 +28,7 @@ import com.fasterxml.jackson.annotation.JsonView;
@MappedSuperclass
public abstract class VersionedModel extends BasicModel implements Activatable {
/** The Constant DEFAULT_ACTIVE_VALUE. */
static final boolean DEFAULT_ACTIVE_VALUE = true;
/** The Constant serialVersionUID. */
......
/*
* 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.
......
......@@ -26,6 +26,9 @@ import org.genesys.blocks.model.QAuditedVersionedModel;
/**
* {@link AuditedVersionedModel} match by sample filters.
*
* @param <T> the generic type
* @param <R> the generic type
*/
public abstract class AuditedVersionedModelFilter<T extends AuditedVersionedModelFilter<T, R>, R extends AuditedVersionedModel> extends VersionedModelFilter<T, R> {
......
......@@ -33,6 +33,9 @@ import com.querydsl.core.types.dsl.SimpleExpression;
/**
* {@link BasicModel} match by sample filters.
*
* @param <T> the generic type
* @param <R> the generic type
*/
public abstract class BasicModelFilter<T extends BasicModelFilter<T, R>, R extends BasicModel> {
......@@ -46,7 +49,7 @@ public abstract class BasicModelFilter<T extends BasicModelFilter<T, R>, R exten
/** The id. */
public Set<Long> id;
/** The negative filters, but don't de-/serialize it's own NOT-properties */
/** The negative filters, but don't de-/serialize it's own NOT-properties. */
@JsonIgnoreProperties({ "NOT", "NULL", "NOTNULL" })
public T NOT;
......@@ -66,7 +69,7 @@ public abstract class BasicModelFilter<T extends BasicModelFilter<T, R>, R exten
/**
* Builds the query.
*
* @param instance the instance of Q-type of <R>
* @param instance the instance of Q-type of <em>R</em>
* @param basicModel the basic model
* @param builder the builder
*/
......
/*
* 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.
......
......@@ -28,6 +28,9 @@ import com.querydsl.core.types.dsl.EntityPathBase;
/**
* {@link UuidModel} match by sample filters.
*
* @param <T> the generic type
* @param <R> the generic type
*/
public abstract class UuidModelFilter<T extends UuidModelFilter<T, R>, R extends AuditedVersionedModel> extends AuditedVersionedModelFilter<T, R> {
......
......@@ -26,6 +26,9 @@ import org.genesys.blocks.model.VersionedModel;
/**
* {@link VersionedModel} match by sample filters.
*
* @param <T> the generic type
* @param <R> the generic type
*/
public abstract class VersionedModelFilter<T extends VersionedModelFilter<T, R>, R extends VersionedModel> extends BasicModelFilter<T, R> {
......
/*
* 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.
......
......@@ -45,7 +45,7 @@ public class JsonClassNameWriter extends VirtualBeanPropertyWriter {
private static final Logger LOG = LoggerFactory.getLogger(JsonClassNameWriter.class);
/**
* Default constructor
* Default constructor.
*/
public JsonClassNameWriter() {
LOG.trace("JsonClassNameWriter");
......
/*
* 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.
......@@ -28,12 +28,20 @@ import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.context.annotation.Import;
import org.springframework.core.io.ClassPathResource;
/**
* The Class ApplicationConfig.
*/
@Configuration
@EnableAspectJAutoProxy
@Import({ DatabaseConfig.class })
@ComponentScan(basePackages = { })
public class ApplicationConfig {
/**
* Property placeholder configurer.
*
* @return the property placeholder configurer
*/
@Bean
public static PropertyPlaceholderConfigurer propertyPlaceholderConfigurer() {
......@@ -45,6 +53,11 @@ public class ApplicationConfig {
return propertyPlaceholderConfigurer;
}
/**
* Cache manager.
*
* @return the cache manager
*/
@Bean
public CacheManager cacheManager() {
final SimpleCacheManager cacheManager = new SimpleCacheManager();
......
/*
* 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.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
/**
* The Class DatabaseConfig.
*
* @author Matija Obreza
* @author Maxym Borodenko
*/
......@@ -73,6 +75,12 @@ public class DatabaseConfig {
@Value("${db.pool.initialSize}")
private int dbPoolInitialSize;
/**
* Data source.
*
* @return the data source
* @throws Exception the exception
*/
@Bean(name = "dataSource")
public DataSource dataSource() throws Exception {
final DataSource dataSource = new DataSource();
......@@ -90,11 +98,23 @@ public class DatabaseConfig {
return dataSource;
}
/**
* Jdbc template.
*
* @param dataSource the data source
* @return the jdbc template
*/
@Bean
public JdbcTemplate jdbcTemplate(final DataSource dataSource) {
return new JdbcTemplate(dataSource);
}
/**
* Entity manager factory.
*
* @return the local container entity manager factory bean
* @throws Exception the exception
*/
@Bean(name = "entityManagerFactory")
public LocalContainerEntityManagerFactoryBean entityManagerFactory() throws Exception {
final LocalContainerEntityManagerFactoryBean bean = new LocalContainerEntityManagerFactoryBean();
......@@ -117,6 +137,13 @@ public class DatabaseConfig {
return bean;
}
/**
* Jpa transaction manager.
*
* @param entityManagerFactory the entity manager factory
* @return the platform transaction manager
* @throws Exception the exception
*/
@Bean(name = "transactionManager")
public PlatformTransactionManager jpaTransactionManager(final EntityManagerFactory entityManagerFactory) throws Exception {
final JpaTransactionManager transactionManager = new JpaTransactionManager();
......@@ -125,6 +152,11 @@ public class DatabaseConfig {
return transactionManager;
}
/**
* Hibernate exception translator.
*
* @return the persistence exception translator
*/
@Bean
public PersistenceExceptionTranslator hibernateExceptionTranslator() {
return new HibernateExceptionTranslator();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment