Class IdentifiersUtil


  • public class IdentifiersUtil
    extends Object
    Useful methods for working with internal and external identifiers.
    Since:
    8.0
    • 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
      • ourInaccessibleStringEntityId

        public static final EntityId<String> ourInaccessibleStringEntityId
      • ourDummyEntityId

        public static final EntityId<String> ourDummyEntityId
    • Constructor Detail

      • IdentifiersUtil

        public IdentifiersUtil()
    • Method Detail

      • 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