Package com.atlassian.bamboo.plan
Class PlanKeys
java.lang.Object
com.atlassian.bamboo.plan.PlanKeys
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Comparator<PlanKey>static Function<? super PlanResultKey,? extends PlanResultKey> static final char -
Method Summary
Modifier and TypeMethodDescriptionstatic PlanKeyasDeletedPlanKey(@NotNull PlanKey planKey) static PlanKeyasNonDeletedPlanKey(@NotNull PlanKey planKey) static voidassertSafeKey(String key) static @NotNull PlanKeygetChainKeyFromJobKey(@NotNull PlanKey jobKey) static @Nullable PlanKeygetChainKeyIfJobKey(@NotNull PlanKey jobKey) static @NotNull PlanResultKeygetChainResultKey(@NotNull PlanResultKey planResultKey) Creates a chain result key from job result key.static @NotNull PlanKeygetNumberSuffixFromBranch(@NotNull PlanKey chainKey, @NotNull PlanKey branchKey) Extract numerical branch suffixstatic StringgetPartialJobKey(PlanKey jobKey) Return a partial job key from a full job key, e.g.static PlanKeygetPlanKey(@NotNull com.atlassian.bamboo.specs.api.model.plan.PlanIdentifierProperties planIdentifier) Creates aPlanKeyfromPlanIdentifierPropertiesstatic PlanKeygetPlanKey(@NotNull com.atlassian.bamboo.specs.api.model.plan.PlanProperties planProperties) Creates aPlanKeyfrom PlanPropertiesstatic @NotNull PlanKeygetPlanKey(@NotNull String planKey) Creates aPlanKeyfrom its string form 'BAM-BOO' or from the result key form 'BAM-BOO-123'static PlanKeygetPlanKey(@NotNull String projectKey, @NotNull String buildKey) Creates aPlanKeyfrom project key and build keystatic PlanKeygetPlanKey(@NotNull String projectKey, @Nullable String chainKey, @NotNull String buildKey) Creates aPlanKeyfrom project key, parent chain key and build keystatic PlanKeygetPlanKey(com.atlassian.bamboo.specs.api.builders.plan.PlanIdentifier planIdentifier) Creates aPlanKeyfromPlanIdentifierstatic @NotNull StringgetPlanKeyPart(@NotNull PlanKey planKey) Returns plan key part for givenPlanKeystatic @Nullable StringgetPlanKeyPart(@NotNull PlanResultKey planResultKey) Returns plan key part for givenPlanResultKeystatic PlanResultKeygetPlanResultKey(@NotNull String planKey, int buildNumber) Creates aPlanResultKeyfrom the given planKey and buildNumberstatic PlanResultKeygetPlanResultKey(PlanKey planKey, int buildNumber) Creates aPlanResultKeyfrom the givenPlanKeyand buildNumberstatic PlanResultKeygetPlanResultKey(String planResultKey) Creates aPlanResultKeyfrom its string form 'BAM-BOO-123'static @NotNull StringgetProjectKeyPart(@NotNull PlanKey planKey) Returns project key part for givenPlanKeystatic @Nullable StringgetProjectKeyPart(@NotNull PlanResultKey planResultKey) Returns project key part for givenPlanResultKeystatic StringgetShortKeyFromPlanKey(PlanKey planKey) Return a last part of the plan key, e.g PROJ-CHAIN would reduce CHAIN and PROJ-CHAIN-HOB would return JOBstatic booleanisChainKey(@NotNull PlanKey planKey) static booleanstatic booleanisJobResultKey(@NotNull PlanResultKey planResultKey) Checks ifPlanResultKeyrepresents a result ofJobstatic booleanstatic booleanisPlanResultKey(String planResultKey) static PlanKeyupdatePlanKeyInBranchKey(@NotNull PlanKey branchKey, @NotNull PlanKey originalPlanKey, @NotNull PlanKey newPlanKey) Update plan key part in branch key
-
Field Details
-
SEP
public static final char SEP- See Also:
-
REMOVE_DELETION_MARKER
-
CHAIN_KEY_FROM_JOB_KEY
-
PARTIAL_JOB_KEY_FROM_JOB_KEY
-
PLAN_KEY_COMPARATOR
-
SHORT_KEY_FROM_PLAN_KEY
-
-
Method Details
-
isChainKey
- Parameters:
planKey-- Returns:
- isChainKey
-
isJobKey
- Parameters:
planKey-- Returns:
- isJobKey
-
isJobResultKey
Checks ifPlanResultKeyrepresents a result ofJob- Parameters:
planResultKey-- Returns:
- isJobResultKey
-
getPlanKey
public static PlanKey getPlanKey(@NotNull @NotNull String projectKey, @NotNull @NotNull String buildKey) Creates aPlanKeyfrom project key and build key- Parameters:
projectKey-buildKey-- Returns:
- key
-
getPlanKey
public static PlanKey getPlanKey(@NotNull @NotNull com.atlassian.bamboo.specs.api.model.plan.PlanProperties planProperties) Creates aPlanKeyfrom PlanProperties- Parameters:
planProperties-- Returns:
- key
-
getPlanKey
public static PlanKey getPlanKey(@NotNull com.atlassian.bamboo.specs.api.builders.plan.PlanIdentifier planIdentifier) Creates aPlanKeyfromPlanIdentifier- Parameters:
planIdentifier-- Returns:
- key
-
getPlanKey
public static PlanKey getPlanKey(@NotNull @NotNull com.atlassian.bamboo.specs.api.model.plan.PlanIdentifierProperties planIdentifier) Creates aPlanKeyfromPlanIdentifierProperties- Parameters:
planIdentifier-- Returns:
- key
-
getProjectKeyPart
Returns project key part for givenPlanKey- Parameters:
planKey-- Returns:
- project key
-
getProjectKeyPart
@Nullable public static @Nullable String getProjectKeyPart(@NotNull @NotNull PlanResultKey planResultKey) Returns project key part for givenPlanResultKey- Parameters:
planResultKey-- Returns:
- project key
-
getPlanKeyPart
Returns plan key part for givenPlanKey- Parameters:
planKey-- Returns:
- project key
-
getPlanKeyPart
@Nullable public static @Nullable String getPlanKeyPart(@NotNull @NotNull PlanResultKey planResultKey) Returns plan key part for givenPlanResultKey- Parameters:
planResultKey-- Returns:
- project key
-
getJobKey
@NotNull public static @NotNull PlanKey getJobKey(@NotNull @NotNull PlanKey chainPlanKey, @NotNull @NotNull String jobKey) Joins the aChainkey and a jobKey part to create a JobPlanKeyFor example, BAM-REL and UNIT becomes BAM-REL-UNIT
- Parameters:
chainPlanKey-jobKey-- Returns:
- planKey
-
getChainKeyFromJobKey
Extracts aChainkey from a jobKey and creates newPlanKeyFor example, BAM-REL-UNIT becomes BAM-REL- Parameters:
jobKey-- Returns:
- chainKey
- Throws:
IllegalArgumentException- if the argument has incorrect format.
-
getChainKeyIfJobKey
Extracts aChainkey from a jobKey and creates newPlanKeyFor example, BAM-REL-UNIT becomes BAM-REL Returns a Chain key if the passed in key is a Job key, otherwise a null is returned- Parameters:
jobKey-- Returns:
- chainKey
-
getPlanKey
public static PlanKey getPlanKey(@NotNull @NotNull String projectKey, @Nullable @Nullable String chainKey, @NotNull @NotNull String buildKey) Creates aPlanKeyfrom project key, parent chain key and build key- Parameters:
projectKey-chainKey- - if empty a key for top level plan is createdbuildKey-- Returns:
- key
-
getPlanKey
Creates aPlanKeyfrom its string form 'BAM-BOO' or from the result key form 'BAM-BOO-123'- Parameters:
planKey-- Returns:
- key
- Throws:
IllegalArgumentException- if key could not be parsed
-
isPlanKey
-
getPlanResultKey
Creates aPlanResultKeyfrom its string form 'BAM-BOO-123'- Parameters:
planResultKey-- Returns:
- key
- Throws:
IllegalArgumentException- if key could not be parsed
-
getPlanResultKey
Creates aPlanResultKeyfrom the given planKey and buildNumber- Parameters:
planKey-buildNumber-- Returns:
- key
- Throws:
IllegalArgumentException- if key could not be parsed
-
getPlanResultKey
Creates aPlanResultKeyfrom the givenPlanKeyand buildNumber- Parameters:
planKey-buildNumber-- Returns:
- planResultKey
-
getChainResultKey
@NotNull public static @NotNull PlanResultKey getChainResultKey(@NotNull @NotNull PlanResultKey planResultKey) Creates a chain result key from job result key. E.g. BAM-BOO-N-1 will return BAM-BOO-1- Parameters:
planResultKey- the job result key to convert- Returns:
- chain result key
-
getPartialJobKey
Return a partial job key from a full job key, e.g. PROJ-CHAIN-JOB would return JOB.- Parameters:
jobKey- a full job key- Returns:
- partial job key
-
getShortKeyFromPlanKey
Return a last part of the plan key, e.g PROJ-CHAIN would reduce CHAIN and PROJ-CHAIN-HOB would return JOB- Parameters:
planKey- a full plan key- Returns:
- short plan key
-
assertSafeKey
-
updatePlanKeyInBranchKey
public static PlanKey updatePlanKeyInBranchKey(@NotNull @NotNull PlanKey branchKey, @NotNull @NotNull PlanKey originalPlanKey, @NotNull @NotNull PlanKey newPlanKey) Update plan key part in branch key- Parameters:
branchKey- branch key to be alteredoriginalPlanKey- original plan keynewPlanKey- new plan key- Returns:
- updated plan key or the original branchKey argument when it didn't match originalPlanKey
-
getNumberSuffixFromBranch
public static Optional<Long> getNumberSuffixFromBranch(@NotNull @NotNull PlanKey chainKey, @NotNull @NotNull PlanKey branchKey) Extract numerical branch suffix- Parameters:
chainKey- chain keybranchKey- branch key- Returns:
- Long value of branch suffix or empty Option
- Throws:
IllegalArgumentException- if the branch key doesn't start with chain keyNumberFormatException- if the branch suffix is not proper numerical value
-
asDeletedPlanKey
-
asNonDeletedPlanKey
-
isPlanResultKey
-