Commit 6f8adc31 authored by Matija Obreza's avatar Matija Obreza
Browse files

Update javadoc

- JAutodoc headers and members
parent cabd3831
......@@ -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> {
......
/*
* 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();
......
/*
* 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.
......@@ -18,6 +18,9 @@ package org.genesys.blocks.model;
import javax.persistence.Column;
import javax.persistence.Entity;
/**
* The Class UuidEntity.
*/
@Entity
public class UuidEntity extends UuidModel {
......@@ -26,10 +29,20 @@ public class UuidEntity extends UuidModel {
@Column(nullable = false)
private String name;
/**
* Gets the name.
*
* @return the name
*/
public String getName() {
return name;
}
/**
* Sets the name.
*
* @param name the new name
*/
public void setName(String name) {
this.name = name;
}
......
/*
* 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.
......@@ -18,6 +18,9 @@ package org.genesys.blocks.model;
import javax.persistence.Column;
import javax.persistence.Entity;
/**
* The Class VersionedEntity.
*/
@Entity
public class VersionedEntity extends VersionedModel {
......@@ -26,10 +29,20 @@ public class VersionedEntity extends VersionedModel {
@Column(nullable = false)
private String name;
/**
* Gets the name.
*
* @return the name
*/
public String getName() {
return name;
}
/**
* Sets the name.
*
* @param name the new name
*/
public void setName(String name) {
this.name = name;
}
......
/*
* 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.
......@@ -18,6 +18,9 @@ package org.genesys.blocks.persistence;
import org.genesys.blocks.model.UuidEntity;
import org.springframework.data.jpa.repository.JpaRepository;
/**
* The Interface UuidEntityRepository.
*/
public interface UuidEntityRepository extends JpaRepository<UuidEntity, Long> {
}
/*
* 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.
......@@ -18,6 +18,9 @@ package org.genesys.blocks.persistence;
import org.genesys.blocks.model.VersionedEntity;
import org.springframework.data.jpa.repository.JpaRepository;
/**
* The Interface VersionedEntityRepository.
*/
public interface VersionedEntityRepository extends JpaRepository<VersionedEntity, Long> {
}
/*
* 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,8 @@ import org.springframework.test.context.transaction.AfterTransaction;
import org.springframework.transaction.annotation.Transactional;
/**
* The Class BaseTest.
*
* @author Matija Obreza
* @author Maxym Borodenko
*/
......@@ -39,14 +41,21 @@ import org.springframework.transaction.annotation.Transactional;
@EnableAspectJAutoProxy
@ContextConfiguration(name = "root", classes = { ApplicationConfig.class })
public abstract class BaseTest {
/** The log. */
protected final Logger LOG = LoggerFactory.getLogger(getClass());
/** The versioned entity repository. */
@Autowired
protected VersionedEntityRepository versionedEntityRepository;
/** The uuid entity repository. */
@Autowired
protected UuidEntityRepository uuidEntityRepository;
/**
* Cleanup.
*/
@AfterTransaction
@Transactional
public void cleanup() {
......
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