Skip to content
Browse files

cleanup, whitespace, STS warnings

  • Loading branch information...
1 parent 518be48 commit 54dffdf3d6d560190735cd7c4a5ce77e6dc77a24 Burt Beckwith committed
Showing with 1,576 additions and 2,122 deletions.
  1. +1 −1 ...s-datastore-core/src/main/groovy/org/grails/datastore/mapping/cache/TPCacheAdapterRepository.java
  2. +2 −0 ...s-datastore-core/src/main/groovy/org/grails/datastore/mapping/cache/exception/CacheException.java
  3. +1 −1 ...re-core/src/main/groovy/org/grails/datastore/mapping/cache/impl/TPCacheAdapterRepositoryImpl.java
  4. +0 −1 grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/collection/PersistentList.java
  5. +1 −7 ...s-datastore-core/src/main/groovy/org/grails/datastore/mapping/collection/PersistentSortedSet.java
  6. +14 −11 ...atastore-core/src/main/groovy/org/grails/datastore/mapping/config/AbstractGormMappingFactory.java
  7. +2 −4 ...ore/src/main/groovy/org/grails/datastore/mapping/config/groovy/MappingConfigurationBuilder.groovy
  8. +2 −3 grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/core/AbstractDatastore.java
  9. +8 −10 grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/core/AbstractSession.java
  10. +1 −0 grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/core/DatastoreUtils.java
  11. +3 −1 ...datastore-core/src/main/groovy/org/grails/datastore/mapping/core/IdentityGenerationException.java
  12. +7 −2 ...e-core/src/main/groovy/org/grails/datastore/mapping/document/config/DocumentPersistentEntity.java
  13. +21 −22 grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/engine/EntityPersister.java
  14. +85 −74 ...atastore-core/src/main/groovy/org/grails/datastore/mapping/engine/NativeEntryEntityPersister.java
  15. +10 −10 grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/engine/event/EventType.java
  16. +0 −1 grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/engine/event/PostLoadEvent.java
  17. +0 −1 ...s-datastore-core/src/main/groovy/org/grails/datastore/mapping/engine/event/SaveOrUpdateEvent.java
  18. +20 −14 grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/engine/internal/MappingUtils.java
  19. +0 −1 ...in/groovy/org/grails/datastore/mapping/engine/types/AbstractMappingAwareCustomTypeMarshaller.java
  20. +4 −3 .../main/groovy/org/grails/datastore/mapping/keyvalue/mapping/config/GormKeyValueMappingFactory.java
  21. +1 −1 .../src/main/groovy/org/grails/datastore/mapping/keyvalue/mapping/config/KeyValueMappingContext.java
  22. +21 −27 grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/model/AbstractMappingContext.java
  23. +1 −2 ...s-datastore-core/src/main/groovy/org/grails/datastore/mapping/model/AbstractPersistentEntity.java
  24. +1 −0 ...s-datastore-core/src/main/groovy/org/grails/datastore/mapping/model/EmbeddedPersistentEntity.java
  25. +4 −4 grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/model/IdentityMapping.java
  26. +2 −2 ...ls-datastore-core/src/main/groovy/org/grails/datastore/mapping/model/IllegalMappingException.java
  27. +21 −4 grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/model/MappingFactory.java
  28. +1 −1 grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/model/PersistentProperty.java
  29. +32 −20 ...e/src/main/groovy/org/grails/datastore/mapping/model/config/GormMappingConfigurationStrategy.java
  30. +0 −1 ...re-core/src/main/groovy/org/grails/datastore/mapping/model/types/BasicTypeConverterRegistrar.java
  31. +6 −7 ...src/main/groovy/org/grails/datastore/mapping/model/types/conversion/DefaultConversionService.java
  32. +0 −1 grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/proxy/EntityProxy.java
  33. +1 −3 grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/proxy/JavassistProxyFactory.java
  34. +3 −5 grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/query/Projections.java
  35. +26 −32 grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/query/Query.java
  36. +0 −1 grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/query/Restrictions.java
  37. +1 −0 ...ls-datastore-core/src/main/groovy/org/grails/datastore/mapping/query/api/AssociationCriteria.java
  38. +5 −4 grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/query/api/Criteria.java
  39. +0 −1 grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/query/api/ProjectionList.java
  40. +3 −5 ...ls-datastore-core/src/main/groovy/org/grails/datastore/mapping/query/api/QueryArgumentsAware.java
  41. +22 −19 grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/query/jpa/JpaQueryBuilder.java
  42. +1 −7 grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/query/jpa/JpaQueryInfo.java
  43. +4 −4 ...datastore-core/src/main/groovy/org/grails/datastore/mapping/query/order/ManualEntityOrdering.java
  44. +1 −1 grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/reflect/ClassPropertyFetcher.java
  45. +1 −1 ...e-core/src/main/groovy/org/grails/datastore/mapping/transactions/DatastoreTransactionManager.java
  46. +3 −2 grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/validation/ValidationErrors.java
  47. +4 −4 .../src/test/groovy/org/grails/datastore/mapping/keyvalue/mapping/KeyValueMappingFactoryTests.groovy
  48. +3 −2 ...ynamodb/src/main/groovy/org/grails/datastore/mapping/dynamodb/DelayAfterWriteDynamoDBSession.java
  49. +19 −13 ...s-datastore-dynamodb/src/main/groovy/org/grails/datastore/mapping/dynamodb/DynamoDBDatastore.java
  50. +3 −2 grails-datastore-dynamodb/src/main/groovy/org/grails/datastore/mapping/dynamodb/DynamoDBSession.java
  51. +2 −4 ...b/src/main/groovy/org/grails/datastore/mapping/dynamodb/config/DynamoDBDomainClassMappedForm.java
  52. +2 −1 ...dynamodb/src/main/groovy/org/grails/datastore/mapping/dynamodb/config/DynamoDBMappingContext.java
  53. +1 −1 ...modb/src/main/groovy/org/grails/datastore/mapping/dynamodb/config/GormDynamoDBMappingFactory.java
  54. +1 −1 ...b/src/main/groovy/org/grails/datastore/mapping/dynamodb/engine/AbstractDynamoDBTableResolver.java
  55. +15 −9 ...modb/src/main/groovy/org/grails/datastore/mapping/dynamodb/engine/DynamoDBAssociationIndexer.java
  56. +7 −7 ...ynamodb/src/main/groovy/org/grails/datastore/mapping/dynamodb/engine/DynamoDBHiLoIdGenerator.java
  57. +1 −9 ...db/src/main/groovy/org/grails/datastore/mapping/dynamodb/engine/DynamoDBTableResolverFactory.java
  58. +0 −8 ...main/groovy/org/grails/datastore/mapping/dynamodb/model/types/DynamoDBTypeConverterRegistrar.java
  59. +20 −18 ...datastore-dynamodb/src/main/groovy/org/grails/datastore/mapping/dynamodb/query/DynamoDBQuery.java
  60. +5 −1 ...amodb/src/main/groovy/org/grails/datastore/mapping/dynamodb/util/DataStoreOperationException.java
  61. +11 −13 ...n/groovy/org/grails/datastore/mapping/dynamodb/util/DelayAfterWriteDynamoDBTemplateDecorator.java
  62. +12 −5 ...tastore-dynamodb/src/main/groovy/org/grails/datastore/mapping/dynamodb/util/DynamoDBTemplate.java
  63. +32 −16 ...ore-dynamodb/src/main/groovy/org/grails/datastore/mapping/dynamodb/util/DynamoDBTemplateImpl.java
  64. +14 −8 ...s-datastore-dynamodb/src/main/groovy/org/grails/datastore/mapping/dynamodb/util/DynamoDBUtil.java
  65. +6 −8 grails-datastore-gemfire/src/main/groovy/org/grails/datastore/mapping/gemfire/GemfireDatastore.java
  66. +1 −5 ...e-gemfire/src/main/groovy/org/grails/datastore/mapping/gemfire/engine/GemfireEntityPersister.java
  67. +15 −20 ...ls-datastore-gemfire/src/main/groovy/org/grails/datastore/mapping/gemfire/query/GemfireQuery.java
  68. +2 −2 ...n/groovy/org/grails/datastore/gorm/dynamodb/bean/factory/DynamoDBMappingContextFactoryBean.groovy
  69. +21 −22 ...ovy/org/grails/datastore/gorm/dynamodb/plugin/support/DynamoDBApplicationContextConfigurer.groovy
  70. +9 −10 ...rc/main/groovy/org/grails/datastore/gorm/dynamodb/plugin/support/DynamoDBMethodsConfigurer.groovy
  71. +1 −2 ...src/main/groovy/org/grails/datastore/gorm/dynamodb/plugin/support/DynamoDBSpringConfigurer.groovy
  72. +2 −5 grails-datastore-gorm-dynamodb/src/test/groovy/grails/gorm/tests/ChildEntity.groovy
  73. +3 −23 grails-datastore-gorm-dynamodb/src/test/groovy/grails/gorm/tests/CommonTypes.groovy
  74. +3 −8 grails-datastore-gorm-dynamodb/src/test/groovy/grails/gorm/tests/Country.groovy
  75. +1 −3 grails-datastore-gorm-dynamodb/src/test/groovy/grails/gorm/tests/DetachedCriteriaSpec.groovy
  76. +6 −5 grails-datastore-gorm-dynamodb/src/test/groovy/grails/gorm/tests/DynamoDBCombinationSpec.groovy
  77. +3 −9 grails-datastore-gorm-dynamodb/src/test/groovy/grails/gorm/tests/GroupWithin.groovy
  78. +1 −2 grails-datastore-gorm-dynamodb/src/test/groovy/grails/gorm/tests/InheritanceSpec.groovy
  79. +35 −35 grails-datastore-gorm-dynamodb/src/test/groovy/grails/gorm/tests/LexComparisonSpec.groovy
  80. +4 −8 grails-datastore-gorm-dynamodb/src/test/groovy/grails/gorm/tests/PagedResultSpec.groovy
  81. +3 −10 grails-datastore-gorm-dynamodb/src/test/groovy/grails/gorm/tests/Person.groovy
  82. +3 −11 grails-datastore-gorm-dynamodb/src/test/groovy/grails/gorm/tests/Pet.groovy
  83. +3 −8 grails-datastore-gorm-dynamodb/src/test/groovy/grails/gorm/tests/PlantNumericIdValue.groovy
  84. +3 −9 grails-datastore-gorm-dynamodb/src/test/groovy/grails/gorm/tests/Publication.groovy
  85. +3 −2 grails-datastore-gorm-dynamodb/src/test/groovy/grails/gorm/tests/SimpleDBHiloSpec.groovy
  86. +2 −7 grails-datastore-gorm-dynamodb/src/test/groovy/grails/gorm/tests/TestEntity.groovy
  87. +3 −8 grails-datastore-gorm-dynamodb/src/test/groovy/grails/gorm/tests/UniqueGroup.groovy
  88. +15 −15 grails-datastore-gorm-dynamodb/src/test/groovy/org/grails/datastore/gorm/Setup.groovy
  89. +12 −11 ...tastore-gorm-gemfire/src/main/groovy/org/grails/datastore/gorm/gemfire/GemfireGormEnhancer.groovy
  90. +3 −18 grails-datastore-gorm-gemfire/src/test/groovy/grails/gorm/tests/DetachedCriteriaSpec.groovy
  91. +4 −8 grails-datastore-gorm-gemfire/src/test/groovy/grails/gorm/tests/PagedResultSpec.groovy
  92. +4 −4 grails-datastore-gorm-gemfire/src/test/groovy/grails/gorm/tests/PropertyComparisonQuerySpec.groovy
  93. +1 −1 ...s-datastore-gorm-gemfire/src/test/groovy/org/grails/datastore/gorm/gemfire/GemfireUuidSpec.groovy
  94. +11 −11 grails-datastore-gorm-jpa/src/main/groovy/org/grails/datastore/gorm/jpa/GormToJpaTransform.java
  95. +7 −12 grails-datastore-gorm-jpa/src/main/groovy/org/grails/datastore/gorm/jpa/JpaGormEnhancer.groovy
  96. +3 −4 ...orm-jpa/src/main/groovy/org/grails/datastore/gorm/jpa/bean/factory/JpaDatastoreFactoryBean.groovy
  97. +6 −8 ...gorm-jpa/src/main/groovy/org/grails/datastore/gorm/jpa/plugin/support/JpaMethodsConfigurer.groovy
  98. +4 −8 ...-gorm-jpa/src/main/groovy/org/grails/datastore/gorm/jpa/plugin/support/JpaSpringConfigurer.groovy
  99. +6 −18 ...m-jpa/src/main/groovy/org/grails/datastore/gorm/jpa/support/JpaPersistenceContextInterceptor.java
  100. +6 −8 grails-datastore-gorm-jpa/src/test/groovy/grails/gorm/tests/Book.groovy
  101. +6 −4 ...s-datastore-gorm-jpa/src/test/groovy/org/grails/datastore/gorm/JpaMappingConfigurationSpec.groovy
  102. +1 −0 ...ls-datastore-gorm-mongo/src/main/groovy/org/grails/datastore/gorm/mongo/MongoCriteriaBuilder.java
  103. +1 −2 ...re-gorm-mongo/src/main/groovy/org/grails/datastore/gorm/mongo/bean/factory/GMongoFactoryBean.java
  104. +4 −2 ...rc/main/groovy/org/grails/datastore/gorm/mongo/bean/factory/MongoMappingContextFactoryBean.groovy
  105. +7 −13 ...gorm-mongo/src/main/groovy/org/grails/datastore/gorm/mongo/config/MongoDatastoreConfigurer.groovy
  106. +16 −20 ...ongo/src/main/groovy/org/grails/datastore/gorm/mongo/plugin/support/MongoMethodsConfigurer.groovy
  107. +6 −5 ...mongo/src/main/groovy/org/grails/datastore/gorm/mongo/plugin/support/MongoSpringConfigurer.groovy
  108. +16 −28 ...ls-datastore-gorm-mongo/src/test/groovy/grails/gorm/tests/DirtyCheckEmbeddedCollectionSpec.groovy
  109. +14 −16 grails-datastore-gorm-mongo/src/test/groovy/org/grails/datastore/gorm/Setup.groovy
  110. +12 −12 ...atastore-gorm-mongo/src/test/groovy/org/grails/datastore/gorm/mongo/AssignedIdentifierSpec.groovy
  111. +2 −7 ...-datastore-gorm-mongo/src/test/groovy/org/grails/datastore/gorm/mongo/AutowireServicesSpec.groovy
  112. +1 −3 ...tastore-gorm-mongo/src/test/groovy/org/grails/datastore/gorm/mongo/BasicCollectionTypeSpec.groovy
  113. +7 −6 ...store-gorm-mongo/src/test/groovy/org/grails/datastore/gorm/mongo/CascadeDeleteOneToOneSpec.groovy
  114. +5 −13 grails-datastore-gorm-mongo/src/test/groovy/org/grails/datastore/gorm/mongo/CascadeDeleteSpec.groovy
  115. +2 −2 ...s-datastore-gorm-mongo/src/test/groovy/org/grails/datastore/gorm/mongo/ClearCollectionSpec.groovy
  116. +16 −18 ...go/src/test/groovy/org/grails/datastore/gorm/mongo/CustomCollectionAndAttributeMappingSpec.groovy
  117. +5 −9 ...atastore-gorm-mongo/src/test/groovy/org/grails/datastore/gorm/mongo/DBObjectConversionSpec.groovy
  118. +5 −8 ...-datastore-gorm-mongo/src/test/groovy/org/grails/datastore/gorm/mongo/DefaultSortOrderSpec.groovy
  119. +4 −9 ...ls-datastore-gorm-mongo/src/test/groovy/org/grails/datastore/gorm/mongo/DisableVersionSpec.groovy
  120. +0 −5 ...tastore-gorm-mongo/src/test/groovy/org/grails/datastore/gorm/mongo/EmbeddedAssociationSpec.groovy
  121. +12 −12 ...mongo/src/test/groovy/org/grails/datastore/gorm/mongo/EmbeddedCollectionAndInheritanceSpec.groovy
  122. +1 −4 ...astore-gorm-mongo/src/test/groovy/org/grails/datastore/gorm/mongo/EmbeddedSimpleObjectSpec.groovy
  123. +8 −19 ...test/groovy/org/grails/datastore/gorm/mongo/EmbeddedStringListInsideEmbeddedCollectionSpec.groovy
  124. +16 −20 ...m-mongo/src/test/groovy/org/grails/datastore/gorm/mongo/EmbeddedWithCustomFieldMappingSpec.groovy
  125. +5 −10 ...ore-gorm-mongo/src/test/groovy/org/grails/datastore/gorm/mongo/EmbeddedWithIdSpecifiedSpec.groovy
  126. +4 −11 ...go/src/test/groovy/org/grails/datastore/gorm/mongo/EmbeddedWithNonEmbeddedAssociationsSpec.groovy
  127. +1 −2 ...ongo/src/test/groovy/org/grails/datastore/gorm/mongo/EmbeddedWithinEmbeddedAssociationSpec.groovy
  128. +1 −1 ...ls-datastore-gorm-mongo/src/test/groovy/org/grails/datastore/gorm/mongo/EnumCollectionSpec.groovy
  129. +1 −4 ...datastore-gorm-mongo/src/test/groovy/org/grails/datastore/gorm/mongo/FindOrCreateWhereSpec.groovy
  130. +5 −8 ...m-mongo/src/test/groovy/org/grails/datastore/gorm/mongo/GreaterThanAndLessThanCriteriaSpec.groovy
  131. +3 −5 grails-datastore-gorm-mongo/src/test/groovy/org/grails/datastore/gorm/mongo/HasOneSpec.groovy
  132. +15 −18 ...datastore-gorm-mongo/src/test/groovy/org/grails/datastore/gorm/mongo/HintQueryArgumentSpec.groovy
  133. +7 −9 grails-datastore-gorm-mongo/src/test/groovy/org/grails/datastore/gorm/mongo/InListQuerySpec.groovy
  134. +2 −5 ...tastore-gorm-mongo/src/test/groovy/org/grails/datastore/gorm/mongo/InheritanceQueryingSpec.groovy
  135. +3 −6 grails-datastore-gorm-mongo/src/test/groovy/org/grails/datastore/gorm/mongo/IsNullSpec.groovy
  136. +6 −8 ...store-gorm-mongo/src/test/groovy/org/grails/datastore/gorm/mongo/ListOneToManyOrderingSpec.groovy
  137. +6 −8 grails-datastore-gorm-mongo/src/test/groovy/org/grails/datastore/gorm/mongo/MongoTypesSpec.groovy
  138. +1 −7 grails-datastore-gorm-mongo/src/test/groovy/org/grails/datastore/gorm/mongo/NegateInListSpec.groovy
  139. +2 −5 ...s-datastore-gorm-mongo/src/test/groovy/org/grails/datastore/gorm/mongo/NullifyPropertySpec.groovy
  140. +2 −10 ...re-gorm-mongo/src/test/groovy/org/grails/datastore/gorm/mongo/OneToManyWithInheritanceSpec.groovy
  141. +4 −15 ...datastore-gorm-mongo/src/test/groovy/org/grails/datastore/gorm/mongo/OneToOneIntegritySpec.groovy
  142. +3 −6 ...tastore-gorm-mongo/src/test/groovy/org/grails/datastore/gorm/mongo/OneToOneNoReferenceSpec.groovy
  143. +1 −3 grails-datastore-gorm-mongo/src/test/groovy/org/grails/datastore/gorm/mongo/SchemalessSpec.groovy
  144. +6 −12 ...datastore-gorm-mongo/src/test/groovy/org/grails/datastore/gorm/mongo/TransientPropertySpec.groovy
  145. +4 −6 grails-datastore-gorm-mongo/src/test/groovy/org/grails/datastore/gorm/mongo/WriteConcernSpec.groovy
  146. +2 −2 .../main/groovy/org/grails/datastore/gorm/plugin/support/AggregatePersistenceContextInterceptor.java
  147. +7 −9 ...rm-plugin-support/src/main/groovy/org/grails/datastore/gorm/plugin/support/OnChangeHandler.groovy
  148. +3 −3 ...m-plugin-support/src/main/groovy/org/grails/datastore/gorm/plugin/support/SpringConfigurer.groovy
  149. +9 −8 ...port/src/test/groovy/org/grails/datastore/gorm/plugin/support/DynamicMethodsConfigurerSpec.groovy
  150. +3 −3 ...lugin-support/src/test/groovy/org/grails/datastore/gorm/plugin/support/OnChangeHandlerSpec.groovy
  151. +10 −7 ...ugin-support/src/test/groovy/org/grails/datastore/gorm/plugin/support/SpringConfigurerSpec.groovy
  152. +3 −3 grails-datastore-gorm-redis/src/main/groovy/org/grails/datastore/gorm/redis/RedisGormEnhancer.groovy
  153. +1 −1 ...dis/src/main/groovy/org/grails/datastore/gorm/redis/bean/factory/RedisDatastoreFactoryBean.groovy
  154. +1 −1 ...rc/main/groovy/org/grails/datastore/gorm/redis/bean/factory/RedisMappingContextFactoryBean.groovy
  155. +4 −4 grails-datastore-gorm-redis/src/test/groovy/grails/gorm/tests/PropertyComparisonQuerySpec.groovy
  156. +1 −2 ...n/groovy/org/grails/datastore/gorm/simpledb/bean/factory/SimpleDBMappingContextFactoryBean.groovy
  157. +25 −25 ...ovy/org/grails/datastore/gorm/simpledb/plugin/support/SimpleDBApplicationContextConfigurer.groovy
  158. +11 −13 ...rc/main/groovy/org/grails/datastore/gorm/simpledb/plugin/support/SimpleDBMethodsConfigurer.groovy
  159. +2 −3 ...src/main/groovy/org/grails/datastore/gorm/simpledb/plugin/support/SimpleDBSpringConfigurer.groovy
  160. +2 −5 grails-datastore-gorm-simpledb/src/test/groovy/grails/gorm/tests/ChildEntity.groovy
  161. +2 −22 grails-datastore-gorm-simpledb/src/test/groovy/grails/gorm/tests/CommonTypes.groovy
  162. +3 −8 grails-datastore-gorm-simpledb/src/test/groovy/grails/gorm/tests/Country.groovy
  163. +3 −9 grails-datastore-gorm-simpledb/src/test/groovy/grails/gorm/tests/GroupWithin.groovy
  164. +1 −3 grails-datastore-gorm-simpledb/src/test/groovy/grails/gorm/tests/InheritanceSpec.groovy
  165. +34 −35 grails-datastore-gorm-simpledb/src/test/groovy/grails/gorm/tests/LexComparisonSpec.groovy
  166. +3 −7 grails-datastore-gorm-simpledb/src/test/groovy/grails/gorm/tests/PagedResultSpec.groovy
  167. +5 −9 grails-datastore-gorm-simpledb/src/test/groovy/grails/gorm/tests/Person.groovy
  168. +3 −12 grails-datastore-gorm-simpledb/src/test/groovy/grails/gorm/tests/Pet.groovy
  169. +3 −8 grails-datastore-gorm-simpledb/src/test/groovy/grails/gorm/tests/PlantNumericIdValue.groovy
  170. +3 −9 grails-datastore-gorm-simpledb/src/test/groovy/grails/gorm/tests/Publication.groovy
  171. +4 −3 grails-datastore-gorm-simpledb/src/test/groovy/grails/gorm/tests/SimpleDBHiloSpec.groovy
  172. +3 −5 grails-datastore-gorm-simpledb/src/test/groovy/grails/gorm/tests/StringConversionSpec.groovy
  173. +2 −7 grails-datastore-gorm-simpledb/src/test/groovy/grails/gorm/tests/TestEntity.groovy
  174. +4 −8 grails-datastore-gorm-simpledb/src/test/groovy/grails/gorm/tests/UniqueGroup.groovy
  175. +14 −14 grails-datastore-gorm-simpledb/src/test/groovy/org/grails/datastore/gorm/Setup.groovy
  176. +1 −3 grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/CriteriaBuilderSpec.groovy
  177. +1 −1 grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/DeleteAllSpec.groovy
  178. +2 −12 grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/DetachedCriteriaSpec.groovy
  179. +0 −1 grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/EnumSpec.groovy
  180. +227 −231 grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/FindByMethodSpec.groovy
  181. +34 −33 grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/FirstAndLastMethodSpec.groovy
  182. +1 −1 grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/GormEnhancerSpec.groovy
  183. +3 −4 grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/GroovyProxySpec.groovy
  184. +1 −1 grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/InheritanceSpec.groovy
  185. +2 −10 grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/PagedResultSpec.groovy
  186. +1 −2 grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/QueryByNullSpec.groovy
  187. +7 −9 grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/RangeQuerySpec.groovy
  188. +1 −1 grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/SaveAllSpec.groovy
  189. +1 −15 grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/SizeQuerySpec.groovy
  190. +1 −1 grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/TestEnum.groovy
  191. +6 −11 grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/UniqueConstraintSpec.groovy
  192. +4 −4 grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/ValidationSpec.groovy
  193. +16 −18 grails-datastore-gorm-test/src/main/groovy/grails/datastore/test/DatastoreUnitTestMixin.groovy
  194. +1 −9 grails-datastore-gorm-test/src/test/groovy/grails/gorm/tests/JpaQueryBuilderSpec.groovy
  195. +45 −79 grails-datastore-gorm-test/src/test/groovy/grails/gorm/tests/WhereMethodSpec.groovy
  196. +1 −7 ...-datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/AddToAndInjectedServiceSpec.groovy
  197. +4 −10 ...ore-gorm-test/src/test/groovy/org/grails/datastore/gorm/AddToMethodWithBasicCollectionSpec.groovy
  198. +4 −13 ...-gorm-test/src/test/groovy/org/grails/datastore/gorm/AddToMethodWithEmbeddedCollectionSpec.groovy
  199. +3 −4 grails-datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/AssignedIdentifierSpec.groovy
  200. +4 −8 ...store-gorm-test/src/test/groovy/org/grails/datastore/gorm/AutoLinkOneToManyAssociationSpec.groovy
  201. +3 −9 grails-datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/BeforeUpdateEventSpec.groovy
  202. +2 −9 grails-datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/CacheAndJoinSpec.groovy
  203. +1 −8 grails-datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/CircularManyToManySpec.groovy
  204. +3 −6 grails-datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/CircularManyToOneSpec.groovy
  205. +6 −7 grails-datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/CompositeIdentifierSpec.groovy
  206. +0 −9 ...datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/CriteriaProjectedResultsSpec.groovy
  207. +2 −9 ...datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/CustomSequenceIdentifierSpec.groovy
  208. +1 −8 ...s-datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/CustomStringIdentifierSpec.groovy
  209. +5 −4 ...ls-datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/CustomTypeMarshallingSpec.groovy
  210. +0 −8 grails-datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/DistinctProjectionSpec.groovy
  211. +3 −8 ...atastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/DomainWithPrimitiveGetterSpec.groovy
  212. +1 −9 ...store-gorm-test/src/test/groovy/org/grails/datastore/gorm/EmbeddedNonEntityAssociationSpec.groovy
  213. +12 −12 ...s-datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/HasManyDefaultMappedBySpec.groovy
  214. +5 −12 grails-datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/HasOneSetInverseSideSpec.groovy
  215. +3 −8 ...datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/InheritanceWithOneToManySpec.groovy
  216. +3 −8 grails-datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/ManyToManySpec.groovy
  217. +2 −20 ...s-datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/NestedAssociationQuerySpec.groovy
  218. +2 −7 grails-datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/NotNullQuerySpec.groovy
  219. +0 −2 grails-datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/QueryAssociationSpec.groovy
  220. +1 −1 ...-datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/QueryNonIndexedPropertySpec.groovy
  221. +13 −13 grails-datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/Setup.groovy
  222. +2 −10 grails-datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/UUIIdentifierSpec.groovy
  223. +5 −11 ...ls-datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/UniqueConstraintGroupSpec.groovy
