@Transactional(rollbackFor={GenieException.class,GenieRuntimeException.class,javax.validation.ConstraintViolationException.class})
public class JpaCommandPersistenceServiceImpl
extends java.lang.Object
implements CommandPersistenceService
| Constructor and Description |
|---|
JpaCommandPersistenceServiceImpl(JpaTagPersistenceService tagPersistenceService,
JpaFilePersistenceService filePersistenceService,
JpaApplicationRepository applicationRepository,
JpaClusterRepository clusterRepository,
JpaCommandRepository commandRepository)
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addApplicationsForCommand(@NotBlank(message="No command id entered. Unable to add applications.") java.lang.String id,
@NotEmpty(message="No application ids entered. Unable to add applications.") java.util.List<java.lang.String> applicationIds)
Add applications for the command.
|
void |
addConfigsForCommand(@NotBlank(message="No command id entered. Unable to add configurations.") java.lang.String id,
@NotEmpty(message="No configuration files entered. Unable to add.") java.util.Set<java.lang.String> configs)
Add a configuration files to the command.
|
void |
addDependenciesForCommand(@NotBlank(message="No command id entered. Unable to add dependencies.") java.lang.String id,
@NotEmpty(message="No dependencies entered. Unable to add dependencies.") java.util.Set<java.lang.String> dependencies)
Add dependency files to the command.
|
void |
addTagsForCommand(@NotBlank(message="No command id entered. Unable to add tags.") java.lang.String id,
@NotEmpty(message="No tags entered. Unable to add.") java.util.Set<java.lang.String> tags)
Add tags to the command.
|
java.lang.String |
createCommand(@NotNull(message="No command entered. Unable to create.") @Valid CommandRequest request)
Create new command configuration.
|
void |
deleteAllCommands()
Delete all commands from database.
|
void |
deleteCommand(@NotBlank(message="No id entered. Unable to delete.") java.lang.String id)
Delete a command configuration from database.
|
java.util.List<Application> |
getApplicationsForCommand(@NotBlank(message="No command id entered. Unable to get applications.") java.lang.String id)
Get the applications for a given command.
|
java.util.Set<Cluster> |
getClustersForCommand(@NotBlank(message="No command id entered. Unable to get clusters.") java.lang.String id,
java.util.Set<ClusterStatus> statuses)
Get all the clusters the command with given id is associated with.
|
Command |
getCommand(@NotBlank(message="No id entered unable to get.") java.lang.String id)
Gets command configuration for given id.
|
org.springframework.data.domain.Page<Command> |
getCommands(java.lang.String name,
java.lang.String user,
java.util.Set<CommandStatus> statuses,
java.util.Set<java.lang.String> tags,
org.springframework.data.domain.Pageable page)
Get command configurations for given filter criteria.
|
java.util.Set<java.lang.String> |
getConfigsForCommand(@NotBlank(message="No command id entered. Unable to get configs.") java.lang.String id)
Get the set of configuration files associated with the command with given
id.
|
java.util.Set<java.lang.String> |
getDependenciesForCommand(@NotBlank(message="No command id entered. Unable to get dependencies.") java.lang.String id)
Get the set of dependency files associated with the command with given id.
|
java.util.Set<java.lang.String> |
getTagsForCommand(@NotBlank(message="No command id sent. Cannot retrieve tags.") java.lang.String id)
Get the set of tags associated with the command with given
id.
|
void |
patchCommand(@NotBlank java.lang.String id,
@NotNull com.github.fge.jsonpatch.JsonPatch patch)
Patch a command with the given json patch.
|
void |
removeAllConfigsForCommand(@NotBlank(message="No command id entered. Unable to remove configs.") java.lang.String id)
Remove all configuration files from the command.
|
void |
removeAllDependenciesForCommand(@NotBlank(message="No command id entered. Unable to remove dependencies.") java.lang.String id)
Remove all dependency files from the command.
|
void |
removeAllTagsForCommand(@NotBlank(message="No command id entered. Unable to remove tags.") java.lang.String id)
Remove all tags from the command.
|
void |
removeApplicationForCommand(@NotBlank(message="No command id entered. Unable to remove application.") java.lang.String id,
@NotBlank(message="No application id entered. Unable to remove application.") java.lang.String appId)
Remove the application from the command.
|
void |
removeApplicationsForCommand(@NotBlank(message="No command id entered. Unable to remove applications.") java.lang.String id)
Remove the applications from the command.
|
void |
removeConfigForCommand(@NotBlank(message="No command id entered. Unable to remove configuration.") java.lang.String id,
@NotBlank(message="No config entered. Unable to remove.") java.lang.String config)
Remove a configuration file from the command.
|
void |
removeDependencyForCommand(@NotBlank(message="No command id entered. Unable to remove dependency.") java.lang.String id,
@NotBlank(message="No dependency entered. Unable to remove dependency.") java.lang.String dependency)
Remove a dependency file from the command.
|
void |
removeTagForCommand(@NotBlank(message="No command id entered. Unable to remove tag.") java.lang.String id,
@NotBlank(message="No tag entered. Unable to remove.") java.lang.String tag)
Remove a tag from the command.
|
void |
setApplicationsForCommand(@NotBlank(message="No command id entered. Unable to set applications.") java.lang.String id,
@NotNull(message="No application ids entered. Unable to set applications.") java.util.List<java.lang.String> applicationIds)
Set the applications for the command.
|
void |
updateCommand(@NotBlank(message="No id entered. Unable to update.") java.lang.String id,
@NotNull(message="No command information entered. Unable to update.") @Valid Command updateCommand)
Update command configuration.
|
void |
updateConfigsForCommand(@NotBlank(message="No command id entered. Unable to update configurations.") java.lang.String id,
@NotEmpty(message="No configs entered. Unable to update.") java.util.Set<java.lang.String> configs)
Update the set of configuration files associated with the command with
given id.
|
void |
updateDependenciesForCommand(@NotBlank(message="No command id entered. Unable to update dependencies.") java.lang.String id,
@NotNull(message="No dependencies entered. Unable to update.") java.util.Set<java.lang.String> dependencies)
Update the set of dependency files associated with the command with given
id.
|
void |
updateTagsForCommand(@NotBlank(message="No command id entered. Unable to update tags.") java.lang.String id,
@NotEmpty(message="No tags entered. Unable to update.") java.util.Set<java.lang.String> tags)
Update the set of tags associated with the command with
given id.
|
public JpaCommandPersistenceServiceImpl(JpaTagPersistenceService tagPersistenceService, JpaFilePersistenceService filePersistenceService, JpaApplicationRepository applicationRepository, JpaClusterRepository clusterRepository, JpaCommandRepository commandRepository)
tagPersistenceService - The JpaTagPersistenceService to usefilePersistenceService - The JpaFilePersistenceService to useapplicationRepository - The JpaApplicationRepository to useclusterRepository - The JpaClusterRepository to usecommandRepository - The JpaCommandRepository to usepublic java.lang.String createCommand(@NotNull(message="No command entered. Unable to create.") @Valid
@NotNull(message="No command entered. Unable to create.") @Valid CommandRequest request)
throws GenieException
createCommand in interface CommandPersistenceServicerequest - encapsulates the command configuration information to
create. Not null. Valid.GenieException - if there is an error@Transactional(readOnly=true) public Command getCommand(@NotBlank(message="No id entered unable to get.") @NotBlank(message="No id entered unable to get.") java.lang.String id) throws GenieException
getCommand in interface CommandPersistenceServiceid - unique id for command configuration to get. Not null/empty.GenieException - if there is an error@Transactional(readOnly=true) public org.springframework.data.domain.Page<Command> getCommands(@Nullable java.lang.String name, @Nullable java.lang.String user, @Nullable java.util.Set<CommandStatus> statuses, @Nullable java.util.Set<java.lang.String> tags, org.springframework.data.domain.Pageable page)
getCommands in interface CommandPersistenceServicename - Name of command configuser - The name of the user who created the configurationstatuses - The status of the applications to get. Can be null.tags - tags allocated to this commandpage - The page of results to getpublic void updateCommand(@NotBlank(message="No id entered. Unable to update.")
@NotBlank(message="No id entered. Unable to update.") java.lang.String id,
@NotNull(message="No command information entered. Unable to update.") @Valid
@NotNull(message="No command information entered. Unable to update.") @Valid Command updateCommand)
throws GenieException
updateCommand in interface CommandPersistenceServiceid - The id of the command configuration to update. Not null or
empty.updateCommand - contains the information to update the command withGenieException - if there is an errorpublic void patchCommand(@NotBlank
@NotBlank java.lang.String id,
@NotNull
@NotNull com.github.fge.jsonpatch.JsonPatch patch)
throws GenieException
patchCommand in interface CommandPersistenceServiceid - The id of the command to updatepatch - The json patch to use to update the given commandGenieException - if there is an errorpublic void deleteAllCommands()
throws GenieException
deleteAllCommands in interface CommandPersistenceServiceGenieException - if there is an errorpublic void deleteCommand(@NotBlank(message="No id entered. Unable to delete.")
@NotBlank(message="No id entered. Unable to delete.") java.lang.String id)
throws GenieException
deleteCommand in interface CommandPersistenceServiceid - unique if of the command configuration to deleteGenieException - if there is an errorpublic void addConfigsForCommand(@NotBlank(message="No command id entered. Unable to add configurations.")
@NotBlank(message="No command id entered. Unable to add configurations.") java.lang.String id,
@NotEmpty(message="No configuration files entered. Unable to add.")
@NotEmpty(message="No configuration files entered. Unable to add.") java.util.Set<java.lang.String> configs)
throws GenieException
addConfigsForCommand in interface CommandPersistenceServiceid - The id of the command to add the configuration file to. Not
null/empty/blank.configs - The configuration files to add. Not null/empty.GenieException - if there is an error@Transactional(readOnly=true)
public java.util.Set<java.lang.String> getConfigsForCommand(@NotBlank(message="No command id entered. Unable to get configs.")
@NotBlank(message="No command id entered. Unable to get configs.") java.lang.String id)
throws GenieException
getConfigsForCommand in interface CommandPersistenceServiceid - The id of the command to get the configuration files for. Not
null/empty/blank.GenieException - if there is an errorpublic void updateConfigsForCommand(@NotBlank(message="No command id entered. Unable to update configurations.")
@NotBlank(message="No command id entered. Unable to update configurations.") java.lang.String id,
@NotEmpty(message="No configs entered. Unable to update.")
@NotEmpty(message="No configs entered. Unable to update.") java.util.Set<java.lang.String> configs)
throws GenieException
updateConfigsForCommand in interface CommandPersistenceServiceid - The id of the command to update the configuration files for.
Not null/empty/blank.configs - The configuration files to replace existing configurations
with. Not null/empty.GenieException - if there is an errorpublic void removeAllConfigsForCommand(@NotBlank(message="No command id entered. Unable to remove configs.")
@NotBlank(message="No command id entered. Unable to remove configs.") java.lang.String id)
throws GenieException
removeAllConfigsForCommand in interface CommandPersistenceServiceid - The id of the command to remove the configuration file from.
Not null/empty/blank.GenieException - if there is an errorpublic void removeConfigForCommand(@NotBlank(message="No command id entered. Unable to remove configuration.")
@NotBlank(message="No command id entered. Unable to remove configuration.") java.lang.String id,
@NotBlank(message="No config entered. Unable to remove.")
@NotBlank(message="No config entered. Unable to remove.") java.lang.String config)
throws GenieException
removeConfigForCommand in interface CommandPersistenceServiceid - The id of the command to remove the configuration file from.
Not null/empty/blank.config - The configuration file to remove. Not null/empty/blank.GenieException - if there is an errorpublic void addDependenciesForCommand(@NotBlank(message="No command id entered. Unable to add dependencies.")
@NotBlank(message="No command id entered. Unable to add dependencies.") java.lang.String id,
@NotEmpty(message="No dependencies entered. Unable to add dependencies.")
@NotEmpty(message="No dependencies entered. Unable to add dependencies.") java.util.Set<java.lang.String> dependencies)
throws GenieException
addDependenciesForCommand in interface CommandPersistenceServiceid - The id of the command to add the dependency file to. Not
null/empty/blank.dependencies - The dependency files to add. Not null.GenieException - if there is an error@Transactional(readOnly=true)
public java.util.Set<java.lang.String> getDependenciesForCommand(@NotBlank(message="No command id entered. Unable to get dependencies.")
@NotBlank(message="No command id entered. Unable to get dependencies.") java.lang.String id)
throws GenieException
getDependenciesForCommand in interface CommandPersistenceServiceid - The id of the command to get the dependency files for. Not
null/empty/blank.GenieException - if there is an errorpublic void updateDependenciesForCommand(@NotBlank(message="No command id entered. Unable to update dependencies.")
@NotBlank(message="No command id entered. Unable to update dependencies.") java.lang.String id,
@NotNull(message="No dependencies entered. Unable to update.")
@NotNull(message="No dependencies entered. Unable to update.") java.util.Set<java.lang.String> dependencies)
throws GenieException
updateDependenciesForCommand in interface CommandPersistenceServiceid - The id of the command to update the dependency files for. Not
null/empty/blank.dependencies - The dependency files to replace existing dependencies with. Not null/empty.GenieException - if there is an errorpublic void removeAllDependenciesForCommand(@NotBlank(message="No command id entered. Unable to remove dependencies.")
@NotBlank(message="No command id entered. Unable to remove dependencies.") java.lang.String id)
throws GenieException
removeAllDependenciesForCommand in interface CommandPersistenceServiceid - The id of the command to remove the configuration file
from. Not null/empty/blank.GenieException - if there is an errorpublic void removeDependencyForCommand(@NotBlank(message="No command id entered. Unable to remove dependency.")
@NotBlank(message="No command id entered. Unable to remove dependency.") java.lang.String id,
@NotBlank(message="No dependency entered. Unable to remove dependency.")
@NotBlank(message="No dependency entered. Unable to remove dependency.") java.lang.String dependency)
throws GenieException
removeDependencyForCommand in interface CommandPersistenceServiceid - The id of the command to remove the dependency file from. Not
null/empty/blank.dependency - The dependency file to remove. Not null/empty/blank.GenieException - if there is an errorpublic void addTagsForCommand(@NotBlank(message="No command id entered. Unable to add tags.")
@NotBlank(message="No command id entered. Unable to add tags.") java.lang.String id,
@NotEmpty(message="No tags entered. Unable to add.")
@NotEmpty(message="No tags entered. Unable to add.") java.util.Set<java.lang.String> tags)
throws GenieException
addTagsForCommand in interface CommandPersistenceServiceid - The id of the command to add the tags to. Not
null/empty/blank.tags - The tags to add. Not null/empty.GenieException - if there is an error@Transactional(readOnly=true)
public java.util.Set<java.lang.String> getTagsForCommand(@NotBlank(message="No command id sent. Cannot retrieve tags.")
@NotBlank(message="No command id sent. Cannot retrieve tags.") java.lang.String id)
throws GenieException
getTagsForCommand in interface CommandPersistenceServiceid - The id of the command to get the tags for. Not
null/empty/blank.GenieException - if there is an errorpublic void updateTagsForCommand(@NotBlank(message="No command id entered. Unable to update tags.")
@NotBlank(message="No command id entered. Unable to update tags.") java.lang.String id,
@NotEmpty(message="No tags entered. Unable to update.")
@NotEmpty(message="No tags entered. Unable to update.") java.util.Set<java.lang.String> tags)
throws GenieException
updateTagsForCommand in interface CommandPersistenceServiceid - The id of the command to update the tags for.
Not null/empty/blank.tags - The tags to replace existing tags
with. Not null/empty.GenieException - if there is an errorpublic void removeAllTagsForCommand(@NotBlank(message="No command id entered. Unable to remove tags.")
@NotBlank(message="No command id entered. Unable to remove tags.") java.lang.String id)
throws GenieException
removeAllTagsForCommand in interface CommandPersistenceServiceid - The id of the command to remove the tags from.
Not null/empty/blank.GenieException - if there is an errorpublic void removeTagForCommand(@NotBlank(message="No command id entered. Unable to remove tag.")
@NotBlank(message="No command id entered. Unable to remove tag.") java.lang.String id,
@NotBlank(message="No tag entered. Unable to remove.")
@NotBlank(message="No tag entered. Unable to remove.") java.lang.String tag)
throws GenieException
removeTagForCommand in interface CommandPersistenceServiceid - The id of the command to remove the tag from. Not
null/empty/blank.tag - The tag to remove. Not null/empty/blank.GenieException - if there is an errorpublic void addApplicationsForCommand(@NotBlank(message="No command id entered. Unable to add applications.")
@NotBlank(message="No command id entered. Unable to add applications.") java.lang.String id,
@NotEmpty(message="No application ids entered. Unable to add applications.")
@NotEmpty(message="No application ids entered. Unable to add applications.") java.util.List<java.lang.String> applicationIds)
throws GenieException
addApplicationsForCommand in interface CommandPersistenceServiceid - The id of the command to add the application file to. Not
null/empty/blank.applicationIds - The ids of the applications to add. Not null.GenieException - if there is an errorpublic void setApplicationsForCommand(@NotBlank(message="No command id entered. Unable to set applications.")
@NotBlank(message="No command id entered. Unable to set applications.") java.lang.String id,
@NotNull(message="No application ids entered. Unable to set applications.")
@NotNull(message="No application ids entered. Unable to set applications.") java.util.List<java.lang.String> applicationIds)
throws GenieException
setApplicationsForCommand in interface CommandPersistenceServiceid - The id of the command to add the application file to. Not
null/empty/blank.applicationIds - The ids of the applications to set. Not null.GenieException - if there is an error@Transactional(readOnly=true) public java.util.List<Application> getApplicationsForCommand(@NotBlank(message="No command id entered. Unable to get applications.") @NotBlank(message="No command id entered. Unable to get applications.") java.lang.String id) throws GenieException
getApplicationsForCommand in interface CommandPersistenceServiceid - The id of the command to get the application for. Not
null/empty/blank.GenieException - if there is an errorpublic void removeApplicationsForCommand(@NotBlank(message="No command id entered. Unable to remove applications.")
@NotBlank(message="No command id entered. Unable to remove applications.") java.lang.String id)
throws GenieException
removeApplicationsForCommand in interface CommandPersistenceServiceid - The id of the command to remove the application from. Not
null/empty/blank.GenieException - if there is an errorpublic void removeApplicationForCommand(@NotBlank(message="No command id entered. Unable to remove application.")
@NotBlank(message="No command id entered. Unable to remove application.") java.lang.String id,
@NotBlank(message="No application id entered. Unable to remove application.")
@NotBlank(message="No application id entered. Unable to remove application.") java.lang.String appId)
throws GenieException
removeApplicationForCommand in interface CommandPersistenceServiceid - The id of the command to remove the application from. Not null/empty/blank.appId - The id of the application to remove. Not null/empty/blankGenieException - if there is an error@Transactional(readOnly=true) public java.util.Set<Cluster> getClustersForCommand(@NotBlank(message="No command id entered. Unable to get clusters.") @NotBlank(message="No command id entered. Unable to get clusters.") java.lang.String id, @Nullable java.util.Set<ClusterStatus> statuses) throws GenieException
getClustersForCommand in interface CommandPersistenceServiceid - The id of the command to get the clusters for.statuses - The status of the clusters returnedGenieException - if there is an error