Class ArtifactDefinitionManagerImpl
java.lang.Object
com.atlassian.bamboo.plan.artifact.ArtifactDefinitionManagerImpl
- All Implemented Interfaces:
ArtifactDefinitionManager
-
Constructor Summary
ConstructorDescriptionArtifactDefinitionManagerImpl
(ArtifactDefinitionDao artifactDefinitionDao, com.atlassian.event.api.EventPublisher eventPublisher) -
Method Summary
Modifier and TypeMethodDescription@NotNull Map<ArtifactDefinition,
ArtifactDefinition> cloneArtifactDefinitions
(@NotNull Job sourcePlan, @NotNull Job targetPlan) @NotNull Map<ArtifactDefinition,
ArtifactDefinition> cloneArtifactDefinitions
(@NotNull Job sourcePlan, @NotNull Job targetPlan, boolean preserveSharedFlag) @Nullable ArtifactDefinition
findArtifactDefinition
(long id) Get artifact definition of specified id@Nullable ArtifactDefinition
findArtifactDefinition
(@NotNull ImmutablePlan plan, @NotNull String label) Get artifact definition associated with a plan of a given label@Nullable ArtifactDefinition
findArtifactDefinitionByChain
(@NotNull ImmutablePlan plan, @NotNull String label) @NotNull List<ArtifactDefinition>
findArtifactDefinitionsByPlan
(@NotNull ImmutablePlan plan) Get list of artifact definitions associated with a specific plan.@NotNull List<ArtifactDefinition>
findSharedArtifactsByChain
(@NotNull ImmutableChain chain) Find all shared artifacts that exist for a particular chain (looks through all jobs).@NotNull Multimap<? extends ImmutableJob,
ArtifactDefinition> getArtifactDefinitionsByJob
(@NotNull ImmutableChain chain, Predicate<ArtifactDefinitionBase> predicate) GetArtifactDefinition
grouped byJob
boolean
isArtifactDefinitionNameUniqueInChain
(@NotNull ArtifactDefinition artifactDefinition) Test if artifact definition's name is unique within a chain that producer plan belongs to.boolean
isArtifactDefinitionNameUniqueInJob
(@NotNull ArtifactDefinition artifactDefinition) Test if artifact definition's name is unique within a producer job.void
removeArtifactDefinition
(@NotNull ArtifactDefinition artifactDefinition) Remove artifact definition.void
removeArtifactDefinitionsByPlan
(@NotNull ImmutablePlan plan) Remove all artifact definitions associated with a plan.void
saveArtifactDefinition
(@NotNull ArtifactDefinition artifactDefinition) Save/update artifact definition.void
saveArtifactDefinitions
(@NotNull Collection<ArtifactDefinition> artifactDefinitions) Save all artifact definitions in a collection.
-
Constructor Details
-
ArtifactDefinitionManagerImpl
public ArtifactDefinitionManagerImpl(ArtifactDefinitionDao artifactDefinitionDao, com.atlassian.event.api.EventPublisher eventPublisher)
-
-
Method Details
-
findArtifactDefinition
Description copied from interface:ArtifactDefinitionManager
Get artifact definition of specified id- Specified by:
findArtifactDefinition
in interfaceArtifactDefinitionManager
- Parameters:
id
- id of artifact definition- Returns:
- artifact definition of specified id or null if not found
-
findArtifactDefinition
@Nullable public @Nullable ArtifactDefinition findArtifactDefinition(@NotNull @NotNull ImmutablePlan plan, @NotNull @NotNull String label) Description copied from interface:ArtifactDefinitionManager
Get artifact definition associated with a plan of a given label- Specified by:
findArtifactDefinition
in interfaceArtifactDefinitionManager
- Parameters:
plan
- plan which associated artifact definition should be retrievedlabel
- label to search among plan's artifact definitions- Returns:
- artifact definition matching plan and label or null if not found
-
findArtifactDefinitionByChain
@Nullable public @Nullable ArtifactDefinition findArtifactDefinitionByChain(@NotNull @NotNull ImmutablePlan plan, @NotNull @NotNull String label) - Specified by:
findArtifactDefinitionByChain
in interfaceArtifactDefinitionManager
-
findArtifactDefinitionsByPlan
@NotNull public @NotNull List<ArtifactDefinition> findArtifactDefinitionsByPlan(@NotNull @NotNull ImmutablePlan plan) Description copied from interface:ArtifactDefinitionManager
Get list of artifact definitions associated with a specific plan. (Does not recurse into children. i.e. if passed a chain, wont look at jobs)- Specified by:
findArtifactDefinitionsByPlan
in interfaceArtifactDefinitionManager
- Parameters:
plan
- plan which associated artifact definitions should be retrieved- Returns:
- list of artifact definitions
-
removeArtifactDefinition
Description copied from interface:ArtifactDefinitionManager
Remove artifact definition.- Specified by:
removeArtifactDefinition
in interfaceArtifactDefinitionManager
- Parameters:
artifactDefinition
-ArtifactDefinition
to be removed
-
removeArtifactDefinitionsByPlan
Description copied from interface:ArtifactDefinitionManager
Remove all artifact definitions associated with a plan.- Specified by:
removeArtifactDefinitionsByPlan
in interfaceArtifactDefinitionManager
- Parameters:
plan
- plan which associated artifact definitions should be removed
-
saveArtifactDefinition
Description copied from interface:ArtifactDefinitionManager
Save/update artifact definition. This method will generate appropriate event for saved/updated artifactDefinition.- Specified by:
saveArtifactDefinition
in interfaceArtifactDefinitionManager
- Parameters:
artifactDefinition
- object to be saved/updated
-
saveArtifactDefinitions
public void saveArtifactDefinitions(@NotNull @NotNull Collection<ArtifactDefinition> artifactDefinitions) Description copied from interface:ArtifactDefinitionManager
Save all artifact definitions in a collection. This method will generate event for each newly created artifact in the list.- Specified by:
saveArtifactDefinitions
in interfaceArtifactDefinitionManager
- Parameters:
artifactDefinitions
- collection of objects to be saved/updated
-
cloneArtifactDefinitions
@NotNull public @NotNull Map<ArtifactDefinition,ArtifactDefinition> cloneArtifactDefinitions(@NotNull @NotNull Job sourcePlan, @NotNull @NotNull Job targetPlan) Description copied from interface:ArtifactDefinitionManager
Creates artifact definitions objects for aBuildable
plan based according to definitions associated with inputBuildable
plan. This method does not persist the objects. SharedArtifact flags are copied.- Specified by:
cloneArtifactDefinitions
in interfaceArtifactDefinitionManager
- Parameters:
sourcePlan
- plan which associated artifact definitions should be clonedtargetPlan
- plan for which artifacts should be created- Returns:
- map of original and cloned artifact definitions
-
cloneArtifactDefinitions
@NotNull public @NotNull Map<ArtifactDefinition,ArtifactDefinition> cloneArtifactDefinitions(@NotNull @NotNull Job sourcePlan, @NotNull @NotNull Job targetPlan, boolean preserveSharedFlag) Description copied from interface:ArtifactDefinitionManager
Creates artifact definitions objects for aBuildable
plan based according to definitions associated with inputBuildable
plan. This method does not persist the objects.- Specified by:
cloneArtifactDefinitions
in interfaceArtifactDefinitionManager
- Parameters:
sourcePlan
- plan which associated artifact definitions should be clonedtargetPlan
- plan for which artifacts should be createdpreserveSharedFlag
- false will degrade all the artifacts to job level artifacts- Returns:
- map of original and cloned artifact definitions
-
isArtifactDefinitionNameUniqueInChain
public boolean isArtifactDefinitionNameUniqueInChain(@NotNull @NotNull ArtifactDefinition artifactDefinition) Description copied from interface:ArtifactDefinitionManager
Test if artifact definition's name is unique within a chain that producer plan belongs to. That check is performed only ifImmutableArtifactDefinitionBase.isSharedArtifact()
returns true. IfImmutableArtifactDefinitionBase.isSharedArtifact()
returns false this method will always return true.- Specified by:
isArtifactDefinitionNameUniqueInChain
in interfaceArtifactDefinitionManager
- Parameters:
artifactDefinition
- artifact definition to be validated- Returns:
- true if name is unique or sharedArtifact flag is set to false
-
isArtifactDefinitionNameUniqueInJob
public boolean isArtifactDefinitionNameUniqueInJob(@NotNull @NotNull ArtifactDefinition artifactDefinition) Description copied from interface:ArtifactDefinitionManager
Test if artifact definition's name is unique within a producer job.- Specified by:
isArtifactDefinitionNameUniqueInJob
in interfaceArtifactDefinitionManager
- Parameters:
artifactDefinition
- artifact definition to be validated- Returns:
- true if name is unique
-
getArtifactDefinitionsByJob
@NotNull public @NotNull Multimap<? extends ImmutableJob,ArtifactDefinition> getArtifactDefinitionsByJob(@NotNull @NotNull ImmutableChain chain, Predicate<ArtifactDefinitionBase> predicate) GetArtifactDefinition
grouped byJob
- Specified by:
getArtifactDefinitionsByJob
in interfaceArtifactDefinitionManager
- Parameters:
chain
-predicate
- for filtering definition types- Returns:
-