Skip to content

Commit

Permalink
DD-1605 Implement several dd-dataverse-cli dataset commands - VI - ch…
Browse files Browse the repository at this point in the history
…anges for PR reviewers
  • Loading branch information
aliassheikh committed Sep 5, 2024
1 parent 02c6a32 commit c83e29c
Show file tree
Hide file tree
Showing 21 changed files with 26 additions and 230 deletions.
2 changes: 0 additions & 2 deletions src/main/java/nl/knaw/dans/dvcli/DdDataverseCli.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import nl.knaw.dans.dvcli.command.DatasetAssignRole;
import nl.knaw.dans.dvcli.command.DatasetCmd;
import nl.knaw.dans.dvcli.command.DatasetDeleteDraft;
import nl.knaw.dans.dvcli.command.DatasetDeleteRole;
import nl.knaw.dans.dvcli.command.DatasetGetFiles;
import nl.knaw.dans.dvcli.command.DatasetGetLatestVersion;
import nl.knaw.dans.dvcli.command.DatasetGetVersion;
Expand Down Expand Up @@ -81,7 +80,6 @@ public void configureCommandLine(CommandLine commandLine, DdDataverseCliConfig c
.addSubcommand(new CommandLine(new DatasetCmd(dataverseClient))
.addSubcommand(new DatasetAssignRole())
.addSubcommand(new DatasetDeleteDraft())
.addSubcommand(new DatasetDeleteRole())
.addSubcommand(new DatasetGetFiles())
.addSubcommand(new DatasetGetLatestVersion())
.addSubcommand(new DatasetGetVersion())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,5 @@ else if (commandParameter.assignment != null) {
protected record RoleAssignmentParams(DatasetApi pid, Optional<RoleAssignment> roleAssignment) {

Check warning on line 103 in src/main/java/nl/knaw/dans/dvcli/command/AbstractAssignmentRole.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/nl/knaw/dans/dvcli/command/AbstractAssignmentRole.java#L103

Added line #L103 was not covered by tests
}

@Override
public void doCall() throws IOException, DataverseException {
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package nl.knaw.dans.dvcli.command;

import nl.knaw.dans.dvcli.action.ConsoleReport;
import nl.knaw.dans.lib.dataverse.DataverseException;
import picocli.CommandLine.Command;
import picocli.CommandLine.Option;
Expand Down Expand Up @@ -43,14 +42,7 @@ public class CollectionCreateDataset extends AbstractCmd {

@Override
public void doCall() throws IOException, DataverseException {
collectionCmd.batchProcessorBuilder()
.action(d -> {
var json = Files.readString(Path.of(dataset));
var r = d.createDataset(json, metadataKeys);
return r.getEnvelopeAsString();
})
.report(new ConsoleReport<>())
.build()
.process();
collectionCmd.batchProcessor(c ->
c.createDataset(Files.readString(Path.of(dataset)), metadataKeys).getEnvelopeAsString()).process();
}
}
10 changes: 1 addition & 9 deletions src/main/java/nl/knaw/dans/dvcli/command/CollectionDelete.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package nl.knaw.dans.dvcli.command;

import nl.knaw.dans.dvcli.action.ConsoleReport;
import nl.knaw.dans.lib.dataverse.DataverseException;
import picocli.CommandLine.Command;
import picocli.CommandLine.ParentCommand;
Expand All @@ -31,13 +30,6 @@ public class CollectionDelete extends AbstractCmd {

@Override
public void doCall() throws IOException, DataverseException {
collectionCmd.batchProcessorBuilder()
.action(d -> {
var r = d.delete();
return r.getEnvelopeAsString();
})
.report(new ConsoleReport<>())
.build()
.process();
collectionCmd.batchProcessor(c -> c.delete().getEnvelopeAsString()).process();

Check warning on line 33 in src/main/java/nl/knaw/dans/dvcli/command/CollectionDelete.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/nl/knaw/dans/dvcli/command/CollectionDelete.java#L33

Added line #L33 was not covered by tests
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package nl.knaw.dans.dvcli.command;

import nl.knaw.dans.dvcli.action.ConsoleReport;
import nl.knaw.dans.lib.dataverse.DataverseException;
import picocli.CommandLine.Command;
import picocli.CommandLine.ParentCommand;
Expand All @@ -31,13 +30,6 @@ public class CollectionGetContents extends AbstractCmd {

@Override
public void doCall() throws IOException, DataverseException {
collectionCmd.batchProcessorBuilder()
.action(d -> {
var r = d.getContents();
return r.getEnvelopeAsString();
})
.report(new ConsoleReport<>())
.build()
.process();
collectionCmd.batchProcessor(c -> c.getContents().getEnvelopeAsString()).process();

Check warning on line 33 in src/main/java/nl/knaw/dans/dvcli/command/CollectionGetContents.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/nl/knaw/dans/dvcli/command/CollectionGetContents.java#L33

Added line #L33 was not covered by tests
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package nl.knaw.dans.dvcli.command;

import nl.knaw.dans.dvcli.action.ConsoleReport;
import nl.knaw.dans.lib.dataverse.DataverseException;
import picocli.CommandLine.Command;
import picocli.CommandLine.ParentCommand;
Expand All @@ -31,13 +30,6 @@ public class CollectionGetStorageSize extends AbstractCmd {

@Override
public void doCall() throws IOException, DataverseException {
collectionCmd.batchProcessorBuilder()
.action(d -> {
var r = d.getStorageSize();
return r.getEnvelopeAsString();
})
.report(new ConsoleReport<>())
.build()
.process();
collectionCmd.batchProcessor(c -> c.getStorageSize().getEnvelopeAsString()).process();

Check warning on line 33 in src/main/java/nl/knaw/dans/dvcli/command/CollectionGetStorageSize.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/nl/knaw/dans/dvcli/command/CollectionGetStorageSize.java#L33

Added line #L33 was not covered by tests
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package nl.knaw.dans.dvcli.command;

import nl.knaw.dans.dvcli.action.ConsoleReport;
import nl.knaw.dans.lib.dataverse.DataverseException;
import picocli.CommandLine.Command;
import picocli.CommandLine.Option;
Expand Down Expand Up @@ -49,14 +48,7 @@ public class CollectionImportDataset extends AbstractCmd {

@Override
public void doCall() throws IOException, DataverseException {
collectionCmd.batchProcessorBuilder()
.action(d -> {
var json = Files.readString(Path.of(dataset));
var r = d.importDataset(json, persistentId, autoPublish, metadataKeys);
return r.getEnvelopeAsString();
})
.report(new ConsoleReport<>())
.build()
.process();
collectionCmd.batchProcessor(c ->
c.importDataset(Files.readString(Path.of(dataset)), persistentId, autoPublish, metadataKeys).getEnvelopeAsString()).process();

Check warning on line 52 in src/main/java/nl/knaw/dans/dvcli/command/CollectionImportDataset.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/nl/knaw/dans/dvcli/command/CollectionImportDataset.java#L51-L52

Added lines #L51 - L52 were not covered by tests
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package nl.knaw.dans.dvcli.command;

import nl.knaw.dans.dvcli.action.ConsoleReport;
import nl.knaw.dans.lib.dataverse.DataverseException;
import picocli.CommandLine.Command;
import picocli.CommandLine.ParentCommand;
Expand All @@ -31,13 +30,6 @@ public class CollectionIsMetadataBlocksRoot extends AbstractCmd {

@Override
public void doCall() throws IOException, DataverseException {
collectionCmd.batchProcessorBuilder()
.action(d -> {
var r = d.isMetadataBlocksRoot();
return r.getEnvelopeAsString();
})
.report(new ConsoleReport<>())
.build()
.process();
collectionCmd.batchProcessor(c -> c.isMetadataBlocksRoot().getEnvelopeAsString()).process();

Check warning on line 33 in src/main/java/nl/knaw/dans/dvcli/command/CollectionIsMetadataBlocksRoot.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/nl/knaw/dans/dvcli/command/CollectionIsMetadataBlocksRoot.java#L33

Added line #L33 was not covered by tests
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package nl.knaw.dans.dvcli.command;

import nl.knaw.dans.dvcli.action.ConsoleReport;
import nl.knaw.dans.lib.dataverse.DataverseException;
import picocli.CommandLine.Command;
import picocli.CommandLine.ParentCommand;
Expand All @@ -31,13 +30,6 @@ public class CollectionListMetadataBlocks extends AbstractCmd {

@Override
public void doCall() throws IOException, DataverseException {
collectionCmd.batchProcessorBuilder()
.action(d -> {
var r = d.listMetadataBlocks();
return r.getEnvelopeAsString();
})
.report(new ConsoleReport<>())
.build()
.process();
collectionCmd.batchProcessor(c -> c.listMetadataBlocks().getEnvelopeAsString()).process();

Check warning on line 33 in src/main/java/nl/knaw/dans/dvcli/command/CollectionListMetadataBlocks.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/nl/knaw/dans/dvcli/command/CollectionListMetadataBlocks.java#L33

Added line #L33 was not covered by tests
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package nl.knaw.dans.dvcli.command;

import nl.knaw.dans.dvcli.action.ConsoleReport;
import nl.knaw.dans.lib.dataverse.DataverseException;
import picocli.CommandLine.Command;
import picocli.CommandLine.ParentCommand;
Expand All @@ -31,13 +30,6 @@ public class CollectionListRoleAssignments extends AbstractCmd {

@Override
public void doCall() throws IOException, DataverseException {
collectionCmd.batchProcessorBuilder()
.action(d -> {
var r = d.listRoleAssignments();
return r.getEnvelopeAsString();
})
.report(new ConsoleReport<>())
.build()
.process();
collectionCmd.batchProcessor(c -> c.listRoleAssignments().getEnvelopeAsString()).process();

Check warning on line 33 in src/main/java/nl/knaw/dans/dvcli/command/CollectionListRoleAssignments.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/nl/knaw/dans/dvcli/command/CollectionListRoleAssignments.java#L33

Added line #L33 was not covered by tests
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package nl.knaw.dans.dvcli.command;

import nl.knaw.dans.dvcli.action.ConsoleReport;
import nl.knaw.dans.lib.dataverse.DataverseException;
import picocli.CommandLine.Command;
import picocli.CommandLine.ParentCommand;
Expand All @@ -31,13 +30,6 @@ public class CollectionListRoles extends AbstractCmd {

@Override
public void doCall() throws IOException, DataverseException {
collectionCmd.batchProcessorBuilder()
.action(d -> {
var r = d.listRoles();
return r.getEnvelopeAsString();
})
.report(new ConsoleReport<>())
.build()
.process();
collectionCmd.batchProcessor(c -> c.listRoles().getEnvelopeAsString()).process();

Check warning on line 33 in src/main/java/nl/knaw/dans/dvcli/command/CollectionListRoles.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/nl/knaw/dans/dvcli/command/CollectionListRoles.java#L33

Added line #L33 was not covered by tests
}
}
10 changes: 1 addition & 9 deletions src/main/java/nl/knaw/dans/dvcli/command/CollectionPublish.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package nl.knaw.dans.dvcli.command;

import nl.knaw.dans.dvcli.action.ConsoleReport;
import nl.knaw.dans.lib.dataverse.DataverseException;
import picocli.CommandLine.Command;
import picocli.CommandLine.ParentCommand;
Expand All @@ -31,13 +30,6 @@ public class CollectionPublish extends AbstractCmd {

@Override
public void doCall() throws IOException, DataverseException {
collectionCmd.batchProcessorBuilder()
.action(d -> {
var r = d.publish();
return r.getEnvelopeAsString();
})
.report(new ConsoleReport<>())
.build()
.process();
collectionCmd.batchProcessor(c -> c.publish().getEnvelopeAsString()).process();

Check warning on line 33 in src/main/java/nl/knaw/dans/dvcli/command/CollectionPublish.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/nl/knaw/dans/dvcli/command/CollectionPublish.java#L33

Added line #L33 was not covered by tests
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package nl.knaw.dans.dvcli.command;

import nl.knaw.dans.dvcli.action.ConsoleReport;
import nl.knaw.dans.lib.dataverse.DataverseException;
import picocli.CommandLine.Command;
import picocli.CommandLine.Parameters;
Expand All @@ -35,13 +34,6 @@ public class CollectionSetMetadataBlocksRoot extends AbstractCmd {

@Override
public void doCall() throws IOException, DataverseException {
collectionCmd.batchProcessorBuilder()
.action(d -> {
var r = d.setMetadataBlocksRoot(isRoot);
return r.getEnvelopeAsString();
})
.report(new ConsoleReport<>())
.build()
.process();
collectionCmd.batchProcessor(c -> c.setMetadataBlocksRoot(isRoot).getEnvelopeAsString()).process();

Check warning on line 37 in src/main/java/nl/knaw/dans/dvcli/command/CollectionSetMetadataBlocksRoot.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/nl/knaw/dans/dvcli/command/CollectionSetMetadataBlocksRoot.java#L37

Added line #L37 was not covered by tests
}
}
10 changes: 1 addition & 9 deletions src/main/java/nl/knaw/dans/dvcli/command/CollectionView.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package nl.knaw.dans.dvcli.command;

import nl.knaw.dans.dvcli.action.ConsoleReport;
import nl.knaw.dans.lib.dataverse.DataverseException;
import picocli.CommandLine.Command;
import picocli.CommandLine.ParentCommand;
Expand All @@ -31,13 +30,6 @@ public class CollectionView extends AbstractCmd {

@Override
public void doCall() throws IOException, DataverseException {
collectionCmd.batchProcessorBuilder()
.action(d -> {
var r = d.view();
return r.getEnvelopeAsString();
})
.report(new ConsoleReport<>())
.build()
.process();
collectionCmd.batchProcessor(c -> c.view().getEnvelopeAsString()).process();

Check warning on line 33 in src/main/java/nl/knaw/dans/dvcli/command/CollectionView.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/nl/knaw/dans/dvcli/command/CollectionView.java#L33

Added line #L33 was not covered by tests
}
}
14 changes: 1 addition & 13 deletions src/main/java/nl/knaw/dans/dvcli/command/DatasetDeleteDraft.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
*/
package nl.knaw.dans.dvcli.command;

import nl.knaw.dans.dvcli.action.BatchProcessor;
import nl.knaw.dans.dvcli.action.ConsoleReport;
import nl.knaw.dans.lib.dataverse.DatasetApi;
import nl.knaw.dans.lib.dataverse.DataverseException;
import picocli.CommandLine.Command;
import picocli.CommandLine.ParentCommand;
Expand All @@ -33,15 +30,6 @@ public class DatasetDeleteDraft extends AbstractCmd {

@Override
public void doCall() throws IOException, DataverseException {
BatchProcessor.<DatasetApi, String> builder()
.labeledItems(datasetCmd.getItems())
.action(d -> {
var r = d.deleteDraft();
return r.getEnvelopeAsString();
})
.report(new ConsoleReport<>())
.delay(1000L)
.build()
.process();
datasetCmd.batchProcessor(d -> d.deleteDraft().getEnvelopeAsString()).process();

Check warning on line 33 in src/main/java/nl/knaw/dans/dvcli/command/DatasetDeleteDraft.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/nl/knaw/dans/dvcli/command/DatasetDeleteDraft.java#L33

Added line #L33 was not covered by tests
}
}
53 changes: 0 additions & 53 deletions src/main/java/nl/knaw/dans/dvcli/command/DatasetDeleteRole.java

This file was deleted.

Loading

0 comments on commit c83e29c

Please sign in to comment.