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.
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
10286 add owner info #10322
10286 add owner info #10322
Changes from 13 commits
8abeaf0
9fdebb3
572b9cb
889e942
6e51bbc
43f61e6
43f8706
1898c14
a828fd1
9fd7c48
923f02e
5ba6a1a
d3482af
0244b1e
314e2eb
78d7283
a752ba7
951077f
f9429bb
4709cd0
4789d2e
6a4af15
14a817c
a34d1ec
b17d3d9
3751638
34c0f67
ae132a3
da77732
9790d23
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
You can directly use the primitive boolean type:
@QueryParam("returnOwners") boolean returnOwners
And thus avoid the null check. If the query param is not set in the URL,
false
is the default value.Same for other endpoints in this PR.
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.
To be consistent with method naming in other places, why not rename the endpoint method from "viewDataverse" to "getDataverse"?
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.
You can avoid this using boolean primitive, as I mentioned in the first review.
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 would extract the type check to a separate method to improve readability, and try to use a
switch
statement instead of theseifs
. As far as I know advObject
can't be of more than one type, and by having theseifs
withoutelse ifs
it seems that a dvObject can have multiple types which is confusing.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 simplified it here because since we're ignoring the object itself we can only have a Dataverse or a Dataset
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.
There is an indentation issue in this line
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 would be beneficial to include the version as well to the ownerObject, because for a file, its owner might be the dataset doi:10.5072/FK2/WTBMGC with version=2.0, but its owner is not the same dataset at an earlier version such as 1.0, because the file was added in a later version. I hope I'm making myself clear
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 the logic for including a version number, but since we're omitting the base object from the isPartOf it can only apply to Files, however there's no endpoint for getting a file by its version like there is for dataset - the current result is that if I use the getFileData (@path("{id}")) it gets me the latest available version
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.
@MellyGray @GPortas I think I need #10280 to be completed before I can finish this the way it needs to be finished.
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 @sekmiller , I was testing the last changes.
identifier
includes both the identifier and the version, this can complicate parsing and utilizing these distinct pieces of information separately. I suggest separating the version information from the DOI identifierThere 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.
Sure. I can do that. The reason I had put them together is that the url for the dataset page currently looks like this: http://localhost:8080/dataset.xhtml?persistentId=doi:10.5072/FK2/UE0DKV&version=2.0
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.
Got it, @sekmiller! I see where you're coming from, but we're aiming to follow an API-first approach to decouple the API implementation from the UI use cases, ensuring our API remains flexible for various applications. We don't know who is going to consume this endpoint, so we should keep these two pieces of information separate to allow them to be used independently. Thanks for implementing the suggestion
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 can get here if dvo is a DataFile and it has a global ID right? so the cast might fail. I don't think it is needed though.
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.
Fixed the logic so that it doesn't need to cast or decide whether there's a dataset or datafile - basically for the purposes of "isPartOf" we're ignoring the object itself so we're never dealing with files.
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 can be confusing and lead to casting / response parsing errors on the API consumer side that the value of "identifier" can be the numeric id or the persistent id. I think it would be better to add different fields to avoid confusion: "identifier" and "persistentIdentifier" or similar, being the second one present only if it exists.
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.
@GPortas I was just trying to keep it consistent across types - like I use identifier for Dataverses even though it's really 'alias' - so if there's no global/persistent id should I call it 'id' as in table id?
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.
As discussed I will add persistentIdentifier to the dataset object. For collections I will assign 'alias' to identifier and for datasets I will assign the table id to 'identifier'
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.
Just to be consistent with the other test method names.
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 is not critical but I would avoid adding more blank spaces than necessary.