-
Notifications
You must be signed in to change notification settings - Fork 535
11914 set template default #11989
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
Merged
+276
−58
Merged
11914 set template default #11989
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
7ebb100
placeholder
jp-tosca 4c9044a
Endpoints work but need polish.
jp-tosca 9460189
Merge remote-tracking branch 'origin/develop' into 11914-set-template…
jp-tosca 097e972
pr notes
jp-tosca 5d7379e
Merge remote-tracking branch 'origin/develop' into 11914-set-template…
jp-tosca d5aab83
Initial test
jp-tosca 31a2078
Changes to show the ID of the created template
jp-tosca 76ff3e0
Changes to the set default endpoint
jp-tosca 8e72fea
Flush entity manager after setting default template in CreateTemplate…
jp-tosca 17bb055
Update success messages for removing default dataset template
jp-tosca 04fcb16
Implement RemoveDefaultDatasetCommand and update endpoint to use it f…
jp-tosca 72237fb
Add tests for setting and removing default template in DataversesIT
jp-tosca a86a9ab
Fix permission description in API documentation and method signatures…
jp-tosca 924da37
Merge branch 'develop' into 11914-set-template-default
jp-tosca fd645d8
Merge branch 'develop' into 11914-set-template-default
sekmiller 1599767
#11914 fix merge conflicts
sekmiller e57568e
#11914 return default true for test
sekmiller 1649109
#11914 fix find template and tests
sekmiller 93fcb43
#11914 update command name for clarity
sekmiller bf10460
Merge branch 'develop' into 11914-set-template-default
sekmiller 671901b
Merge branch 'develop' into 11914-set-template-default
sekmiller dc1c200
Update src/main/java/edu/harvard/iq/dataverse/engine/command/impl/Set…
sekmiller eef6ce0
Update src/main/java/edu/harvard/iq/dataverse/engine/command/impl/Rem…
sekmiller 2fd494f
#11914 change path
sekmiller 23253fb
Update native-api.rst
sekmiller f668cfa
Update native-api.rst
sekmiller 53447e0
Merge branch 'develop' into 11914-set-template-default
sekmiller 3e04cee
fix docs
stevenwinship 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| ## New Endpoint: POST `/dataverses/{id}/template/default/{templateId}` | ||
|
|
||
| A new endpoint has been implemented to set the default template to a given dataverse collection. | ||
|
|
||
| ### Functionality | ||
| - Sets the default template of the given dataverse collection. | ||
| - You must have edit dataverse permission in the collection in order to use this endpoint. | ||
|
|
||
| ## New Endpoint: DELETE `/dataverses/{id}/template/default` | ||
jp-tosca marked this conversation as resolved.
Show resolved
Hide resolved
stevenwinship marked this conversation as resolved.
Show resolved
Hide resolved
stevenwinship marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| A new endpoint has been implemented to remove the default template to a given dataverse collection. | ||
|
|
||
| ### Functionality | ||
| - Removes the default template of the given dataverse collection. | ||
| - You must have edit dataverse permission in the collection in order to use this endpoint. | ||
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
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
33 changes: 33 additions & 0 deletions
33
src/main/java/edu/harvard/iq/dataverse/engine/command/impl/RemoveDefaultTemplateCommand.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,33 @@ | ||
| package edu.harvard.iq.dataverse.engine.command.impl; | ||
|
|
||
| import edu.harvard.iq.dataverse.*; | ||
| import edu.harvard.iq.dataverse.authorization.Permission; | ||
|
|
||
| import edu.harvard.iq.dataverse.engine.command.AbstractCommand; | ||
| import edu.harvard.iq.dataverse.engine.command.CommandContext; | ||
| import edu.harvard.iq.dataverse.engine.command.DataverseRequest; | ||
| import edu.harvard.iq.dataverse.engine.command.RequiredPermissions; | ||
| import edu.harvard.iq.dataverse.engine.command.exception.CommandException; | ||
|
|
||
| /** | ||
| * @author J.P. Tosca | ||
| * Removes the default template {@link Template} for a {@link Dataverse}. | ||
| */ | ||
| @RequiredPermissions(Permission.EditDataverse) | ||
| public class RemoveDefaultTemplateCommand extends AbstractCommand<Dataverse>{ | ||
|
|
||
| private final Dataverse dataverse; | ||
|
|
||
| public RemoveDefaultTemplateCommand(DataverseRequest request, Dataverse dataverse) { | ||
| super(request, dataverse); | ||
| this.dataverse = dataverse; | ||
| } | ||
|
|
||
| @Override | ||
| public Dataverse execute(CommandContext ctxt) throws CommandException { | ||
| dataverse.setDefaultTemplate(null); | ||
| Dataverse mergedDataverse = ctxt.em().merge(dataverse); | ||
| return mergedDataverse; | ||
| } | ||
|
|
||
| } |
36 changes: 36 additions & 0 deletions
36
src/main/java/edu/harvard/iq/dataverse/engine/command/impl/SetDefaultTemplateCommand.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 @@ | ||
| package edu.harvard.iq.dataverse.engine.command.impl; | ||
|
|
||
| import edu.harvard.iq.dataverse.*; | ||
| import edu.harvard.iq.dataverse.authorization.Permission; | ||
|
|
||
| import edu.harvard.iq.dataverse.engine.command.AbstractCommand; | ||
| import edu.harvard.iq.dataverse.engine.command.CommandContext; | ||
| import edu.harvard.iq.dataverse.engine.command.DataverseRequest; | ||
| import edu.harvard.iq.dataverse.engine.command.RequiredPermissions; | ||
| import edu.harvard.iq.dataverse.engine.command.exception.CommandException; | ||
| import edu.harvard.iq.dataverse.Template; | ||
|
|
||
| /** | ||
| * @author J.P. Tosca | ||
| * Sets a default template {@link Template} for a {@link Dataverse}. | ||
| */ | ||
| @RequiredPermissions(Permission.EditDataverse) | ||
| public class SetDefaultTemplateCommand extends AbstractCommand<Template> { | ||
|
|
||
| private final Template template; | ||
| private final Dataverse dataverse; | ||
|
|
||
| public SetDefaultTemplateCommand(Template template, DataverseRequest request, Dataverse dataverse) { | ||
| super(request, dataverse); | ||
| this.template = template; | ||
| this.dataverse = dataverse; | ||
| } | ||
|
|
||
| @Override | ||
| public Template execute(CommandContext ctxt) throws CommandException { | ||
| dataverse.setDefaultTemplate(template); | ||
sekmiller marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ctxt.em().merge(dataverse); | ||
| return template; | ||
| } | ||
|
|
||
| } | ||
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.
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.
Uh oh!
There was an error while loading. Please reload this page.