-
Notifications
You must be signed in to change notification settings - Fork 4
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
1 parent
155959a
commit 6d79896
Showing
27 changed files
with
497 additions
and
127 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
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
36 changes: 36 additions & 0 deletions
36
src/main/java/nl/knaw/dans/dvcli/action/SingleCollectionOrCollectionsFile.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,36 @@ | ||
/* | ||
* Copyright (C) 2024 DANS - Data Archiving and Networked Services ([email protected]) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package nl.knaw.dans.dvcli.action; | ||
|
||
import nl.knaw.dans.lib.dataverse.DataverseApi; | ||
import nl.knaw.dans.lib.dataverse.DataverseClient; | ||
|
||
import java.io.IOException; | ||
import java.util.stream.Stream; | ||
|
||
public class SingleCollectionOrCollectionsFile { | ||
private final SingleIdOrIdsFile singleIdOrIdsFile; | ||
private final DataverseClient dataverseClient; | ||
|
||
public SingleCollectionOrCollectionsFile(String singleCollectionOrCollectionsFile, DataverseClient dataverseClient) { | ||
this.singleIdOrIdsFile = new SingleIdOrIdsFile(singleCollectionOrCollectionsFile, "root"); | ||
this.dataverseClient = dataverseClient; | ||
} | ||
|
||
public Stream<Pair<String, DataverseApi>> getCollections() throws IOException { | ||
return singleIdOrIdsFile.getPids().map(alias -> new Pair<>(alias, dataverseClient.dataverse(alias))); | ||
} | ||
} |
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
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
62 changes: 62 additions & 0 deletions
62
src/main/java/nl/knaw/dans/dvcli/command/AbstractSubcommandContainer2.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,62 @@ | ||
/* | ||
* Copyright (C) 2024 DANS - Data Archiving and Networked Services ([email protected]) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package nl.knaw.dans.dvcli.command; | ||
|
||
import lombok.NonNull; | ||
import nl.knaw.dans.dvcli.action.BatchProcessor; | ||
import nl.knaw.dans.dvcli.action.Pair; | ||
import nl.knaw.dans.dvcli.action.SingleIdOrIdsFile; | ||
import nl.knaw.dans.lib.dataverse.DataverseClient; | ||
import picocli.CommandLine.Option; | ||
import picocli.CommandLine.Parameters; | ||
|
||
import java.io.IOException; | ||
import java.util.List; | ||
|
||
public abstract class AbstractSubcommandContainer2<T> extends AbstractCmd { | ||
private static final long DEFAULT_DELAY = 1000; | ||
|
||
protected DataverseClient dataverseClient; | ||
|
||
public AbstractSubcommandContainer2(@NonNull DataverseClient dataverseClient) { | ||
this.dataverseClient = dataverseClient; | ||
} | ||
|
||
@Parameters(index = "0", description = "The target(s) of the operation; this is either an ID a file with a with a list of IDs, or - if the subcommand supports it - a parameters file.", | ||
paramLabel = "targets", defaultValue = SingleIdOrIdsFile.DEFAULT_TARGET_PLACEHOLDER) | ||
|
||
protected String targets; | ||
|
||
@Option(names = { "-d", "--delay" }, description = "Delay in milliseconds between requests to the server (default: ${DEFAULT-VALUE}).", defaultValue = "" + DEFAULT_DELAY) | ||
protected long delay; | ||
|
||
protected BatchProcessor.BatchProcessorBuilder<T, String> batchProcessorBuilder() throws IOException { | ||
return BatchProcessor.<T, String> builder() | ||
.labeledItems(getItems()) | ||
.delay(delay); | ||
} | ||
|
||
protected <P> BatchProcessor.BatchProcessorBuilder<P, String> paramsBatchProcessorBuilder() throws IOException { | ||
return BatchProcessor.<P, String> builder() | ||
.delay(delay); | ||
} | ||
|
||
protected abstract List<Pair<String, T>> getItems() throws IOException; | ||
|
||
@Override | ||
public void doCall() { | ||
} | ||
} |
48 changes: 0 additions & 48 deletions
48
src/main/java/nl/knaw/dans/dvcli/command/CollectionAssignRole.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.