public ome.model.enums.ChecksumAlgorithm newInstance() { return new ome.model.enums.ChecksumAlgorithm(); }
public static ChecksumType getChecksumType(ome.model.enums.ChecksumAlgorithm algorithm) { return checksumAlgorithms.get(algorithm.getValue()); }
public void setValue(java.lang.String value) { if (! _loaded ) errorIfUnloaded(); this.value = (java.lang.String) value; } protected ome.model.internal.Details details = new Details();
@Override public Object retrieve(String field) { if (field == null) { return null; } else if (field.equals(ID)) { return getId(); } else if (field.equals(VALUE)) { return getValue(); } else if (field.equals(DETAILS)) { return getDetails(); } else { if (_dynamicFields != null) { return _dynamicFields.get(field); } return null; } }
@Override public void putAt(String field, Object value) { if (field == null) { return; } else if (field.equals(ID)) { setId((Long) value); } else if (field.equals(VALUE)) { setValue((java.lang.String)value); } else if (field.equals(DETAILS)) { setDetails((ome.model.internal.Details)value); } else { if (_dynamicFields == null) { _dynamicFields = new java.util.HashMap<String, Object>(); } _dynamicFields.put(field,value); } }
/** * Main constructor. */ public ChecksumAlgorithm (Long id, boolean loaded) { setId(id); if (loaded) { getDetails().setContext(this); } else { if (this.id == null) { throw new ApiUsageException("Id cannot be null for a proxy"); } unload(); } }
public ChecksumAlgorithm (String value) { this(null, true); setValue(value); }
@Override public String toString() { String name = this.getClass().getName(); StringBuilder sb = new StringBuilder(name.length() + 24); sb.append(name); sb.append(':'); sb.append(value); if (this.id == null) { sb.append(":Hash_"); sb.append(this.hashCode()); } else { sb.append(":Id_"); sb.append(this.id); } return sb.toString(); }
public ome.model.enums.ChecksumAlgorithm proxy() { return new ome.model.enums.ChecksumAlgorithm(this.id, false); }
if (fromHasher != null && fromHash != null) { if (toHasherName.equals(fromHasher.getValue())) {
/** * Use the {@link ome.model.internal.Details#copy(ome.model.internal.Details)} * or {@link ome.model.internal.Details#shallowCopy(ome.model.internal.Details)} * methods to set the {@link Details} instance instead. */ protected void setDetails(ome.model.internal.Details details) { if (! _loaded ) errorIfUnloaded(); this.details = (Details) details; }
ca = new ome.model.enums.ChecksumAlgorithm(checksumAlgorithm.getValue().getValue());
try { if (file.getHasher() != null) { final ChecksumType checksumType = checksumAlgorithms.get(file.getHasher().getValue()); file.setHash(this.checksumProviderFactory .getProvider(checksumType).putFile(path).checksumAsString());
/** * Simple field ome.model.enums.ChecksumAlgorithm.value (java.lang.String) */ // No @Type annotation @org.hibernate.search.annotations.Fields({ @org.hibernate.search.annotations.Field(index = org.hibernate.search.annotations.Index.TOKENIZED), @org.hibernate.search.annotations.Field(index = org.hibernate.search.annotations.Index.TOKENIZED, name="combined_fields") }) @javax.persistence.Column(columnDefinition="", nullable=false, unique=true, name="value", updatable=true) public java.lang.String getValue() { if (! _loaded ) errorIfUnloaded(); return this.value; }
/** * Make the file, this is a temporary file which will be changed when the * script is validated. * * @param script * script. * @return OriginalFile tempfile.. * @throws ServerError */ private OriginalFile makeFile(final String path, final String script, Ice.Current current) throws ServerError { OriginalFile file = new OriginalFile(); file.setName(FilenameUtils.getName(path)); file.setPath(FilenameUtils.getFullPath(path)); file.setSize((long) script.getBytes().length); file.setHasher(new ChecksumAlgorithm("SHA1-160")); file.setHash(cpf.getProvider(ChecksumType.SHA1) .putBytes(script.getBytes()).checksumAsString()); scripts.setMimetype(file); return updateFile(file, current); }
private OriginalFile update(Session session, final RepoFile repoFile, SqlAction sqlAction, ServiceFactory sf, OriginalFile ofile) { ExperimenterGroup group = loadUserGroup(session); ChecksumAlgorithm hasher = loadChecksum(session, repoFile.hasher().getValue()); ofile.setPath(repoFile.dirname()); ofile.setName(fileRepoSecretKey + repoFile.basename()); ofile.setRepo(uuid); ofile.setHasher(hasher); ofile.setHash(repoFile.hash()); ofile.setSize(repoFile.length()); ofile.getDetails().setGroup(group); setMimetype(ofile); ofile = sf.getUpdateService().saveAndReturnObject(ofile); final String name = ofile.getName(); if (name.startsWith(fileRepoSecretKey)) { ofile.setName(name.substring(fileRepoSecretKey.length())); } return ofile; }
@Override public ome.model.internal.Details getDetails() { if (! _loaded ) errorIfUnloaded(); return this.details;
file.setHasher(new ChecksumAlgorithm(ChecksumAlgorithm.VALUE_SHA1_160)); file.setHash(cpf.getProvider(ChecksumType.SHA1).putBytes(data) .checksumAsString());
/** * Creates {@link Field} instances for {@link FileAnnotation} objects. * * @param document * @param opts * @param fileAnnotation */ private void handleFileAnnotation(final Document document, final LuceneOptions opts, FileAnnotation fileAnnotation) { OriginalFile file = fileAnnotation.getFile(); if (file != null) { // None of these values can be null add(document, "file.name", file.getName(), opts); add(document, "file.path", file.getPath(), opts); if (file.getHasher() != null) { add(document, "file.hasher", file.getHasher().getValue(), opts); } if (file.getHash() != null) { add(document, "file.hash", file.getHash(), opts); } if (file.getMimetype() != null) { add(document, "file.format", file.getMimetype(), opts); // ticket:2211 - duplicating for backwards compatibility add(document, "file.mimetype", file.getMimetype(), opts); } addContents(document, "file.contents", file, files, parsers, opts); } }