Class AbstractVcsTaskExporter
- java.lang.Object
-
- com.atlassian.bamboo.task.export.AbstractRepositoryAwareTaskExporter
-
- com.atlassian.bamboo.plugins.vcs.task.export.AbstractVcsTaskExporter
-
- All Implemented Interfaces:
TaskDefinitionExporter
- Direct Known Subclasses:
VcsBranchTaskExporter
,VcsCheckoutTaskExporter
,VcsCommitTaskExporter
,VcsPushTaskExporter
,VcsTagTaskExporter
public abstract class AbstractVcsTaskExporter extends AbstractRepositoryAwareTaskExporter implements TaskDefinitionExporter
Abstract exporter for all VCS-related tasks.
-
-
Field Summary
Fields Modifier and Type Field Description protected ProjectManager
projectManager
protected VcsRepositoryManager
vcsRepositoryManager
-
Fields inherited from class com.atlassian.bamboo.task.export.AbstractRepositoryAwareTaskExporter
repositoryDefinitionManager
-
-
Constructor Summary
Constructors Constructor Description AbstractVcsTaskExporter(@NotNull RepositoryDefinitionManager repositoryDefinitionManager, @NotNull VcsRepositoryManager vcsRepositoryManager, @NotNull ProjectManager projectManager)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected @NotNull Map<String,String>
baseVcsTaskToConfiguration(@NotNull TaskContainer taskContainer, @NotNull com.atlassian.bamboo.specs.api.model.task.TaskProperties taskProperties)
Implementation ofTaskDefinitionExporter.toTaskConfiguration(TaskContainer, TaskProperties)
for exporters ofBaseVcsTaskProperties
.protected <P extends com.atlassian.bamboo.specs.model.task.BaseVcsTaskProperties,B extends com.atlassian.bamboo.specs.builders.task.BaseVcsTask<B,P>>
BbaseVcsTaskToSpecsEntity(@NotNull TaskDefinition taskDefinition, B specsEntity)
Implementation ofTaskDefinitionExporter.toSpecsEntity(TaskDefinition)
for exporters ofBaseVcsTaskProperties
.protected @NotNull List<com.atlassian.bamboo.specs.api.validators.common.ValidationProblem>
baseVcsTaskValidate(@NotNull TaskValidationContext taskValidationContext, @NotNull com.atlassian.bamboo.specs.api.model.task.TaskProperties taskProperties)
Implementation ofTaskDefinitionExporter.validate(TaskValidationContext, TaskProperties)
for exporters ofBaseVcsTaskProperties
.protected <T> T
getTypedTaskProperties(@NotNull com.atlassian.bamboo.specs.api.model.task.TaskProperties taskProperties, @NotNull Class<T> expectedClass)
Get task properties as an instance of the given class if possible.protected abstract @NotNull com.atlassian.bamboo.specs.api.validators.common.ValidationContext
getValidationContext()
Get validation context for this task type.protected boolean
isDefaultRepositoryRef(@NotNull String repositorySelector, @NotNull Map<String,String> configuration)
Whether the given repository identifier points to a default repository of a plan.protected abstract boolean
isRepositoryTypeSupported(@NotNull VcsRepositoryModuleDescriptor moduleDescriptor)
Returns true if the given repository type is supported by this task type.-
Methods inherited from class com.atlassian.bamboo.task.export.AbstractRepositoryAwareTaskExporter
getNonDefaultRepositoryRef, getNonDefaultRepositoryRef, getRepositoryIdString, getRepositoryListForTaskContainer, isDefaultRepositoryRef
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.atlassian.bamboo.task.export.TaskDefinitionExporter
fromYaml, toSpecsEntity, toSpecsEntity, toTaskConfiguration, toTaskConfiguration, toTaskConfiguration, toYaml, validate
-
-
-
-
Field Detail
-
vcsRepositoryManager
protected final VcsRepositoryManager vcsRepositoryManager
-
projectManager
protected final ProjectManager projectManager
-
-
Constructor Detail
-
AbstractVcsTaskExporter
public AbstractVcsTaskExporter(@NotNull @NotNull RepositoryDefinitionManager repositoryDefinitionManager, @NotNull @NotNull VcsRepositoryManager vcsRepositoryManager, @NotNull @NotNull ProjectManager projectManager)
-
-
Method Detail
-
getValidationContext
@NotNull protected abstract @NotNull com.atlassian.bamboo.specs.api.validators.common.ValidationContext getValidationContext()
Get validation context for this task type.
-
isRepositoryTypeSupported
protected abstract boolean isRepositoryTypeSupported(@NotNull @NotNull VcsRepositoryModuleDescriptor moduleDescriptor)
Returns true if the given repository type is supported by this task type.
-
isDefaultRepositoryRef
protected boolean isDefaultRepositoryRef(@NotNull @NotNull String repositorySelector, @NotNull @NotNull Map<String,String> configuration)
Whether the given repository identifier points to a default repository of a plan.- Parameters:
repositorySelector
- key to select repository identifier from the configurationconfiguration
- task configuration- Returns:
- true if the repository identifier points to a default plan's repository
-
baseVcsTaskToConfiguration
@NotNull protected @NotNull Map<String,String> baseVcsTaskToConfiguration(@NotNull @NotNull TaskContainer taskContainer, @NotNull @NotNull com.atlassian.bamboo.specs.api.model.task.TaskProperties taskProperties)
Implementation ofTaskDefinitionExporter.toTaskConfiguration(TaskContainer, TaskProperties)
for exporters ofBaseVcsTaskProperties
.
-
baseVcsTaskToSpecsEntity
@NotNull protected <P extends com.atlassian.bamboo.specs.model.task.BaseVcsTaskProperties,B extends com.atlassian.bamboo.specs.builders.task.BaseVcsTask<B,P>> B baseVcsTaskToSpecsEntity(@NotNull @NotNull TaskDefinition taskDefinition, @NotNull B specsEntity)
Implementation ofTaskDefinitionExporter.toSpecsEntity(TaskDefinition)
for exporters ofBaseVcsTaskProperties
.
-
baseVcsTaskValidate
@NotNull protected @NotNull List<com.atlassian.bamboo.specs.api.validators.common.ValidationProblem> baseVcsTaskValidate(@NotNull @NotNull TaskValidationContext taskValidationContext, @NotNull @NotNull com.atlassian.bamboo.specs.api.model.task.TaskProperties taskProperties)
Implementation ofTaskDefinitionExporter.validate(TaskValidationContext, TaskProperties)
for exporters ofBaseVcsTaskProperties
.
-
getTypedTaskProperties
@NotNull protected <T> T getTypedTaskProperties(@NotNull @NotNull com.atlassian.bamboo.specs.api.model.task.TaskProperties taskProperties, @NotNull @NotNull Class<T> expectedClass)
Get task properties as an instance of the given class if possible.- Parameters:
taskProperties
- generic task properties, not yet typed properlyexpectedClass
- expected class of the task properties- Returns:
- typed task properties
- Throws:
IllegalStateException
- if the task properties are of an incorrect, unsupported type
-
-