-
Notifications
You must be signed in to change notification settings - Fork 493
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added: endpoint for listing featured items
- Loading branch information
Showing
7 changed files
with
81 additions
and
5 deletions.
There are no files selected for viewing
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
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
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
39 changes: 39 additions & 0 deletions
39
.../java/edu/harvard/iq/dataverse/engine/command/impl/ListDataverseFeaturedItemsCommand.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,39 @@ | ||
package edu.harvard.iq.dataverse.engine.command.impl; | ||
|
||
import edu.harvard.iq.dataverse.Dataverse; | ||
import edu.harvard.iq.dataverse.DataverseFeaturedItem; | ||
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.exception.CommandException; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Set; | ||
|
||
/** | ||
* List the featured items {@link DataverseFeaturedItem} of a {@link Dataverse}. | ||
*/ | ||
public class ListDataverseFeaturedItemsCommand extends AbstractCommand<List<DataverseFeaturedItem>> { | ||
|
||
private final Dataverse dataverse; | ||
|
||
public ListDataverseFeaturedItemsCommand(DataverseRequest request, Dataverse dataverse) { | ||
super(request, dataverse); | ||
this.dataverse = dataverse; | ||
} | ||
|
||
@Override | ||
public List<DataverseFeaturedItem> execute(CommandContext ctxt) throws CommandException { | ||
return dataverse.getDataverseFeaturedItems(); | ||
} | ||
|
||
@Override | ||
public Map<String, Set<Permission>> getRequiredPermissions() { | ||
return Collections.singletonMap("", | ||
dataverse.isReleased() ? Collections.emptySet() | ||
: Collections.singleton(Permission.ViewUnpublishedDataverse)); | ||
} | ||
} |
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
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
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