Package ome.model.jobs
Class Job
- java.lang.Object
-
- ome.model.jobs.Job
-
- All Implemented Interfaces:
java.io.Serializable
,IMutable
,IObject
,Filterable
- Direct Known Subclasses:
ImportJob
,IndexingJob
,IntegrityCheckJob
,MetadataImportJob
,ParseJob
,PixelDataJob
,ScriptJob
,ThumbnailGenerationJob
,UploadJob
@Entity @ClassBridge(name="details", impl=DetailsFieldBridge.class, index=UN_TOKENIZED, store=NO) public abstract class Job extends java.lang.Object implements java.io.Serializable, IObject, IMutable
These filter definitions are used by the security system to eliminate non-readable objects from queries. The regular user does not need to worry about them, as they will be injected directly into the SQL (not HQL)- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Job.Details
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<java.lang.String,java.lang.Object>
_dynamicFields
protected boolean
_loaded
protected Details
details
static java.lang.String
DETAILS
static java.lang.String
EVENT_FILTER
static java.lang.String
EVENT_FILTER_ORIGINALFILELINKS
static java.util.Set<java.lang.String>
FIELDS
protected java.sql.Timestamp
finished
static java.lang.String
FINISHED
static java.lang.String
GROUP_FILTER
static java.lang.String
GROUP_FILTER_ORIGINALFILELINKS
protected java.lang.String
groupname
static java.lang.String
GROUPNAME
protected java.lang.Long
id
static java.lang.String
ID
protected java.lang.String
message
static java.lang.String
MESSAGE
protected java.util.Set<JobOriginalFileLink>
originalFileLinks
static java.lang.String
ORIGINALFILELINKS
static java.lang.String
ORIGINALFILELINKSCOUNTPEROWNER
static java.lang.String
OWNER_FILTER
static java.lang.String
OWNER_FILTER_ORIGINALFILELINKS
static java.lang.String
PERMS_FILTER
static java.lang.String
PERMS_FILTER_ORIGINALFILELINKS
protected java.sql.Timestamp
scheduledFor
static java.lang.String
SCHEDULEDFOR
protected java.sql.Timestamp
started
static java.lang.String
STARTED
protected JobStatus
status
static java.lang.String
STATUS
protected java.sql.Timestamp
submitted
static java.lang.String
SUBMITTED
protected java.lang.String
type
static java.lang.String
TYPE
protected java.lang.String
username
static java.lang.String
USERNAME
protected java.lang.Integer
version
static java.lang.String
VERSION
-
Constructor Summary
Constructors Modifier Constructor Description Job()
protected
Job(java.lang.Long id)
Job(java.lang.Long id, boolean loaded)
Main constructor.Job(java.lang.String _username, java.lang.String _groupname, java.lang.String _type, java.lang.String _message, JobStatus _status, java.sql.Timestamp _submitted, java.sql.Timestamp _scheduledFor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
acceptFilter(Filter __filter)
void
addJobOriginalFileLink(JobOriginalFileLink target)
use instead of setOriginalFileLinks .void
addJobOriginalFileLink(JobOriginalFileLink link, boolean bothSides)
Adds a ome.model.jobs.JobOriginalFileLink to originalFileLinks, allowing for recursion -- whether or not addJobOriginalFileLink will be called on the addition if it is loadedvoid
addJobOriginalFileLinkSet(java.util.Collection<JobOriginalFileLink> targets)
use like addJobOriginalFileLink.void
clearOriginalFileLinks()
clears the set.<E> java.util.List<E>
collectOriginalFileLinks(CBlock<E> block)
takes a CBlock and calls the block once for each ome.model.jobs.JobOriginalFileLink while collecting the results.<E> java.util.List<E>
eachLinkedOriginalFile(CBlock<E> block)
takes a CBlock and calls the block once for each ome.model.core.OriginalFile while collecting the results.protected void
errorIfUnloaded()
java.util.Set<java.lang.String>
fields()
returns a Set of field names that belong to this classjava.util.Set<JobOriginalFileLink>
findJobOriginalFileLink(OriginalFile target)
find all ome.model.jobs.JobOriginalFileLink which have the argument as their child.Details
getDetails()
The details of this object correspond to low-level system information.java.sql.Timestamp
getFinished()
Simple field ome.model.jobs.Job.finished (java.sql.Timestamp)GraphHolder
getGraphHolder()
retrieves theGraphHolder
for this entity.java.lang.String
getGroupname()
Simple field ome.model.jobs.Job.groupname (java.lang.String)java.lang.Long
getId()
The DB unique identifier for this object.java.lang.String
getMessage()
Simple field ome.model.jobs.Job.message (java.lang.String)protected java.util.Set<JobOriginalFileLink>
getOriginalFileLinks()
returns originalFileLinks .java.util.Map<java.lang.Long,java.lang.Long>
getOriginalFileLinksCountPerOwner()
If fetched, returns the count(*) of ome.model.jobs.JobOriginalFileLink that a user has.java.sql.Timestamp
getScheduledFor()
Simple field ome.model.jobs.Job.scheduledFor (java.sql.Timestamp)java.sql.Timestamp
getStarted()
Simple field ome.model.jobs.Job.started (java.sql.Timestamp)JobStatus
getStatus()
Many-to-one field ome.model.jobs.Job.status (ome.model.jobs.JobStatus)java.sql.Timestamp
getSubmitted()
Simple field ome.model.jobs.Job.submitted (java.sql.Timestamp)java.lang.String
getType()
Simple field ome.model.jobs.Job.type (java.lang.String)java.lang.String
getUsername()
Simple field ome.model.jobs.Job.username (java.lang.String)java.lang.Integer
getVersion()
This version number is controlled by the database for optimisitic locking.boolean
isLoaded()
transient field (not stored in the DB) which specifies whether this object has been loaded from the DB or is only a wrapper around the ID.boolean
isValid()
calls the class-specific validator for this instance and returns the value fromValidation.isValid()
java.util.Iterator<JobOriginalFileLink>
iterateOriginalFileLinks()
should be used rather than accessing the originalFileLinks set directly.java.util.Iterator<OriginalFile>
linkedOriginalFileIterator()
provides an iterator over the parent values of the originalFileLinks.java.util.List<OriginalFile>
linkedOriginalFileList()
produces aList
-copy of the underlying collection.JobOriginalFileLink
linkOriginalFile(OriginalFile addition)
Adds a ome.model.jobs.JobOriginalFileLink to originalFileLinks .void
putAt(java.lang.String field, java.lang.Object value)
stores a value in this instance.void
removeJobOriginalFileLink(JobOriginalFileLink target)
removes a single element from this set and makes the inverse call on ome.model.jobs.JobOriginalFileLinkvoid
removeJobOriginalFileLink(JobOriginalFileLink link, boolean bothSides)
removes the given JobOriginalFileLink from originalFileLinks, allowing for recursion -- whether or not the removal will call unlinkJob again if loaded.void
removeJobOriginalFileLinkSet(java.util.Collection<JobOriginalFileLink> targets)
use like removeJobOriginalFileLinkjava.lang.Object
retrieve(java.lang.String field)
retrieves a value from this instance.protected void
setDetails(Details details)
void
setFinished(java.sql.Timestamp finished)
void
setGroupname(java.lang.String groupname)
void
setId(java.lang.Long id)
usually unneeded.void
setMessage(java.lang.String message)
protected void
setOriginalFileLinks(java.util.Set<JobOriginalFileLink> originalFileLinks)
setter for originalFileLinks should be avoided.protected void
setOriginalFileLinksCountPerOwner(java.util.Map<java.lang.Long,java.lang.Long> map)
void
setScheduledFor(java.sql.Timestamp scheduledFor)
void
setStarted(java.sql.Timestamp started)
void
setStatus(JobStatus status)
void
setSubmitted(java.sql.Timestamp submitted)
void
setType(java.lang.String type)
void
setUsername(java.lang.String username)
void
setVersion(java.lang.Integer version)
use with caution.int
sizeOfOriginalFileLinks()
returns the size of originalFileLinks.protected void
throwNullCollectionException(java.lang.String propertyName)
java.lang.String
toString()
void
unlinkOriginalFile(OriginalFile removal)
unlinks all ome.model.core.OriginalFile instances from this instance.void
unload()
set the loaded field to false, and set all non-ID fields to null.java.util.Collection<JobOriginalFileLink>
unmodifiableOriginalFileLinks()
Returns an unmodifiable collection-viewValidation
validate()
calls the class-specific validator for this instance and returns theValidation
object.
-
-
-
Field Detail
-
OWNER_FILTER
public static final java.lang.String OWNER_FILTER
- See Also:
- Constant Field Values
-
GROUP_FILTER
public static final java.lang.String GROUP_FILTER
- See Also:
- Constant Field Values
-
EVENT_FILTER
public static final java.lang.String EVENT_FILTER
- See Also:
- Constant Field Values
-
PERMS_FILTER
public static final java.lang.String PERMS_FILTER
- See Also:
- Constant Field Values
-
ID
public static final java.lang.String ID
- See Also:
- Constant Field Values
-
id
protected java.lang.Long id
-
VERSION
public static final java.lang.String VERSION
- See Also:
- Constant Field Values
-
version
protected java.lang.Integer version
-
username
protected java.lang.String username
-
groupname
protected java.lang.String groupname
-
type
protected java.lang.String type
-
message
protected java.lang.String message
-
status
protected JobStatus status
-
submitted
protected java.sql.Timestamp submitted
-
scheduledFor
protected java.sql.Timestamp scheduledFor
-
started
protected java.sql.Timestamp started
-
finished
protected java.sql.Timestamp finished
-
originalFileLinks
protected java.util.Set<JobOriginalFileLink> originalFileLinks
-
OWNER_FILTER_ORIGINALFILELINKS
public static final java.lang.String OWNER_FILTER_ORIGINALFILELINKS
- See Also:
- Constant Field Values
-
GROUP_FILTER_ORIGINALFILELINKS
public static final java.lang.String GROUP_FILTER_ORIGINALFILELINKS
- See Also:
- Constant Field Values
-
EVENT_FILTER_ORIGINALFILELINKS
public static final java.lang.String EVENT_FILTER_ORIGINALFILELINKS
- See Also:
- Constant Field Values
-
PERMS_FILTER_ORIGINALFILELINKS
public static final java.lang.String PERMS_FILTER_ORIGINALFILELINKS
- See Also:
- Constant Field Values
-
details
protected Details details
-
USERNAME
public static final java.lang.String USERNAME
- See Also:
- Constant Field Values
-
GROUPNAME
public static final java.lang.String GROUPNAME
- See Also:
- Constant Field Values
-
TYPE
public static final java.lang.String TYPE
- See Also:
- Constant Field Values
-
MESSAGE
public static final java.lang.String MESSAGE
- See Also:
- Constant Field Values
-
STATUS
public static final java.lang.String STATUS
- See Also:
- Constant Field Values
-
SUBMITTED
public static final java.lang.String SUBMITTED
- See Also:
- Constant Field Values
-
SCHEDULEDFOR
public static final java.lang.String SCHEDULEDFOR
- See Also:
- Constant Field Values
-
STARTED
public static final java.lang.String STARTED
- See Also:
- Constant Field Values
-
FINISHED
public static final java.lang.String FINISHED
- See Also:
- Constant Field Values
-
ORIGINALFILELINKSCOUNTPEROWNER
public static final java.lang.String ORIGINALFILELINKSCOUNTPEROWNER
- See Also:
- Constant Field Values
-
ORIGINALFILELINKS
public static final java.lang.String ORIGINALFILELINKS
- See Also:
- Constant Field Values
-
DETAILS
public static final java.lang.String DETAILS
- See Also:
- Constant Field Values
-
FIELDS
public static final java.util.Set<java.lang.String> FIELDS
-
_dynamicFields
protected java.util.Map<java.lang.String,java.lang.Object> _dynamicFields
-
_loaded
protected boolean _loaded
-
-
Constructor Detail
-
Job
public Job()
-
Job
protected Job(java.lang.Long id)
-
Job
public Job(java.lang.Long id, boolean loaded)
Main constructor.
-
Job
public Job(java.lang.String _username, java.lang.String _groupname, java.lang.String _type, java.lang.String _message, JobStatus _status, java.sql.Timestamp _submitted, java.sql.Timestamp _scheduledFor)
-
-
Method Detail
-
getId
@DocumentId public java.lang.Long getId()
The DB unique identifier for this object. You are not responsible for setting the id; however, it can be useful for creating "unloaded" versions of your objects. Each top-level entity contains an id field of type long. For all objects returned from the server, this value will be non-null, which doesn't necessarily hold for the other fields.
-
setId
public void setId(java.lang.Long id)
Description copied from interface:IObject
usually unneeded. Ids are managed by the backend.
-
getVersion
public java.lang.Integer getVersion()
This version number is controlled by the database for optimisitic locking.- Specified by:
getVersion
in interfaceIMutable
-
setVersion
public void setVersion(java.lang.Integer version)
Description copied from interface:IMutable
use with caution. In general, the version should only be altered by the backend. In the best case, an exception will be thrown for a version not equal to the current DB value. In the worst (though rare) case, the new version could match the database, and override optimistic lock checks that are supposed to prevent data loss.- Specified by:
setVersion
in interfaceIMutable
- Parameters:
version
- Value for this objects version.
-
getUsername
@Field(index=TOKENIZED) @Field(index=TOKENIZED,analyzer=@Analyzer(impl=ConfiguredAnalyzer.class),name="combined_fields") public java.lang.String getUsername()
Simple field ome.model.jobs.Job.username (java.lang.String)
-
setUsername
public void setUsername(java.lang.String username)
-
getGroupname
@Field(index=TOKENIZED) @Field(index=TOKENIZED,analyzer=@Analyzer(impl=ConfiguredAnalyzer.class),name="combined_fields") public java.lang.String getGroupname()
Simple field ome.model.jobs.Job.groupname (java.lang.String)
-
setGroupname
public void setGroupname(java.lang.String groupname)
-
getType
@Field(index=TOKENIZED) @Field(index=TOKENIZED,analyzer=@Analyzer(impl=ConfiguredAnalyzer.class),name="combined_fields") public java.lang.String getType()
Simple field ome.model.jobs.Job.type (java.lang.String)
-
setType
public void setType(java.lang.String type)
-
getMessage
@Field(index=TOKENIZED) @Field(index=TOKENIZED,analyzer=@Analyzer(impl=ConfiguredAnalyzer.class),name="combined_fields") public java.lang.String getMessage()
Simple field ome.model.jobs.Job.message (java.lang.String)
-
setMessage
public void setMessage(java.lang.String message)
-
getStatus
public JobStatus getStatus()
Many-to-one field ome.model.jobs.Job.status (ome.model.jobs.JobStatus)
-
setStatus
public void setStatus(JobStatus status)
-
getSubmitted
@DateBridge(resolution=MINUTE) @Fields(@Field(index=UN_TOKENIZED)) public java.sql.Timestamp getSubmitted()
Simple field ome.model.jobs.Job.submitted (java.sql.Timestamp)
-
setSubmitted
public void setSubmitted(java.sql.Timestamp submitted)
-
getScheduledFor
@DateBridge(resolution=MINUTE) @Fields(@Field(index=UN_TOKENIZED)) public java.sql.Timestamp getScheduledFor()
Simple field ome.model.jobs.Job.scheduledFor (java.sql.Timestamp)
-
setScheduledFor
public void setScheduledFor(java.sql.Timestamp scheduledFor)
-
getStarted
@DateBridge(resolution=MINUTE) @Fields(@Field(index=UN_TOKENIZED)) public java.sql.Timestamp getStarted()
Simple field ome.model.jobs.Job.started (java.sql.Timestamp)
-
setStarted
public void setStarted(java.sql.Timestamp started)
-
getFinished
@DateBridge(resolution=MINUTE) @Fields(@Field(index=UN_TOKENIZED)) public java.sql.Timestamp getFinished()
Simple field ome.model.jobs.Job.finished (java.sql.Timestamp)
-
setFinished
public void setFinished(java.sql.Timestamp finished)
-
getOriginalFileLinks
protected java.util.Set<JobOriginalFileLink> getOriginalFileLinks()
returns originalFileLinks . You should not modify this collection unless you know what you are doing. Use the iterate method instead. one-to-many Set ome.model.jobs.Job.originalFileLinks (ome.model.jobs.JobOriginalFileLink)
-
setOriginalFileLinks
protected void setOriginalFileLinks(java.util.Set<JobOriginalFileLink> originalFileLinks)
setter for originalFileLinks should be avoided. Does not fulfill normal semantics.
-
sizeOfOriginalFileLinks
public int sizeOfOriginalFileLinks()
returns the size of originalFileLinks. If less than zero, the Set was null.
-
iterateOriginalFileLinks
public java.util.Iterator<JobOriginalFileLink> iterateOriginalFileLinks()
should be used rather than accessing the originalFileLinks set directly. This method will never return null, but rather will return an instance ofEmptyIterator
. To test for a null collection, see ofsizeOfOriginalFileLinks()
is less than zero.
-
unmodifiableOriginalFileLinks
public java.util.Collection<JobOriginalFileLink> unmodifiableOriginalFileLinks()
Returns an unmodifiable collection-view
-
collectOriginalFileLinks
public <E> java.util.List<E> collectOriginalFileLinks(CBlock<E> block)
takes a CBlock and calls the block once for each ome.model.jobs.JobOriginalFileLink while collecting the results. Ifblock == null
, then the iterator values themselves are collected. This method usesiterateOriginalFileLinks()
internally and so will return a value even if the underlying collection is null.
-
addJobOriginalFileLink
public void addJobOriginalFileLink(JobOriginalFileLink target)
use instead of setOriginalFileLinks . Makes the necessary call on ome.model.jobs.JobOriginalFileLink as well.
-
addJobOriginalFileLinkSet
public void addJobOriginalFileLinkSet(java.util.Collection<JobOriginalFileLink> targets)
use like addJobOriginalFileLink.
-
removeJobOriginalFileLink
public void removeJobOriginalFileLink(JobOriginalFileLink target)
removes a single element from this set and makes the inverse call on ome.model.jobs.JobOriginalFileLink
-
removeJobOriginalFileLinkSet
public void removeJobOriginalFileLinkSet(java.util.Collection<JobOriginalFileLink> targets)
use like removeJobOriginalFileLink
-
linkOriginalFile
public JobOriginalFileLink linkOriginalFile(OriginalFile addition)
Adds a ome.model.jobs.JobOriginalFileLink to originalFileLinks . This entails changing our originalFileLinks Set, creating a new ome.model.jobs.JobOriginalFileLink and calling linkOriginalFile on the ome.model.core.OriginalFile.
-
addJobOriginalFileLink
public void addJobOriginalFileLink(JobOriginalFileLink link, boolean bothSides)
Adds a ome.model.jobs.JobOriginalFileLink to originalFileLinks, allowing for recursion -- whether or not addJobOriginalFileLink will be called on the addition if it is loaded
-
linkedOriginalFileIterator
public java.util.Iterator<OriginalFile> linkedOriginalFileIterator()
provides an iterator over the parent values of the originalFileLinks. Like with most Collection iterators, modifications to the underlying collection while iterating will result in anConcurrentModificationException
. UselinkedOriginalFileList()
instead.
-
findJobOriginalFileLink
public java.util.Set<JobOriginalFileLink> findJobOriginalFileLink(OriginalFile target)
find all ome.model.jobs.JobOriginalFileLink which have the argument as their child.
-
linkedOriginalFileList
public java.util.List<OriginalFile> linkedOriginalFileList()
produces aList
-copy of the underlying collection. Unlike,linkedOriginalFileIterator()
, while using the returnedList
, modifications can be made to the underlying collection without throwingConcurrentModificationException
.
-
eachLinkedOriginalFile
public <E> java.util.List<E> eachLinkedOriginalFile(CBlock<E> block)
takes a CBlock and calls the block once for each ome.model.core.OriginalFile while collecting the results. Ifblock == null
, then the iterator values themselves are collected.
-
unlinkOriginalFile
public void unlinkOriginalFile(OriginalFile removal)
unlinks all ome.model.core.OriginalFile instances from this instance.
-
removeJobOriginalFileLink
public void removeJobOriginalFileLink(JobOriginalFileLink link, boolean bothSides)
removes the given JobOriginalFileLink from originalFileLinks, allowing for recursion -- whether or not the removal will call unlinkJob again if loaded.
-
clearOriginalFileLinks
public void clearOriginalFileLinks()
clears the set.
-
setOriginalFileLinksCountPerOwner
protected void setOriginalFileLinksCountPerOwner(java.util.Map<java.lang.Long,java.lang.Long> map)
-
getOriginalFileLinksCountPerOwner
public java.util.Map<java.lang.Long,java.lang.Long> getOriginalFileLinksCountPerOwner()
If fetched, returns the count(*) of ome.model.jobs.JobOriginalFileLink that a user has. If unfetched, returns null. No entries in the collection should be null.
-
getDetails
public Details getDetails()
The details of this object correspond to low-level system information. Owner, permissions, Details is always guaranteed to be non-null, unless the user actively nulls it. Every entity also contains a Detail reference, which doesn't refer to a separate table but rather to a collection of fields collected into a Hibernate "component" which is embedded in the object. HQL queries which refer to the Details component cannot directly fetch the entity like this: select o from Object join fetch o.details but rather each field of the Details instance must be explicitly joined: select o from Object join fetch o.details.owner It should also be noted that not all types have all the fields which are present on Details. For example, select e from Experimenter e join fetch e.details.owner will fail. Experimenter has no owner, for obvious reasons. Note: subclasses of this class will return a subclass of theDetails
type.- Specified by:
getDetails
in interfaceIObject
-
setDetails
protected void setDetails(Details details)
-
isValid
public boolean isValid()
Description copied from interface:IObject
calls the class-specific validator for this instance and returns the value fromValidation.isValid()
-
validate
public Validation validate()
Description copied from interface:IObject
calls the class-specific validator for this instance and returns theValidation
object.
-
acceptFilter
public boolean acceptFilter(Filter __filter)
- Specified by:
acceptFilter
in interfaceFilterable
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
fields
public java.util.Set<java.lang.String> fields()
Description copied from interface:IObject
returns a Set of field names that belong to this class
-
retrieve
public java.lang.Object retrieve(java.lang.String field)
Description copied from interface:IObject
retrieves a value from this instance. Values forfield
which match a field of this instance will be delegated to the accessors. Otherwise, values will be retrieved from a lazy-loaded map filled by calls toIObject.putAt(String, Object)
-
putAt
public void putAt(java.lang.String field, java.lang.Object value)
Description copied from interface:IObject
stores a value in this instance. Values forfield
which match a field of this instance will be delegated to the accessors. Otherwise, values will be stored in a lazy-loaded map.
-
isLoaded
public boolean isLoaded()
Description copied from interface:IObject
transient field (not stored in the DB) which specifies whether this object has been loaded from the DB or is only a wrapper around the ID.
-
errorIfUnloaded
protected void errorIfUnloaded()
-
unload
public void unload()
Description copied from interface:IObject
set the loaded field to false, and set all non-ID fields to null. Subsequent calls to all accessors other than getId/setId will throw an ApiUsageException
-
getGraphHolder
public final GraphHolder getGraphHolder()
Description copied from interface:IObject
retrieves theGraphHolder
for this entity. If the GraphHolder has not been actively set, a new one will be instatiated.- Specified by:
getGraphHolder
in interfaceIObject
- Returns:
- Non-null GraphHolder
-
throwNullCollectionException
protected void throwNullCollectionException(java.lang.String propertyName)
-
-