-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Rename properties and support for name variants #2488
Conversation
Modified the Relationship so that it also has a leftWardLabel and a rightWardLabel for storing alternative labels (name variants). Also created an sql migration to add two columns for these labels to the relationship table.
Refactor the integration tests for the RelationshipRestRepository to reduce the amount of code duplication. Many tests contained code to create a number of variables to be used in the test, this code was pretty much the same for every test. I refactored the integration test class so that all variables used in multiple tests are now declared at the top and are initialized in an @before function. Test-specific variables are unchanged.
Renamed the columns 'left_label' and 'right_label' in the table 'relationship_type' to 'leftward_label' and 'rightward_label'. Also renamed all instances of [l|L]eftLabel and [r|R]ightLabel to [l|L]eftwardLabel and [r|R]ightwardLabel, respectively.
Renamed the leftwardLabel and rightwardlabel for Relationship to leftwardValue and rightwardValue. Renamed the same values for RelationshipType to leftwardType and rightwardType.
@benbosman : Gave this a quick look today. Unfortunately, though this PR is pointing out some more possible confusion in our naming of relationships. It definitely looks odd to me that we have a While I like the idea of |
Conflicts: dspace-api/src/main/java/org/dspace/content/ItemServiceImpl.java
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.
@benbosman : I think this PR needs more attention in the code itself. Each time I try to review it, the method names trip me up (they are very confusing to me), and I end up having to (literally) open up the entire source code to understand what the methods names are trying to say. This implies to me that these methods are likely misnamed (or maybe trying to do too much?), and it'd be extremely hard for other developers to learn.
The best example here is the large number of methods that all start with handle
. While it's accurate that they are all "handling" some process, the word handle
itself provides no description of what they are doing. Some handle
methods seem to be doing validation (like a validate
method would), while others seem like they are gathering together information (like a find
or get
method would). But, overall, the name of the method doesn't give me any clues as to what it is trying to achieve.
Sorry to pester yet again on a PR that seems like it should be "straightforward", but I cannot seem to even get 1/2 way through this PR in over an hour's review time. It's just not making sense to me, without having to try and open up the entire source code :(
Could you take a closer look at the methods names here and see if they make sense to you? Perhaps we can simply clean up the method names to be more descriptive?
dspace-api/src/main/java/org/dspace/app/bulkedit/MetadataImport.java
Outdated
Show resolved
Hide resolved
dspace-api/src/main/java/org/dspace/app/bulkedit/MetadataImport.java
Outdated
Show resolved
Hide resolved
dspace-api/src/main/java/org/dspace/content/RelationshipMetadataServiceImpl.java
Outdated
Show resolved
Hide resolved
dspace-api/src/main/java/org/dspace/content/RelationshipMetadataServiceImpl.java
Outdated
Show resolved
Hide resolved
dspace-api/src/main/java/org/dspace/content/RelationshipMetadataServiceImpl.java
Outdated
Show resolved
Hide resolved
dspace-api/src/main/java/org/dspace/app/bulkedit/MetadataImport.java
Outdated
Show resolved
Hide resolved
dspace-api/src/main/java/org/dspace/app/bulkedit/MetadataImport.java
Outdated
Show resolved
Hide resolved
Add javadocs to complex private methods
Add javadocs to complex private methods
@tdonohue @mwoodiupui The method names and JavaDoc has been updated to make it easier to understand. |
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.
Thanks for the explanations & updates to the method names @benbosman ! I think the code is looking a ton better. I've noticed on other method with an awkward name handle*
(which might be nice to cleanup here). But, more importantly, it looks like we are missing Unit tests in one area (see below). At a minimum, I think the latter should be fixed before merger.
Overall though, nice work. This is looking much better.
dspace-api/src/main/java/org/dspace/content/RelationshipMetadataServiceImpl.java
Outdated
Show resolved
Hide resolved
|
||
@Test | ||
@Ignore | ||
public void testGetRelationshipMetadata() throws Exception { |
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.
This test class is essentially empty (unfinished). It seems like we should be implementing tests for the new RelationshipMetadataService
interface, and it's single method (getRelationshipMetadata()
). There's a lot of complexity in our implementation (RelationshipMetadataServiceImpl
) that isn't being tested out via Unit Tests
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've asked Raf to implement the tests for the new RelationshipMetadataService interface.
It's indeed currently only tested indirectly in the ITs, but an explicit test of the service was planned to be included as well
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.
Raf has completed the tests for the new RelationshipMetadataService interface.
3bb715e
to
2de90e0
Compare
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.
No issues found
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.
It's working as expected. I just have some minor comments. But overall it's ok by me.
dspace-api/src/main/java/org/dspace/content/RelationshipMetadataServiceImpl.java
Show resolved
Hide resolved
dspace-api/src/main/java/org/dspace/content/RelationshipMetadataServiceImpl.java
Show resolved
Hide resolved
dspace-api/src/main/java/org/dspace/content/RelationshipMetadataServiceImpl.java
Show resolved
Hide resolved
dspace-api/src/main/java/org/dspace/content/RelationshipMetadataServiceImpl.java
Show resolved
Hide resolved
dspace-api/src/main/java/org/dspace/content/virtual/VirtualMetadataConfiguration.java
Show resolved
Hide resolved
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.
Overall, I'm nearly a +1 now. I found just a few more minor things to clean up, and then I think this can be merged.
dspace-api/src/main/java/org/dspace/content/RelationshipMetadataService.java
Show resolved
Hide resolved
dspace-api/src/test/java/org/dspace/content/RelationshipMetadataServiceTest.java
Outdated
Show resolved
Hide resolved
dspace-server-webapp/src/test/java/org/dspace/app/rest/RelationshipRestRepositoryIT.java
Show resolved
Hide resolved
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.
Thank you @benbosman !
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.
👍 Thanks as well, looks good to me! As this is at +2, merging immediately.
This PR contains the implementation for DSpace/RestContract#67
The name variants can be exposed in the virtual metadata as well, so this direct property will primarily be used for storing and updating the label.