CommandLineImporter configuration for group
Posted: Fri Apr 05, 2019 10:43 am
Hi,
From my java app I am using the ome.formats.importer.cli.CommandLineImporter to upload images.
I've included my code below.
The user belongs to 2 groups. Private and Public. The default is the private one.
If the user uploads to the private group, do not need to set the groupId and everthing works ok.
If, however, I try to upload to the public group by adding the public groupId to the configuration I get a "Failed to load target" ERROR.
How do I configure the cli to be able to upload to the public group?
Thanks in advance
Derek
From my java app I am using the ome.formats.importer.cli.CommandLineImporter to upload images.
I've included my code below.
The user belongs to 2 groups. Private and Public. The default is the private one.
If the user uploads to the private group, do not need to set the groupId and everthing works ok.
If, however, I try to upload to the public group by adding the public groupId to the configuration I get a "Failed to load target" ERROR.
How do I configure the cli to be able to upload to the public group?
Thanks in advance
Derek
- Code: Select all
public String upload_via_omero_cli(String[] paths, long datasetID, boolean isPublic) throws Exception {
String RET="OK";
ImportConfig config = new ImportConfig();
long public_group_id=53;
config.email.set("");
config.sendFiles.set(true);
config.sendReport.set(false);
config.contOnError.set(false);
config.debug.set(false);
config.hostname.set(props.getProperty("server"));
config.port.set(Integer.parseInt(props.getProperty("port")));
config.username.set(props.getProperty("db_user"));
config.password.set(props.getProperty("db_passwd"));
config.target.set("Dataset:"+datasetID);
if(isPublic)
config.group.set(public_group_id);
boolean setting=false;
CommandLineImporter cli=null;
try {
cli = new CommandLineImporter(config,paths,setting);
cli.start();
}
catch(Exception e){RET="ERROR: "+e.getMessage();}
finally {
if(cli!=null)
cli.cleanup();
}
return RET;
}