/** * Unregisters a given file from the script repository by setting its * Repo uuid to null. */ protected void unregister(final Long old, SqlAction sqlAction) { sqlAction.setFileRepo(Collections.singleton(old), null); }
@Transactional(readOnly = true) public Object doWork(SqlAction sql) { return sql.activeSession(userId); } });
@Transactional(readOnly = false) public Object doWork(SqlAction sql) { sql.addMessageWithinDbPatchEnd(version, patch, configKeyValue); sql.updateOrInsertConfigValue(configKey, configValue); return null; } });
/** * Calls either {@link #preparePassword(String)} or * {@link #prepareSaltedPassword(Long, String)} and passes the resulting * value to {@link SqlAction#setUserPassword(Long, String)}. * An {@link InternalException} is thrown if the modification is not * successful, which should only occur if the user has been deleted. * @param id the user ID * @param password the password * @param meth how to encode the password */ public void changeUserPasswordById(Long id, String password, METHOD meth) { String prepared = password; if (meth.hash){ prepared = preparePassword(id, password, meth.salt); } if (! sql.setUserPassword(id, prepared)) { throw new InternalException("0 results for password insert."); } sql.clearPermissionsBit("experimenter", id, 16); }
/** * Looks to see if a path is contained in the repository. */ public Long findInDb(SqlAction sql, RepoFile repoFile, boolean scriptsOnly) { return sql.findRepoFile(uuid, repoFile.dirname(), repoFile.basename(), scriptsOnly ? mimetypes : null); }
long lastValue = sql.nextValue("seq_eventlog", logs.size()); long id = lastValue - logs.size() + 1; List<Object[]> batchData = new ArrayList<Object[]>(); sql.insertLogs(batchData);
id = sql.findRepoFile(repoUuid, checked.getRelativePath(), checked.getName()); List<Long> ids = sql.findRepoFiles(repoUuid, checked.getDirname());
public synchronized Serializable generate(final SessionImplementor session, Object obj) { if (hiValue < 0 || value >= hiValue) { hiValue = sql.nextValue(getSegmentValue(), getIncrementSize()); if (log.isDebugEnabled()) { log.debug("Loaded new hiValue " + hiValue + " for " + getSegmentValue()); } value = hiValue - getIncrementSize(); } value++; return value; }
@Transactional(readOnly = false) public Object doWork(SqlAction sql) { sql.addMessageWithinDbPatchStart(version, patch, configKeyValue); return null; } });
@Transactional(readOnly = false) public Object doWork(Session session, ServiceFactory sf) { return getSqlAction().closeNodeSessions(managerUuid); } });
@Transactional(readOnly = false) public Object doWork(Session session, ServiceFactory sf) { return getSqlAction().closeNode(managerUuid); } });
private void handleGroupChange(IObject obj, Permissions newPerms) { final ExperimenterGroup group = load(obj); if (newPerms == null) { throw new ApiUsageException("PERMS cannot be null"); } final Permissions oldPerms = group.getDetails().getPermissions(); if (oldPerms.sameRights(newPerms)) { log.debug(String.format("Ignoring unchanged permissions: %s", newPerms)); return; } final Long internal = (Long) Utils.internalForm(newPerms); sql.changeGroupPermissions(obj.getId(), internal); log.info(String.format("Changed permissions for %s to %s", obj.getId(), internal)); eventlog(obj.getId(), newPerms.toString()); }
public ome.model.core.OriginalFile findRepoFile(ServiceFactory sf, SqlAction sql, final String uuid, final CheckedPath checked, final String mimetype) { Long id = sql.findRepoFile(uuid, checked.getRelativePath(), checked.getName(), mimetype); if (id == null) { return null; } else { return sf.getQueryService().get( ome.model.core.OriginalFile.class, id); } }
Long id = sql.findRepoFile(repoUuid, checked.getRelativePath(), checked.getName()); sw.stop("omero.repo.file.find");
@Transactional(readOnly = false) public ome.model.core.OriginalFile doWork(Session session, ServiceFactory sf) { final ome.model.core.OriginalFile persisted = sf.getUpdateService().saveAndReturnObject(originalFile); getSqlAction().setFileRepo(Collections.singleton(persisted.getId()), repoUuid); session.refresh(persisted); return persisted; } });
final Long parentId = sql.findRepoFile(repoUuid, parent.getRelativePath(), parent.getName());