Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions vcell-admin/src/main/java/org/vcell/admin/cli/AdminCLI.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.vcell.admin.cli.sim.JobInfoCommand;
import org.vcell.admin.cli.sim.ResultSetCrawlerCommand;
import org.vcell.admin.cli.sim.SimDataVerifierCommand;
import org.vcell.admin.cli.tools.DatabaseCommand;
import org.vcell.admin.cli.tools.UsageCommand;
import org.vcell.admin.cli.tools.UsersQueryCommand;
import org.vcell.db.DatabaseSyntax;
Expand All @@ -33,6 +34,7 @@
DatabaseCreateScriptCommand.class,
UsageCommand.class,
UsersQueryCommand.class,
DatabaseCommand.class,
ResultSetCrawlerCommand.class,
SimDataVerifierCommand.class,
JobInfoCommand.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,15 @@ public BioModelInfo queryBiomodelInfo(User owner, KeyValue biomodelId) throws Da
return getDatabaseServer().getBioModelInfo(owner, biomodelId);
}

public User resolveUser(String userid) throws DataAccessException, SQLException {
AdminDBTopLevel adminDbTopLevel = new AdminDBTopLevel(conFactory);
User user = adminDbTopLevel.getUser(userid, true);
if (user == null) {
throw new DataAccessException("user '" + userid + "' not found");
}
return user;
}

public MathModelInfo queryMathmodelInfo(User owner, KeyValue mathmodelId) throws DataAccessException {
return getDatabaseServer().getMathModelInfo(owner, mathmodelId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ public class DatabaseCommand implements Callable<Integer> {
@Option(names = "--user", description = "userid and key for private models --biomodel-id (format is 'userid:key')")
private User user = User.tempUser;

@Option(names = "--userid", description = "userid alone for private --biomodel-id; user key resolved via DB lookup")
private String userid;

@Option(names = {"-d", "--debug"}, description = "full application debug mode")
private boolean bDebug = false;

Expand All @@ -61,6 +64,10 @@ public Integer call() {
throw new RuntimeException("outputDir '" + (outputDir == null ? "" : outputDir) + "' is not a 'valid directory'");

try (CLIDatabaseService cliDatabaseService = new CLIDatabaseService()) {
if (userid != null) {
user = cliDatabaseService.resolveUser(userid);
logger.info("resolved userid '" + userid + "' to user " + user.getName() + ":" + user.getID());
}
if (biomodelsFile != null) {
List<String> lines = Files.readAllLines(biomodelsFile.toPath());
for (String line : lines) {
Expand Down
Loading