Class IdentifiersUtil
- java.lang.Object
-
- jetbrains.buildServer.serverSide.identifiers.IdentifiersUtil
-
public class IdentifiersUtil extends Object
Useful methods for working with internal and external identifiers.- Since:
- 8.0
-
-
Field Summary
Fields Modifier and Type Field Description static int
CONFIG_ID_LENGTH
The config identifier length limit.static int
EXT_ID_LENGTH
The external identifier length limit.static String
EXT_ID_PARTS_DELIMITER
The delimiter between parent external id and a child part that is used when an external identifier is generated automatically.static EntityId<String>
ourDummyEntityId
static EntityId<String>
ourInaccessibleStringEntityId
-
Constructor Summary
Constructors Constructor Description IdentifiersUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
generateExternalIdByName(String name, boolean requireFirstLetter, boolean adjustCase, int limitLength)
static String
generateUniqueExternalIdByUserString(String parentId, String name, boolean adjustCase, OccupiedIdsChecker occupiedIdsChecker)
Generates a new unique external id by the given parent external id and a user string (usually name).static void
validateExternalId(String id, String idKindName)
static void
validateExternalId(String id, String idKindName, int maxLength)
static void
validateExternalIdReference(String id, String idKindName)
-
-
-
Field Detail
-
EXT_ID_PARTS_DELIMITER
public static final String EXT_ID_PARTS_DELIMITER
The delimiter between parent external id and a child part that is used when an external identifier is generated automatically.- See Also:
- Constant Field Values
-
EXT_ID_LENGTH
public static final int EXT_ID_LENGTH
The external identifier length limit. In database the limit is 256 characters, but ext ID is often used in file name and OS can have own limitations for the length of the file name (for example, in Linux it is 255 for most types of file systems), so in code we set id limit to some smaller value to make sure file name ([ext id].[file ext]) does not exceed 255 (see also https://youtrack.jetbrains.com/issue/TW-59369)- See Also:
- Constant Field Values
-
CONFIG_ID_LENGTH
public static final int CONFIG_ID_LENGTH
The config identifier length limit.- See Also:
- Constant Field Values
-
-
Method Detail
-
validateExternalIdReference
public static void validateExternalIdReference(@NotNull String id, String idKindName) throws InvalidIdentifierException
- Throws:
InvalidIdentifierException
-
validateExternalId
public static void validateExternalId(@NotNull String id, String idKindName) throws InvalidIdentifierException
- Throws:
InvalidIdentifierException
-
validateExternalId
public static void validateExternalId(@NotNull String id, String idKindName, int maxLength) throws InvalidIdentifierException
- Throws:
InvalidIdentifierException
-
generateExternalIdByName
@NotNull public static String generateExternalIdByName(@NotNull String name, boolean requireFirstLetter, boolean adjustCase, int limitLength)
-
generateUniqueExternalIdByUserString
@NotNull public static String generateUniqueExternalIdByUserString(@Nullable String parentId, @NotNull String name, boolean adjustCase, @NotNull OccupiedIdsChecker occupiedIdsChecker)
Generates a new unique external id by the given parent external id and a user string (usually name).- Parameters:
parentId
- the external id of the parent entity.name
- name to generate a new id based on.existentIdentifiers
- a set of existent identifiers to ensure uniqueness.- Returns:
- the result identifier
-
-