-
-
Notifications
You must be signed in to change notification settings - Fork 964
7.0.x AutoTmestamp Enhancements + grails.importGrailsAnnotations GrailsExtension #15118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
codeconsole
wants to merge
19
commits into
apache:7.0.x
Choose a base branch
from
codeconsole:7.0.x-autotimestamp-enhancements
base: 7.0.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
89d77d5
Introduce CreatedDate and LastModifiedDate annotations
codeconsole 841fe22
Introduce GrailsExtension importGrailsAnnotations that will auto impo…
codeconsole 568060d
Merge branch '7.0.x' into 7.0.x-autotimestamp-enhancements
codeconsole f0de080
Fix for mongodb autotimestamp properties not being marked dirty. Prop…
codeconsole 2c91003
unused import
codeconsole e935901
Skip null check on AutoTimestamp properties
codeconsole 7fed24c
Hide AutoTimestamp properties from scaffold input/edit views
codeconsole 00a4f03
remove duplicate method
codeconsole 0997abd
Merge branch '7.0.x' into 7.0.x-autotimestamp-enhancements
codeconsole 8019058
Merge branch '7.0.x' into 7.0.x-autotimestamp-enhancements
codeconsole 4d93af3
Merge branch '7.0.x' into 7.0.x-autotimestamp-enhancements
codeconsole a73aac7
Revert setting properties dirty in AutoTimestampEventListener as this…
codeconsole 809f1d0
Deprecate @AutoTimestamp
codeconsole f05cee7
Cache annotation lookups when not in development mode
codeconsole f37dcc1
Add jakarta.validation.constraints.* to common annotation star imports
codeconsole a052ed1
null check on persistentProperty
codeconsole 8602be4
remove unused imports
codeconsole df38a80
Support for Spring Data annotations
codeconsole e1597d9
@CreatedBy and @LastModifiedBy support
codeconsole File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
grails-datamapping-core/src/main/groovy/grails/gorm/annotation/CreatedDate.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package grails.gorm.annotation; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* A property annotation used to apply auto-timestamping on a field | ||
* upon gorm insert events. This is an alias for @AutoTimestamp(EventType.CREATED). | ||
* | ||
* @author Scott Murphy Heiberg | ||
* @since 7.0 | ||
*/ | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target({ElementType.FIELD}) | ||
public @interface CreatedDate { | ||
} |
36 changes: 36 additions & 0 deletions
36
grails-datamapping-core/src/main/groovy/grails/gorm/annotation/LastModifiedDate.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package grails.gorm.annotation; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* A property annotation used to apply auto-timestamping on a field | ||
* upon gorm insert and update events. This is an alias for @AutoTimestamp(EventType.UPDATED). | ||
* | ||
* @author Scott Murphy Heiberg | ||
* @since 7.0 | ||
*/ | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target({ElementType.FIELD}) | ||
public @interface LastModifiedDate { | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I understand why you added it while at it, this technically does not have anything to do with time.
It should probably be in a subsequent PR?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sbglasius I agree it could of been in a separate PR, but it's kind of a gray area because the added config is
importGrailsAnnotations
and that is just adding 1 annotation@Scaffold
. Plus there is a lot I want to address and the latency in getting PRs reviewed is a bit slow at the moment for what I want to get added/fixed.The motivation for this PR is actually for
importGrailsAnnotations
. I was originally against@matrei 's suggest of having 2 different annotations for AutoTimestamp because of the extra import statement on every domain class, but with
importGrailsAnnotations
, I don't mind.In fact, with
importGrailsAnnotations
, I am even willing to get rid of@AutoTimestamp
now. @matrei what are your thoughts about getting rid of@AutoTimestamp
?