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
ConstructorsConstructorDescriptionArtifactSubscriptionManagerImpl(ArtifactDefinitionManager artifactDefinitionManager, ArtifactSubscriptionDao artifactSubscriptionDao, ConsumedSubscriptionDao consumedSubscriptionDao, ArtifactLinkDao artifactLinkDao, ResultsSummaryManager resultsSummaryManager) -
Method Summary
Modifier and TypeMethodDescriptionlongcountSubscriptionsOfArtifact(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 ofConsumedSubscriptionordered by order ofResultsSummaryexecution.booleanisSubscriptionsValid(@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) voidremoveArtifactSubscription(@NotNull ArtifactSubscription artifactSubscription) Remove artifact subscription.voidremoveArtifactSubscriptions(@NotNull Collection<ArtifactSubscription> artifactSubscriptions) Remove all artifact subscriptions in the collection.voidremoveArtifactSubscriptionsOfPlan(@NotNull ImmutablePlan plan) Remove all artifact subscriptions for a planvoidsaveArtifactSubscription(@NotNull ArtifactSubscription artifactSubscription) Save artifact subscription.voidsaveArtifactSubscriptions(@NotNull Collection<ArtifactSubscription> artifactSubscriptions) Save all artifact definitions in a collection.voidsaveConsumedSubscription(@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:ArtifactSubscriptionManagerGet artifact definition of specified id- Specified by:
findSubscriptionin 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:ArtifactSubscriptionManagerGet list of artifact subscriptions associated with a plan- Specified by:
findSubscriptionsOfPlanin 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:
transformSubscriptionsin interfaceArtifactSubscriptionManager
-
findSubscriptionsPossibleForPlan
@NotNull public @NotNull List<ArtifactDefinition> findSubscriptionsPossibleForPlan(@NotNull @NotNull ImmutableJob job) Description copied from interface:ArtifactSubscriptionManagerGet list of chain level artifacts available for specified plan- Specified by:
findSubscriptionsPossibleForPlanin interfaceArtifactSubscriptionManager- Parameters:
job-- Returns:
- list of available artifact definitions
-
findCurrentSubscriptionsForPlan
@NotNull public @NotNull List<ArtifactSubscription> findCurrentSubscriptionsForPlan(@NotNull @NotNull ImmutableJob producerJob) Description copied from interface:ArtifactSubscriptionManagerGet list of subscriptions existing in a chain for given artifact- Specified by:
findCurrentSubscriptionsForPlanin interfaceArtifactSubscriptionManager- Parameters:
producerJob-- Returns:
- list of artifact subscriptions
-
validateSubscribersForMovedJob
@NotNull public @NotNull List<ArtifactSubscription> validateSubscribersForMovedJob(@NotNull @NotNull ImmutableJob producer, @NotNull @NotNull ImmutableChainStage destinationStage) Description copied from interface:ArtifactSubscriptionManagerValidate all consumer artifact subscriptions to the artifacts produced by a Job against target stage- Specified by:
validateSubscribersForMovedJobin 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:ArtifactSubscriptionManagerValidate consumer artifact subscriptions against target chain and stage- Specified by:
validateSubscriptionsin 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:ArtifactSubscriptionManagerValidate 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:
validateSubscriptionsForMovedJobin interfaceArtifactSubscriptionManager- Parameters:
job- job being movedtargetStage- target stage- Returns:
- list of
ArtifactSubscriptionthat won't qualify after the move
-
validateSubscriptionsForMovedStage
@NotNull public @NotNull List<ArtifactSubscription> validateSubscriptionsForMovedStage(@NotNull @NotNull ImmutableChainStage stageToMove, int newIndex) Description copied from interface:ArtifactSubscriptionManagerValidates 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:
validateSubscriptionsForMovedStagein interfaceArtifactSubscriptionManager- Parameters:
stageToMove- stage being movednewIndex- target stage index- Returns:
- list of
ArtifactSubscriptionthat 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:ArtifactSubscriptionManagerShorter for of validateSubscriptions method- Specified by:
isSubscriptionsValidin 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:
prepareSubscriptionContextsin interfaceArtifactSubscriptionManager- Parameters:
job-parentBuildContext-secureToken-- Returns:
-
prepareArtifactDefinitionContexts
@NotNull public @NotNull List<ArtifactDefinitionContext> prepareArtifactDefinitionContexts(@NotNull @NotNull ImmutableJob job, @NotNull @NotNull BuildContext buildContext, SecureToken secureToken) Description copied from interface:ArtifactSubscriptionManagerHelps prepare the artifact definitions- Specified by:
prepareArtifactDefinitionContextsin interfaceArtifactSubscriptionManager- Parameters:
job-buildContext-secureToken-- Returns:
-
removeArtifactSubscription
Description copied from interface:ArtifactSubscriptionManagerRemove artifact subscription.- Specified by:
removeArtifactSubscriptionin interfaceArtifactSubscriptionManager- Parameters:
artifactSubscription-ArtifactSubscriptionto be removed
-
removeArtifactSubscriptions
public void removeArtifactSubscriptions(@NotNull @NotNull Collection<ArtifactSubscription> artifactSubscriptions) Description copied from interface:ArtifactSubscriptionManagerRemove all artifact subscriptions in the collection.- Specified by:
removeArtifactSubscriptionsin interfaceArtifactSubscriptionManager- Parameters:
artifactSubscriptions- collection ofArtifactSubscriptionto be removed
-
removeArtifactSubscriptionsOfPlan
Description copied from interface:ArtifactSubscriptionManagerRemove all artifact subscriptions for a plan- Specified by:
removeArtifactSubscriptionsOfPlanin interfaceArtifactSubscriptionManager
-
saveArtifactSubscription
Description copied from interface:ArtifactSubscriptionManagerSave artifact subscription.- Specified by:
saveArtifactSubscriptionin interfaceArtifactSubscriptionManager- Parameters:
artifactSubscription- object to be saved
-
saveArtifactSubscriptions
public void saveArtifactSubscriptions(@NotNull @NotNull Collection<ArtifactSubscription> artifactSubscriptions) Description copied from interface:ArtifactSubscriptionManagerSave all artifact definitions in a collection.- Specified by:
saveArtifactSubscriptionsin 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:ArtifactSubscriptionManagerStore consumed subscription. Method should be called when artifacts are physically transferred to the agent- Specified by:
saveConsumedSubscriptionin interfaceArtifactSubscriptionManager- Parameters:
artifactSubscription-planResultKey-
-
getConsumedSubscriptions
@NotNull public @NotNull Multimap<ResultsSummary,ConsumedSubscription> getConsumedSubscriptions(@NotNull @NotNull ResultsSummary resultsSummary) Description copied from interface:ArtifactSubscriptionManagerReturns list ofConsumedSubscriptionordered by order ofResultsSummaryexecution. Artifacts whose producer does not exists are appended at the end, with null key.- Specified by:
getConsumedSubscriptionsin interfaceArtifactSubscriptionManager- Parameters:
resultsSummary- a job result- Returns:
-
countSubscriptionsOfArtifact
public long countSubscriptionsOfArtifact(long artifactDefinitionId) - Specified by:
countSubscriptionsOfArtifactin interfaceArtifactSubscriptionManager- Returns:
- amount of subscriptions existing for an artifact
-