-
Notifications
You must be signed in to change notification settings - Fork 0
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
c41c6aa
commit 3ec62fd
Showing
16 changed files
with
899 additions
and
165 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
61 changes: 61 additions & 0 deletions
61
src/main/java/life/qbic/io/commandline/TransferSampleTypesToSeekCommand.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,61 @@ | ||
package life.qbic.io.commandline; | ||
|
||
import ch.ethz.sis.openbis.generic.OpenBIS; | ||
import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.SampleType; | ||
import java.io.IOException; | ||
import java.net.URISyntaxException; | ||
import life.qbic.App; | ||
import life.qbic.model.OpenbisSeekTranslator; | ||
import life.qbic.model.SampleTypesAndMaterials; | ||
import life.qbic.model.download.OpenbisConnector; | ||
import life.qbic.model.download.SEEKConnector; | ||
import org.apache.commons.codec.binary.Base64; | ||
import picocli.CommandLine.Command; | ||
import picocli.CommandLine.Mixin; | ||
|
||
@Command(name = "sample-type-transfer", | ||
description = | ||
"Transfers sample types from openBIS to SEEK.") | ||
public class TransferSampleTypesToSeekCommand implements Runnable { | ||
@Mixin | ||
AuthenticationOptions auth = new AuthenticationOptions(); | ||
OpenbisConnector openbis; | ||
SEEKConnector seek; | ||
OpenbisSeekTranslator translator; | ||
|
||
@Override | ||
public void run() { | ||
System.out.println("auth..."); | ||
|
||
OpenBIS authentication = App.loginToOpenBIS(auth.getOpenbisPassword(), auth.getOpenbisUser(), | ||
auth.getAS(), auth.getDSS()); | ||
System.out.println("openbis..."); | ||
|
||
openbis = new OpenbisConnector(authentication); | ||
|
||
byte[] httpCredentials = Base64.encodeBase64( | ||
(auth.getSeekUser() + ":" + new String(auth.getSeekPassword())).getBytes()); | ||
try { | ||
seek = new SEEKConnector(auth.getSeekURL(), httpCredentials, "seek_test", | ||
"lisym default study"); | ||
translator = seek.getTranslator(); | ||
} catch (URISyntaxException | IOException | InterruptedException e) { | ||
throw new RuntimeException(e); | ||
} | ||
|
||
SampleTypesAndMaterials types = openbis.getSampleTypesWithMaterials(); | ||
|
||
try { | ||
for(SampleType type : types.getSampleTypes()) { | ||
System.err.println("creating "+type.getCode()); | ||
String sampleTypeId = seek.createSampleType(translator.translate(type)); | ||
System.err.println("created "+sampleTypeId); | ||
} | ||
} catch (URISyntaxException | IOException | InterruptedException e) { | ||
throw new RuntimeException(e); | ||
} | ||
|
||
System.out.println("Done"); | ||
} | ||
|
||
} |
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,23 @@ | ||
package life.qbic.model; | ||
|
||
import java.util.List; | ||
import life.qbic.model.download.SEEKConnector.AssetToUpload; | ||
|
||
public class AssayWithQueuedAssets { | ||
|
||
private String assayEndpoint; | ||
private List<AssetToUpload> assetsToUpload; | ||
|
||
public AssayWithQueuedAssets(String assayEndpoint, List<AssetToUpload> assetsToUpload) { | ||
this.assayEndpoint = assayEndpoint; | ||
this.assetsToUpload = assetsToUpload; | ||
} | ||
|
||
public String getAssayEndpoint() { | ||
return assayEndpoint; | ||
} | ||
|
||
public List<AssetToUpload> getAssets() { | ||
return assetsToUpload; | ||
} | ||
} |
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.