public Long call() { Long id = scripts.findInDb(scriptPath, true); if (id == null) { return -1L; } else { return id; } }
@Transactional(readOnly = true) public Object doWork(SqlAction sql) { return findInDb(sql, file, scriptsOnly); } });
public Long findInDb(final String path, final boolean scriptsOnly) { RepoFile repoFile = new RepoFile(dir, path); return findInDb(repoFile, scriptsOnly); }
f = it.next(); file = new RepoFile(dir, f); Long id = findInDb(sqlAction, file, false); // non-scripts count String hash = null; OriginalFile ofile = null;
public Long call() throws Exception { EventContext ec = factory.getEventContext(); if ( ! ec.isCurrentUserAdmin() ) { throw new omero.SecurityViolation(null, null, "User is not an administrator"); } try { // ticket:2356 - should only overwrite non-scripts Long scriptID = scripts.findInDb(path, true); Long fileID = scripts.findInDb(path, false); if (scriptID != null) { throw new ApiUsageException(null, null, "Path already exists: " + path + "\n" + "Use editScript to modify existing official scripts."); } else if (fileID != null) { log.info("Overwriting existing non-script: " + fileID); cache.removeParams(fileID); } RepoFile f = scripts.write(path, scriptText); OriginalFile file = scripts.addOrReplace(f, fileID); if (!scripts.isInert(file)) { validateParams(__current, file); } return file.getId(); } catch (IOException e) { omero.ServerError se = new omero.InternalException(null, null, "Cannot write " + path); IceMapper.fillServerError(se, e); throw se; } } });