Polished JavaDoc and code.
Removed any reference to Hades from JavaDoc and code. Use a logger instead of System.out in test cases.
This commit is contained in:
@@ -58,7 +58,7 @@ public abstract class AbstractAuditable<U, PK extends Serializable> extends
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.synyx.hades.domain.auditing.Auditable#getCreatedBy()
|
||||
* @see org.springframework.data.domain.Auditable#getCreatedBy()
|
||||
*/
|
||||
public U getCreatedBy() {
|
||||
|
||||
@@ -70,7 +70,7 @@ public abstract class AbstractAuditable<U, PK extends Serializable> extends
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.synyx.hades.domain.auditing.Auditable#setCreatedBy(java.lang.Object)
|
||||
* org.springframework.data.domain.Auditable#setCreatedBy(java.lang.Object)
|
||||
*/
|
||||
public void setCreatedBy(final U createdBy) {
|
||||
|
||||
@@ -81,7 +81,7 @@ public abstract class AbstractAuditable<U, PK extends Serializable> extends
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.synyx.hades.domain.auditing.Auditable#getCreatedDate()
|
||||
* @see org.springframework.data.domain.Auditable#getCreatedDate()
|
||||
*/
|
||||
public DateTime getCreatedDate() {
|
||||
|
||||
@@ -93,7 +93,7 @@ public abstract class AbstractAuditable<U, PK extends Serializable> extends
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.synyx.hades.domain.auditing.Auditable#setCreatedDate(org.joda.time
|
||||
* org.springframework.data.domain.Auditable#setCreatedDate(org.joda.time
|
||||
* .DateTime)
|
||||
*/
|
||||
public void setCreatedDate(final DateTime createdDate) {
|
||||
@@ -105,7 +105,7 @@ public abstract class AbstractAuditable<U, PK extends Serializable> extends
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.synyx.hades.domain.auditing.Auditable#getLastModifiedBy()
|
||||
* @see org.springframework.data.domain.Auditable#getLastModifiedBy()
|
||||
*/
|
||||
public U getLastModifiedBy() {
|
||||
|
||||
@@ -117,7 +117,7 @@ public abstract class AbstractAuditable<U, PK extends Serializable> extends
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.synyx.hades.domain.auditing.Auditable#setLastModifiedBy(java.lang
|
||||
* org.springframework.data.domain.Auditable#setLastModifiedBy(java.lang
|
||||
* .Object)
|
||||
*/
|
||||
public void setLastModifiedBy(final U lastModifiedBy) {
|
||||
@@ -129,7 +129,7 @@ public abstract class AbstractAuditable<U, PK extends Serializable> extends
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.synyx.hades.domain.auditing.Auditable#getLastModifiedDate()
|
||||
* @see org.springframework.data.domain.Auditable#getLastModifiedDate()
|
||||
*/
|
||||
public DateTime getLastModifiedDate() {
|
||||
|
||||
@@ -141,7 +141,7 @@ public abstract class AbstractAuditable<U, PK extends Serializable> extends
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.synyx.hades.domain.auditing.Auditable#setLastModifiedDate(org.joda
|
||||
* org.springframework.data.domain.Auditable#setLastModifiedDate(org.joda
|
||||
* .time.DateTime)
|
||||
*/
|
||||
public void setLastModifiedDate(final DateTime lastModifiedDate) {
|
||||
|
||||
@@ -48,7 +48,7 @@ public abstract class AbstractPersistable<PK extends Serializable> implements
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.synyx.hades.hades.jpa.support.Entity#getId()
|
||||
* @see org.springframework.data.domain.Persistable#getId()
|
||||
*/
|
||||
public PK getId() {
|
||||
|
||||
@@ -70,7 +70,7 @@ public abstract class AbstractPersistable<PK extends Serializable> implements
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.synyx.hades.hades.jpa.support.Entity#isNew()
|
||||
* @see org.springframework.data.domain.Persistable#isNew()
|
||||
*/
|
||||
public boolean isNew() {
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ import javax.persistence.criteria.Predicate;
|
||||
import javax.persistence.criteria.Root;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Helper class to easily combine {@link Specification} instances.
|
||||
*
|
||||
@@ -122,9 +121,8 @@ public class Specifications<T> implements Specification<T> {
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.synyx.hades.domain.Specification#toPredicate(javax.persistence.criteria
|
||||
* .Root, javax.persistence.criteria.CriteriaQuery,
|
||||
* @see org.springframework.data.jpa.domain.Specification#toPredicate(javax.
|
||||
* persistence.criteria.Root, javax.persistence.criteria.CriteriaQuery,
|
||||
* javax.persistence.criteria.CriteriaBuilder)
|
||||
*/
|
||||
public Predicate toPredicate(Root<T> root, CriteriaQuery<?> query,
|
||||
|
||||
@@ -45,7 +45,7 @@ import org.springframework.data.domain.AuditorAware;
|
||||
* After that it's just a matter of activating auditing in your Spring config:
|
||||
*
|
||||
* <pre>
|
||||
* <hades:auditing auditor-aware-ref="yourAuditorAwarebean" />
|
||||
* <jpa:auditing auditor-aware-ref="yourAuditorAwarebean" />
|
||||
* </pre>
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
|
||||
@@ -74,10 +74,10 @@ public class SimpleJpaRepositoryConfiguration
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
/**
|
||||
* Returns the name of the entity manager factory bean.
|
||||
*
|
||||
* @see org.synyx.hades.dao.config.DaoConfigContext#getEntityManagerRef()
|
||||
* @return
|
||||
*/
|
||||
public String getEntityManagerFactoryRef() {
|
||||
|
||||
@@ -89,10 +89,6 @@ public class SimpleJpaRepositoryConfiguration
|
||||
AutomaticRepositoryConfigInformation<SimpleJpaRepositoryConfiguration>
|
||||
implements JpaRepositoryConfiguration {
|
||||
|
||||
/**
|
||||
* @param interfaceName
|
||||
* @param parent
|
||||
*/
|
||||
public AutomaticJpaRepositoryConfigInformation(String interfaceName,
|
||||
SimpleJpaRepositoryConfiguration parent) {
|
||||
|
||||
@@ -116,10 +112,6 @@ public class SimpleJpaRepositoryConfiguration
|
||||
ManualRepositoryConfigInformation<SimpleJpaRepositoryConfiguration>
|
||||
implements JpaRepositoryConfiguration {
|
||||
|
||||
/**
|
||||
* @param element
|
||||
* @param parent
|
||||
*/
|
||||
public ManualJpaRepositoryConfigInformation(Element element,
|
||||
SimpleJpaRepositoryConfiguration parent) {
|
||||
|
||||
@@ -130,8 +122,9 @@ public class SimpleJpaRepositoryConfiguration
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.synyx.hades.dao.config.DaoConfigContext#getEntityManagerRef()
|
||||
* @see org.springframework.data.jpa.repository.config.
|
||||
* SimpleJpaRepositoryConfiguration
|
||||
* .JpaRepositoryConfiguration#getEntityManagerFactoryRef()
|
||||
*/
|
||||
public String getEntityManagerFactoryRef() {
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ import javax.persistence.EntityManager;
|
||||
import javax.persistence.NoResultException;
|
||||
import javax.persistence.Query;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.repository.query.Parameters;
|
||||
import org.springframework.data.repository.query.QueryMethod;
|
||||
@@ -29,16 +30,17 @@ import org.springframework.util.Assert;
|
||||
|
||||
|
||||
/**
|
||||
* Enum to contain query execution strategies. Depending (mostly) on the return
|
||||
* type of a {@link QueryMethod} a {@link HadesQuery} can be executed in various
|
||||
* flavours.
|
||||
* Set of classes to contain query execution strategies. Depending (mostly) on
|
||||
* the return type of a {@link QueryMethod} a
|
||||
* {@link AbstractStringBasedJpaQuery} can be executed in various flavours.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public abstract class JpaQueryExecution {
|
||||
|
||||
/**
|
||||
* Executes the given {@link HadesQuery} with the given {@link Parameters}.
|
||||
* Executes the given {@link AbstractStringBasedJpaQuery} with the given
|
||||
* {@link ParameterBinder}.
|
||||
*
|
||||
* @param query
|
||||
* @param binder
|
||||
@@ -73,8 +75,8 @@ public abstract class JpaQueryExecution {
|
||||
|
||||
|
||||
/**
|
||||
* Method to implement {@link AbstractHadesQuery} executions by single enum
|
||||
* values.
|
||||
* Method to implement {@link AbstractStringBasedJpaQuery} executions by
|
||||
* single enum values.
|
||||
*
|
||||
* @param query
|
||||
* @param binder
|
||||
@@ -88,8 +90,8 @@ public abstract class JpaQueryExecution {
|
||||
Object[] parameters);
|
||||
|
||||
/**
|
||||
* Executes the {@link HadesQuery} to return a simple collection of
|
||||
* entities.
|
||||
* Executes the {@link AbstractStringBasedJpaQuery} to return a simple
|
||||
* collection of entities.
|
||||
*/
|
||||
static class CollectionExecution extends JpaQueryExecution {
|
||||
|
||||
@@ -117,8 +119,8 @@ public abstract class JpaQueryExecution {
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the {@link HadesQuery} to return a
|
||||
* {@link org.synyx.hades.domain.Page} of entities.
|
||||
* Executes the {@link AbstractStringBasedJpaQuery} to return a {@link Page}
|
||||
* of entities.
|
||||
*/
|
||||
static class PagedExecution extends JpaQueryExecution {
|
||||
|
||||
@@ -174,7 +176,7 @@ public abstract class JpaQueryExecution {
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a {@link HadesQuery} to return a single entity.
|
||||
* Executes a {@link AbstractStringBasedJpaQuery} to return a single entity.
|
||||
*/
|
||||
static class SingleEntityExecution extends JpaQueryExecution {
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ public class JpaQueryLookupStrategy {
|
||||
EntityManager em) {
|
||||
|
||||
RepositoryQuery query =
|
||||
SimpleJpaQuery.fromHadesAnnotation(method, em);
|
||||
SimpleJpaQuery.fromQueryAnnotation(method, em);
|
||||
|
||||
if (null != query) {
|
||||
return query;
|
||||
@@ -130,7 +130,7 @@ public class JpaQueryLookupStrategy {
|
||||
|
||||
throw new IllegalStateException(
|
||||
String.format(
|
||||
"Did neither find a NamedQuery nor a Hades Query for method %s!",
|
||||
"Did neither find a NamedQuery nor an annotated query for method %s!",
|
||||
method));
|
||||
}
|
||||
|
||||
|
||||
@@ -117,8 +117,10 @@ final class NamedQuery extends AbstractStringBasedJpaQuery {
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.synyx.hades.dao.query.AbstractHadesQuery#createQuery(javax.persistence
|
||||
* .EntityManager, org.synyx.hades.dao.query.ParameterBinder)
|
||||
* org.springframework.data.jpa.repository.query.AbstractStringBasedJpaQuery
|
||||
* #
|
||||
* createQuery(org.springframework.data.jpa.repository.query.ParameterBinder
|
||||
* )
|
||||
*/
|
||||
@Override
|
||||
protected Query createQuery(ParameterBinder binder) {
|
||||
@@ -130,8 +132,10 @@ final class NamedQuery extends AbstractStringBasedJpaQuery {
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.synyx.hades.dao.query.AbstractHadesQuery#createCountQuery(javax.
|
||||
* persistence.EntityManager)
|
||||
* @see
|
||||
* org.springframework.data.jpa.repository.query.AbstractStringBasedJpaQuery
|
||||
* #createCountQuery(org.springframework.data.jpa.repository.query.
|
||||
* ParameterBinder)
|
||||
*/
|
||||
@Override
|
||||
protected Query createCountQuery(ParameterBinder binder) {
|
||||
|
||||
@@ -28,9 +28,9 @@ import org.springframework.data.repository.query.RepositoryQuery;
|
||||
|
||||
|
||||
/**
|
||||
* {@link HadesQuery} implementation that inspects a {@link QueryMethod} for the
|
||||
* existanve of an {@link org.synyx.hades.dao.Query} annotation and creates a
|
||||
* JPA {@link Query} from it.
|
||||
* {@link RepositoryQuery} implementation that inspects a {@link QueryMethod}
|
||||
* for the existanve of an {@link org.springframework.data.jpa.repository.Query}
|
||||
* annotation and creates a JPA {@link Query} from it.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
@@ -66,8 +66,10 @@ final class SimpleJpaQuery extends AbstractStringBasedJpaQuery {
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.synyx.hades.dao.query.AbstractHadesQuery#createQuery(javax.persistence
|
||||
* .EntityManager, org.synyx.hades.dao.query.ParameterBinder)
|
||||
* org.springframework.data.jpa.repository.query.AbstractStringBasedJpaQuery
|
||||
* #
|
||||
* createQuery(org.springframework.data.jpa.repository.query.ParameterBinder
|
||||
* )
|
||||
*/
|
||||
@Override
|
||||
public Query createQuery(ParameterBinder binder) {
|
||||
@@ -111,18 +113,19 @@ final class SimpleJpaQuery extends AbstractStringBasedJpaQuery {
|
||||
|
||||
|
||||
/**
|
||||
* Creates a {@link HadesQuery} from the given {@link QueryMethod} that is
|
||||
* potentially annotated with {@link org.synyx.hades.dao.Query}.
|
||||
* Creates a {@link RepositoryQuery} from the given {@link QueryMethod} that
|
||||
* is potentially annotated with
|
||||
* {@link org.springframework.data.jpa.repository.Query}.
|
||||
*
|
||||
* @param queryMethod
|
||||
* @param em
|
||||
* @return the {@link HadesQuery} derived from the annotation or
|
||||
* @return the {@link RepositoryQuery} derived from the annotation or
|
||||
* {@code null} if no annotation found.
|
||||
*/
|
||||
public static RepositoryQuery fromHadesAnnotation(
|
||||
public static RepositoryQuery fromQueryAnnotation(
|
||||
JpaQueryMethod queryMethod, EntityManager em) {
|
||||
|
||||
LOG.debug("Looking up Hades query for method %s", queryMethod.getName());
|
||||
LOG.debug("Looking up query for method %s", queryMethod.getName());
|
||||
|
||||
String query = queryMethod.getAnnotatedQuery();
|
||||
|
||||
|
||||
@@ -138,7 +138,9 @@ enum PersistenceProvider implements QueryExtractor {
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.synyx.hades.dao.query.QueryExtractor#canExtractQuery()
|
||||
* @see
|
||||
* org.springframework.data.jpa.repository.query.QueryExtractor#canExtractQuery
|
||||
* ()
|
||||
*/
|
||||
public boolean canExtractQuery() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user