-
Notifications
You must be signed in to change notification settings - Fork 479
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
334 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
New api endpoints have been added to allow you to add or remove featured collections from a dataverse collection. |
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
50 changes: 50 additions & 0 deletions
50
...ain/java/edu/harvard/iq/dataverse/engine/command/impl/ListFeaturedCollectionsCommand.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,50 @@ | ||
|
||
package edu.harvard.iq.dataverse.engine.command.impl; | ||
|
||
import edu.harvard.iq.dataverse.Dataverse; | ||
import edu.harvard.iq.dataverse.DataverseFeaturedDataverse; | ||
import edu.harvard.iq.dataverse.DvObject; | ||
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.ArrayList; | ||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Set; | ||
|
||
/** | ||
* | ||
* @author stephenkraffmiller | ||
*/ | ||
public class ListFeaturedCollectionsCommand extends AbstractCommand<List<Dataverse>> { | ||
|
||
private final Dataverse dv; | ||
|
||
public ListFeaturedCollectionsCommand(DataverseRequest aRequest, Dataverse aDataverse) { | ||
super(aRequest, aDataverse); | ||
dv = aDataverse; | ||
} | ||
|
||
@Override | ||
public List<Dataverse> execute(CommandContext ctxt) throws CommandException { | ||
List<Dataverse> featuredTarget = new ArrayList<>(); | ||
List<DataverseFeaturedDataverse> featuredList = ctxt.featuredDataverses().findByDataverseId(dv.getId()); | ||
for (DataverseFeaturedDataverse dfd : featuredList) { | ||
Dataverse fd = dfd.getFeaturedDataverse(); | ||
featuredTarget.add(fd); | ||
} | ||
return featuredTarget; | ||
|
||
} | ||
|
||
@Override | ||
public Map<String, Set<Permission>> getRequiredPermissions() { | ||
return Collections.singletonMap("", | ||
dv.isReleased() ? Collections.<Permission>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
Oops, something went wrong.