/** * Implemented as specified by the {@link RenderingEngine} interface. * * @see RenderingEngine#getQuantumDef() */ @RolesAllowed("user") public QuantumDef getQuantumDef() { rwl.readLock().lock(); try { errorIfNullRenderingDef(); return new ShallowCopy().copy(rendDefObj.getQuantization()); } finally { rwl.readLock().unlock(); } }
/** * Copies the specified pixels set. * * @param pixels The pixels to set. */ @SuppressWarnings("unchecked") private Pixels copyPixels(Pixels pixels) { if (pixels == null) { return null; } Pixels newPixels = new ShallowCopy().copy(pixels); newPixels.putAt(Pixels.CHANNELS, new ArrayList<Channel>()); copyChannels(pixels, newPixels); newPixels.setPixelsType(new ShallowCopy().copy(pixels.getPixelsType())); return newPixels; }
/** * Copies the specified channel. * * @param channel The channel to copy. * @return See above. */ private Channel copyChannel(Channel channel) { if (channel == null) return null; Channel newChannel = new ShallowCopy().copy(channel); newChannel.setLogicalChannel(new ShallowCopy().copy(channel .getLogicalChannel())); if (channel.getStatsInfo() != null) { newChannel.setStatsInfo(new ShallowCopy().copy(channel.getStatsInfo())); } return newChannel; }
@RolesAllowed("user") @Transactional(readOnly = false) public synchronized Pixels save() { if (isModified()) { Long id = (pixelsInstance == null) ? null : pixelsInstance.getId(); if (id == null) { return null; } try { byte[] hash = buffer.calculateMessageDigest(); pixelsInstance.setSha1(Hex.encodeHexString(hash)); } catch (RuntimeException re) { // ticket:3140 if (re.getCause() instanceof FileNotFoundException) { String msg = "Cannot find path. Deleted? " + buffer; log.warn(msg); clean(); // Prevent a second exception on close. throw new ResourceError(msg); } throw re; } catch (IOException e) { log.warn("calculateMessageDigest failed on " + buffer, e); throw new ResourceError(e.getMessage()); } iUpdate.flush(); modified = false; return new ShallowCopy().copy(pixelsInstance); } return null; }
@RolesAllowed("user") public Job getJob() { Job job = internalJobOnly(); JobStatus status = job.getStatus(); Details unloadedDetails = status.getDetails().shallowCopy(); status.getDetails().shallowCopy(unloadedDetails); Job copy = new ShallowCopy().copy(job); copy.setStatus(job.getStatus()); return copy; }
iUpdate.flush(); modified = false; return new ShallowCopy().copy(file); } finally { finalize.stop("omero.services.file.finalize");