Job

public abstract class Job

This is a Job.

Fields

allClasses

static HashMap<String, Class<? extends Job>> allClasses

All known Job classes, by name (actually lowercase getSimpleName()).

Constructors

Job

protected Job()

Methods

appendJob

protected ScheduledJob appendJob(Class<? extends Job> clazz)

appendJob

protected ScheduledJob appendJob(EntityInterface entity, Class<? extends Job> clazz)

equals

public boolean equals(Object obj)

execute

protected <K extends BackendTransaction> K execute(K t)

getCache

protected <S, T> Map<S, T> getCache(String name)

getContainer

protected TransactionContainer getContainer()

getEntity

public EntityInterface getEntity()

getEntityById

protected EntityInterface getEntityById(EntityID id)

getEntityByName

protected EntityInterface getEntityByName(String name)

getFailureSeverity

protected final JobFailureSeverity getFailureSeverity()

getJob

public static Job getJob(String job, JobFailureSeverity severiy, EntityInterface entity, Transaction<? extends TransactionContainer> transaction)

Create a Job object with the given parameters.

This static method is used by other classes to create Job objects, instead of the private constructor.

Returns:

The generated Job object.

getRequestId

protected String getRequestId()

getTarget

public abstract JobTarget getTarget()

getTransaction

public Transaction<? extends TransactionContainer> getTransaction()

getTransactionStage

public TransactionStage getTransactionStage()

getUser

protected Subject getUser()

hashCode

public int hashCode()

init

public final Job init(JobFailureSeverity severity, EntityInterface entity, Transaction<? extends TransactionContainer> transaction)

isSubType

protected final boolean isSubType(EntityInterface child, EntityInterface targetParent)

Check if an entity (‘child’) is a direct or indirect child of another entity (‘targetParent’).

This assumes that the parent has either an id (persistent or temporary) or a name.

If the targetParent is not in the set of parents of the child, this method iterates through the direct parents of the child.

If both entities are part of this transaction, they are resolved within this transaction. Otherwise they are fetched from the database backend or the whole evaluation takes place in the backend (if both have persistent ids and are not part of this transaction).

If both entities have the same id or name, the return value is true without any further checks.

Parameters:
  • child – the child entity

  • targetParent – the parent entity

Throws:
Returns:

true iff targetParent is a direct or indirect parent of the child or when the ids or names match.

isValidSubType

protected final boolean isValidSubType(EntityID child, EntityID parent)

loadDataTypeSpecificJobs

protected List<Job> loadDataTypeSpecificJobs()

loadDataTypeSpecificJobs

public List<Job> loadDataTypeSpecificJobs(EntityInterface entity, Transaction<? extends TransactionContainer> transaction)

loadJobs

public List<Job> loadJobs(EntityInterface entity, Transaction<? extends TransactionContainer> transaction)

loadPermanentContainerJobs

public static List<Job> loadPermanentContainerJobs(Transaction<?> transaction)

Return those matching jobs which are annotated with the “loadAlways” attribute.

Returns:

A list with the jobs.

loadStandardJobs

public List<Job> loadStandardJobs(EntityInterface entity, Transaction<? extends TransactionContainer> transaction)

resolve

protected EntityInterface resolve(EntityInterface entity)

Resolve an entity (which might only be specified by it’s name or id) to its full representation (with properties, parents and all).

Parameters:
  • entity – the entity to be resolved.

Throws:
Returns:

the resolved entity.

resolve

protected EntityInterface resolve(EntityID id)

resolve

protected EntityInterface resolve(EntityID id, String name, String versionId)

resolve

protected EntityInterface resolve(EntityID id, String name, Version version)

retrieveValidIDByName

protected final EntityID retrieveValidIDByName(String name, String version)

run

protected abstract void run()

to be overridden

runJobFromSchedule

protected void runJobFromSchedule(EntityInterface entity, Class<? extends Job> jobclass)

setFailureSeverity

protected final void setFailureSeverity(JobFailureSeverity severiy)

toString

public String toString()