@PublicApi public final class PlanKeys extends Object
Modifier and Type | Field and Description |
---|---|
static com.google.common.base.Function<PlanKey,PlanKey> |
CHAIN_KEY_FROM_JOB_KEY |
static com.google.common.base.Function<PlanKey,String> |
PARTIAL_JOB_KEY_FROM_JOB_KEY |
static Comparator<PlanKey> |
PLAN_KEY_COMPARATOR |
static com.google.common.base.Function<? super PlanResultKey,? extends PlanResultKey> |
REMOVE_DELETION_MARKER |
static char |
SEP |
static com.google.common.base.Function<PlanKey,String> |
SHORT_KEY_FROM_PLAN_KEY |
Modifier and Type | Method and Description |
---|---|
static PlanKey |
asDeletedPlanKey(PlanKey planKey) |
static PlanKey |
asNonDeletedPlanKey(PlanKey planKey) |
static void |
assertSafeKey(String key) |
static com.atlassian.fugue.Option<Long> |
getBranchNumberSuffix(PlanKey chainKey,
PlanKey branchKey)
Deprecated.
since 6.2 use
getNumberSuffixFromBranch(PlanKey, PlanKey) |
static PlanKey |
getChainKeyFromJobKey(PlanKey jobKey)
|
static PlanKey |
getChainKeyIfJobKey(PlanKey jobKey)
|
static PlanResultKey |
getChainResultKey(PlanResultKey planResultKey)
Creates a chain result key from job result key.
|
static PlanKey |
getJobKey(PlanKey chainPlanKey,
String jobKey)
|
static Optional<Long> |
getNumberSuffixFromBranch(PlanKey chainKey,
PlanKey branchKey)
Extract numerical branch suffix
|
static String |
getPartialJobKey(PlanKey jobKey)
Return a partial job key from a full job key, e.g.
|
static PlanKey |
getPlanKey(com.atlassian.bamboo.specs.api.builders.plan.PlanIdentifier planIdentifier)
Creates a
PlanKey from PlanIdentifier |
static PlanKey |
getPlanKey(com.atlassian.bamboo.specs.api.model.plan.PlanProperties planProperties)
Creates a
PlanKey from PlanProperties |
static PlanKey |
getPlanKey(String planKey)
Creates a
PlanKey from its string form 'BAM-BOO' or from the result key form 'BAM-BOO-123' |
static PlanKey |
getPlanKey(String projectKey,
String buildKey)
Creates a
PlanKey from project key and build key |
static PlanKey |
getPlanKey(String projectKey,
String chainKey,
String buildKey)
Creates a
PlanKey from project key, parent chain key and build key |
static String |
getPlanKeyPart(PlanKey planKey)
Returns plan key part for given
PlanKey |
static String |
getPlanKeyPart(PlanResultKey planResultKey)
Returns plan key part for given
PlanResultKey |
static PlanResultKey |
getPlanResultKey(PlanKey planKey,
int buildNumber)
Creates a
PlanResultKey from the given PlanKey and buildNumber |
static PlanResultKey |
getPlanResultKey(String planResultKey)
Creates a
PlanResultKey from its string form 'BAM-BOO-123' |
static PlanResultKey |
getPlanResultKey(String planKey,
int buildNumber)
Creates a
PlanResultKey from the given planKey and buildNumber |
static String |
getProjectKeyPart(PlanKey planKey)
Returns project key part for given
PlanKey |
static String |
getProjectKeyPart(PlanResultKey planResultKey)
Returns project key part for given
PlanResultKey |
static String |
getShortKeyFromPlanKey(PlanKey planKey)
Return a last part of the plan key, e.g PROJ-CHAIN would reduce CHAIN and PROJ-CHAIN-HOB would return JOB
|
static boolean |
isChainKey(PlanKey planKey)
|
static boolean |
isJobKey(PlanKey planKey)
|
static boolean |
isPlanKey(String planKey) |
static PlanKey |
updatePlanKeyInBranchKey(PlanKey branchKey,
PlanKey originalPlanKey,
PlanKey newPlanKey)
Update plan key part in branch key
|
public static final char SEP
public static com.google.common.base.Function<? super PlanResultKey,? extends PlanResultKey> REMOVE_DELETION_MARKER
public static final com.google.common.base.Function<PlanKey,PlanKey> CHAIN_KEY_FROM_JOB_KEY
public static final com.google.common.base.Function<PlanKey,String> PARTIAL_JOB_KEY_FROM_JOB_KEY
public static final Comparator<PlanKey> PLAN_KEY_COMPARATOR
public static boolean isChainKey(@NotNull PlanKey planKey)
planKey
- public static boolean isJobKey(@NotNull PlanKey planKey)
planKey
- public static PlanKey getPlanKey(@NotNull String projectKey, @NotNull String buildKey)
PlanKey
from project key and build keyprojectKey
- buildKey
- public static PlanKey getPlanKey(@NotNull com.atlassian.bamboo.specs.api.model.plan.PlanProperties planProperties)
PlanKey
from PlanPropertiesplanProperties
- public static PlanKey getPlanKey(@NotNull com.atlassian.bamboo.specs.api.builders.plan.PlanIdentifier planIdentifier)
PlanKey
from PlanIdentifier
planIdentifier
- @NotNull public static String getProjectKeyPart(@NotNull PlanKey planKey)
PlanKey
planKey
- @Nullable public static String getProjectKeyPart(@NotNull PlanResultKey planResultKey)
PlanResultKey
planResultKey
- @NotNull public static String getPlanKeyPart(@NotNull PlanKey planKey)
PlanKey
planKey
- @Nullable public static String getPlanKeyPart(@NotNull PlanResultKey planResultKey)
PlanResultKey
planResultKey
- @NotNull public static PlanKey getJobKey(@NotNull PlanKey chainPlanKey, @NotNull String jobKey)
Chain
key and a jobKey part to create a Job PlanKey
For example, BAM-REL and UNIT becomes BAM-REL-UNITchainPlanKey
- jobKey
- @NotNull public static PlanKey getChainKeyFromJobKey(@NotNull PlanKey jobKey)
Chain
key from a jobKey and creates new PlanKey
For example, BAM-REL-UNIT becomes BAM-RELjobKey
- IllegalArgumentException
- if the argument has incorrect format.@Nullable public static PlanKey getChainKeyIfJobKey(@NotNull PlanKey jobKey)
Chain
key from a jobKey and creates new PlanKey
For example, BAM-REL-UNIT becomes
BAM-REL
Returns a Chain key if the passed in key is a Job key, otherwise a null is returnedjobKey
- public static PlanKey getPlanKey(@NotNull String projectKey, @Nullable String chainKey, @NotNull String buildKey)
PlanKey
from project key, parent chain key and build keyprojectKey
- chainKey
- - if empty a key for top level plan is createdbuildKey
- @NotNull public static PlanKey getPlanKey(@NotNull String planKey)
PlanKey
from its string form 'BAM-BOO' or from the result key form 'BAM-BOO-123'planKey
- IllegalArgumentException
- if key could not be parsedpublic static boolean isPlanKey(@NotNull String planKey)
public static PlanResultKey getPlanResultKey(String planResultKey)
PlanResultKey
from its string form 'BAM-BOO-123'planResultKey
- IllegalArgumentException
- if key could not be parsedpublic static PlanResultKey getPlanResultKey(@NotNull String planKey, int buildNumber)
PlanResultKey
from the given planKey and buildNumberplanKey
- buildNumber
- IllegalArgumentException
- if key could not be parsedpublic static PlanResultKey getPlanResultKey(PlanKey planKey, int buildNumber)
PlanResultKey
from the given PlanKey
and buildNumberplanKey
- buildNumber
- @NotNull public static PlanResultKey getChainResultKey(@NotNull PlanResultKey planResultKey)
planResultKey
- the job result key to convertpublic static String getPartialJobKey(PlanKey jobKey)
jobKey
- a full job keypublic static String getShortKeyFromPlanKey(PlanKey planKey)
planKey
- a full plan keypublic static void assertSafeKey(String key)
public static PlanKey updatePlanKeyInBranchKey(@NotNull PlanKey branchKey, @NotNull PlanKey originalPlanKey, @NotNull PlanKey newPlanKey)
branchKey
- branch key to be alteredoriginalPlanKey
- original plan keynewPlanKey
- new plan key@Deprecated public static com.atlassian.fugue.Option<Long> getBranchNumberSuffix(@NotNull PlanKey chainKey, @NotNull PlanKey branchKey)
getNumberSuffixFromBranch(PlanKey, PlanKey)
chainKey
- chain keybranchKey
- branch keyIllegalArgumentException
- if the branch key doesn't start with chain keyNumberFormatException
- if the branch suffix is not proper numerical valuepublic static Optional<Long> getNumberSuffixFromBranch(@NotNull PlanKey chainKey, @NotNull PlanKey branchKey)
chainKey
- chain keybranchKey
- branch keyIllegalArgumentException
- if the branch key doesn't start with chain keyNumberFormatException
- if the branch suffix is not proper numerical valueCopyright © 2020 Atlassian Software Systems Pty Ltd. All rights reserved.