Checkstyle fixups
This commit is contained in:
parent
58473c87dd
commit
2b66cd72bb
|
@ -19,6 +19,9 @@ public interface Metamodel extends javax.persistence.metamodel.Metamodel {
|
|||
*/
|
||||
SessionFactory getSessionFactory();
|
||||
|
||||
/**
|
||||
* @deprecated since 5.2
|
||||
*/
|
||||
@Deprecated
|
||||
default EntityType getEntityTypeByName(String entityName) {
|
||||
return entity( entityName );
|
||||
|
|
|
@ -444,6 +444,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*
|
||||
* @deprecated (since 5.2) use {@link ParameterMetadata#getNamedParameterNames()}
|
||||
*/
|
||||
@Deprecated
|
||||
String[] getNamedParameters();
|
||||
|
||||
/**
|
||||
|
|
|
@ -818,6 +818,9 @@ public class SessionFactoryBuilderImpl implements SessionFactoryBuilderImplement
|
|||
return transactionCoordinatorBuilder.getDefaultConnectionHandlingMode();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 5.2
|
||||
*/
|
||||
@Deprecated
|
||||
private PhysicalConnectionHandlingMode interpretConnectionHandlingMode(
|
||||
ConnectionAcquisitionMode specifiedAcquisitionMode,
|
||||
|
|
|
@ -582,8 +582,8 @@ public final class AnnotationBinder {
|
|||
entityBinder.setProxy( clazzToProcess.getAnnotation( Proxy.class ) );
|
||||
entityBinder.setBatchSize( clazzToProcess.getAnnotation( BatchSize.class ) );
|
||||
entityBinder.setWhere( clazzToProcess.getAnnotation( Where.class ) );
|
||||
entityBinder.setCache( determineCacheSettings( clazzToProcess, context ) );
|
||||
entityBinder.setNaturalIdCache( clazzToProcess, clazzToProcess.getAnnotation( NaturalIdCache.class ) );
|
||||
entityBinder.setCache( determineCacheSettings( clazzToProcess, context ) );
|
||||
entityBinder.setNaturalIdCache( clazzToProcess, clazzToProcess.getAnnotation( NaturalIdCache.class ) );
|
||||
|
||||
bindFilters( clazzToProcess, entityBinder, context );
|
||||
|
||||
|
@ -701,7 +701,7 @@ public final class AnnotationBinder {
|
|||
}
|
||||
}
|
||||
|
||||
if ( onDeleteAnn != null && !onDeleteAppropriate ) {
|
||||
if ( onDeleteAnn != null && !onDeleteAppropriate ) {
|
||||
LOG.invalidOnDeleteAnnotation(propertyHolder.getEntityName());
|
||||
}
|
||||
|
||||
|
@ -2900,7 +2900,7 @@ public final class AnnotationBinder {
|
|||
&& ! BinderHelper.isEmptyAnnotationValue( joinColumn.name() )
|
||||
&& joinColumn.name().equals( columnName )
|
||||
&& !property.isAnnotationPresent( MapsId.class ) ) {
|
||||
hasSpecjManyToOne = true;
|
||||
hasSpecjManyToOne = true;
|
||||
for ( Ejb3JoinColumn column : columns ) {
|
||||
column.setInsertable( false );
|
||||
column.setUpdatable( false );
|
||||
|
|
|
@ -612,7 +612,7 @@ public interface AvailableSettings {
|
|||
* @see #SESSION_FACTORY_NAME_IS_JNDI
|
||||
* @see org.hibernate.internal.SessionFactoryRegistry
|
||||
*/
|
||||
String SESSION_FACTORY_NAME = "hibernate.session_factory_name";
|
||||
String SESSION_FACTORY_NAME = "hibernate.session_factory_name";
|
||||
|
||||
/**
|
||||
* Does the value defined by {@link #SESSION_FACTORY_NAME} represent a JNDI namespace into which
|
||||
|
@ -860,6 +860,7 @@ public interface AvailableSettings {
|
|||
* Proxool/Hibernate property prefix
|
||||
* @deprecated Use {@link #PROXOOL_CONFIG_PREFIX} instead
|
||||
*/
|
||||
@Deprecated
|
||||
String PROXOOL_PREFIX = PROXOOL_CONFIG_PREFIX;
|
||||
|
||||
/**
|
||||
|
@ -950,7 +951,7 @@ public interface AvailableSettings {
|
|||
/**
|
||||
* The EntityMode in which set the Session opened from the SessionFactory.
|
||||
*/
|
||||
String DEFAULT_ENTITY_MODE = "hibernate.default_entity_mode";
|
||||
String DEFAULT_ENTITY_MODE = "hibernate.default_entity_mode";
|
||||
|
||||
/**
|
||||
* Should all database identifiers be quoted. A {@code true}/{@code false} option.
|
||||
|
@ -1362,7 +1363,7 @@ public interface AvailableSettings {
|
|||
*/
|
||||
String STATEMENT_INSPECTOR = "hibernate.session_factory.statement_inspector";
|
||||
|
||||
String ENABLE_LAZY_LOAD_NO_TRANS = "hibernate.enable_lazy_load_no_trans";
|
||||
String ENABLE_LAZY_LOAD_NO_TRANS = "hibernate.enable_lazy_load_no_trans";
|
||||
|
||||
String HQL_BULK_ID_STRATEGY = "hibernate.hql.bulk_id_strategy";
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ public class BinderHelper {
|
|||
|
||||
public static final String ANNOTATION_STRING_DEFAULT = "";
|
||||
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, BinderHelper.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, BinderHelper.class.getName());
|
||||
|
||||
private BinderHelper() {
|
||||
}
|
||||
|
@ -258,7 +258,7 @@ public class BinderHelper {
|
|||
Object columnOwner = findColumnOwner( ownerEntity, columns[0].getReferencedColumn(), context );
|
||||
List<Property> properties = findPropertiesByColumns( columnOwner, columns, context );
|
||||
//create an embeddable component
|
||||
Property synthProp = null;
|
||||
Property synthProp = null;
|
||||
if ( properties != null ) {
|
||||
//todo how about properties.size() == 1, this should be much simpler
|
||||
Component embeddedComp = columnOwner instanceof PersistentClass ?
|
||||
|
@ -273,8 +273,8 @@ public class BinderHelper {
|
|||
clone.setNaturalIdentifier( false );
|
||||
clone.setValueGenerationStrategy( property.getValueGenerationStrategy() );
|
||||
embeddedComp.addProperty( clone );
|
||||
}
|
||||
synthProp = new SyntheticProperty();
|
||||
}
|
||||
synthProp = new SyntheticProperty();
|
||||
synthProp.setName( syntheticPropertyName );
|
||||
synthProp.setPersistentClass( ownerEntity );
|
||||
synthProp.setUpdateable( false );
|
||||
|
@ -282,9 +282,9 @@ public class BinderHelper {
|
|||
synthProp.setValue( embeddedComp );
|
||||
synthProp.setPropertyAccessorName( "embedded" );
|
||||
ownerEntity.addProperty( synthProp );
|
||||
//make it unique
|
||||
//make it unique
|
||||
TableBinder.createUniqueConstraint( embeddedComp );
|
||||
}
|
||||
}
|
||||
else {
|
||||
//TODO use a ToOne type doing a second select
|
||||
StringBuilder columnsList = new StringBuilder();
|
||||
|
@ -838,7 +838,7 @@ public class BinderHelper {
|
|||
MetadataBuildingContext buildingContext) {
|
||||
final XClass persistentXClass;
|
||||
try {
|
||||
persistentXClass = buildingContext.getBuildingOptions().getReflectionManager()
|
||||
persistentXClass = buildingContext.getBuildingOptions().getReflectionManager()
|
||||
.classForName( propertyHolder.getPersistentClass().getClassName() );
|
||||
}
|
||||
catch ( ClassLoadingException e ) {
|
||||
|
@ -857,8 +857,8 @@ public class BinderHelper {
|
|||
}
|
||||
return pd;
|
||||
}
|
||||
String propertyPath = isId ? "" : propertyName;
|
||||
return buildingContext.getMetadataCollector().getPropertyAnnotatedWithMapsId( persistentXClass, propertyPath );
|
||||
String propertyPath = isId ? "" : propertyName;
|
||||
return buildingContext.getMetadataCollector().getPropertyAnnotatedWithMapsId( persistentXClass, propertyPath );
|
||||
}
|
||||
|
||||
public static Map<String,String> toAliasTableMap(SqlFragmentAlias[] aliases){
|
||||
|
|
|
@ -82,7 +82,7 @@ import org.hibernate.usertype.UserType;
|
|||
*/
|
||||
@SuppressWarnings( {"UnusedDeclaration"})
|
||||
public class Configuration {
|
||||
private static final CoreMessageLogger log = CoreLogging.messageLogger( Configuration.class );
|
||||
private static final CoreMessageLogger log = CoreLogging.messageLogger( Configuration.class );
|
||||
|
||||
public static final String ARTEFACT_PROCESSING_ORDER = AvailableSettings.ARTIFACT_PROCESSING_ORDER;
|
||||
|
||||
|
|
|
@ -121,8 +121,7 @@ public class CopyIdentifierComponentSecondPass implements SecondPass {
|
|||
|
||||
|
||||
Iterator<Property> propertyIterator = referencedValue.getPropertyIterator();
|
||||
while(propertyIterator.hasNext())
|
||||
{
|
||||
while(propertyIterator.hasNext()) {
|
||||
Property referencedComponentProperty = propertyIterator.next();
|
||||
|
||||
if ( referencedComponentProperty.isComposite() ) {
|
||||
|
|
|
@ -90,7 +90,7 @@ public class DefaultNamingStrategy implements NamingStrategy, Serializable {
|
|||
* otherwise the concatenation of owner entity table and the unqualified property name
|
||||
*/
|
||||
public String logicalCollectionTableName(String tableName,
|
||||
String ownerEntityTable, String associatedEntityTable, String propertyName
|
||||
String ownerEntityTable, String associatedEntityTable, String propertyName
|
||||
) {
|
||||
if ( tableName != null ) {
|
||||
return tableName;
|
||||
|
|
|
@ -42,7 +42,7 @@ import org.jboss.logging.Logger;
|
|||
*/
|
||||
public class Ejb3Column {
|
||||
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, Ejb3Column.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, Ejb3Column.class.getName());
|
||||
|
||||
private MetadataBuildingContext context;
|
||||
|
||||
|
@ -596,7 +596,7 @@ public class Ejb3Column {
|
|||
column.setPropertyName(
|
||||
BinderHelper.getRelativePath( propertyHolder, inferredData.getPropertyName() )
|
||||
);
|
||||
column.setNullable(
|
||||
column.setNullable(
|
||||
col.nullable()
|
||||
); //TODO force to not null if available? This is a (bad) user choice.
|
||||
column.setUnique( col.unique() );
|
||||
|
|
|
@ -479,7 +479,7 @@ public class Ejb3JoinColumn extends Ejb3Column {
|
|||
getMappingColumn() != null ? getMappingColumn().isNullable() : false,
|
||||
referencedColumn.getSqlType(),
|
||||
getMappingColumn() != null ? getMappingColumn().isUnique() : false,
|
||||
false
|
||||
false
|
||||
);
|
||||
linkWithValue( value );
|
||||
}
|
||||
|
@ -763,7 +763,7 @@ public class Ejb3JoinColumn extends Ejb3Column {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void addColumnBinding(SimpleValue value) {
|
||||
protected void addColumnBinding(SimpleValue value) {
|
||||
if ( StringHelper.isEmpty( mappedBy ) ) {
|
||||
// was the column explicitly quoted in the mapping/annotation
|
||||
// TODO: in metamodel, we need to better split global quoting and explicit quoting w/ respect to logical names
|
||||
|
|
|
@ -214,14 +214,15 @@ public final class Environment implements AvailableSettings {
|
|||
}
|
||||
|
||||
try {
|
||||
Properties systemProperties = System.getProperties();
|
||||
Properties systemProperties = System.getProperties();
|
||||
// Must be thread-safe in case an application changes System properties during Hibernate initialization.
|
||||
// See HHH-8383.
|
||||
synchronized (systemProperties) {
|
||||
GLOBAL_PROPERTIES.putAll(systemProperties);
|
||||
}
|
||||
} catch (SecurityException se) {
|
||||
LOG.unableToCopySystemProperties();
|
||||
synchronized (systemProperties) {
|
||||
GLOBAL_PROPERTIES.putAll(systemProperties);
|
||||
}
|
||||
}
|
||||
catch (SecurityException se) {
|
||||
LOG.unableToCopySystemProperties();
|
||||
}
|
||||
|
||||
verifyProperties(GLOBAL_PROPERTIES);
|
||||
|
|
|
@ -316,8 +316,7 @@ public abstract class ExternalSessionFactoryConfig {
|
|||
}
|
||||
}
|
||||
|
||||
private void verifyInt(String value)
|
||||
{
|
||||
private void verifyInt(String value) {
|
||||
if ( value != null ) {
|
||||
Integer.parseInt( value );
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ public class ImprovedNamingStrategy implements NamingStrategy, Serializable {
|
|||
* otherwise the concatenation of owner entity table and the unqualified property name
|
||||
*/
|
||||
public String logicalCollectionTableName(String tableName,
|
||||
String ownerEntityTable, String associatedEntityTable, String propertyName
|
||||
String ownerEntityTable, String associatedEntityTable, String propertyName
|
||||
) {
|
||||
if ( tableName != null ) {
|
||||
return tableName;
|
||||
|
|
|
@ -82,9 +82,11 @@ public class IndexOrUniqueKeySecondPass implements SecondPass {
|
|||
"@Index references a unknown column: " + columnName
|
||||
);
|
||||
}
|
||||
if ( unique )
|
||||
if ( unique ) {
|
||||
table.getOrCreateUniqueKey( indexName ).addColumn( column );
|
||||
else
|
||||
}
|
||||
else {
|
||||
table.getOrCreateIndex( indexName ).addColumn( column );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -237,12 +237,13 @@ public class InheritanceState {
|
|||
}
|
||||
|
||||
private AccessType determineDefaultAccessType() {
|
||||
for (XClass xclass = clazz; xclass != null; xclass = xclass.getSuperclass()) {
|
||||
if ((xclass.getSuperclass() == null || Object.class.getName().equals(xclass.getSuperclass().getName()))
|
||||
&& (xclass.isAnnotationPresent(Entity.class) || xclass.isAnnotationPresent(MappedSuperclass.class))
|
||||
&& xclass.isAnnotationPresent(Access.class))
|
||||
return AccessType.getAccessStrategy(xclass.getAnnotation(Access.class).value());
|
||||
}
|
||||
for (XClass xclass = clazz; xclass != null; xclass = xclass.getSuperclass()) {
|
||||
if ( ( xclass.getSuperclass() == null || Object.class.getName().equals( xclass.getSuperclass().getName() ) )
|
||||
&& ( xclass.isAnnotationPresent( Entity.class ) || xclass.isAnnotationPresent( MappedSuperclass.class ) )
|
||||
&& xclass.isAnnotationPresent( Access.class ) ) {
|
||||
return AccessType.getAccessStrategy( xclass.getAnnotation( Access.class ).value() );
|
||||
}
|
||||
}
|
||||
// Guess from identifier.
|
||||
// FIX: Shouldn't this be determined by the first attribute (i.e., field or property) with annotations, but without an
|
||||
// explicit Access annotation, according to JPA 2.0 spec 2.3.1: Default Access Type?
|
||||
|
@ -262,7 +263,7 @@ public class InheritanceState {
|
|||
}
|
||||
}
|
||||
}
|
||||
throw new AnnotationException( "No identifier specified for entity: " + clazz );
|
||||
throw new AnnotationException( "No identifier specified for entity: " + clazz );
|
||||
}
|
||||
|
||||
private void getMappedSuperclassesTillNextEntityOrdered() {
|
||||
|
|
|
@ -46,5 +46,3 @@ public enum MetadataSourceType {
|
|||
throw new HibernateException( "Unknown metadata source type value [" + value + "]" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -308,4 +308,3 @@ public class OneToOneSecondPass implements SecondPass {
|
|||
return join;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ public class PkDrivenByDefaultMapsIdSecondPass implements SecondPass {
|
|||
throw new AnnotationException(
|
||||
"Unknown entity name: " + referencedEntityName
|
||||
);
|
||||
};
|
||||
}
|
||||
TableBinder.linkJoinColumnWithValueOverridingNameIfImplicit(
|
||||
referencedEntity,
|
||||
referencedEntity.getKey().getColumnIterator(),
|
||||
|
|
|
@ -49,7 +49,7 @@ class PropertyContainer {
|
|||
// System.setProperty("jboss.i18n.generate-proxies", "true");
|
||||
// }
|
||||
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, PropertyContainer.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, PropertyContainer.class.getName());
|
||||
|
||||
/**
|
||||
* The class for which this container is created.
|
||||
|
@ -401,5 +401,3 @@ class PropertyContainer {
|
|||
|| "org.hibernate.bytecode.internal.javassist.FieldHandler".equals( property.getType().getName() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -50,12 +50,12 @@ public class ToOneFkSecondPass extends FkSecondPass {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getReferencedEntityName() {
|
||||
public String getReferencedEntityName() {
|
||||
return ( (ToOne) value ).getReferencedEntityName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInPrimaryKey() {
|
||||
public boolean isInPrimaryKey() {
|
||||
if ( entityClassName == null ) return false;
|
||||
final PersistentClass persistentClass = buildingContext.getMetadataCollector().getEntityBinding( entityClassName );
|
||||
Property property = persistentClass.getIdentifierProperty();
|
||||
|
|
|
@ -54,5 +54,3 @@ public class VerifyFetchProfileReferenceSecondPass implements SecondPass {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ import static org.hibernate.cfg.BinderHelper.toAliasTableMap;
|
|||
*/
|
||||
@SuppressWarnings({"unchecked", "serial"})
|
||||
public abstract class CollectionBinder {
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, CollectionBinder.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, CollectionBinder.class.getName());
|
||||
|
||||
private MetadataBuildingContext buildingContext;
|
||||
|
||||
|
@ -720,7 +720,7 @@ public abstract class CollectionBinder {
|
|||
final MetadataBuildingContext buildingContext) {
|
||||
return new CollectionSecondPass( buildingContext, collection ) {
|
||||
@Override
|
||||
public void secondPass(java.util.Map persistentClasses, java.util.Map inheritedMetas) throws MappingException {
|
||||
public void secondPass(java.util.Map persistentClasses, java.util.Map inheritedMetas) throws MappingException {
|
||||
bindStarToManySecondPass(
|
||||
persistentClasses,
|
||||
collType,
|
||||
|
@ -1174,18 +1174,18 @@ public abstract class CollectionBinder {
|
|||
|
||||
boolean isCollectionOfEntities = collectionEntity != null;
|
||||
ManyToAny anyAnn = property.getAnnotation( ManyToAny.class );
|
||||
if ( LOG.isDebugEnabled() ) {
|
||||
if ( LOG.isDebugEnabled() ) {
|
||||
String path = collValue.getOwnerEntityName() + "." + joinColumns[0].getPropertyName();
|
||||
if ( isCollectionOfEntities && unique ) {
|
||||
if ( isCollectionOfEntities && unique ) {
|
||||
LOG.debugf("Binding a OneToMany: %s through an association table", path);
|
||||
}
|
||||
else if (isCollectionOfEntities) {
|
||||
else if (isCollectionOfEntities) {
|
||||
LOG.debugf("Binding as ManyToMany: %s", path);
|
||||
}
|
||||
else if (anyAnn != null) {
|
||||
else if (anyAnn != null) {
|
||||
LOG.debugf("Binding a ManyToAny: %s", path);
|
||||
}
|
||||
else {
|
||||
else {
|
||||
LOG.debugf("Binding a collection of element: %s", path);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,8 +100,8 @@ import static org.hibernate.cfg.BinderHelper.toAliasTableMap;
|
|||
* @author Emmanuel Bernard
|
||||
*/
|
||||
public class EntityBinder {
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, EntityBinder.class.getName());
|
||||
private static final String NATURAL_ID_CACHE_SUFFIX = "##NaturalId";
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, EntityBinder.class.getName());
|
||||
private static final String NATURAL_ID_CACHE_SUFFIX = "##NaturalId";
|
||||
|
||||
private MetadataBuildingContext context;
|
||||
|
||||
|
@ -296,10 +296,10 @@ public class EntityBinder {
|
|||
}
|
||||
}
|
||||
else {
|
||||
if (explicitHibernateEntityAnnotation) {
|
||||
if (explicitHibernateEntityAnnotation) {
|
||||
LOG.entityAnnotationOnNonRoot(annotatedClass.getName());
|
||||
}
|
||||
if (annotatedClass.isAnnotationPresent(Immutable.class)) {
|
||||
if (annotatedClass.isAnnotationPresent(Immutable.class)) {
|
||||
LOG.immutableAnnotationOnNonRoot(annotatedClass.getName());
|
||||
}
|
||||
}
|
||||
|
@ -1159,7 +1159,7 @@ public class EntityBinder {
|
|||
public AccessType getPropertyAccessor(XAnnotatedElement element) {
|
||||
AccessType accessType = getExplicitAccessType( element );
|
||||
if ( accessType == null ) {
|
||||
accessType = propertyAccessType;
|
||||
accessType = propertyAccessType;
|
||||
}
|
||||
return accessType;
|
||||
}
|
||||
|
|
|
@ -53,14 +53,16 @@ public class ListBinder extends CollectionBinder {
|
|||
|
||||
@Override
|
||||
public void setSqlOrderBy(OrderBy orderByAnn) {
|
||||
if ( orderByAnn != null )
|
||||
if ( orderByAnn != null ) {
|
||||
LOG.orderByAnnotationIndexedCollection();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSort(Sort sortAnn) {
|
||||
if ( sortAnn != null )
|
||||
if ( sortAnn != null ) {
|
||||
LOG.sortAnnotationIndexedCollection();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -51,7 +51,7 @@ import org.jboss.logging.Logger;
|
|||
* @author Emmanuel Bernard
|
||||
*/
|
||||
public class PropertyBinder {
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, PropertyBinder.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, PropertyBinder.class.getName());
|
||||
|
||||
private MetadataBuildingContext buildingContext;
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ import org.jboss.logging.Logger;
|
|||
* @author Emmanuel Bernard
|
||||
*/
|
||||
public abstract class QueryBinder {
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, QueryBinder.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, QueryBinder.class.getName());
|
||||
|
||||
public static void bindQuery(
|
||||
NamedQuery queryAnn,
|
||||
|
|
|
@ -21,14 +21,14 @@ public class SetBinder extends CollectionBinder {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Collection createCollection(PersistentClass persistentClass) {
|
||||
protected Collection createCollection(PersistentClass persistentClass) {
|
||||
return new org.hibernate.mapping.Set( getBuildingContext().getMetadataCollector(), persistentClass );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSqlOrderBy(OrderBy orderByAnn) {
|
||||
public void setSqlOrderBy(OrderBy orderByAnn) {
|
||||
if ( orderByAnn != null ) {
|
||||
super.setSqlOrderBy( orderByAnn );
|
||||
super.setSqlOrderBy( orderByAnn );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ import org.jboss.logging.Logger;
|
|||
* @author Emmanuel Bernard
|
||||
*/
|
||||
public class SimpleValueBinder {
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, SimpleValueBinder.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, SimpleValueBinder.class.getName());
|
||||
|
||||
private MetadataBuildingContext buildingContext;
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ import org.jboss.logging.Logger;
|
|||
@SuppressWarnings("unchecked")
|
||||
public class TableBinder {
|
||||
//TODO move it to a getter/setter strategy
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, TableBinder.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, TableBinder.class.getName());
|
||||
|
||||
MetadataBuildingContext buildingContext;
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ import org.dom4j.Element;
|
|||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public class JPAOverriddenAnnotationReader implements AnnotationReader {
|
||||
private static final CoreMessageLogger LOG = CoreLogging.messageLogger( JPAOverriddenAnnotationReader.class );
|
||||
private static final CoreMessageLogger LOG = CoreLogging.messageLogger( JPAOverriddenAnnotationReader.class );
|
||||
|
||||
private static final String SCHEMA_VALIDATION = "Activate schema validation for more information";
|
||||
private static final String WORD_SEPARATOR = "-";
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.dom4j.Element;
|
|||
* @author Brett Meyer
|
||||
*/
|
||||
public class XMLContext implements Serializable {
|
||||
private static final CoreMessageLogger LOG = CoreLogging.messageLogger( XMLContext.class );
|
||||
private static final CoreMessageLogger LOG = CoreLogging.messageLogger( XMLContext.class );
|
||||
|
||||
private final ClassLoaderAccess classLoaderAccess;
|
||||
|
||||
|
@ -310,11 +310,21 @@ public class XMLContext implements Serializable {
|
|||
|
||||
public void override(Default globalDefault) {
|
||||
if ( globalDefault != null ) {
|
||||
if ( globalDefault.getAccess() != null ) access = globalDefault.getAccess();
|
||||
if ( globalDefault.getPackageName() != null ) packageName = globalDefault.getPackageName();
|
||||
if ( globalDefault.getSchema() != null ) schema = globalDefault.getSchema();
|
||||
if ( globalDefault.getCatalog() != null ) catalog = globalDefault.getCatalog();
|
||||
if ( globalDefault.getDelimitedIdentifier() != null ) delimitedIdentifier = globalDefault.getDelimitedIdentifier();
|
||||
if ( globalDefault.getAccess() != null ) {
|
||||
access = globalDefault.getAccess();
|
||||
}
|
||||
if ( globalDefault.getPackageName() != null ) {
|
||||
packageName = globalDefault.getPackageName();
|
||||
}
|
||||
if ( globalDefault.getSchema() != null ) {
|
||||
schema = globalDefault.getSchema();
|
||||
}
|
||||
if ( globalDefault.getCatalog() != null ) {
|
||||
catalog = globalDefault.getCatalog();
|
||||
}
|
||||
if ( globalDefault.getDelimitedIdentifier() != null ) {
|
||||
delimitedIdentifier = globalDefault.getDelimitedIdentifier();
|
||||
}
|
||||
if ( globalDefault.getMetadataComplete() != null ) {
|
||||
metadataComplete = globalDefault.getMetadataComplete();
|
||||
}
|
||||
|
|
|
@ -42,8 +42,10 @@ import org.jboss.logging.Logger;
|
|||
public class BeanValidationEventListener
|
||||
implements PreInsertEventListener, PreUpdateEventListener, PreDeleteEventListener {
|
||||
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class,
|
||||
BeanValidationEventListener.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(
|
||||
CoreMessageLogger.class,
|
||||
BeanValidationEventListener.class.getName()
|
||||
);
|
||||
|
||||
private ValidatorFactory factory;
|
||||
private ConcurrentHashMap<EntityPersister, Set<String>> associationsPerEntityPersister =
|
||||
|
@ -99,7 +101,7 @@ public class BeanValidationEventListener
|
|||
}
|
||||
|
||||
private <T> void validate(T object, EntityMode mode, EntityPersister persister,
|
||||
SessionFactoryImplementor sessionFactory, GroupsPerOperation.Operation operation) {
|
||||
SessionFactoryImplementor sessionFactory, GroupsPerOperation.Operation operation) {
|
||||
if ( object == null || mode != EntityMode.POJO ) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -60,7 +60,8 @@ public class HibernateTraversableResolver implements TraversableResolver {
|
|||
//ToOne association
|
||||
else if ( type.isEntityType() || type.isAnyType() ) {
|
||||
associations.add( prefix + name );
|
||||
} else if ( type.isComponentType() ) {
|
||||
}
|
||||
else if ( type.isComponentType() ) {
|
||||
CompositeType componentType = (CompositeType) type;
|
||||
addAssociationsToTheSetForAllProperties(
|
||||
componentType.getPropertyNames(),
|
||||
|
@ -88,20 +89,20 @@ public class HibernateTraversableResolver implements TraversableResolver {
|
|||
}
|
||||
|
||||
public boolean isReachable(Object traversableObject,
|
||||
Path.Node traversableProperty,
|
||||
Class<?> rootBeanType,
|
||||
Path pathToTraversableObject,
|
||||
ElementType elementType) {
|
||||
Path.Node traversableProperty,
|
||||
Class<?> rootBeanType,
|
||||
Path pathToTraversableObject,
|
||||
ElementType elementType) {
|
||||
//lazy, don't load
|
||||
return Hibernate.isInitialized( traversableObject )
|
||||
&& Hibernate.isPropertyInitialized( traversableObject, traversableProperty.getName() );
|
||||
}
|
||||
|
||||
public boolean isCascadable(Object traversableObject,
|
||||
Path.Node traversableProperty,
|
||||
Class<?> rootBeanType,
|
||||
Path pathToTraversableObject,
|
||||
ElementType elementType) {
|
||||
Path.Node traversableProperty,
|
||||
Class<?> rootBeanType,
|
||||
Path pathToTraversableObject,
|
||||
ElementType elementType) {
|
||||
String path = getStringBasedPath( traversableProperty, pathToTraversableObject );
|
||||
return ! associations.contains(path);
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ import org.jboss.logging.Logger;
|
|||
*/
|
||||
class TypeSafeActivator {
|
||||
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, TypeSafeActivator.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, TypeSafeActivator.class.getName());
|
||||
|
||||
private static final String FACTORY_PROPERTY = "javax.persistence.validation.factory";
|
||||
|
||||
|
@ -268,7 +268,7 @@ class TypeSafeActivator {
|
|||
descriptor.getComposingConstraints(),
|
||||
property, propertyDesc, null,
|
||||
canApplyNotNull,
|
||||
dialect
|
||||
dialect
|
||||
);
|
||||
}
|
||||
return hasNotNull;
|
||||
|
|
|
@ -163,7 +163,8 @@ public class ParameterParser {
|
|||
// colon character has been escaped
|
||||
recognizer.other( c );
|
||||
indx++;
|
||||
} else if ( c == ':' ) {
|
||||
}
|
||||
else if ( c == ':' ) {
|
||||
// named parameter
|
||||
final int right = StringHelper.firstIndexOfChar( sqlString, ParserHelper.HQL_SEPARATORS_BITSET, indx + 1 );
|
||||
final int chopLocation = right < 0 ? sqlString.length() : right;
|
||||
|
|
|
@ -367,6 +367,7 @@ public interface SessionFactoryImplementor extends Mapping, SessionFactory, Quer
|
|||
* @param entityName The entity name for which to get the collection roles.
|
||||
* @return set of all the collection roles in which the given entityName participates.
|
||||
*/
|
||||
@Deprecated
|
||||
default Set<String> getCollectionRolesByEntityParticipant(String entityName) {
|
||||
return getMetamodel().getCollectionRolesByEntityParticipant( entityName );
|
||||
}
|
||||
|
|
|
@ -47,15 +47,20 @@ public class GetterFieldImpl implements Getter {
|
|||
if ( type.isPrimitive() ) {
|
||||
if ( type == Boolean.TYPE ) {
|
||||
return Boolean.valueOf( field.getBoolean( owner ) );
|
||||
} else if ( type == Byte.TYPE ) {
|
||||
}
|
||||
else if ( type == Byte.TYPE ) {
|
||||
return Byte.valueOf( field.getByte( owner ) );
|
||||
} else if ( type == Character.TYPE ) {
|
||||
}
|
||||
else if ( type == Character.TYPE ) {
|
||||
return Character.valueOf( field.getChar( owner ) );
|
||||
} else if ( type == Integer.TYPE ) {
|
||||
}
|
||||
else if ( type == Integer.TYPE ) {
|
||||
return Integer.valueOf( field.getInt( owner ) );
|
||||
} else if ( type == Long.TYPE ) {
|
||||
}
|
||||
else if ( type == Long.TYPE ) {
|
||||
return Long.valueOf( field.getLong( owner ) );
|
||||
} else if ( type == Short.TYPE ) {
|
||||
}
|
||||
else if ( type == Short.TYPE ) {
|
||||
return Short.valueOf( field.getShort( owner ) );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,8 +120,9 @@ public class BindingTypeHelper {
|
|||
public BasicType resolveDateTemporalTypeVariant(Class javaType, Type baseType) {
|
||||
// prefer to use any Type already known
|
||||
if ( baseType != null && baseType instanceof BasicType ) {
|
||||
if ( baseType.getReturnedClass().isAssignableFrom( javaType ) )
|
||||
if ( baseType.getReturnedClass().isAssignableFrom( javaType ) ) {
|
||||
return (BasicType) baseType;
|
||||
}
|
||||
}
|
||||
|
||||
if ( Calendar.class.isAssignableFrom( javaType ) ) {
|
||||
|
|
|
@ -10,7 +10,6 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.hibernate.envers.boot.internal.EnversService;
|
||||
import org.hibernate.envers.configuration.EnversSettings;
|
||||
import org.hibernate.envers.strategy.DefaultAuditStrategy;
|
||||
import org.hibernate.internal.util.config.ConfigurationHelper;
|
||||
|
|
|
@ -61,10 +61,10 @@ public class EntitiesConfigurator {
|
|||
if (pc.getClassName() != null) {
|
||||
// Collecting information from annotations on the persistent class pc
|
||||
final AnnotationsMetadataReader annotationsMetadataReader =
|
||||
new AnnotationsMetadataReader(globalConfiguration, reflectionManager, pc);
|
||||
new AnnotationsMetadataReader( globalConfiguration, reflectionManager, pc );
|
||||
final ClassAuditingData auditData = annotationsMetadataReader.getAuditData();
|
||||
|
||||
classesAuditingData.addClassAuditingData(pc, auditData);
|
||||
classesAuditingData.addClassAuditingData( pc, auditData );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -316,7 +316,7 @@ public class RevisionInfoConfiguration {
|
|||
}
|
||||
|
||||
// Checking if custom revision entity isn't audited
|
||||
if (clazz.getAnnotation(Audited.class) != null) {
|
||||
if ( clazz.getAnnotation( Audited.class ) != null ) {
|
||||
throw new MappingException("An entity annotated with @RevisionEntity cannot be audited!");
|
||||
}
|
||||
|
||||
|
@ -350,14 +350,14 @@ public class RevisionInfoConfiguration {
|
|||
|
||||
revisionInfoEntityName = persistentClass.getEntityName();
|
||||
revisionInfoClass = persistentClass.getMappedClass();
|
||||
final Class<? extends RevisionListener> revisionListenerClass = getRevisionListenerClass(revisionEntity.value());
|
||||
revisionInfoTimestampType = persistentClass.getProperty(revisionInfoTimestampData.getName()).getType();
|
||||
if (globalCfg.isTrackEntitiesChangedInRevision()
|
||||
|| (globalCfg.isUseRevisionEntityWithNativeId() && DefaultTrackingModifiedEntitiesRevisionEntity.class
|
||||
.isAssignableFrom(revisionInfoClass))
|
||||
|| (!globalCfg.isUseRevisionEntityWithNativeId() && SequenceIdTrackingModifiedEntitiesRevisionEntity.class
|
||||
.isAssignableFrom(revisionInfoClass))
|
||||
|| modifiedEntityNamesFound.isSet()) {
|
||||
final Class<? extends RevisionListener> revisionListenerClass = getRevisionListenerClass( revisionEntity.value() );
|
||||
revisionInfoTimestampType = persistentClass.getProperty( revisionInfoTimestampData.getName() ).getType();
|
||||
if ( globalCfg.isTrackEntitiesChangedInRevision()
|
||||
|| ( globalCfg.isUseRevisionEntityWithNativeId() && DefaultTrackingModifiedEntitiesRevisionEntity.class
|
||||
.isAssignableFrom( revisionInfoClass ) )
|
||||
|| ( !globalCfg.isUseRevisionEntityWithNativeId() && SequenceIdTrackingModifiedEntitiesRevisionEntity.class
|
||||
.isAssignableFrom( revisionInfoClass ) )
|
||||
|| modifiedEntityNamesFound.isSet() ) {
|
||||
// If tracking modified entities parameter is enabled, custom revision info entity is a subtype
|
||||
// of DefaultTrackingModifiedEntitiesRevisionEntity class, or @ModifiedEntityNames annotation is used.
|
||||
revisionInfoGenerator = new DefaultTrackingModifiedEntitiesRevisionInfoGenerator(
|
||||
|
@ -369,7 +369,7 @@ public class RevisionInfoConfiguration {
|
|||
modifiedEntityNamesData,
|
||||
metadata.getMetadataBuildingOptions().getServiceRegistry()
|
||||
);
|
||||
globalCfg.setTrackEntitiesChangedInRevision(true);
|
||||
globalCfg.setTrackEntitiesChangedInRevision( true );
|
||||
}
|
||||
else {
|
||||
revisionInfoGenerator = new DefaultRevisionInfoGenerator(
|
||||
|
|
|
@ -38,7 +38,7 @@ public final class BasicMetadataGenerator {
|
|||
|| "org.hibernate.type.PrimitiveByteArrayBlobType".equals( type.getClass().getName() ) ) {
|
||||
if ( parent != null ) {
|
||||
final boolean addNestedType = (value instanceof SimpleValue)
|
||||
&& ((SimpleValue) value).getTypeParameters() != null;
|
||||
&& ( (SimpleValue) value ).getTypeParameters() != null;
|
||||
|
||||
String typeName = type.getName();
|
||||
if ( typeName == null ) {
|
||||
|
@ -55,7 +55,7 @@ public final class BasicMetadataGenerator {
|
|||
MetadataTools.addColumns( propMapping, value.getColumnIterator() );
|
||||
|
||||
if ( addNestedType ) {
|
||||
final Properties typeParameters = ((SimpleValue) value).getTypeParameters();
|
||||
final Properties typeParameters = ( (SimpleValue) value ).getTypeParameters();
|
||||
final Element typeMapping = propMapping.addElement( "type" );
|
||||
typeMapping.addAttribute( "name", typeName );
|
||||
|
||||
|
@ -110,7 +110,7 @@ public final class BasicMetadataGenerator {
|
|||
}
|
||||
else {
|
||||
parent.addElement( "param" ).addAttribute( "name", EnumType.NAMED )
|
||||
.setText( "" + !((EnumType) ((CustomType) type).getUserType()).isOrdinal() );
|
||||
.setText( "" + !( (EnumType) ( (CustomType) type ).getUserType() ).isOrdinal() );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -932,7 +932,7 @@ public final class CollectionMetadataGenerator {
|
|||
if ( property.getValue() instanceof Collection ) {
|
||||
// The equality is intentional. We want to find a collection property with the same collection table.
|
||||
//noinspection ObjectEquality
|
||||
if ( ((Collection) property.getValue()).getCollectionTable() == collectionTable ) {
|
||||
if ( ( (Collection) property.getValue() ).getCollectionTable() == collectionTable ) {
|
||||
return property.getName();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -375,7 +375,7 @@ public final class MetadataTools {
|
|||
/**
|
||||
* An iterator over column names.
|
||||
*/
|
||||
public static abstract class ColumnNameIterator implements Iterator<String> {
|
||||
public abstract static class ColumnNameIterator implements Iterator<String> {
|
||||
}
|
||||
|
||||
public static ColumnNameIterator getColumnNameIterator(final Iterator<Selectable> selectableIterator) {
|
||||
|
@ -389,7 +389,7 @@ public final class MetadataTools {
|
|||
if ( next.isFormula() ) {
|
||||
throw new FormulaNotSupportedException();
|
||||
}
|
||||
return ((Column) next).getName();
|
||||
return ( (Column) next ).getName();
|
||||
}
|
||||
|
||||
public void remove() {
|
||||
|
|
|
@ -44,7 +44,7 @@ public final class ToOneRelationMetadataGenerator {
|
|||
CompositeMapperBuilder mapper,
|
||||
String entityName,
|
||||
boolean insertable) {
|
||||
final String referencedEntityName = ((ToOne) value).getReferencedEntityName();
|
||||
final String referencedEntityName = ( (ToOne) value ).getReferencedEntityName();
|
||||
|
||||
final IdMappingData idMapping = mainGenerator.getReferencedIdMappingData(
|
||||
entityName,
|
||||
|
@ -160,7 +160,7 @@ public final class ToOneRelationMetadataGenerator {
|
|||
CompositeMapperBuilder mapper,
|
||||
String entityName,
|
||||
boolean insertable) {
|
||||
final String referencedEntityName = ((ToOne) value).getReferencedEntityName();
|
||||
final String referencedEntityName = ( (ToOne) value ).getReferencedEntityName();
|
||||
|
||||
final IdMappingData idMapping = mainGenerator.getReferencedIdMappingData(
|
||||
entityName,
|
||||
|
|
|
@ -544,12 +544,12 @@ public class AuditedPropertiesReader {
|
|||
propertyData.setStore( aud.modStore() );
|
||||
propertyData.setRelationTargetAuditMode( aud.targetAuditMode() );
|
||||
propertyData.setUsingModifiedFlag( checkUsingModifiedFlag( aud ) );
|
||||
if(aud.modifiedColumnName() != null && !"".equals(aud.modifiedColumnName())) {
|
||||
propertyData.setModifiedFlagName(aud.modifiedColumnName());
|
||||
if( aud.modifiedColumnName() != null && !"".equals( aud.modifiedColumnName() ) ) {
|
||||
propertyData.setModifiedFlagName( aud.modifiedColumnName() );
|
||||
}
|
||||
else {
|
||||
propertyData.setModifiedFlagName(
|
||||
MetadataTools.getModifiedFlagPropertyName(propertyName, modifiedFlagSuffix)
|
||||
MetadataTools.getModifiedFlagPropertyName( propertyName, modifiedFlagSuffix )
|
||||
);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -44,8 +44,8 @@ public class ComponentAuditedPropertiesReader extends AuditedPropertiesReader {
|
|||
propertyData.setStore( aud.modStore() );
|
||||
propertyData.setRelationTargetAuditMode( aud.targetAuditMode() );
|
||||
propertyData.setUsingModifiedFlag( checkUsingModifiedFlag( aud ) );
|
||||
if(aud.modifiedColumnName() != null && !"".equals(aud.modifiedColumnName())) {
|
||||
propertyData.setModifiedFlagName(aud.modifiedColumnName());
|
||||
if( aud.modifiedColumnName() != null && !"".equals( aud.modifiedColumnName() ) ) {
|
||||
propertyData.setModifiedFlagName( aud.modifiedColumnName() );
|
||||
}
|
||||
else {
|
||||
propertyData.setModifiedFlagName(
|
||||
|
|
|
@ -55,7 +55,7 @@ public abstract class BaseEnversCollectionEventListener extends BaseEnversEventL
|
|||
final AuditProcess auditProcess = getEnversService().getAuditProcessManager().get( event.getSession() );
|
||||
|
||||
final String entityName = event.getAffectedOwnerEntityName();
|
||||
final String ownerEntityName = ((AbstractCollectionPersister) collectionEntry.getLoadedPersister()).getOwnerEntityName();
|
||||
final String ownerEntityName = ( (AbstractCollectionPersister) collectionEntry.getLoadedPersister() ).getOwnerEntityName();
|
||||
final String referencingPropertyName = collectionEntry.getRole().substring( ownerEntityName.length() + 1 );
|
||||
|
||||
// Checking if this is not a "fake" many-to-one bidirectional relation. The relation description may be
|
||||
|
|
|
@ -53,7 +53,7 @@ public class RevisionTypeType implements UserType, Serializable {
|
|||
throws HibernateException, SQLException {
|
||||
IntegerType.INSTANCE.nullSafeSet(
|
||||
preparedStatement,
|
||||
(value == null ? null : ((RevisionType) value).getRepresentation().intValue()),
|
||||
(value == null ? null : ( (RevisionType) value ).getRepresentation().intValue()),
|
||||
index,
|
||||
session
|
||||
);
|
||||
|
|
|
@ -43,11 +43,11 @@ public class PersistentCollectionChangeData {
|
|||
*/
|
||||
public Object getChangedElement() {
|
||||
if ( changedElement instanceof Pair ) {
|
||||
return ((Pair) changedElement).getSecond();
|
||||
return ( (Pair) changedElement ).getSecond();
|
||||
}
|
||||
|
||||
if ( changedElement instanceof Map.Entry ) {
|
||||
return ((Map.Entry) changedElement).getValue();
|
||||
return ( (Map.Entry) changedElement ).getValue();
|
||||
}
|
||||
|
||||
return changedElement;
|
||||
|
@ -58,11 +58,11 @@ public class PersistentCollectionChangeData {
|
|||
*/
|
||||
public Object getChangedElementIndex() {
|
||||
if ( changedElement instanceof Pair ) {
|
||||
return ((Pair) changedElement).getFirst();
|
||||
return ( (Pair) changedElement ).getFirst();
|
||||
}
|
||||
|
||||
if ( changedElement instanceof Map.Entry ) {
|
||||
return ((Map.Entry) changedElement).getKey();
|
||||
return ( (Map.Entry) changedElement ).getKey();
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -114,7 +114,7 @@ public abstract class AbstractCollectionMapper<T> implements PropertyMapper {
|
|||
// Mapping collection element and index (if present).
|
||||
mapToMapFromObject( session, originalId, entityData, changedObj );
|
||||
|
||||
(revisionTypeInId ? originalId : entityData).put(
|
||||
( revisionTypeInId ? originalId : entityData ).put(
|
||||
commonCollectionMapperData.getVerEntCfg()
|
||||
.getRevisionTypePropName(), revisionType
|
||||
);
|
||||
|
|
|
@ -65,7 +65,7 @@ public class BasicCollectionMapper<T extends Collection> extends AbstractCollect
|
|||
return null;
|
||||
}
|
||||
else if ( oldCollection instanceof Map ) {
|
||||
return ((Map) oldCollection).keySet();
|
||||
return ( (Map) oldCollection ).keySet();
|
||||
}
|
||||
else {
|
||||
return (Collection) oldCollection;
|
||||
|
|
|
@ -61,7 +61,7 @@ public class MapCollectionMapper<T extends Map> extends AbstractCollectionMapper
|
|||
return null;
|
||||
}
|
||||
else {
|
||||
return ((Map) newCollection).entrySet();
|
||||
return ( (Map) newCollection ).entrySet();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ public class MapCollectionMapper<T extends Map> extends AbstractCollectionMapper
|
|||
return null;
|
||||
}
|
||||
else {
|
||||
return ((Map) oldCollection).entrySet();
|
||||
return ( (Map) oldCollection ).entrySet();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -85,13 +85,13 @@ public class MapCollectionMapper<T extends Map> extends AbstractCollectionMapper
|
|||
session,
|
||||
idData,
|
||||
data,
|
||||
((Map.Entry) changed).getValue()
|
||||
( (Map.Entry) changed ).getValue()
|
||||
);
|
||||
indexComponentData.getComponentMapper().mapToMapFromObject(
|
||||
session,
|
||||
idData,
|
||||
data,
|
||||
((Map.Entry) changed).getKey()
|
||||
( (Map.Entry) changed ).getKey()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ public class MiddleEmbeddableComponentMapper implements MiddleComponentMapper, C
|
|||
);
|
||||
}
|
||||
else if ( nestedMapper instanceof ToOneIdMapper ) {
|
||||
((ToOneIdMapper) nestedMapper).addMiddleEqualToQuery(
|
||||
( (ToOneIdMapper) nestedMapper ).addMiddleEqualToQuery(
|
||||
parameters,
|
||||
idPrefix1,
|
||||
prefix1,
|
||||
|
|
|
@ -30,7 +30,7 @@ public final class MiddleSimpleComponentMapper implements MiddleComponentMapper
|
|||
public Object mapToObjectFromFullMap(
|
||||
EntityInstantiator entityInstantiator, Map<String, Object> data,
|
||||
Object dataObject, Number revision) {
|
||||
return ((Map<String, Object>) data.get( verEntCfg.getOriginalIdPropName() )).get( propertyName );
|
||||
return ( (Map<String, Object>) data.get( verEntCfg.getOriginalIdPropName() ) ).get( propertyName );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -44,18 +44,18 @@ public class ArrayCollectionInitializor extends AbstractCollectionInitializor<Ob
|
|||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
protected void addToCollection(Object[] collection, Object collectionRow) {
|
||||
final Object elementData = ((List) collectionRow).get( elementComponentData.getComponentIndex() );
|
||||
final Object elementData = ( (List) collectionRow ).get( elementComponentData.getComponentIndex() );
|
||||
final Object element = elementComponentData.getComponentMapper().mapToObjectFromFullMap(
|
||||
entityInstantiator,
|
||||
(Map<String, Object>) elementData, null, revision
|
||||
);
|
||||
|
||||
final Object indexData = ((List) collectionRow).get( indexComponentData.getComponentIndex() );
|
||||
final Object indexData = ( (List) collectionRow ).get( indexComponentData.getComponentIndex() );
|
||||
final Object indexObj = indexComponentData.getComponentMapper().mapToObjectFromFullMap(
|
||||
entityInstantiator,
|
||||
(Map<String, Object>) indexData, element, revision
|
||||
);
|
||||
final int index = ((Number) indexObj).intValue();
|
||||
final int index = ( (Number) indexObj ).intValue();
|
||||
|
||||
collection[index] = element;
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ public class BasicCollectionInitializor<T extends Collection> extends AbstractCo
|
|||
// otherwise it will be a List
|
||||
Object elementData = collectionRow;
|
||||
if ( collectionRow instanceof java.util.List ) {
|
||||
elementData = ((List) collectionRow).get( elementComponentData.getComponentIndex() );
|
||||
elementData = ( (List) collectionRow ).get( elementComponentData.getComponentIndex() );
|
||||
}
|
||||
|
||||
// If the target entity is not audited, the elements may be the entities already, so we have to check
|
||||
|
|
|
@ -59,8 +59,8 @@ public class ListCollectionInitializor extends AbstractCollectionInitializor<Lis
|
|||
Object elementData = collectionRow;
|
||||
Object indexData = collectionRow;
|
||||
if ( collectionRow instanceof java.util.List ) {
|
||||
elementData = ((List) collectionRow).get( elementComponentData.getComponentIndex() );
|
||||
indexData = ((List) collectionRow).get( indexComponentData.getComponentIndex() );
|
||||
elementData = ( (List) collectionRow ).get( elementComponentData.getComponentIndex() );
|
||||
indexData = ( (List) collectionRow ).get( indexComponentData.getComponentIndex() );
|
||||
}
|
||||
final Object element = elementData instanceof Map
|
||||
? elementComponentData.getComponentMapper().mapToObjectFromFullMap(
|
||||
|
@ -73,7 +73,7 @@ public class ListCollectionInitializor extends AbstractCollectionInitializor<Lis
|
|||
entityInstantiator,
|
||||
(Map<String, Object>) indexData, element, revision
|
||||
);
|
||||
final int index = ((Number) indexObj).intValue();
|
||||
final int index = ( (Number) indexObj ).intValue();
|
||||
|
||||
collection.set( index, element );
|
||||
}
|
||||
|
|
|
@ -67,8 +67,8 @@ public class MapCollectionInitializor<T extends Map> extends AbstractCollectionI
|
|||
Object elementData = collectionRow;
|
||||
Object indexData = collectionRow;
|
||||
if ( collectionRow instanceof java.util.List ) {
|
||||
elementData = ((List) collectionRow).get( elementComponentData.getComponentIndex() );
|
||||
indexData = ((List) collectionRow).get( indexComponentData.getComponentIndex() );
|
||||
elementData = ( (List) collectionRow ).get( elementComponentData.getComponentIndex() );
|
||||
indexData = ( (List) collectionRow ).get( indexComponentData.getComponentIndex() );
|
||||
}
|
||||
final Object element = elementComponentData.getComponentMapper().mapToObjectFromFullMap(
|
||||
entityInstantiator,
|
||||
|
|
|
@ -323,7 +323,7 @@ public class AuditReaderImpl implements AuditReaderImplementor {
|
|||
|
||||
// Unwrap if necessary
|
||||
if ( entity instanceof HibernateProxy ) {
|
||||
entity = ((HibernateProxy) entity).getHibernateLazyInitializer().getImplementation();
|
||||
entity = ( (HibernateProxy) entity ).getHibernateLazyInitializer().getImplementation();
|
||||
}
|
||||
if ( firstLevelCache.containsEntityName( primaryKey, revision, entity ) ) {
|
||||
// it's on envers FLC!
|
||||
|
|
|
@ -133,10 +133,10 @@ public class AuditProcess implements BeforeTransactionCompletionProcess {
|
|||
}
|
||||
|
||||
// see: http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4178431
|
||||
if ( FlushModeType.COMMIT.equals ( session.getFlushMode() ) ) {
|
||||
if ( FlushModeType.COMMIT.equals( session.getFlushMode() ) ) {
|
||||
Session temporarySession = null;
|
||||
try {
|
||||
temporarySession = ((Session) session).sessionWithOptions()
|
||||
temporarySession = ( (Session) session ).sessionWithOptions()
|
||||
.transactionContext()
|
||||
.autoClose( false )
|
||||
.connectionReleaseMode( ConnectionReleaseMode.AFTER_TRANSACTION )
|
||||
|
|
|
@ -42,7 +42,7 @@ public class EntityChangeNotifier {
|
|||
Serializable entityId = vwu.getEntityId();
|
||||
if ( entityId instanceof PersistentCollectionChangeWorkUnit.PersistentCollectionChangeWorkUnitId ) {
|
||||
// Notify about a change in collection owner entity.
|
||||
entityId = ((PersistentCollectionChangeWorkUnit.PersistentCollectionChangeWorkUnitId) entityId).getOwnerId();
|
||||
entityId = ( (PersistentCollectionChangeWorkUnit.PersistentCollectionChangeWorkUnitId) entityId ).getOwnerId();
|
||||
}
|
||||
final Class entityClass = EntityTools.getEntityClass( sessionImplementor, session, vwu.getEntityName() );
|
||||
revisionInfoGenerator.entityChanged(
|
||||
|
|
|
@ -27,7 +27,7 @@ public class SessionCacheCleaner {
|
|||
* @param data Audit data that shall be evicted (e.g. revision data or entity snapshot)
|
||||
*/
|
||||
public void scheduleAuditDataRemoval(final Session session, final Object data) {
|
||||
((EventSource) session).getActionQueue().registerProcess(
|
||||
( (EventSource) session ).getActionQueue().registerProcess(
|
||||
new AfterTransactionCompletionProcess() {
|
||||
public void doAfterTransactionCompletion(boolean success, SharedSessionContractImplementor sessionImplementor) {
|
||||
if ( !sessionImplementor.isClosed() ) {
|
||||
|
|
|
@ -81,7 +81,7 @@ public class PersistentCollectionChangeWorkUnit extends AbstractAuditWorkUnit im
|
|||
|
||||
for ( PersistentCollectionChangeData persistentCollectionChangeData : collectionChanges ) {
|
||||
// Setting the revision number
|
||||
((Map<String, Object>) persistentCollectionChangeData.getData().get( entitiesCfg.getOriginalIdPropName() ))
|
||||
( (Map<String, Object>) persistentCollectionChangeData.getData().get( entitiesCfg.getOriginalIdPropName() ) )
|
||||
.put( entitiesCfg.getRevisionFieldName(), revisionData );
|
||||
|
||||
auditStrategy.performCollectionChange(
|
||||
|
|
|
@ -36,13 +36,13 @@ public abstract class MappingTools {
|
|||
|
||||
public static String getReferencedEntityName(Value value) {
|
||||
if ( value instanceof ToOne ) {
|
||||
return ((ToOne) value).getReferencedEntityName();
|
||||
return ( (ToOne) value ).getReferencedEntityName();
|
||||
}
|
||||
else if ( value instanceof OneToMany ) {
|
||||
return ((OneToMany) value).getReferencedEntityName();
|
||||
return ( (OneToMany) value ).getReferencedEntityName();
|
||||
}
|
||||
else if ( value instanceof Collection ) {
|
||||
return getReferencedEntityName( ((Collection) value).getElement() );
|
||||
return getReferencedEntityName( ( (Collection) value ).getElement() );
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -20,8 +20,8 @@ import org.hibernate.envers.internal.tools.MutableInteger;
|
|||
* @author Adam Warski (adam at warski dot org)
|
||||
*/
|
||||
public class Parameters {
|
||||
public final static String AND = "and";
|
||||
public final static String OR = "or";
|
||||
public static final String AND = "and";
|
||||
public static final String OR = "or";
|
||||
|
||||
/**
|
||||
* Main alias of the entity.
|
||||
|
|
|
@ -37,7 +37,7 @@ public class IlikeAuditExpression implements AuditCriterion {
|
|||
);
|
||||
CriteriaTools.checkPropertyNotARelation( enversService, entityName, propertyName );
|
||||
|
||||
parameters.addWhereWithFunction( propertyName, " lower ", " like ", value.toLowerCase(Locale.ROOT) );
|
||||
parameters.addWhereWithFunction( propertyName, " lower ", " like ", value.toLowerCase( Locale.ROOT ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -61,10 +61,10 @@ public class RevisionsOfEntityQuery extends AbstractAuditQuery {
|
|||
String originalId = verEntCfg.getOriginalIdPropName();
|
||||
String revisionPropertyName = verEntCfg.getRevisionFieldName();
|
||||
|
||||
Object revisionInfoObject = ((Map) versionsEntity.get( originalId )).get( revisionPropertyName );
|
||||
Object revisionInfoObject = ( (Map) versionsEntity.get( originalId ) ).get( revisionPropertyName );
|
||||
|
||||
if ( revisionInfoObject instanceof HibernateProxy ) {
|
||||
return (Number) ((HibernateProxy) revisionInfoObject).getHibernateLazyInitializer().getIdentifier();
|
||||
return (Number) ( (HibernateProxy) revisionInfoObject ).getHibernateLazyInitializer().getIdentifier();
|
||||
}
|
||||
else {
|
||||
// Not a proxy - must be read from cache or with a join
|
||||
|
|
|
@ -69,7 +69,7 @@ public class ValidityAuditStrategy implements AuditStrategy {
|
|||
/**
|
||||
* getter for the revision entity field annotated with @RevisionTimestamp
|
||||
*/
|
||||
private Getter revisionTimestampGetter = null;
|
||||
private Getter revisionTimestampGetter;
|
||||
|
||||
private final SessionCacheCleaner sessionCacheCleaner;
|
||||
|
||||
|
@ -221,7 +221,7 @@ public class ValidityAuditStrategy implements AuditStrategy {
|
|||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
} );
|
||||
}
|
||||
sessionCacheCleaner.scheduleAuditDataRemoval( session, data );
|
||||
}
|
||||
|
@ -257,7 +257,7 @@ public class ValidityAuditStrategy implements AuditStrategy {
|
|||
}
|
||||
}
|
||||
|
||||
final SessionFactoryImplementor sessionFactory = ((SessionImplementor) session).getFactory();
|
||||
final SessionFactoryImplementor sessionFactory = ( (SessionImplementor) session ).getFactory();
|
||||
final Type propertyType = sessionFactory.getEntityPersister( entityName ).getPropertyType( propertyName );
|
||||
if ( propertyType.isCollectionType() ) {
|
||||
CollectionType collectionPropertyType = (CollectionType) propertyType;
|
||||
|
@ -328,7 +328,7 @@ public class ValidityAuditStrategy implements AuditStrategy {
|
|||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
private RevisionType getRevisionType(EnversService enversService, Object data) {
|
||||
return (RevisionType) ((Map<String, Object>) data).get( enversService.getAuditEntitiesConfiguration().getRevisionTypePropName() );
|
||||
return (RevisionType) ( (Map<String, Object>) data ).get( enversService.getAuditEntitiesConfiguration().getRevisionTypePropName() );
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
|
@ -344,7 +344,7 @@ public class ValidityAuditStrategy implements AuditStrategy {
|
|||
// Setting the end revision to be the current rev
|
||||
Object previousData = l.get( 0 );
|
||||
String revisionEndFieldName = enversService.getAuditEntitiesConfiguration().getRevisionEndFieldName();
|
||||
((Map<String, Object>) previousData).put( revisionEndFieldName, revision );
|
||||
( (Map<String, Object>) previousData ).put( revisionEndFieldName, revision );
|
||||
|
||||
if ( enversService.getAuditEntitiesConfiguration().isRevisionEndTimestampEnabled() ) {
|
||||
// Determine the value of the revision property annotated with @RevisionTimestamp
|
||||
|
@ -353,7 +353,7 @@ public class ValidityAuditStrategy implements AuditStrategy {
|
|||
Date revisionEndTimestamp = convertRevEndTimestampToDate( revEndTimestampObj );
|
||||
|
||||
// Setting the end revision timestamp
|
||||
((Map<String, Object>) previousData).put( revEndTimestampFieldName, revisionEndTimestamp );
|
||||
( (Map<String, Object>) previousData ).put( revEndTimestampFieldName, revisionEndTimestamp );
|
||||
}
|
||||
|
||||
// Saving the previous version
|
||||
|
|
Loading…
Reference in New Issue