Class ArtifactSubscriptionManagerImpl
java.lang.Object
com.atlassian.bamboo.plan.artifact.ArtifactSubscriptionManagerImpl
- All Implemented Interfaces:
ArtifactSubscriptionManager
-
Field Summary
Fields inherited from interface com.atlassian.bamboo.plan.artifact.ArtifactSubscriptionManager
BAMBOO_ARTIFACTS_PATH_VARIABLE
-
Constructor Summary
ConstructorDescriptionArtifactSubscriptionManagerImpl
(ArtifactDefinitionManager artifactDefinitionManager, ArtifactSubscriptionDao artifactSubscriptionDao, ConsumedSubscriptionDao consumedSubscriptionDao, ArtifactLinkDao artifactLinkDao, ResultsSummaryManager resultsSummaryManager) -
Method Summary
Modifier and TypeMethodDescriptionlong
countSubscriptionsOfArtifact
(long artifactDefinitionId) @NotNull List<ArtifactSubscription>
findCurrentSubscriptionsForPlan
(@NotNull ImmutableJob producerJob) Get list of subscriptions existing in a chain for given artifactfindSubscription
(long id) Get artifact definition of specified id@NotNull List<ArtifactSubscription>
findSubscriptionsOfPlan
(@NotNull PlanIdentifier plan) Get list of artifact subscriptions associated with a plan@NotNull List<ArtifactDefinition>
findSubscriptionsPossibleForPlan
(@NotNull ImmutableJob job) Get list of chain level artifacts available for specified plan@NotNull Multimap<ResultsSummary,
ConsumedSubscription> getConsumedSubscriptions
(@NotNull ResultsSummary resultsSummary) Returns list ofConsumedSubscription
ordered by order ofResultsSummary
execution.boolean
isSubscriptionsValid
(@NotNull Job consumer, @NotNull Chain chain, @NotNull String stageName) Shorter for of validateSubscriptions method@NotNull List<ArtifactDefinitionContext>
prepareArtifactDefinitionContexts
(@NotNull ImmutableJob job, @NotNull BuildContext buildContext, SecureToken secureToken) Helps prepare the artifact definitions@NotNull List<ArtifactSubscriptionContext>
prepareSubscriptionContexts
(@NotNull ImmutableJob job, @NotNull BuildContext parentBuildContext, SecureToken secureToken) void
removeArtifactSubscription
(@NotNull ArtifactSubscription artifactSubscription) Remove artifact subscription.void
removeArtifactSubscriptions
(@NotNull Collection<ArtifactSubscription> artifactSubscriptions) Remove all artifact subscriptions in the collection.void
removeArtifactSubscriptionsOfPlan
(@NotNull ImmutablePlan plan) Remove all artifact subscriptions for a planvoid
saveArtifactSubscription
(@NotNull ArtifactSubscription artifactSubscription) Save artifact subscription.void
saveArtifactSubscriptions
(@NotNull Collection<ArtifactSubscription> artifactSubscriptions) Save all artifact definitions in a collection.void
saveConsumedSubscription
(@NotNull ArtifactSubscriptionContext artifactSubscription, @NotNull PlanResultKey planResultKey, @NotNull String artifactLinkType) Store consumed subscription.transformSubscriptions
(@NotNull List<ArtifactSubscription> subscriptions) @NotNull List<ArtifactSubscription>
validateSubscribersForMovedJob
(@NotNull ImmutableJob producer, @NotNull ImmutableChainStage destinationStage) Validate all consumer artifact subscriptions to the artifacts produced by a Job against target stage@NotNull List<ArtifactSubscription>
validateSubscriptions
(@NotNull ImmutableJob consumer, @NotNull ImmutableChain chain, @NotNull String stageName) Validate consumer artifact subscriptions against target chain and stage@NotNull List<ArtifactSubscription>
validateSubscriptionsForMovedJob
(@NotNull ImmutableJob job, @NotNull ImmutableChainStage targetStage) Validate all artifact subscriptions possibly affected by moving a job.@NotNull List<ArtifactSubscription>
validateSubscriptionsForMovedStage
(@NotNull ImmutableChainStage stageToMove, int newIndex) Validates all artifact subscriptions possibly affected by moving a stage.
-
Constructor Details
-
ArtifactSubscriptionManagerImpl
public ArtifactSubscriptionManagerImpl(ArtifactDefinitionManager artifactDefinitionManager, ArtifactSubscriptionDao artifactSubscriptionDao, ConsumedSubscriptionDao consumedSubscriptionDao, ArtifactLinkDao artifactLinkDao, ResultsSummaryManager resultsSummaryManager)
-
-
Method Details
-
findSubscription
Description copied from interface:ArtifactSubscriptionManager
Get artifact definition of specified id- Specified by:
findSubscription
in interfaceArtifactSubscriptionManager
- Parameters:
id
- id of artifact subscription- Returns:
- artifact definition of specified id or null if not found
-
findSubscriptionsOfPlan
@NotNull public @NotNull List<ArtifactSubscription> findSubscriptionsOfPlan(@NotNull @NotNull PlanIdentifier plan) Description copied from interface:ArtifactSubscriptionManager
Get list of artifact subscriptions associated with a plan- Specified by:
findSubscriptionsOfPlan
in interfaceArtifactSubscriptionManager
- Parameters:
plan
- plan which associated artifact subscriptions should be retrieved- Returns:
- list of artifact subscriptions
-
transformSubscriptions
public List<ArtifactSubscriptionSubstitutionAware> transformSubscriptions(@NotNull @NotNull List<ArtifactSubscription> subscriptions) - Specified by:
transformSubscriptions
in interfaceArtifactSubscriptionManager
-
findSubscriptionsPossibleForPlan
@NotNull public @NotNull List<ArtifactDefinition> findSubscriptionsPossibleForPlan(@NotNull @NotNull ImmutableJob job) Description copied from interface:ArtifactSubscriptionManager
Get list of chain level artifacts available for specified plan- Specified by:
findSubscriptionsPossibleForPlan
in interfaceArtifactSubscriptionManager
- Returns:
- list of available artifact definitions
-
findCurrentSubscriptionsForPlan
@NotNull public @NotNull List<ArtifactSubscription> findCurrentSubscriptionsForPlan(@NotNull @NotNull ImmutableJob producerJob) Description copied from interface:ArtifactSubscriptionManager
Get list of subscriptions existing in a chain for given artifact- Specified by:
findCurrentSubscriptionsForPlan
in interfaceArtifactSubscriptionManager
- Returns:
- list of artifact subscriptions
-
validateSubscribersForMovedJob
@NotNull public @NotNull List<ArtifactSubscription> validateSubscribersForMovedJob(@NotNull @NotNull ImmutableJob producer, @NotNull @NotNull ImmutableChainStage destinationStage) Description copied from interface:ArtifactSubscriptionManager
Validate all consumer artifact subscriptions to the artifacts produced by a Job against target stage- Specified by:
validateSubscribersForMovedJob
in interfaceArtifactSubscriptionManager
- Parameters:
producer
- job being producer of the artifactsdestinationStage
- target stage- Returns:
- list of subscriptions that NOT satisfy
-
validateSubscriptions
@NotNull public @NotNull List<ArtifactSubscription> validateSubscriptions(@NotNull @NotNull ImmutableJob consumer, @NotNull @NotNull ImmutableChain chain, @NotNull @NotNull String stageName) Description copied from interface:ArtifactSubscriptionManager
Validate consumer artifact subscriptions against target chain and stage- Specified by:
validateSubscriptions
in interfaceArtifactSubscriptionManager
- Parameters:
consumer
- job being consumer of artifact definitionschain
- target chainstageName
- target stage- Returns:
- list of subscriptions that NOT satisfy
-
validateSubscriptionsForMovedJob
@NotNull public @NotNull List<ArtifactSubscription> validateSubscriptionsForMovedJob(@NotNull @NotNull ImmutableJob job, @NotNull @NotNull ImmutableChainStage targetStage) Description copied from interface:ArtifactSubscriptionManager
Validate all artifact subscriptions possibly affected by moving a job. Artifact subscriptions will be broken if the producer is moved down, or if the consumer is moved up. This validation will return all artifact subscriptions that will be broken.- Specified by:
validateSubscriptionsForMovedJob
in interfaceArtifactSubscriptionManager
- Parameters:
job
- job being movedtargetStage
- target stage- Returns:
- list of
ArtifactSubscription
that won't qualify after the move
-
validateSubscriptionsForMovedStage
@NotNull public @NotNull List<ArtifactSubscription> validateSubscriptionsForMovedStage(@NotNull @NotNull ImmutableChainStage stageToMove, int newIndex) Description copied from interface:ArtifactSubscriptionManager
Validates all artifact subscriptions possibly affected by moving a stage. Artifact subscriptions will be broken if the producer is moved down, or if the consumer is moved up. This validation will return all artifact subscriptions that will be broken.- Specified by:
validateSubscriptionsForMovedStage
in interfaceArtifactSubscriptionManager
- Parameters:
stageToMove
- stage being movednewIndex
- target stage index- Returns:
- list of
ArtifactSubscription
that won't qualify after the move
-
isSubscriptionsValid
public boolean isSubscriptionsValid(@NotNull @NotNull Job consumer, @NotNull @NotNull Chain chain, @NotNull @NotNull String stageName) Description copied from interface:ArtifactSubscriptionManager
Shorter for of validateSubscriptions method- Specified by:
isSubscriptionsValid
in interfaceArtifactSubscriptionManager
- Parameters:
consumer
- job being consumer of artifact definitionschain
- target chainstageName
- target stage- Returns:
- true if all subscriptions are valid
-
prepareSubscriptionContexts
@NotNull public @NotNull List<ArtifactSubscriptionContext> prepareSubscriptionContexts(@NotNull @NotNull ImmutableJob job, @NotNull @NotNull BuildContext parentBuildContext, SecureToken secureToken) - Specified by:
prepareSubscriptionContexts
in interfaceArtifactSubscriptionManager
- Returns:
-
prepareArtifactDefinitionContexts
@NotNull public @NotNull List<ArtifactDefinitionContext> prepareArtifactDefinitionContexts(@NotNull @NotNull ImmutableJob job, @NotNull @NotNull BuildContext buildContext, SecureToken secureToken) Description copied from interface:ArtifactSubscriptionManager
Helps prepare the artifact definitions- Specified by:
prepareArtifactDefinitionContexts
in interfaceArtifactSubscriptionManager
- Returns:
-
removeArtifactSubscription
Description copied from interface:ArtifactSubscriptionManager
Remove artifact subscription.- Specified by:
removeArtifactSubscription
in interfaceArtifactSubscriptionManager
- Parameters:
artifactSubscription
-ArtifactSubscription
to be removed
-
removeArtifactSubscriptions
public void removeArtifactSubscriptions(@NotNull @NotNull Collection<ArtifactSubscription> artifactSubscriptions) Description copied from interface:ArtifactSubscriptionManager
Remove all artifact subscriptions in the collection.- Specified by:
removeArtifactSubscriptions
in interfaceArtifactSubscriptionManager
- Parameters:
artifactSubscriptions
- collection ofArtifactSubscription
to be removed
-
removeArtifactSubscriptionsOfPlan
Description copied from interface:ArtifactSubscriptionManager
Remove all artifact subscriptions for a plan- Specified by:
removeArtifactSubscriptionsOfPlan
in interfaceArtifactSubscriptionManager
-
saveArtifactSubscription
Description copied from interface:ArtifactSubscriptionManager
Save artifact subscription.- Specified by:
saveArtifactSubscription
in interfaceArtifactSubscriptionManager
- Parameters:
artifactSubscription
- object to be saved
-
saveArtifactSubscriptions
public void saveArtifactSubscriptions(@NotNull @NotNull Collection<ArtifactSubscription> artifactSubscriptions) Description copied from interface:ArtifactSubscriptionManager
Save all artifact definitions in a collection.- Specified by:
saveArtifactSubscriptions
in interfaceArtifactSubscriptionManager
- Parameters:
artifactSubscriptions
- collection of objects to be saved/updated
-
saveConsumedSubscription
public void saveConsumedSubscription(@NotNull @NotNull ArtifactSubscriptionContext artifactSubscription, @NotNull @NotNull PlanResultKey planResultKey, @NotNull @NotNull String artifactLinkType) Description copied from interface:ArtifactSubscriptionManager
Store consumed subscription. Method should be called when artifacts are physically transferred to the agent- Specified by:
saveConsumedSubscription
in interfaceArtifactSubscriptionManager
-
getConsumedSubscriptions
@NotNull public @NotNull Multimap<ResultsSummary,ConsumedSubscription> getConsumedSubscriptions(@NotNull @NotNull ResultsSummary resultsSummary) Description copied from interface:ArtifactSubscriptionManager
Returns list ofConsumedSubscription
ordered by order ofResultsSummary
execution. Artifacts whose producer does not exists are appended at the end, with null key.- Specified by:
getConsumedSubscriptions
in interfaceArtifactSubscriptionManager
- Parameters:
resultsSummary
- a job result- Returns:
-
countSubscriptionsOfArtifact
public long countSubscriptionsOfArtifact(long artifactDefinitionId) - Specified by:
countSubscriptionsOfArtifact
in interfaceArtifactSubscriptionManager
- Returns:
- amount of subscriptions existing for an artifact
-