Search in sources :

Example 1 with ClonedWorkspace

use of bio.terra.workspace.model.ClonedWorkspace in project terra-cli by DataBiosphere.

the class Clone method execute.

@Override
protected void execute() {
    workspaceOption.overrideIfSpecified();
    Workspace sourceWorkspace = Context.requireWorkspace();
    ClonedWorkspace clonedWorkspace = sourceWorkspace.clone(workspaceNameAndDescription.displayName, workspaceNameAndDescription.description);
    Workspace destinationWorkspaceHydrated = Workspace.get(clonedWorkspace.getDestinationWorkspaceId());
    // Get a list of UFClonedResource objects based on the resources returned in the ClonedWorkspace
    java.util.List<UFClonedResource> ufClonedResources = clonedWorkspace.getResources().stream().map(r -> buildUfClonedResource(sourceWorkspace, destinationWorkspaceHydrated, r)).collect(Collectors.toList());
    // print results
    formatOption.printReturnValue(new UFClonedWorkspace(new UFWorkspace(sourceWorkspace), new UFWorkspace(destinationWorkspaceHydrated), ufClonedResources), this::printText);
}
Also used : UFClonedResource(bio.terra.cli.serialization.userfacing.UFClonedResource) Context(bio.terra.cli.businessobject.Context) ResourceCloneDetails(bio.terra.workspace.model.ResourceCloneDetails) Workspace(bio.terra.cli.businessobject.Workspace) Format(bio.terra.cli.command.shared.options.Format) CloneResourceResult(bio.terra.workspace.model.CloneResourceResult) Resource(bio.terra.cli.businessobject.Resource) Collectors(java.util.stream.Collectors) BaseCommand(bio.terra.cli.command.shared.BaseCommand) WorkspaceNameAndDescription(bio.terra.cli.command.shared.options.WorkspaceNameAndDescription) WorkspaceOverride(bio.terra.cli.command.shared.options.WorkspaceOverride) UFClonedResource(bio.terra.cli.serialization.userfacing.UFClonedResource) UFClonedWorkspace(bio.terra.cli.serialization.userfacing.UFClonedWorkspace) UFWorkspace(bio.terra.cli.serialization.userfacing.UFWorkspace) Optional(java.util.Optional) Command(picocli.CommandLine.Command) ClonedWorkspace(bio.terra.workspace.model.ClonedWorkspace) CommandLine(picocli.CommandLine) UFClonedWorkspace(bio.terra.cli.serialization.userfacing.UFClonedWorkspace) ClonedWorkspace(bio.terra.workspace.model.ClonedWorkspace) UFWorkspace(bio.terra.cli.serialization.userfacing.UFWorkspace) UFClonedWorkspace(bio.terra.cli.serialization.userfacing.UFClonedWorkspace) Workspace(bio.terra.cli.businessobject.Workspace) UFClonedWorkspace(bio.terra.cli.serialization.userfacing.UFClonedWorkspace) UFWorkspace(bio.terra.cli.serialization.userfacing.UFWorkspace) ClonedWorkspace(bio.terra.workspace.model.ClonedWorkspace) WorkspaceOverride(bio.terra.cli.command.shared.options.WorkspaceOverride)

Aggregations

Context (bio.terra.cli.businessobject.Context)1 Resource (bio.terra.cli.businessobject.Resource)1 Workspace (bio.terra.cli.businessobject.Workspace)1 BaseCommand (bio.terra.cli.command.shared.BaseCommand)1 Format (bio.terra.cli.command.shared.options.Format)1 WorkspaceNameAndDescription (bio.terra.cli.command.shared.options.WorkspaceNameAndDescription)1 WorkspaceOverride (bio.terra.cli.command.shared.options.WorkspaceOverride)1 UFClonedResource (bio.terra.cli.serialization.userfacing.UFClonedResource)1 UFClonedWorkspace (bio.terra.cli.serialization.userfacing.UFClonedWorkspace)1 UFWorkspace (bio.terra.cli.serialization.userfacing.UFWorkspace)1 CloneResourceResult (bio.terra.workspace.model.CloneResourceResult)1 ClonedWorkspace (bio.terra.workspace.model.ClonedWorkspace)1 ResourceCloneDetails (bio.terra.workspace.model.ResourceCloneDetails)1 Optional (java.util.Optional)1 Collectors (java.util.stream.Collectors)1 CommandLine (picocli.CommandLine)1 Command (picocli.CommandLine.Command)1