Skip to content

Commit 2468a45

Browse files
committed
Align with Grails controller terminology
1 parent 4c1a670 commit 2468a45

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

grails-datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/CustomAutoTimestampSpec.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@ class CustomAutoTimestampSpec extends GormDatastoreSpec {
4040
class RecordCustom {
4141
Long id
4242
String name
43-
@AutoTimestamp(ON_INSERT) Date created
43+
@AutoTimestamp(SAVE) Date created
4444
@AutoTimestamp Date modified
4545
}

grails-datastore-gorm/src/main/groovy/grails/gorm/annotation/AutoTimestamp.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@
3535
* Enum to specify when auto-timestamping should occur.
3636
*/
3737
enum EventType {
38-
ON_INSERT,
39-
ON_UPDATE
38+
SAVE,
39+
UPDATE
4040
}
4141

4242
/**
4343
* When to apply auto-timestamping
4444
*/
45-
EventType value() default EventType.ON_UPDATE;
45+
EventType value() default EventType.UPDATE;
4646
}

grails-datastore-gorm/src/main/groovy/org/grails/datastore/gorm/events/AutoTimestampEventListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ protected void storeDateCreatedAndLastUpdatedInfo(PersistentEntity persistentEnt
170170
Field field = getFieldFromHierarchy(persistentEntity, property.getName());
171171
if (field != null && field.isAnnotationPresent(AutoTimestamp.class)) {
172172
AutoTimestamp autoTimestamp = field.getAnnotation(AutoTimestamp.class);
173-
if (autoTimestamp.value() == AutoTimestamp.EventType.ON_UPDATE) {
173+
if (autoTimestamp.value() == AutoTimestamp.EventType.UPDATE) {
174174
storeTimestampAvailability(entitiesWithLastUpdated, persistentEntity, property);
175175
} else {
176176
storeTimestampAvailability(entitiesWithDateCreated, persistentEntity, property);

0 commit comments

Comments
 (0)