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
TRUNK-4917 - Add Creatable and Changeable interfaces #2245
Conversation
*/ | ||
public void setDateChanged(Date dateChanged); | ||
|
||
public interface Auditable extends Creatable, Changeable { |
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.
Should we actually get rid of this interface? Or should we keep it around?
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.
Unless we can scan core code and popular modules and ensure nobody is referencing it, I would keep it around for now.
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.
Definitely it's referenced in core, but in the follow up commit I was going to replace its usage. I wasn't going to remove it in this version, we would mark it as deprecated now and eventually remove it may be 2 versions later.
* @since 2.2 | ||
*/ | ||
public abstract class BaseChangeableOpenmrsData extends BaseOpenmrsData { | ||
|
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.
I added these overrides so that these setters/getters don't appear deprecated as an effect from the superclass since eventually the methods will still exist on this class.
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.
Make sense.
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.
public interface OpenmrsData extends OpenmrsObject, Auditable, Voidable {}
Which more methods will be added in OpenmrsData interface?
Or OpenmrsData interface will implement the methods of Creatable interface which contain getCreator, getDateCreated methods and Changeable interface contain getChangedBy, getDateChanged methods?
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.
OpenmrsData for now will stay the way it is, in future it will implement Creatable instead of Auditable because Data should be immutable by default.
@djazayeri and @bmamlin does this seem in line with option D from this design call? |
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.
Looks good. I think the summary for TRUNK-4917 needs to be updated to reflect what you've done here (i.e., "Changeable" vs. "Mutable"). Also, would like to know how big of an effect this has on core and popular modules.
* @see OpenmrsData | ||
* @see OpenmrsMetadata | ||
* @see MutableOpenmrsData | ||
* @see MutableOpenmrsMetadata |
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.
Do MutableOpenmrsData
and MutableOpenmrsMetadata
classes exist outside of this PR? Or should these be references Changeable
, BaseChangeableOpenmrsData
, and BaseChangeableOpenmrsMetadata
classes?
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.
Good catch! I had them and removed them and should have updated these javadocs
*/ | ||
public void setDateChanged(Date dateChanged); | ||
|
||
public interface Auditable extends Creatable, Changeable { |
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.
Unless we can scan core code and popular modules and ensure nobody is referencing it, I would keep it around for now.
* @since 2.2 | ||
*/ | ||
public abstract class BaseChangeableOpenmrsData extends BaseOpenmrsData { | ||
|
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.
Make sense.
*/ | ||
@Override | ||
public void setDateCreated(Date dateCreated) { | ||
this.dateCreated = dateCreated; | ||
} | ||
|
||
/** | ||
* @see org.openmrs.Auditable#getChangedBy() | ||
* @deprecated |
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.
I assume @deprecated in javadoc would ideally include "as of version x.y".
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.
Yes, I will add it
In core we are going to change subclasses of |
…escriptions for the @SInCE annotations TRUNK-4917 - Removed non-existent type references
@bmamlin I did address the review comments, I think we can merge this along with the change of all subclasses of BaseOpenmrsData and BaseOpenmrsMetadata to extend the new base classes. |
@dkayiwa , @rkorytkowski do you mind merging this PR after you review it? I need to do the next step of changing domain objects to extend |
@wluyima will it take you much time to squash these commits into one? I find it easier to review one commit than multiple, especially when they are followup commits to address earlier review comments. |
@dkayiwa you shouldn't be looking at individual commits, the PR shows them as one |
Aren't you viewing all the changes as one in Files changed tab on the PR? |
Still waiting on you @dkayiwa |
*/ | ||
@Override | ||
public void setDateCreated(Date dateCreated) { | ||
this.dateCreated = dateCreated; | ||
} | ||
|
||
/** | ||
* @see org.openmrs.Auditable#getChangedBy() | ||
* @see org.openmrs.OpenmrsMetadata#getChangedBy() | ||
* @deprecated as of version 2.2 |
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.
Our convention has been to include what they should alternatively use. https://wiki.openmrs.org/display/docs/Java+Conventions#JavaConventions-Deprecation
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.
The methods are actually going away with no replacement, I think I just have to add more details as to why it was necessary to remove the method.
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.
And to mention that we introduced a new interface that one would need to implement in case they want to have a mutable class
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.
Actually the method javadocs have the @see
the superclass where information as to why it's deprecated is included
* TRUNK-4917 - Add Creatable and Changeable interfaces * TRUNK-4917 - Renamed usaged of Mutable to Changeable * TRUNK-4917 - Removed unnecessary deprecation comments * TRUNK-4917 - Removed non-existent type references and added missing descriptions for the @SInCE annotations TRUNK-4917 - Removed non-existent type references
Description of what I changed
I added the new Creatable and Changeable interfaces, deprecated the changedBy and dateChanged setters and getters in the relevant super classes
This pull request is just a partial commit so that I can get some feedback from other devs before I can go ahead to do the major refactoring of updating the domain objects to extend BaseChangeableOpenmrsData or BaseChangeableOpenmrsMetadata
Issue I worked on
see https://issues.openmrs.org/browse/TRUNK-4917