@Transactional(rollbackFor={GenieException.class,javax.validation.ConstraintViolationException.class})
public class JpaApplicationServiceImpl
extends java.lang.Object
implements ApplicationService
| Constructor and Description |
|---|
JpaApplicationServiceImpl(JpaApplicationRepository applicationRepo,
JpaCommandRepository commandRepo)
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addConfigsToApplication(java.lang.String id,
java.util.Set<java.lang.String> configs)
Add a configuration file to the application.
|
void |
addDependenciesForApplication(java.lang.String id,
java.util.Set<java.lang.String> dependencies)
Add dependency files to the application.
|
void |
addTagsForApplication(java.lang.String id,
java.util.Set<java.lang.String> tags)
Add tags to the application.
|
java.lang.String |
createApplication(Application app)
Create new application.
|
void |
deleteAllApplications()
Delete all applications from database.
|
void |
deleteApplication(java.lang.String id)
Delete an application configuration from database.
|
Application |
getApplication(java.lang.String id)
Gets application for given id.
|
org.springframework.data.domain.Page<Application> |
getApplications(java.lang.String name,
java.lang.String user,
java.util.Set<ApplicationStatus> statuses,
java.util.Set<java.lang.String> tags,
java.lang.String type,
org.springframework.data.domain.Pageable page)
Get applications for given filter criteria.
|
java.util.Set<Command> |
getCommandsForApplication(java.lang.String id,
java.util.Set<CommandStatus> statuses)
Get all the commands the application with given id is associated with.
|
java.util.Set<java.lang.String> |
getConfigsForApplication(java.lang.String id)
Get the set of configuration files associated with the application with
given id.
|
java.util.Set<java.lang.String> |
getDependenciesForApplication(java.lang.String id)
Get the set of dependency files associated with the application with given id.
|
java.util.Set<java.lang.String> |
getTagsForApplication(java.lang.String id)
Get the set of tags associated with the application with given
id.
|
void |
patchApplication(java.lang.String id,
com.github.fge.jsonpatch.JsonPatch patch)
Patch an application with the given json patch.
|
void |
removeAllConfigsForApplication(java.lang.String id)
Remove all configuration files from the application.
|
void |
removeAllDependenciesForApplication(java.lang.String id)
Remove all dependency files from the application.
|
void |
removeAllTagsForApplication(java.lang.String id)
Remove all tags from the application.
|
void |
removeConfigForApplication(java.lang.String id,
java.lang.String config)
Remove a configuration file from the application.
|
void |
removeDependencyForApplication(java.lang.String id,
java.lang.String dependency)
Remove a dependency file from the application.
|
void |
removeTagForApplication(java.lang.String id,
java.lang.String tag)
Remove a tag from the application.
|
void |
updateApplication(java.lang.String id,
Application updateApp)
Update an application.
|
void |
updateConfigsForApplication(java.lang.String id,
java.util.Set<java.lang.String> configs)
Update the set of configuration files associated with the application
with given id.
|
void |
updateDependenciesForApplication(java.lang.String id,
java.util.Set<java.lang.String> dependencies)
Update the set of dependency files associated with the application with given
id.
|
void |
updateTagsForApplication(java.lang.String id,
java.util.Set<java.lang.String> tags)
Update the set of tags associated with the application with
given id.
|
public JpaApplicationServiceImpl(JpaApplicationRepository applicationRepo, JpaCommandRepository commandRepo)
applicationRepo - The application repository to usecommandRepo - The command repository to usepublic java.lang.String createApplication(@NotNull(message="No application entered to create.")
Application app)
throws GenieException
createApplication in interface ApplicationServiceapp - The application configuration to createGenieException - if there is an error@Transactional(readOnly=true) public Application getApplication(@NotBlank(message="No id entered. Unable to get") java.lang.String id) throws GenieException
getApplication in interface ApplicationServiceid - unique id for application configuration to get. Not null/empty.GenieException - if there is an error@Transactional(readOnly=true) public org.springframework.data.domain.Page<Application> getApplications(java.lang.String name, java.lang.String user, java.util.Set<ApplicationStatus> statuses, java.util.Set<java.lang.String> tags, java.lang.String type, org.springframework.data.domain.Pageable page)
getApplications in interface ApplicationServicename - Name of application. Can be null or empty.user - The user who created the application. Can be null/emptystatuses - The statuses of the applications to find. Can be null.tags - Tags allocated to this applicationtype - The type of the application to findpage - The page requested from the search resultspublic void updateApplication(@NotBlank(message="No application id entered. Unable to update.")
java.lang.String id,
@NotNull(message="No application information entered. Unable to update.")
Application updateApp)
throws GenieException
updateApplication in interface ApplicationServiceid - The id of the application configuration to updateupdateApp - Information to update for the application configuration
withGenieException - if there is an errorpublic void patchApplication(@NotBlank
java.lang.String id,
@NotNull
com.github.fge.jsonpatch.JsonPatch patch)
throws GenieException
patchApplication in interface ApplicationServiceid - The id of the application to updatepatch - The json patch to use to update the given applicationGenieException - if there is an errorpublic void deleteAllApplications()
throws GenieException
deleteAllApplications in interface ApplicationServiceGenieException - if there is an errorpublic void deleteApplication(@NotBlank(message="No application id entered. Unable to delete.")
java.lang.String id)
throws GenieException
deleteApplication in interface ApplicationServiceid - unique id of application configuration to deleteGenieException - if there is an errorpublic void addConfigsToApplication(@NotBlank(message="No application id entered. Unable to add configurations.")
java.lang.String id,
@NotEmpty(message="No configuration files entered.")
java.util.Set<java.lang.String> configs)
throws GenieException
addConfigsToApplication in interface ApplicationServiceid - The id of the application 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> getConfigsForApplication(@NotBlank(message="No application id entered. Unable to get configs.")
java.lang.String id)
throws GenieException
getConfigsForApplication in interface ApplicationServiceid - The id of the application to get the configuration files for.
Not null/empty/blank.GenieException - if there is an errorpublic void updateConfigsForApplication(@NotBlank(message="No application id entered. Unable to update configurations.")
java.lang.String id,
@NotNull(message="No configs entered. Unable to update. If you want, use delete API.")
java.util.Set<java.lang.String> configs)
throws GenieException
updateConfigsForApplication in interface ApplicationServiceid - The id of the application 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 removeAllConfigsForApplication(@NotBlank(message="No application id entered. Unable to remove configs.")
java.lang.String id)
throws GenieException
removeAllConfigsForApplication in interface ApplicationServiceid - The id of the application to remove the configuration file
from. Not null/empty/blank.GenieException - if there is an errorpublic void removeConfigForApplication(@NotBlank(message="No application id entered. Unable to remove configuration.")
java.lang.String id,
@NotBlank(message="No config entered. Unable to remove.")
java.lang.String config)
throws GenieException
removeConfigForApplication in interface ApplicationServiceid - The id of the application 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 addDependenciesForApplication(@NotBlank(message="No application 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)
throws GenieException
addDependenciesForApplication in interface ApplicationServiceid - The id of the application 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> getDependenciesForApplication(@NotBlank(message="No application id entered. Unable to get dependencies.")
java.lang.String id)
throws GenieException
getDependenciesForApplication in interface ApplicationServiceid - The id of the application to get the dependency files for. Not
null/empty/blank.GenieException - if there is an errorpublic void updateDependenciesForApplication(@NotBlank(message="No application 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)
throws GenieException
updateDependenciesForApplication in interface ApplicationServiceid - The id of the application 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 removeAllDependenciesForApplication(@NotBlank(message="No application id entered. Unable to remove dependencies.")
java.lang.String id)
throws GenieException
removeAllDependenciesForApplication in interface ApplicationServiceid - The id of the application to remove the configuration file
from. Not null/empty/blank.GenieException - if there is an errorpublic void removeDependencyForApplication(@NotBlank(message="No application id entered. Unable to remove dependency.")
java.lang.String id,
@NotBlank(message="No dependency entered. Unable to remove dependency.")
java.lang.String dependency)
throws GenieException
removeDependencyForApplication in interface ApplicationServiceid - The id of the application 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 addTagsForApplication(@NotBlank(message="No application 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)
throws GenieException
addTagsForApplication in interface ApplicationServiceid - The id of the application 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> getTagsForApplication(@NotBlank(message="No application id entered. Cannot retrieve tags.")
java.lang.String id)
throws GenieException
getTagsForApplication in interface ApplicationServiceid - The id of the application to get the tags for. Not
null/empty/blank.GenieException - if there is an errorpublic void updateTagsForApplication(@NotBlank(message="No application id entered. Unable to update tags.")
java.lang.String id,
@NotNull(message="No tags entered unable to update tags.")
java.util.Set<java.lang.String> tags)
throws GenieException
updateTagsForApplication in interface ApplicationServiceid - The id of the application 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 removeAllTagsForApplication(@NotBlank(message="No application id entered. Unable to remove tags.")
java.lang.String id)
throws GenieException
removeAllTagsForApplication in interface ApplicationServiceid - The id of the application to remove the tags from.
Not null/empty/blank.GenieException - if there is an errorpublic void removeTagForApplication(@NotBlank(message="No application id entered. Unable to remove tag.")
java.lang.String id,
@NotBlank(message="No tag entered. Unable to remove.")
java.lang.String tag)
throws GenieException
removeTagForApplication in interface ApplicationServiceid - The id of the application to remove the tag from. Not
null/empty/blank.tag - The tag to remove. Not null/empty/blank.GenieException - if there is an error@Transactional(readOnly=true) public java.util.Set<Command> getCommandsForApplication(@NotBlank(message="No application id entered. Unable to get commands.") java.lang.String id, java.util.Set<CommandStatus> statuses) throws GenieException
getCommandsForApplication in interface ApplicationServiceid - The id of the application to get the commands for.statuses - The status of the commands returnedGenieException - if there is an error