Class CommandEntity
- java.lang.Object
-
- com.netflix.genie.web.data.services.impl.jpa.entities.IdEntity
-
- com.netflix.genie.web.data.services.impl.jpa.entities.AuditEntity
-
- com.netflix.genie.web.data.services.impl.jpa.entities.UniqueIdEntity
-
- com.netflix.genie.web.data.services.impl.jpa.entities.BaseEntity
-
- com.netflix.genie.web.data.services.impl.jpa.entities.CommandEntity
-
- All Implemented Interfaces:
AuditProjection
,BaseProjection
,IdProjection
,SetupFileProjection
,UniqueIdProjection
,java.io.Serializable
@Entity public class CommandEntity extends BaseEntity
Representation of the state of the Command Object.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
APPLICATIONS_DTO_ENTITY_GRAPH
The name of theEntityGraph
which will eagerly load the command base fields and its associated applications dto fields.static java.lang.String
APPLICATIONS_ENTITY_GRAPH
The name of theEntityGraph
which will eagerly load the command base fields and its associated applications base fields.static java.lang.String
CLUSTER_CRITERIA_ENTITY_GRAPH
The name of theEntityGraph
which will eagerly load the command base fields and its associated cluster criteria.static java.lang.String
DTO_ENTITY_GRAPH
The name of theEntityGraph
which will eagerly load everything needed to construct a Command DTO.
-
Constructor Summary
Constructors Constructor Description CommandEntity()
Default Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addApplication(@NotNull ApplicationEntity application)
Append an application to the list of applications this command uses.void
addClusterCriterion(CriterionEntity criterion)
Add a new cluster criterion as the lowest priority criterion to evaluate for this command.void
addClusterCriterion(CriterionEntity criterion, int priority)
Add a new cluster criterion with the given priority.boolean
equals(java.lang.Object o)
java.util.Optional<com.fasterxml.jackson.databind.JsonNode>
getLauncherExt()
Get any metadata associated with this command pertaining to specifying details for various agent launchers.java.util.Optional<java.lang.Integer>
getMemory()
Get the default memory for a job using this command.int
hashCode()
void
removeApplication(@NotNull ApplicationEntity application)
Remove an application from this command.CriterionEntity
removeClusterCriterion(int priority)
Remove the criterion with the given priority from the list of available criterion for this command.void
setApplications(java.util.List<ApplicationEntity> applications)
Sets the applications for this command.void
setClusterCriteria(java.util.List<CriterionEntity> clusterCriteria)
Set the criteria, in priority order, that this command has for determining which available clusters to use for a job.void
setConfigs(java.util.Set<FileEntity> configs)
Set all the files associated as configuration files for this cluster.void
setDependencies(java.util.Set<FileEntity> dependencies)
Set all the files associated as dependency files for this cluster.void
setExecutable(@NotEmpty java.util.List<@NotBlank @Size(max=1024) java.lang.String> executable)
Set the executable and any default arguments for this command.void
setLauncherExt(com.fasterxml.jackson.databind.JsonNode launcherExt)
Set any metadata pertaining to additional instructions for various launchers if this command is used.void
setTags(java.util.Set<TagEntity> tags)
Set all the tags associated to this cluster.-
Methods inherited from class com.netflix.genie.web.data.services.impl.jpa.entities.BaseEntity
getDescription, getMetadata, getSetupFile, setDescription, setMetadata, setSetupFile
-
Methods inherited from class com.netflix.genie.web.data.services.impl.jpa.entities.AuditEntity
getCreated, getUpdated, onCreateBaseEntity, onUpdateBaseEntity
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.netflix.genie.web.data.services.impl.jpa.queries.projections.AuditProjection
getCreated, getUpdated
-
Methods inherited from interface com.netflix.genie.web.data.services.impl.jpa.queries.projections.BaseProjection
getName, getStatus, getUser, getVersion
-
Methods inherited from interface com.netflix.genie.web.data.services.impl.jpa.queries.projections.IdProjection
getId
-
Methods inherited from interface com.netflix.genie.web.data.services.impl.jpa.queries.projections.UniqueIdProjection
getUniqueId
-
-
-
-
Field Detail
-
APPLICATIONS_ENTITY_GRAPH
public static final java.lang.String APPLICATIONS_ENTITY_GRAPH
The name of theEntityGraph
which will eagerly load the command base fields and its associated applications base fields.- See Also:
- Constant Field Values
-
APPLICATIONS_DTO_ENTITY_GRAPH
public static final java.lang.String APPLICATIONS_DTO_ENTITY_GRAPH
The name of theEntityGraph
which will eagerly load the command base fields and its associated applications dto fields.- See Also:
- Constant Field Values
-
CLUSTER_CRITERIA_ENTITY_GRAPH
public static final java.lang.String CLUSTER_CRITERIA_ENTITY_GRAPH
The name of theEntityGraph
which will eagerly load the command base fields and its associated cluster criteria.- See Also:
- Constant Field Values
-
DTO_ENTITY_GRAPH
public static final java.lang.String DTO_ENTITY_GRAPH
The name of theEntityGraph
which will eagerly load everything needed to construct a Command DTO.- See Also:
- Constant Field Values
-
-
Method Detail
-
setExecutable
public void setExecutable(@NotEmpty @NotEmpty java.util.List<@NotBlank @Size(max=1024) java.lang.String> executable)
Set the executable and any default arguments for this command.- Parameters:
executable
- The executable and default arguments which can't be blank and there must be at least one
-
setConfigs
public void setConfigs(@Nullable java.util.Set<FileEntity> configs)
Set all the files associated as configuration files for this cluster.- Parameters:
configs
- The configuration files to set
-
setDependencies
public void setDependencies(@Nullable java.util.Set<FileEntity> dependencies)
Set all the files associated as dependency files for this cluster.- Parameters:
dependencies
- The dependency files to set
-
setTags
public void setTags(@Nullable java.util.Set<TagEntity> tags)
Set all the tags associated to this cluster.- Parameters:
tags
- The dependency tags to set
-
getMemory
public java.util.Optional<java.lang.Integer> getMemory()
Get the default memory for a job using this command.- Returns:
- Optional of Integer as it could be null
-
getLauncherExt
public java.util.Optional<com.fasterxml.jackson.databind.JsonNode> getLauncherExt()
Get any metadata associated with this command pertaining to specifying details for various agent launchers.- Returns:
- The metadata or
Optional.empty()
if there isn't any
-
setLauncherExt
public void setLauncherExt(@Nullable com.fasterxml.jackson.databind.JsonNode launcherExt)
Set any metadata pertaining to additional instructions for various launchers if this command is used.- Parameters:
launcherExt
- The metadata
-
setApplications
public void setApplications(@Nullable java.util.List<ApplicationEntity> applications) throws PreconditionFailedException
Sets the applications for this command.- Parameters:
applications
- The application that this command uses- Throws:
PreconditionFailedException
- if the list of applications contains duplicates
-
addApplication
public void addApplication(@NotNull @NotNull ApplicationEntity application) throws PreconditionFailedException
Append an application to the list of applications this command uses.- Parameters:
application
- The application to add. Not null.- Throws:
PreconditionFailedException
- If the application is a duplicate of an existing application
-
removeApplication
public void removeApplication(@NotNull @NotNull ApplicationEntity application)
Remove an application from this command. Manages both sides of relationship.- Parameters:
application
- The application to remove. Not null.
-
setClusterCriteria
public void setClusterCriteria(@Nullable java.util.List<CriterionEntity> clusterCriteria)
Set the criteria, in priority order, that this command has for determining which available clusters to use for a job.- Parameters:
clusterCriteria
- The cluster criteria
-
addClusterCriterion
public void addClusterCriterion(CriterionEntity criterion)
Add a new cluster criterion as the lowest priority criterion to evaluate for this command.- Parameters:
criterion
- TheCriterionEntity
to add
-
addClusterCriterion
public void addClusterCriterion(CriterionEntity criterion, int priority)
Add a new cluster criterion with the given priority.- Parameters:
criterion
- The new criterion to addpriority
- The priority with which this criterion should be considered. 0 would be the highest priority and anything greater than the current size of the existing criteria will just be added to the end of the list. If a priority of< 0
is passed in the criterion is added as the highest priority (0).
-
removeClusterCriterion
public CriterionEntity removeClusterCriterion(int priority) throws java.lang.IllegalArgumentException
Remove the criterion with the given priority from the list of available criterion for this command.- Parameters:
priority
- The priority of the criterion to remove.- Returns:
- The
CriterionEntity
which was removed by this operation - Throws:
java.lang.IllegalArgumentException
- If this value is< 0
or> {@link List#size()}
as it becomes unclear what the user wants to do
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classBaseEntity
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classBaseEntity
-
-