-
Notifications
You must be signed in to change notification settings - Fork 1
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
auto detect latest ARDC versions #170
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
73db9ff
auto detect latest ARDC versions
vietnguyengit 0cee6c6
Update tests
vietnguyengit cbcf9c1
Add tests
vietnguyengit ea2f214
refactor
vietnguyengit eabab6d
Refactor and update tests
vietnguyengit d3a135c
Only update vocabs if there are version changes
vietnguyengit 137366b
Extract specific version from current
vietnguyengit b54a8a7
minor update
vietnguyengit 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
37 changes: 0 additions & 37 deletions
37
ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/configuration/VocabApiPaths.java
This file was deleted.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/model/ArdcCurrentPaths.java
This file contains 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,29 @@ | ||
package au.org.aodn.ardcvocabs.model; | ||
|
||
import lombok.Getter; | ||
|
||
@Getter | ||
public enum ArdcCurrentPaths { | ||
PARAMETER_VOCAB( | ||
"/aodn-parameter-category-vocabulary/current/concept.json", | ||
"/aodn-discovery-parameter-vocabulary/current/concept.json" | ||
), | ||
PLATFORM_VOCAB( | ||
"/aodn-platform-category-vocabulary/current/concept.json", | ||
"/aodn-platform-vocabulary/current/concept.json" | ||
), | ||
ORGANISATION_VOCAB( | ||
"/aodn-organisation-category-vocabulary/current/concept.json", | ||
"/aodn-organisation-vocabulary/current/concept.json" | ||
); | ||
|
||
|
||
private final String categoryCurrent; | ||
private final String vocabCurrent; | ||
|
||
ArdcCurrentPaths(String categoryCurrent, String vocabCurrent) { | ||
String baseUrl = "https://vocabs.ardc.edu.au/repository/api/lda/aodn"; | ||
this.categoryCurrent = baseUrl + categoryCurrent; | ||
this.vocabCurrent = baseUrl + vocabCurrent; | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/model/PathName.java
This file contains 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,8 @@ | ||
package au.org.aodn.ardcvocabs.model; | ||
|
||
public enum PathName { | ||
categoryApi, | ||
categoryDetailsApi, | ||
vocabApi, | ||
vocabDetailsApi | ||
} |
43 changes: 21 additions & 22 deletions
43
ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/model/VocabApiPaths.java
This file contains 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 |
---|---|---|
@@ -1,37 +1,36 @@ | ||
package au.org.aodn.ardcvocabs.model; | ||
|
||
import lombok.Getter; | ||
|
||
@Getter | ||
public enum VocabApiPaths { | ||
PARAMETER_VOCAB( | ||
"/aodn-parameter-category-vocabulary/version-2-1/concept.json", | ||
"/aodn-parameter-category-vocabulary/version-2-1/resource.json?uri=%s", | ||
"/aodn-discovery-parameter-vocabulary/version-1-6/concept.json", | ||
"/aodn-discovery-parameter-vocabulary/version-1-6/resource.json?uri=%s" | ||
"/aodn-parameter-category-vocabulary/%s/concept.json", | ||
"/aodn-parameter-category-vocabulary/%s/resource.json?uri=%s", | ||
"/aodn-discovery-parameter-vocabulary/%s/concept.json", | ||
"/aodn-discovery-parameter-vocabulary/%s/resource.json?uri=%s" | ||
), | ||
PLATFORM_VOCAB( | ||
"/aodn-platform-category-vocabulary/version-1-2/concept.json", | ||
"/aodn-platform-category-vocabulary/version-1-2/resource.json?uri=%s", | ||
"/aodn-platform-vocabulary/version-6-1/concept.json", | ||
"/aodn-platform-vocabulary/version-6-1/resource.json?uri=%s" | ||
"/aodn-platform-category-vocabulary/%s/concept.json", | ||
"/aodn-platform-category-vocabulary/%s/resource.json?uri=%s", | ||
"/aodn-platform-vocabulary/%s/concept.json", | ||
"/aodn-platform-vocabulary/%s/resource.json?uri=%s" | ||
), | ||
ORGANISATION_VOCAB( | ||
"/aodn-organisation-category-vocabulary/version-2-5/concept.json", | ||
"/aodn-organisation-category-vocabulary/version-2-5/resource.json?uri=%s", | ||
"/aodn-organisation-vocabulary/version-2-5/concept.json", | ||
"/aodn-organisation-vocabulary/version-2-5/resource.json?uri=%s" | ||
"/aodn-organisation-category-vocabulary/%s/concept.json", | ||
"/aodn-organisation-category-vocabulary/%s/resource.json?uri=%s", | ||
"/aodn-organisation-vocabulary/%s/concept.json", | ||
"/aodn-organisation-vocabulary/%s/resource.json?uri=%s" | ||
); | ||
|
||
private final String vocabCategoryApiPath; | ||
private final String vocabCategoryDetailsApiPath; | ||
private final String vocabApiPath; | ||
private final String vocabDetailsApiPath; | ||
private final String categoryApiTemplate; | ||
private final String categoryDetailsTemplate; | ||
private final String vocabApiTemplate; | ||
private final String vocabDetailsTemplate; | ||
|
||
VocabApiPaths(String vocabCategoryApiPath, String vocabCategoryDetailsApiPath, String vocabApiPath, String vocabDetailsApiPath) { | ||
this.vocabCategoryApiPath = vocabCategoryApiPath; | ||
this.vocabCategoryDetailsApiPath = vocabCategoryDetailsApiPath; | ||
this.vocabApiPath = vocabApiPath; | ||
this.vocabDetailsApiPath = vocabDetailsApiPath; | ||
VocabApiPaths(String categoryApiTemplate, String categoryDetailsTemplate, String vocabApiTemplate, String vocabDetailsTemplate) { | ||
this.categoryApiTemplate = categoryApiTemplate; | ||
this.categoryDetailsTemplate = categoryDetailsTemplate; | ||
this.vocabApiTemplate = vocabApiTemplate; | ||
this.vocabDetailsTemplate = vocabDetailsTemplate; | ||
} | ||
} |
5 changes: 4 additions & 1 deletion
5
ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/service/ArdcVocabService.java
This file contains 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 |
---|---|---|
@@ -1,10 +1,13 @@ | ||
package au.org.aodn.ardcvocabs.service; | ||
|
||
import au.org.aodn.ardcvocabs.model.PathName; | ||
import au.org.aodn.ardcvocabs.model.VocabApiPaths; | ||
import au.org.aodn.ardcvocabs.model.VocabModel; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public interface ArdcVocabService { | ||
List<VocabModel> getVocabTreeFromArdcByType(VocabApiPaths vocabApiPaths); | ||
Map<String, Map<PathName, String>> getResolvedPathCollection(); | ||
List<VocabModel> getVocabTreeFromArdcByType(Map<PathName, String> resolvedPaths); | ||
} |
This file contains 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.
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.
although I could replace
version
directly withcurrent
, writing tests is a bit headache, after debugging I found that links like this for example:https://vocabs.ardc.edu.au/repository/api/lda/aodn/aodn-platform-vocabulary/current/concept.json
or
https://vocabs.ardc.edu.au/repository/api/lda/aodn/aodn-platform-vocabulary/current/concept.json?_page=1
the
next
andprev
fields refer to paths with specificversion
instead ofcurrent
.So less complex tests and later on ... check if there are versions change to update caches, I keep this template enum, and have separate method for extracting latest specific versions from
current
,current
is just a starting point wrapper.