Package ubic.gemma.core.util
Class AbstractAutoSeekingCLI<T extends Auditable>
- java.lang.Object
-
- ubic.gemma.core.util.AbstractCLI
-
- ubic.gemma.core.util.AbstractAuthenticatedCLI
-
- ubic.gemma.core.util.AbstractAutoSeekingCLI<T>
-
- Type Parameters:
T
- the type of entity being seeked
- All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean
,CLI
- Direct Known Subclasses:
ArrayDesignSequenceManipulatingCli
,ExpressionExperimentManipulatingCLI
public abstract class AbstractAutoSeekingCLI<T extends Auditable> extends AbstractAuthenticatedCLI
Provide auto-seeking capabilities to a CLI.This allows CLIs to process entities that lack certain
AuditEvent
or that haven't been updated since a certain date.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface ubic.gemma.core.util.CLI
CLI.CommandGroup
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
FORCE_OPTION
-
Fields inherited from class ubic.gemma.core.util.AbstractCLI
ABORTED, FAILURE, FAILURE_FROM_ERROR_OBJECTS, log, SUCCESS
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractAutoSeekingCLI(Class<T> entityClass)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addAutoOption(org.apache.commons.cli.Options options)
Add the-auto
option.protected void
addAutoOption(org.apache.commons.cli.Options options, Class<? extends AuditEventType> autoSeekEventType)
Add the-auto
option for a specificAuditEventType
.protected void
addForceOption(org.apache.commons.cli.Options options)
protected void
addLimitingDateOption(org.apache.commons.cli.Options options)
Add the-mdate
option.protected Class<? extends AuditEventType>
getAutoSeekEventType()
Indicate the event to be used for auto-seeking.protected Date
getLimitingDate()
Obtain the limiting date (i.e. starting date at which entities should be processed).protected boolean
isAutoSeek()
Indicate if auto-seek is enabled.protected boolean
isForce()
Check if forcing is enabled.protected boolean
noNeedToRun(T auditable, Class<? extends AuditEventType> eventClass)
Check if the given auditable can be skipped.protected void
processOptions(org.apache.commons.cli.CommandLine commandLine)
Process command line options.protected void
setForce()
Enable the forcing mode.-
Methods inherited from class ubic.gemma.core.util.AbstractAuthenticatedCLI
afterPropertiesSet, createBatchTaskExecutorService, doAuthenticatedWork, doWork, setRequireLogin
-
Methods inherited from class ubic.gemma.core.util.AbstractCLI
abort, addBatchOption, addErrorObject, addErrorObject, addErrorObject, addSuccessObject, addSuccessObject, addThreadsOption, allowPositionalArguments, awaitBatchExecutorService, buildOptions, executeCommand, getBatchTaskExecutor, getCliContext, getCommandAliases, getCommandGroup, getCommandName, getHelpFooter, getNumThreads, getOptions, getShortDesc, getUsage, promptConfirmationOrAbort, setAllowPositionalArguments
-
-
-
-
Field Detail
-
FORCE_OPTION
protected static final String FORCE_OPTION
- See Also:
- Constant Field Values
-
-
Method Detail
-
addAutoOption
protected void addAutoOption(org.apache.commons.cli.Options options)
Add the-auto
option.The auto option value can be retrieved with
isAutoSeek()
.
-
addAutoOption
protected void addAutoOption(org.apache.commons.cli.Options options, Class<? extends AuditEventType> autoSeekEventType)
Add the-auto
option for a specificAuditEventType
.The event type can be retrieved with
getAutoSeekEventType()
.
-
addLimitingDateOption
protected void addLimitingDateOption(org.apache.commons.cli.Options options)
Add the-mdate
option.The limiting date can be retrieved with
getLimitingDate()
.
-
addForceOption
protected void addForceOption(org.apache.commons.cli.Options options)
-
isAutoSeek
protected boolean isAutoSeek()
Indicate if auto-seek is enabled.
-
getAutoSeekEventType
protected Class<? extends AuditEventType> getAutoSeekEventType()
Indicate the event to be used for auto-seeking.
-
getLimitingDate
@Nullable protected Date getLimitingDate()
Obtain the limiting date (i.e. starting date at which entities should be processed).
-
isForce
protected boolean isForce()
Check if forcing is enabled.
-
setForce
protected void setForce()
Enable the forcing mode.
-
processOptions
@OverridingMethodsMustInvokeSuper protected void processOptions(org.apache.commons.cli.CommandLine commandLine) throws org.apache.commons.cli.ParseException
Description copied from class:AbstractCLI
Process command line options.Implement this to provide processing of options. It is called after
AbstractCLI.buildOptions(Options)
and right beforeAbstractCLI.doWork()
.- Overrides:
processOptions
in classAbstractCLI
- Throws:
org.apache.commons.cli.ParseException
- in case of unrecoverable failure (i.e. missing option or invalid value), an exception can be raised and will result in an exit code ofAbstractCLI.FAILURE
.
-
noNeedToRun
protected boolean noNeedToRun(T auditable, @Nullable Class<? extends AuditEventType> eventClass)
Check if the given auditable can be skipped.- Parameters:
auditable
- auditableeventClass
- can be null- Returns:
- boolean
-
-