Sorry, we could not display the entire diff because it was too big.
View
2 ...ore-core/src/main/groovy/org/grails/datastore/mapping/cache/TPCacheAdapterRepository.java
@@ -29,7 +29,7 @@
* @param entityJavaClass equivalent to {@link PersistentEntity.getJavaClass()}
* @param cacheAdapter
*/
- void setTPCacheAdapter(Class entityJavaClass, TPCacheAdapter<T> cacheAdapter);
+ void setTPCacheAdapter(@SuppressWarnings("rawtypes") Class entityJavaClass, TPCacheAdapter<T> cacheAdapter);
/**
* Sets {@link TPCacheAdapter} for the specified FQN java class of {@link PersistentEntity}.
View
2 ...ore-core/src/main/groovy/org/grails/datastore/mapping/cache/exception/CacheException.java
@@ -5,6 +5,8 @@
* @author Roman Stepanenko
*/
public class CacheException extends RuntimeException{
+ private static final long serialVersionUID = 1;
+
public CacheException() {
}
View
2 ...src/main/groovy/org/grails/datastore/mapping/cache/impl/TPCacheAdapterRepositoryImpl.java
@@ -24,7 +24,7 @@ public void setTPCacheAdapter(PersistentEntity entity, TPCacheAdapter<T> cacheAd
setTPCacheAdapter(entity.getJavaClass(), cacheAdapter);
}
- public void setTPCacheAdapter(Class entityJavaClass, TPCacheAdapter<T> cacheAdapter) {
+ public void setTPCacheAdapter(@SuppressWarnings("rawtypes") Class entityJavaClass, TPCacheAdapter<T> cacheAdapter) {
setTPCacheAdapter(entityJavaClass.getName(), cacheAdapter);
}
View
1 ...atastore-core/src/main/groovy/org/grails/datastore/mapping/collection/PersistentList.java
@@ -34,7 +34,6 @@
private final List list;
-
public PersistentList(Class childType, Session session, List collection) {
super(childType, session, collection);
this.list = collection;
View
8 ...ore-core/src/main/groovy/org/grails/datastore/mapping/collection/PersistentSortedSet.java
@@ -12,7 +12,7 @@
* @author Graeme Rocher
* @since 1.0
*/
-@SuppressWarnings("rawtypes")
+@SuppressWarnings({ "rawtypes", "unchecked" })
public class PersistentSortedSet extends AbstractPersistentCollection implements SortedSet {
public PersistentSortedSet(Class childType, Session session, SortedSet collection) {
@@ -27,7 +27,6 @@ public PersistentSortedSet(Serializable associationKey, Session session, Associa
super(associationKey, session, indexer, new TreeSet());
}
- @Override
public Comparator comparator() {
return getSortedSet().comparator();
}
@@ -37,27 +36,22 @@ private SortedSet getSortedSet() {
return ((SortedSet)collection);
}
- @Override
public SortedSet subSet(Object o, Object o1) {
return getSortedSet().subSet(o,o1);
}
- @Override
public SortedSet headSet(Object o) {
return getSortedSet().headSet(o);
}
- @Override
public SortedSet tailSet(Object o) {
return getSortedSet().tailSet(o);
}
- @Override
public Object first() {
return getSortedSet().first();
}
- @Override
public Object last() {
return getSortedSet().last();
}
View
25 ...-core/src/main/groovy/org/grails/datastore/mapping/config/AbstractGormMappingFactory.java
@@ -20,30 +20,34 @@
import java.util.HashMap;
import java.util.Map;
-import org.grails.datastore.mapping.model.*;
-import org.springframework.beans.BeanUtils;
import org.grails.datastore.mapping.config.groovy.MappingConfigurationBuilder;
+import org.grails.datastore.mapping.model.ClassMapping;
+import org.grails.datastore.mapping.model.IdentityMapping;
+import org.grails.datastore.mapping.model.MappingFactory;
+import org.grails.datastore.mapping.model.PersistentEntity;
+import org.grails.datastore.mapping.model.PersistentProperty;
import org.grails.datastore.mapping.model.config.GormProperties;
import org.grails.datastore.mapping.reflect.ClassPropertyFetcher;
+import org.springframework.beans.BeanUtils;
/**
* Abstract GORM implementation that uses the GORM MappingConfigurationBuilder to configure entity mappings.
*
* @author Graeme Rocher
*/
+@SuppressWarnings({"rawtypes", "unchecked"})
public abstract class AbstractGormMappingFactory<R, T> extends MappingFactory<R, T> {
protected Map<PersistentEntity, Map<String, T>> entityToPropertyMap = new HashMap<PersistentEntity, Map<String, T>>();
private Closure defaultMapping;
- @SuppressWarnings("unchecked")
@Override
public R createMappedForm(PersistentEntity entity) {
ClassPropertyFetcher cpf = ClassPropertyFetcher.forClass(entity.getJavaClass());
R family = BeanUtils.instantiate(getEntityMappedFormType());
MappingConfigurationBuilder builder = new MappingConfigurationBuilder(family, getPropertyMappedFormType());
- if(defaultMapping != null) {
+ if (defaultMapping != null) {
builder.evaluate(defaultMapping);
}
Closure value = cpf.getStaticPropertyValue(GormProperties.MAPPING, Closure.class);
@@ -58,7 +62,6 @@ public R createMappedForm(PersistentEntity entity) {
return family;
}
-
public void setDefaultMapping(Closure defaultMapping) {
this.defaultMapping = defaultMapping;
}
@@ -70,10 +73,10 @@ public void setDefaultMapping(Closure defaultMapping) {
@Override
public IdentityMapping createIdentityMapping(ClassMapping classMapping) {
Map<String, T> props = entityToPropertyMap.get(classMapping.getEntity());
- if(props != null) {
+ if (props != null) {
T property = props.get(IDENTITY_PROPERTY);
IdentityMapping customIdentityMapping = getIdentityMappedForm(classMapping,property);
- if(customIdentityMapping != null) {
+ if (customIdentityMapping != null) {
return customIdentityMapping;
}
}
@@ -85,20 +88,20 @@ protected IdentityMapping getIdentityMappedForm(ClassMapping classMapping, T pro
}
@Override
- public T createMappedForm(@SuppressWarnings("rawtypes") PersistentProperty mpp) {
+ public T createMappedForm(PersistentProperty mpp) {
Map<String, T> properties = entityToPropertyMap.get(mpp.getOwner());
if (properties != null && properties.containsKey(mpp.getName())) {
return properties.get(mpp.getName());
}
- else if(properties != null) {
+ else if (properties != null) {
Property property = (Property) properties.get(IDENTITY_PROPERTY);
- if(property != null && mpp.getName().equals(property.getName())) {
+ if (property != null && mpp.getName().equals(property.getName())) {
return (T) property;
}
}
T defaultMapping = properties != null ? properties.get("*") : null;
- if(defaultMapping != null) {
+ if (defaultMapping != null) {
try {
return (T)((Property)defaultMapping).clone();
} catch (CloneNotSupportedException e) {
View
6 ...main/groovy/org/grails/datastore/mapping/config/groovy/MappingConfigurationBuilder.groovy
@@ -14,8 +14,8 @@
*/
package org.grails.datastore.mapping.config.groovy
-import org.springframework.beans.MutablePropertyValues
import org.grails.datastore.mapping.reflect.NameUtils
+import org.springframework.beans.MutablePropertyValues
import org.springframework.validation.DataBinder
/**
@@ -46,8 +46,6 @@ class MappingConfigurationBuilder {
return
}
-
-
def setterName = NameUtils.getSetterName(name)
if (target.respondsTo(setterName)) {
target[name] = args.size() == 1 ? args[0] : args
@@ -56,7 +54,7 @@ class MappingConfigurationBuilder {
if (args[0] instanceof Map) {
def instance
- if(properties['*']) {
+ if (properties['*']) {
instance = properties['*'].clone()
}
else {
View
5 ...s-datastore-core/src/main/groovy/org/grails/datastore/mapping/core/AbstractDatastore.java
@@ -70,7 +70,6 @@ public AbstractDatastore(MappingContext mappingContext, Map<String, String> conn
this.cacheAdapterRepository = cacheAdapterRepository;
}
- @Override
public void destroy() throws Exception {
ERRORS_MAP.remove();
VALIDATE_MAP.remove();
@@ -105,7 +104,7 @@ public final Session connect(Map<String, String> connDetails) {
* @param connectionDetails The session details
* @return The session object
*/
- protected abstract Session createSession(@SuppressWarnings("hiding") Map<String, String> connectionDetails);
+ protected abstract Session createSession(Map<String, String> connectionDetails);
public Session getCurrentSession() throws ConnectionNotFoundException {
return DatastoreUtils.doGetSession(this, false);
@@ -188,7 +187,7 @@ public boolean skipValidation(final Object o) {
return VALIDATE_MAP.get();
}
- protected void initializeConverters(@SuppressWarnings("hiding") MappingContext mappingContext) {
+ protected void initializeConverters(MappingContext mappingContext) {
final ConverterRegistry conversionService = mappingContext.getConverterRegistry();
BasicTypeConverterRegistrar registrar = new BasicTypeConverterRegistrar();
registrar.register(conversionService);
View
18 grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/core/AbstractSession.java
@@ -28,12 +28,6 @@
import javax.persistence.FlushModeType;
import org.grails.datastore.mapping.cache.TPCacheAdapterRepository;
-import org.grails.datastore.mapping.query.api.QueryableCriteria;
-import org.springframework.beans.BeanWrapper;
-import org.springframework.beans.BeanWrapperImpl;
-import org.springframework.context.ApplicationEventPublisher;
-import org.springframework.dao.DataAccessResourceFailureException;
-import org.springframework.dao.InvalidDataAccessResourceUsageException;
import org.grails.datastore.mapping.collection.PersistentCollection;
import org.grails.datastore.mapping.core.impl.PendingInsert;
import org.grails.datastore.mapping.core.impl.PendingOperation;
@@ -46,7 +40,13 @@
import org.grails.datastore.mapping.model.MappingContext;
import org.grails.datastore.mapping.model.PersistentEntity;
import org.grails.datastore.mapping.query.Query;
+import org.grails.datastore.mapping.query.api.QueryableCriteria;
import org.grails.datastore.mapping.transactions.Transaction;
+import org.springframework.beans.BeanWrapper;
+import org.springframework.beans.BeanWrapperImpl;
+import org.springframework.context.ApplicationEventPublisher;
+import org.springframework.dao.DataAccessResourceFailureException;
+import org.springframework.dao.InvalidDataAccessResourceUsageException;
import org.springframework.transaction.NoTransactionException;
import org.springframework.util.Assert;
@@ -172,8 +172,7 @@ public void cacheEntry(PersistentEntity entity, Serializable key, Object entry)
cacheEntry(key, entry, getEntryCache(entity.getJavaClass(), false), false);
}
- protected void cacheEntry(Serializable key, Object entry, Map<Serializable, Object> entryCache,
- @SuppressWarnings("unused") boolean forDirtyCheck) {
+ protected void cacheEntry(Serializable key, Object entry, Map<Serializable, Object> entryCache, boolean forDirtyCheck) {
entryCache.put(key, entry);
}
@@ -333,7 +332,7 @@ private boolean hasUpdates() {
return !pendingInserts.isEmpty() || !pendingUpdates.isEmpty() || !pendingDeletes.isEmpty();
}
- protected void postFlush(@SuppressWarnings("unused") boolean hasUpdates) {
+ protected void postFlush(boolean hasUpdates) {
// do nothing
}
@@ -391,7 +390,6 @@ else if (o instanceof PersistentEntity) {
return p;
}
- @SuppressWarnings("hiding")
protected abstract Persister createPersister(Class cls, MappingContext mappingContext);
public boolean contains(Object o) {
View
1 grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/core/DatastoreUtils.java
@@ -37,6 +37,7 @@
* @author Juergen Hoeller
* @author Graeme Rocher
*/
+@SuppressWarnings("rawtypes")
public abstract class DatastoreUtils {
public static final Log logger = LogFactory.getLog(DatastoreUtils.class);
View
4 ...e-core/src/main/groovy/org/grails/datastore/mapping/core/IdentityGenerationException.java
@@ -15,13 +15,15 @@
package org.grails.datastore.mapping.core;
/**
- * Exception thrown when an identity cannot be generated
+ * Thrown when an identity cannot be generated.
*
* @author Graeme Rocher
* @since 1.0
*/
public class IdentityGenerationException extends RuntimeException {
+ private static final long serialVersionUID = 1;
+
public IdentityGenerationException(String msg) {
super(msg);
}
View
9 ...rc/main/groovy/org/grails/datastore/mapping/document/config/DocumentPersistentEntity.java
@@ -15,7 +15,12 @@
package org.grails.datastore.mapping.document.config;
-import org.grails.datastore.mapping.model.*;
+import org.grails.datastore.mapping.model.AbstractClassMapping;
+import org.grails.datastore.mapping.model.AbstractPersistentEntity;
+import org.grails.datastore.mapping.model.ClassMapping;
+import org.grails.datastore.mapping.model.IdentityMapping;
+import org.grails.datastore.mapping.model.MappingContext;
+import org.grails.datastore.mapping.model.PersistentEntity;
public class DocumentPersistentEntity extends AbstractPersistentEntity<Collection> {
@@ -47,7 +52,7 @@ public Collection getMappedForm() {
@Override
public IdentityMapping getIdentifier() {
- if(identityMapping == null) {
+ if (identityMapping == null) {
identityMapping = context.getMappingFactory().createIdentityMapping(this);
}
return identityMapping;
View
43 ...s-datastore-core/src/main/groovy/org/grails/datastore/mapping/engine/EntityPersister.java
@@ -19,12 +19,19 @@
import java.util.Date;
import java.util.List;
-import org.grails.datastore.mapping.engine.event.*;
-import org.springframework.context.ApplicationEventPublisher;
import org.grails.datastore.mapping.core.Session;
+import org.grails.datastore.mapping.engine.event.PostDeleteEvent;
+import org.grails.datastore.mapping.engine.event.PostInsertEvent;
+import org.grails.datastore.mapping.engine.event.PostLoadEvent;
+import org.grails.datastore.mapping.engine.event.PostUpdateEvent;
+import org.grails.datastore.mapping.engine.event.PreDeleteEvent;
+import org.grails.datastore.mapping.engine.event.PreInsertEvent;
+import org.grails.datastore.mapping.engine.event.PreLoadEvent;
+import org.grails.datastore.mapping.engine.event.PreUpdateEvent;
import org.grails.datastore.mapping.model.MappingContext;
import org.grails.datastore.mapping.model.PersistentEntity;
import org.grails.datastore.mapping.proxy.ProxyFactory;
+import org.springframework.context.ApplicationEventPublisher;
/**
* A {@link org.grails.datastore.mapping.engine.Persister} specifically for persisting PersistentEntity instances.
@@ -88,7 +95,7 @@ public Class getType() {
* @return The identifier or null if it doesn't have one
*/
public Serializable getObjectIdentifier(Object obj) {
- if(obj == null) return null;
+ if (obj == null) return null;
final ProxyFactory pf = getProxyFactory();
if (pf.isProxy(obj)) {
return pf.getIdentifier(obj);
@@ -196,11 +203,11 @@ public void delete(Object obj) {
protected abstract void deleteEntities(PersistentEntity pe, @SuppressWarnings("rawtypes") Iterable objects);
- protected EntityAccess createEntityAccess(@SuppressWarnings("unused") PersistentEntity pe, Object obj) {
+ protected EntityAccess createEntityAccess(PersistentEntity pe, Object obj) {
return new EntityAccess(persistentEntity, obj);
}
- protected Object newEntityInstance(@SuppressWarnings("hiding") PersistentEntity persistentEntity) {
+ protected Object newEntityInstance(PersistentEntity persistentEntity) {
Object o = persistentEntity.newInstance();
publisher.publishEvent(new PreLoadEvent(session.getDatastore(), getPersistentEntity(),
new EntityAccess(persistentEntity, o)));
@@ -213,15 +220,13 @@ protected Object newEntityInstance(@SuppressWarnings("hiding") PersistentEntity
* @param entityAccess The entity access
* @return true if the operation should be cancelled
*/
- public boolean cancelInsert(@SuppressWarnings("hiding") final PersistentEntity persistentEntity,
- final EntityAccess entityAccess) {
+ public boolean cancelInsert(final PersistentEntity persistentEntity, final EntityAccess entityAccess) {
PreInsertEvent event = new PreInsertEvent(session.getDatastore(), persistentEntity, entityAccess);
publisher.publishEvent(event);
return event.isCancelled();
}
- public void firePostInsertEvent(@SuppressWarnings("hiding") final PersistentEntity persistentEntity,
- final EntityAccess entityAccess) {
+ public void firePostInsertEvent(final PersistentEntity persistentEntity, final EntityAccess entityAccess) {
publisher.publishEvent(new PostInsertEvent(
session.getDatastore(), persistentEntity, entityAccess));
}
@@ -232,8 +237,7 @@ public void firePostInsertEvent(@SuppressWarnings("hiding") final PersistentEnti
* @param entityAccess The entity access
* @return true if the operation should be cancelled
*/
- public boolean cancelUpdate(@SuppressWarnings("hiding") final PersistentEntity persistentEntity,
- final EntityAccess entityAccess) {
+ public boolean cancelUpdate(final PersistentEntity persistentEntity, final EntityAccess entityAccess) {
PreUpdateEvent event = new PreUpdateEvent(session.getDatastore(), persistentEntity, entityAccess);
publisher.publishEvent(event);
return event.isCancelled();
@@ -245,33 +249,28 @@ public boolean cancelUpdate(@SuppressWarnings("hiding") final PersistentEntity p
* @param entityAccess The entity access
* @return true if the operation should be cancelled
*/
- public boolean cancelDelete( final PersistentEntity persistentEntity,
- final EntityAccess entityAccess) {
+ public boolean cancelDelete( final PersistentEntity persistentEntity, final EntityAccess entityAccess) {
PreDeleteEvent event = new PreDeleteEvent(session.getDatastore(), persistentEntity, entityAccess);
publisher.publishEvent(event);
return event.isCancelled();
}
- public void firePostUpdateEvent(@SuppressWarnings("hiding") final PersistentEntity persistentEntity,
- final EntityAccess entityAccess) {
+ public void firePostUpdateEvent(final PersistentEntity persistentEntity, final EntityAccess entityAccess) {
publisher.publishEvent(new PostUpdateEvent(
session.getDatastore(), persistentEntity, entityAccess));
}
- public void firePostDeleteEvent(@SuppressWarnings("hiding") final PersistentEntity persistentEntity,
- final EntityAccess entityAccess) {
+ public void firePostDeleteEvent(final PersistentEntity persistentEntity, final EntityAccess entityAccess) {
publisher.publishEvent(new PostDeleteEvent(
session.getDatastore(), persistentEntity, entityAccess));
}
- public void firePreLoadEvent(@SuppressWarnings("hiding") final PersistentEntity persistentEntity,
- final EntityAccess entityAccess) {
+ public void firePreLoadEvent(final PersistentEntity persistentEntity, final EntityAccess entityAccess) {
publisher.publishEvent(new PreLoadEvent(
session.getDatastore(), persistentEntity, entityAccess));
}
- public void firePostLoadEvent(@SuppressWarnings("hiding") final PersistentEntity persistentEntity,
- final EntityAccess entityAccess) {
+ public void firePostLoadEvent(final PersistentEntity persistentEntity, final EntityAccess entityAccess) {
publisher.publishEvent(new PostLoadEvent(
session.getDatastore(), persistentEntity, entityAccess));
}
@@ -289,7 +288,7 @@ protected boolean isVersioned(final EntityAccess ea) {
protected void incrementVersion(final EntityAccess ea) {
if (Number.class.isAssignableFrom(ea.getPropertyType("version"))) {
Number currentVersion = (Number) ea.getProperty("version");
- if(currentVersion == null) {
+ if (currentVersion == null) {
currentVersion = 0L;
}
ea.setProperty("version", currentVersion.longValue() + 1);
View
159 ...-core/src/main/groovy/org/grails/datastore/mapping/engine/NativeEntryEntityPersister.java
@@ -15,7 +15,18 @@
package org.grails.datastore.mapping.engine;
import java.io.Serializable;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.SortedSet;
import javax.persistence.CascadeType;
import javax.persistence.FetchType;
@@ -23,19 +34,11 @@
import org.grails.datastore.mapping.cache.TPCacheAdapter;
import org.grails.datastore.mapping.cache.TPCacheAdapterRepository;
-import org.grails.datastore.mapping.collection.*;
-import org.grails.datastore.mapping.engine.event.PostDeleteEvent;
-import org.grails.datastore.mapping.engine.event.PreLoadEvent;
-import org.grails.datastore.mapping.engine.internal.MappingUtils;
-import org.grails.datastore.mapping.engine.types.CustomTypeMarshaller;
-import org.grails.datastore.mapping.model.*;
-import org.grails.datastore.mapping.model.types.*;
-import org.grails.datastore.mapping.query.Query;
-import org.springframework.beans.BeanWrapper;
-import org.springframework.beans.PropertyAccessorFactory;
-import org.springframework.beans.SimpleTypeConverter;
-import org.springframework.context.ApplicationEventPublisher;
-import org.springframework.dao.CannotAcquireLockException;
+import org.grails.datastore.mapping.collection.AbstractPersistentCollection;
+import org.grails.datastore.mapping.collection.PersistentCollection;
+import org.grails.datastore.mapping.collection.PersistentList;
+import org.grails.datastore.mapping.collection.PersistentSet;
+import org.grails.datastore.mapping.collection.PersistentSortedSet;
import org.grails.datastore.mapping.config.Property;
import org.grails.datastore.mapping.core.Session;
import org.grails.datastore.mapping.core.SessionImplementor;
@@ -47,7 +50,28 @@
import org.grails.datastore.mapping.core.impl.PendingUpdate;
import org.grails.datastore.mapping.core.impl.PendingUpdateAdapter;
import org.grails.datastore.mapping.engine.event.PreDeleteEvent;
+import org.grails.datastore.mapping.engine.internal.MappingUtils;
+import org.grails.datastore.mapping.engine.types.CustomTypeMarshaller;
+import org.grails.datastore.mapping.model.ClassMapping;
+import org.grails.datastore.mapping.model.EmbeddedPersistentEntity;
+import org.grails.datastore.mapping.model.MappingContext;
+import org.grails.datastore.mapping.model.PersistentEntity;
+import org.grails.datastore.mapping.model.PersistentProperty;
+import org.grails.datastore.mapping.model.PropertyMapping;
+import org.grails.datastore.mapping.model.types.Association;
+import org.grails.datastore.mapping.model.types.Basic;
+import org.grails.datastore.mapping.model.types.Custom;
+import org.grails.datastore.mapping.model.types.Embedded;
+import org.grails.datastore.mapping.model.types.EmbeddedCollection;
+import org.grails.datastore.mapping.model.types.ManyToMany;
+import org.grails.datastore.mapping.model.types.OneToMany;
+import org.grails.datastore.mapping.model.types.Simple;
+import org.grails.datastore.mapping.model.types.ToOne;
import org.grails.datastore.mapping.proxy.ProxyFactory;
+import org.grails.datastore.mapping.query.Query;
+import org.springframework.beans.SimpleTypeConverter;
+import org.springframework.context.ApplicationEventPublisher;
+import org.springframework.dao.CannotAcquireLockException;
/**
* Provides an implementation of the {@link org.grails.datastore.mapping.engine.EntityPersister} class that
@@ -206,12 +230,13 @@ else if (prop instanceof ToOne) {
ToOne association = (ToOne) prop;
if (!(prop instanceof Embedded) && !(prop instanceof EmbeddedCollection) &&
association.doesCascade(CascadeType.REMOVE)) {
- if(association.isOwningSide()) {
+ if (association.isOwningSide()) {
Object value = entityAccess.getProperty(association.getName());
- if(value != null) {
+ if (value != null) {
Persister persister = session.getPersister(value);
- if(persister != null)
+ if (persister != null) {
persister.delete(value);
+ }
}
}
}
@@ -378,8 +403,7 @@ protected void refreshObjectStateFromNativeEntry(PersistentEntity persistentEnti
Serializable nativeKey, T nativeEntry, boolean isEmbedded) {
EntityAccess ea = createEntityAccess(persistentEntity, obj, nativeEntry);
ea.setConversionService(getMappingContext().getConversionService());
- if(!(persistentEntity instanceof EmbeddedPersistentEntity)) {
-
+ if (!(persistentEntity instanceof EmbeddedPersistentEntity)) {
String idName = ea.getIdentifierName();
ea.setProperty(idName, nativeKey);
}
@@ -391,7 +415,7 @@ protected void refreshObjectStateFromNativeEntry(PersistentEntity persistentEnti
// this magically converts most types to the correct property type, using bean converters.
ea.setProperty(prop.getName(), getEntryValue(nativeEntry, propKey));
}
- else if(prop instanceof Basic) {
+ else if (prop instanceof Basic) {
Object entryValue = getEntryValue(nativeEntry, propKey);
entryValue = convertBasicEntryValue(persistentEntity, prop, entryValue);
ea.setProperty(prop.getName(), entryValue);
@@ -436,9 +460,8 @@ else if (prop instanceof ToOne) {
else {
// TODO: handle unidirectional?
}
-
-
}
+
if (isEmbeddedEntry(tmp)) {
PersistentEntity associatedEntity = ((ToOne) prop).getAssociatedEntity();
associatedEntity = discriminatePersistentEntity(associatedEntity, (T) tmp);
@@ -475,8 +498,7 @@ else if (prop instanceof OneToMany) {
Association association = (Association) prop;
PropertyMapping<Property> associationPropertyMapping = association.getMapping();
-
- if(isEmbedded) {
+ if (isEmbedded) {
List keys = loadEmbeddedCollectionKeys((Association) prop, ea, nativeEntry);
if (List.class.isAssignableFrom(association.getType())) {
ea.setPropertyNoConversion(association.getName(),
@@ -590,7 +612,7 @@ protected Object convertBasicEntryValue(PersistentEntity persistentEntity, Persi
// In both cases, we use a BeanWrapper to provide all possible conversions, including those from the
// ConversionService as well as standard property editor conversions, etc.
// Enums are handled automatically, as are other standard types such as Locale, URI, Integer, etc.
- if(entryValue instanceof Map) {
+ if (entryValue instanceof Map) {
Map nativeMap = (Map) entryValue;
LinkedHashMap targetMap = new LinkedHashMap();
Class propertyType = prop.getType();
@@ -613,13 +635,13 @@ protected Object convertBasicEntryValue(PersistentEntity persistentEntity, Persi
entryValue = targetMap;
}
- else if(entryValue instanceof Collection) {
+ else if (entryValue instanceof Collection) {
Collection collection = MappingUtils.createConcreteCollection(prop.getType());
Class propertyType = prop.getType();
Class genericType = MappingUtils.getGenericTypeForProperty(persistentEntity.getJavaClass(), prop.getName());
Collection collectionValue = (Collection) entryValue;
- if(genericType != null) {
+ if (genericType != null) {
SimpleTypeConverter converter = new SimpleTypeConverter();
converter.setConversionService(getMappingContext().getConversionService());
for (Object o : collectionValue) {
@@ -655,7 +677,6 @@ protected void setEmbeddedCollectionKeys(Association association, EntityAccess e
// do nothing
}
-
/**
* Tests whether a native entry is an embedded entry
*
@@ -751,11 +772,11 @@ protected final Serializable persistEntity(final PersistentEntity persistentEnti
PendingOperation<T, K> pendingOperation;
PropertyMapping mapping = persistentEntity.getIdentity().getMapping();
- if(mapping != null) {
+ if (mapping != null) {
Property p = (Property) mapping.getMappedForm();
assignedId = p != null && "assigned".equals(p.getGenerator());
- if(assignedId) {
- if(isUpdate && !session.contains(obj)) {
+ if (assignedId) {
+ if (isUpdate && !session.contains(obj)) {
isUpdate = false;
}
}
@@ -765,8 +786,9 @@ protected final Serializable persistEntity(final PersistentEntity persistentEnti
if (!isUpdate) {
tmp = createNewEntry(family);
- if(!assignedId)
+ if (!assignedId) {
k = generateIdentifier(persistentEntity, tmp);
+ }
cacheNativeEntry(persistentEntity, (Serializable) k, tmp);
@@ -842,10 +864,10 @@ else if (prop instanceof OneToMany) {
Collection associatedObjects = (Collection) propValue;
if (isInitializedCollection(associatedObjects)) {
EntityPersister associationPersister = (EntityPersister) session.getPersister(oneToMany.getAssociatedEntity());
- if(associationPersister != null) {
+ if (associationPersister != null) {
PersistentCollection persistentCollection;
boolean newCollection = false;
- if(associatedObjects instanceof PersistentCollection) {
+ if (associatedObjects instanceof PersistentCollection) {
persistentCollection = (PersistentCollection) associatedObjects;
}
else {
@@ -855,17 +877,16 @@ else if (prop instanceof OneToMany) {
persistentCollection.markDirty();
newCollection = true;
}
- if(persistentCollection.isDirty()) {
+ if (persistentCollection.isDirty()) {
persistentCollection.resetDirty();
List<Serializable> keys = associationPersister.persist(associatedObjects);
toManyKeys.put(oneToMany, keys);
- if(newCollection ) {
+ if (newCollection ) {
entityAccess.setProperty(oneToMany.getName(), associatedObjects);
}
}
}
}
-
}
}
else if (prop instanceof ManyToMany) {
@@ -874,7 +895,7 @@ else if (prop instanceof ManyToMany) {
final Object propValue = entityAccess.getProperty(manyToMany.getName());
if (propValue instanceof Collection) {
Collection associatedObjects = (Collection) propValue;
- if(isInitializedCollection(associatedObjects)) {
+ if (isInitializedCollection(associatedObjects)) {
setManyToMany(persistentEntity, obj, e, manyToMany, associatedObjects, toManyKeys);
}
}
@@ -890,7 +911,6 @@ else if (prop instanceof ToOne) {
else if (association.doesCascade(CascadeType.PERSIST)) {
final Object associatedObject = entityAccess.getProperty(prop.getName());
if (associatedObject != null) {
- @SuppressWarnings("hiding")
Serializable associationId;
NativeEntryEntityPersister associationPersister = (NativeEntryEntityPersister) session.getPersister(associatedObject);
ProxyFactory proxyFactory = getProxyFactory();
@@ -1032,12 +1052,10 @@ public void run() {
}
private AbstractPersistentCollection getPersistentCollection(Collection associatedObjects, Class associationType) {
- if(associatedObjects instanceof Set) {
+ if (associatedObjects instanceof Set) {
return associatedObjects instanceof SortedSet ? new PersistentSortedSet(associationType,getSession(), (SortedSet) associatedObjects) : new PersistentSet(associationType, getSession(), associatedObjects);
}
- else {
- return new PersistentList(associationType,getSession(), (List) associatedObjects);
- }
+ return new PersistentList(associationType,getSession(), (List) associatedObjects);
}
private boolean isInitializedCollection(Collection associatedObjects) {
@@ -1061,7 +1079,7 @@ protected void handleEmbeddedToMany(EntityAccess entityAccess, T e, PersistentPr
// will have to store the embedded entity in an appropriate way (as a sub-document in a document store for example)
Object embeddedInstances = entityAccess.getProperty(prop.getName());
if (!(embeddedInstances instanceof Collection) || ((Collection)embeddedInstances).isEmpty()) {
- if(embeddedInstances == null)
+ if (embeddedInstances == null)
setEmbeddedCollection(e, key, null, null);
else {
setEmbeddedCollection(e, key, MappingUtils.createConcreteCollection(prop.getType()), new ArrayList<T>());
@@ -1095,7 +1113,7 @@ protected T handleEmbeddedInstance(Association association, Object embeddedInsta
// embeddedPersister would be null if the associated entity is a EmbeddedPersistentEntity
T embeddedEntry;
- if(embeddedPersister == null) {
+ if (embeddedPersister == null) {
embeddedEntry = createNewEntry(association.getName());
}
else {
@@ -1107,9 +1125,9 @@ protected T handleEmbeddedInstance(Association association, Object embeddedInsta
final List<PersistentProperty> embeddedProperties = associatedEntity.getPersistentProperties();
final EntityAccess embeddedEntityAccess = createEntityAccess(associatedEntity, embeddedInstance);
PersistentProperty identity = associatedEntity.getIdentity();
- if(identity != null) {
+ if (identity != null) {
Object embeddedId = embeddedEntityAccess.getProperty(identity.getName());
- if(embeddedId != null) {
+ if (embeddedId != null) {
setEntryValue(embeddedEntry, getPropertyKey(identity), embeddedId);
}
}
@@ -1124,7 +1142,7 @@ else if (persistentProperty instanceof Custom) {
}
}
else if (persistentProperty instanceof Association) {
- if(persistentProperty instanceof Embedded) {
+ if (persistentProperty instanceof Embedded) {
Association toOne = (Association) persistentProperty;
handleEmbeddedToOne(toOne,getPropertyKey(persistentProperty) , embeddedEntityAccess, embeddedEntry);
@@ -1134,18 +1152,17 @@ else if (persistentProperty instanceof ToOne) {
Object obj = embeddedEntityAccess.getProperty(toOne.getName());
Persister persister = getSession().getPersister(obj);
- if(persister != null) {
+ if (persister != null) {
Serializable id = persister.persist(obj);
- if(id != null) {
+ if (id != null) {
setEntryValue(embeddedEntry, getPropertyKey(toOne), formulateDatabaseReference(embeddedPersister.getPersistentEntity(), association, id));
}
}
-
}
- else if(persistentProperty instanceof Basic) {
+ else if (persistentProperty instanceof Basic) {
setEntryValue(embeddedEntry, getPropertyKey(persistentProperty), embeddedEntityAccess.getProperty(persistentProperty.getName()));
}
- else if(persistentProperty instanceof EmbeddedCollection) {
+ else if (persistentProperty instanceof EmbeddedCollection) {
handleEmbeddedToMany(embeddedEntityAccess, embeddedEntry, persistentProperty, persistentProperty.getName());
}
else {
@@ -1177,7 +1194,6 @@ else if (persistentProperty instanceof ManyToMany) {
return embeddedEntry;
}
-
private void handleIndexing(boolean update, T e, Map<PersistentProperty, Object> toIndex,
Map<PersistentProperty, Object> toUnindex, PersistentProperty prop, String key,
boolean indexed, Object propValue) {
@@ -1325,12 +1341,12 @@ protected String getIdentifierName(ClassMapping cm) {
protected List<Serializable> persistEntities(PersistentEntity persistentEntity, Iterable objs) {
List<Serializable> keys = new ArrayList<Serializable>();
Iterable newIter = objs;
- if(objs instanceof Collection) {
+ if (objs instanceof Collection) {
newIter = new ArrayList((Collection) objs);
}
for (Object obj : newIter) {
- if(persistentEntity.isInstance(obj)) {
- if(persistentEntity.getJavaClass().equals(obj.getClass())) {
+ if (persistentEntity.isInstance(obj)) {
+ if (persistentEntity.getJavaClass().equals(obj.getClass())) {
keys.add(persist(obj));
}
else {
@@ -1517,22 +1533,20 @@ public void setProperty(String name, Object value) {
setEntryValue(nativeEntry, name, value);
}
- if(toIndex != null && property != null) {
+ if (toIndex != null && property != null) {
PropertyMapping<Property> pm = property.getMapping();
- if(pm != null && isPropertyIndexed(pm.getMappedForm())) {
- if(property instanceof ToOne) {
+ if (pm != null && isPropertyIndexed(pm.getMappedForm())) {
+ if (property instanceof ToOne) {
ToOne association = (ToOne) property;
- if(!association.isForeignKeyInChild()) {
+ if (!association.isForeignKeyInChild()) {
NativeEntryEntityPersister associationPersister = (NativeEntryEntityPersister) session.getPersister(value);
- if(value != null) {
-
- toIndex.put(property, associationPersister.getObjectIdentifier(value));
+ if (value == null) {
+ toIndex.put(property, null);
}
else {
- toIndex.put(property, null);
+ toIndex.put(property, associationPersister.getObjectIdentifier(value));
}
}
-
}
else {
toIndex.put(property, value);
@@ -1555,7 +1569,7 @@ public boolean isDirty(Object instance, Object entry) {
if ((instance == null)) {
return false;
}
- else if(entry == null) {
+ if (entry == null) {
return true;
}
@@ -1586,20 +1600,19 @@ else if (prop instanceof OneToMany || prop instanceof ManyToMany) {
}
}
else if (prop instanceof EmbeddedCollection) {
- if(currentValue != null && oldValue == null) return true;
- if((currentValue instanceof Collection) && (oldValue instanceof Collection)) {
+ if (currentValue != null && oldValue == null) return true;
+ if ((currentValue instanceof Collection) && (oldValue instanceof Collection)) {
Collection currentCollection = (Collection) currentValue;
Collection oldCollection = (Collection) oldValue;
- if(currentCollection.size() != oldCollection.size()) {
+ if (currentCollection.size() != oldCollection.size()) {
return true;
}
else {
- if(!areCollectionsEqual(oldValue, currentValue)) {
+ if (!areCollectionsEqual(oldValue, currentValue)) {
return true;
}
}
}
-
}
else if (prop instanceof Custom) {
CustomTypeMarshaller marshaller = ((Custom)prop).getCustomTypeMarshaller();
@@ -1634,8 +1647,6 @@ protected boolean areCollectionsEqual(Object oldValue, Object currentValue) {
return !((PersistentCollection)currentValue).isDirty();
}
-
-
return replaceNullOrUninitialized(oldValue, currentValue).equals(
replaceNullOrUninitialized(currentValue, oldValue));
}
View
20 ...s-datastore-core/src/main/groovy/org/grails/datastore/mapping/engine/event/EventType.java
@@ -18,14 +18,14 @@
* @author Burt Beckwith
*/
public enum EventType {
- PreDelete,
- PreInsert,
- PreLoad,
- PreUpdate,
- PostDelete,
- PostInsert,
- PostLoad,
- PostUpdate,
- SaveOrUpdate,
- Validation
+ PreDelete,
+ PreInsert,
+ PreLoad,
+ PreUpdate,
+ PostDelete,
+ PostInsert,
+ PostLoad,
+ PostUpdate,
+ SaveOrUpdate,
+ Validation
}
View
1 ...tastore-core/src/main/groovy/org/grails/datastore/mapping/engine/event/PostLoadEvent.java
@@ -34,7 +34,6 @@ public PostLoadEvent(final Datastore source, final Object entity) {
super(source, entity);
}
-
@Override
public EventType getEventType() {
return EventType.PostLoad;
View
1 ...ore-core/src/main/groovy/org/grails/datastore/mapping/engine/event/SaveOrUpdateEvent.java
@@ -20,7 +20,6 @@ public SaveOrUpdateEvent(final Datastore source, final Object entity) {
super(source, entity);
}
-
@Override
public EventType getEventType() {
return EventType.SaveOrUpdate;
View
34 ...store-core/src/main/groovy/org/grails/datastore/mapping/engine/internal/MappingUtils.java
@@ -14,15 +14,22 @@
*/
package org.grails.datastore.mapping.engine.internal;
-import org.grails.datastore.mapping.config.Property;
-import org.grails.datastore.mapping.model.PersistentProperty;
-import org.grails.datastore.mapping.model.PropertyMapping;
-
import java.lang.reflect.Field;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
-import java.util.*;
+import java.util.ArrayDeque;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Queue;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import org.grails.datastore.mapping.config.Property;
+import org.grails.datastore.mapping.model.PersistentProperty;
+import org.grails.datastore.mapping.model.PropertyMapping;
/**
* Utility methods for mapping logic.
@@ -30,10 +37,10 @@
* @author Graeme Rocher
* @since 1.0
*/
+@SuppressWarnings({"rawtypes", "unchecked"})
public class MappingUtils {
- public static String getTargetKey(@SuppressWarnings("rawtypes") PersistentProperty property) {
- @SuppressWarnings("unchecked")
+ public static String getTargetKey(PersistentProperty property) {
PropertyMapping<Property> mapping = property.getMapping();
String targetName;
@@ -52,7 +59,6 @@ public static String getTargetKey(@SuppressWarnings("rawtypes") PersistentProper
* @param interfaceType The interface
* @return ArrayList for List, TreeSet for SortedSet, LinkedHashSet for Set etc.
*/
- @SuppressWarnings("rawtypes")
public static Collection createConcreteCollection(Class interfaceType) {
Collection elements;
if (interfaceType.equals(List.class)) {
@@ -94,9 +100,9 @@ public static Class getGenericTypeForProperty(Class javaClass, String propertyNa
Field declaredField = getDeclaredField(javaClass, propertyName);
Type genericType = declaredField != null ? declaredField.getGenericType() : null;
- if(genericType instanceof ParameterizedType) {
+ if (genericType instanceof ParameterizedType) {
Type[] typeArguments = ((ParameterizedType) genericType).getActualTypeArguments();
- if(typeArguments.length>0) {
+ if (typeArguments.length>0) {
genericClass = (Class) typeArguments[0];
}
}
@@ -108,9 +114,9 @@ public static Class getGenericTypeForMapProperty(Class javaClass, String propert
Field declaredField = getDeclaredField(javaClass, propertyName);
Type genericType = declaredField != null ? declaredField.getGenericType() : null;
- if(genericType instanceof ParameterizedType) {
+ if (genericType instanceof ParameterizedType) {
Type[] typeArguments = ((ParameterizedType) genericType).getActualTypeArguments();
- if(typeArguments.length>0) {
+ if (typeArguments.length>0) {
genericClass = (Class) typeArguments[isKeyType ? 0 : 1];
}
}
@@ -120,9 +126,9 @@ public static Class getGenericTypeForMapProperty(Class javaClass, String propert
public static Class getGenericType(Class propertyType) {
Class genericType = null;
TypeVariable[] typeParameters = propertyType.getTypeParameters();
- if(typeParameters != null && typeParameters.length>0) {
+ if (typeParameters != null && typeParameters.length>0) {
Type[] bounds = typeParameters[0].getBounds();
- if(bounds != null && bounds.length>0 && (bounds[0] instanceof Class)) {
+ if (bounds != null && bounds.length>0 && (bounds[0] instanceof Class)) {
genericType = (Class) bounds[0];
}
}
View
1 ...y/org/grails/datastore/mapping/engine/types/AbstractMappingAwareCustomTypeMarshaller.java
@@ -56,7 +56,6 @@ public Q query(PersistentProperty property, Query.PropertyCriterion criterion, Q
return nativeQuery;
}
- @SuppressWarnings("unused")
protected void queryInternal(PersistentProperty property, String key, Query.PropertyCriterion value, Q nativeQuery) {
throw new InvalidDataAccessResourceUsageException("Custom type [" + getTargetType().getName() +
"] does not support querying");
View
7 ...oovy/org/grails/datastore/mapping/keyvalue/mapping/config/GormKeyValueMappingFactory.java
@@ -24,6 +24,7 @@
* @author Graeme Rocher
* @since 1.0
*/
+@SuppressWarnings("rawtypes")
public class GormKeyValueMappingFactory extends AbstractGormMappingFactory<Family, KeyValue> {
private String keyspace;
@@ -45,7 +46,7 @@ public Family createMappedForm(PersistentEntity entity) {
}
@Override
- public KeyValue createMappedForm(@SuppressWarnings("rawtypes") PersistentProperty mpp) {
+ public KeyValue createMappedForm(PersistentProperty mpp) {
KeyValue kv = super.createMappedForm(mpp);
if (kv.getKey() == null) {
kv.setKey(mpp.getName());
@@ -65,9 +66,9 @@ public KeyValue createMappedForm(@SuppressWarnings("rawtypes") PersistentPropert
@Override
protected IdentityMapping getIdentityMappedForm(final ClassMapping classMapping, KeyValue property) {
- if(property != null) {
+ if (property != null) {
final String name = property.getName();
- if(name != null) {
+ if (name != null) {
final PersistentProperty idProperty = classMapping.getEntity().getPropertyByName(name);
return new IdentityMapping() {
public String[] getIdentifierName() {
View
2 ...n/groovy/org/grails/datastore/mapping/keyvalue/mapping/config/KeyValueMappingContext.java
@@ -57,7 +57,7 @@ public String getKeyspace() {
return keyspace;
}
- protected void initializeDefaultMappingFactory(@SuppressWarnings("hiding") String keyspace) {
+ protected void initializeDefaultMappingFactory(String keyspace) {
// TODO: Need to abstract the construction of these to support JPA syntax etc.
if (ClassUtils.isPresent(GROOVY_OBJECT_CLASS, KeyValueMappingContext.class.getClassLoader())) {
mappingFactory = new GormKeyValueMappingFactory(keyspace);
View
48 ...store-core/src/main/groovy/org/grails/datastore/mapping/model/AbstractMappingContext.java
@@ -20,13 +20,13 @@
import java.util.concurrent.ConcurrentLinkedQueue;
import org.grails.datastore.mapping.model.types.conversion.DefaultConversionService;
+import org.grails.datastore.mapping.proxy.JavassistProxyFactory;
+import org.grails.datastore.mapping.proxy.ProxyFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.core.convert.ConversionService;
import org.springframework.core.convert.converter.Converter;
import org.springframework.core.convert.converter.ConverterRegistry;
import org.springframework.core.convert.support.GenericConversionService;
-import org.grails.datastore.mapping.proxy.JavassistProxyFactory;
-import org.grails.datastore.mapping.proxy.ProxyFactory;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
import org.springframework.validation.Validator;
@@ -63,10 +63,10 @@ public ConverterRegistry getConverterRegistry() {
public ProxyFactory getProxyFactory() {
if (this.proxyFactory == null) {
ClassLoader classLoader = AbstractMappingContext.class.getClassLoader();
- if(ClassUtils.isPresent(JAVASIST_PROXY_FACTORY, classLoader)) {
+ if (ClassUtils.isPresent(JAVASIST_PROXY_FACTORY, classLoader)) {
proxyFactory = DefaultProxyFactoryCreator.create();
}
- else if(ClassUtils.isPresent(GROOVY_PROXY_FACTORY_NAME, classLoader)) {
+ else if (ClassUtils.isPresent(GROOVY_PROXY_FACTORY_NAME, classLoader)) {
try {
proxyFactory = (ProxyFactory) BeanUtils.instantiate(ClassUtils.forName(GROOVY_PROXY_FACTORY_NAME, classLoader));
} catch (ClassNotFoundException e) {
@@ -133,14 +133,12 @@ public PersistentEntity addExternalPersistentEntity(Class javaClass) {
* @param override Whether to override an existing entity
* @return The PersistentEntity instance
*/
- @Override
public PersistentEntity addPersistentEntity(Class javaClass, boolean override) {
Assert.notNull(javaClass, "PersistentEntity class cannot be null");
- if(override)
+ if (override) {
return addPersistentEntityInternal(javaClass, false);
- else {
- return addPersistentEntity(javaClass);
}
+ return addPersistentEntity(javaClass);
}
public final PersistentEntity addPersistentEntity(Class javaClass) {
@@ -159,21 +157,20 @@ private PersistentEntity addPersistentEntityInternal(Class javaClass, boolean is
PersistentEntity entity = createPersistentEntity(javaClass);
if (entity == null) {
return null;
- }
+ }
entity.setExternal(isExternal);
persistentEntities.remove(entity); persistentEntities.add(entity);
persistentEntitiesByName.put(entity.getName(), entity);
- try {
- entity.initialize();
- }
- catch(IllegalMappingException x) {
- persistentEntities.remove(entity);
- persistentEntitiesByName.remove(entity.getName());
- throw x;
- }
-
+ try {
+ entity.initialize();
+ }
+ catch(IllegalMappingException x) {
+ persistentEntities.remove(entity);
+ persistentEntitiesByName.remove(entity.getName());
+ throw x;
+ }
if (!entity.isRoot()) {
PersistentEntity root = entity.getRootEntity();
@@ -190,7 +187,6 @@ private PersistentEntity addPersistentEntityInternal(Class javaClass, boolean is
return entity;
}
-
/**
* Returns true if the given entity is in an inheritance hierarchy
*
@@ -198,14 +194,12 @@ private PersistentEntity addPersistentEntityInternal(Class javaClass, boolean is
* @return True if it is
*/
public boolean isInInheritanceHierarchy(PersistentEntity entity) {
- if(entity != null) {
- if(!entity.isRoot()) return true;
- else {
- PersistentEntity rootEntity = entity.getRootEntity();
- final Map<String, PersistentEntity> children = persistentEntitiesByDiscriminator.get(rootEntity);
- if(children != null && !children.isEmpty()) {
- return true;
- }
+ if (entity != null) {
+ if (!entity.isRoot()) return true;
+ PersistentEntity rootEntity = entity.getRootEntity();
+ final Map<String, PersistentEntity> children = persistentEntitiesByDiscriminator.get(rootEntity);
+ if (children != null && !children.isEmpty()) {
+ return true;
}
}
return false;
View
3 ...ore-core/src/main/groovy/org/grails/datastore/mapping/model/AbstractPersistentEntity.java
@@ -25,13 +25,13 @@
import java.util.Map;
import java.util.Set;
-import org.springframework.beans.BeanUtils;
import org.grails.datastore.mapping.config.groovy.MappingConfigurationBuilder;
import org.grails.datastore.mapping.core.EntityCreationException;
import org.grails.datastore.mapping.model.config.GormProperties;
import org.grails.datastore.mapping.model.types.Association;
import org.grails.datastore.mapping.model.types.OneToMany;
import org.grails.datastore.mapping.reflect.ClassPropertyFetcher;
+import org.springframework.beans.BeanUtils;
import org.springframework.util.Assert;
/**
@@ -106,7 +106,6 @@ public void initialize() {
getMapping().getMappedForm(); // initialize mapping
-
if (mappingProperties.isVersioned()) {
version = propertiesByName.get("version");
}
View
1 ...ore-core/src/main/groovy/org/grails/datastore/mapping/model/EmbeddedPersistentEntity.java
@@ -20,6 +20,7 @@
* @author Graeme Rocher
* @since 1.0
*/
+@SuppressWarnings({"rawtypes", "unchecked"})
public class EmbeddedPersistentEntity extends AbstractPersistentEntity{
public EmbeddedPersistentEntity(Class type, MappingContext ctx) {
super(type, ctx);
View
8 ...ls-datastore-core/src/main/groovy/org/grails/datastore/mapping/model/IdentityMapping.java
@@ -22,11 +22,11 @@
public interface IdentityMapping extends PropertyMapping {
/**
- * The identifier property name(s) as an array. Usually there is just one identifier
+ * The identifier property name(s). Usually there is just one identifier
* name, however in the case of a composite or natural identifier there
- * may be serveral names
- *
- * @return A String[] of identifier names that make up the key
+ * may be serveral.
+ *
+ * @return identifier names that make up the key
*/
String[] getIdentifierName();
}
View
4 ...tore-core/src/main/groovy/org/grails/datastore/mapping/model/IllegalMappingException.java
@@ -15,8 +15,8 @@
package org.grails.datastore.mapping.model;
/**
- * Thrown when an error occurs reading the mapping between object and datastore
- *
+ * Thrown when an error occurs reading the mapping between object and datastore.
+ *
* @author Graeme Rocher
* @since 1.0
*/
View
25 grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/model/MappingFactory.java
@@ -24,11 +24,29 @@
import java.sql.Clob;
import java.sql.Time;
import java.sql.Timestamp;
-import java.util.*;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.Collections;
+import java.util.GregorianCalendar;
+import java.util.HashSet;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+import java.util.TimeZone;
import java.util.concurrent.ConcurrentHashMap;
import org.grails.datastore.mapping.engine.types.CustomTypeMarshaller;
-import org.grails.datastore.mapping.model.types.*;
+import org.grails.datastore.mapping.model.types.Basic;
+import org.grails.datastore.mapping.model.types.Custom;
+import org.grails.datastore.mapping.model.types.Embedded;
+import org.grails.datastore.mapping.model.types.EmbeddedCollection;
+import org.grails.datastore.mapping.model.types.Identity;
+import org.grails.datastore.mapping.model.types.ManyToMany;
+import org.grails.datastore.mapping.model.types.ManyToOne;
+import org.grails.datastore.mapping.model.types.OneToMany;
+import org.grails.datastore.mapping.model.types.OneToOne;
+import org.grails.datastore.mapping.model.types.Simple;
+import org.grails.datastore.mapping.model.types.ToOne;
/**
* <p>An abstract factory for creating persistent property instances.</p>
@@ -161,7 +179,7 @@ public static boolean isSimpleType(final String typeName) {
*/
public Custom<T> createCustom(PersistentEntity owner, MappingContext context, PropertyDescriptor pd) {
CustomTypeMarshaller customTypeMarshaller = typeConverterMap.get(pd.getPropertyType());
- if(customTypeMarshaller == null) {
+ if (customTypeMarshaller == null) {
throw new IllegalStateException("Cannot create a custom type without a type converter for type " + pd.getPropertyType());
}
return new Custom<T>(owner, context, pd, customTypeMarshaller) {
@@ -189,7 +207,6 @@ public static boolean isSimpleType(final String typeName) {
};
}
-
protected PropertyMapping<T> createPropertyMapping(final PersistentProperty<T> property, final PersistentEntity owner) {
return new PropertyMapping<T>() {
private T mappedForm = createMappedForm(property);
View
2 ...datastore-core/src/main/groovy/org/grails/datastore/mapping/model/PersistentProperty.java
@@ -41,7 +41,7 @@
/**
* Whether the property can be set to null
- *
+ *
* @return True if it can
*/
boolean isNullable();
View
52 ...in/groovy/org/grails/datastore/mapping/model/config/GormMappingConfigurationStrategy.java
@@ -14,6 +14,13 @@
*/
package org.grails.datastore.mapping.model.config;
+import static org.grails.datastore.mapping.model.config.GormProperties.BELONGS_TO;
+import static org.grails.datastore.mapping.model.config.GormProperties.EMBEDDED;
+import static org.grails.datastore.mapping.model.config.GormProperties.HAS_MANY;
+import static org.grails.datastore.mapping.model.config.GormProperties.HAS_ONE;
+import static org.grails.datastore.mapping.model.config.GormProperties.MAPPED_BY;
+import static org.grails.datastore.mapping.model.config.GormProperties.TRANSIENT;
+import static org.grails.datastore.mapping.model.config.GormProperties.VERSION;
import groovy.lang.Closure;
import groovy.lang.GroovyObject;
@@ -34,14 +41,24 @@
import javax.persistence.Entity;
import org.grails.datastore.mapping.engine.internal.MappingUtils;
-import org.grails.datastore.mapping.model.*;
-import org.grails.datastore.mapping.model.types.*;
+import org.grails.datastore.mapping.model.ClassMapping;
+import org.grails.datastore.mapping.model.IdentityMapping;
+import org.grails.datastore.mapping.model.IllegalMappingException;
+import org.grails.datastore.mapping.model.MappingConfigurationStrategy;
+import org.grails.datastore.mapping.model.MappingContext;
+import org.grails.datastore.mapping.model.MappingFactory;
+import org.grails.datastore.mapping.model.PersistentEntity;
+import org.grails.datastore.mapping.model.PersistentProperty;
+import org.grails.datastore.mapping.model.types.Association;
+import org.grails.datastore.mapping.model.types.Basic;
+import org.grails.datastore.mapping.model.types.EmbeddedCollection;
+import org.grails.datastore.mapping.model.types.ManyToMany;
+import org.grails.datastore.mapping.model.types.OneToOne;
+import org.grails.datastore.mapping.model.types.ToOne;
import org.grails.datastore.mapping.reflect.ClassPropertyFetcher;
import org.grails.datastore.mapping.reflect.ReflectionUtils;
import org.springframework.util.StringUtils;
-import static org.grails.datastore.mapping.model.config.GormProperties.*;
-
/**
* <p>This implementation of the MappingConfigurationStrategy interface
* will interpret GORM-style syntax for defining entities and associations.
@@ -152,8 +169,7 @@ public boolean isPersistentEntity(Class clazz) {