Class Publications


  • public final class Publications
    extends Object
    Publications utility methods.
    Restriction:
    This class is not intended to be sub-classed by clients.
    Restriction:
    This class is not intended to be instantiated by clients.
    • Field Detail

      • NOT_ALLOWED_NAME_PATTERN

        public static final Pattern NOT_ALLOWED_NAME_PATTERN
      • ALLOWED_LETTERS

        public static final Pattern ALLOWED_LETTERS
    • Method Detail

      • findByName

        public static Publication findByName​(String name,
                                             Collection<Publication> publications)
        Returns the publication by the given name. Can return null.
        Parameters:
        name - the name to find publication with, cannot be null
        publications - collection of publications to search in, cannot be null
        Returns:
        publication by the given name or null if not found
      • getNames

        public static List<String> getNames​(Collection<Publication> publications)
        Returns collection of all names of given publications.
        Parameters:
        publications - publications to get names to, cannot be null
        Returns:
        list of all names, never null
      • ofType

        public static Collection<Publication> ofType​(Collection<Publication> publications,
                                                     PublicationType type)
        Filter collection of publications to get publications with the given type only.
        Parameters:
        publications - publications to get names to, cannot be null
        type - the publication type, cannot be null
        Returns:
        publications with the given type only, never null
      • getRuntimeComponent

        public static String getRuntimeComponent​(Publication publication)
        Returns 1C:Enterprise runtime component type by the publication instance.
        Parameters:
        publication - the publication to get 1C:Enterprise runtime component type for, cannot be null
        Returns:
        1C:Enterprise runtime component type, never null
      • generateName

        public static String generateName​(InfobaseReference infobase,
                                          PublicationType type)
        Generates publication name for the given infobase and publication type. Name may be generated by the:
        1. Infobase name, if result is valud
        2. Infobase location (file or server) if result is valud

        May return empty string.

        Parameters:
        infobase - the infobase to use for name generation, cannot be null
        type - the publication type, cannot be null
        Returns:
        a generated publication name, never null; may return empty string when name cannot be correctly generated for the given infobase and type
      • normalizeName

        public static String normalizeName​(String name)
        Normalize publication name. All disallowed symbols will be removed.
        Parameters:
        name - the name to normalize, cannot be null
        Returns:
        normalized publication name, never null
      • isValidName

        public static boolean isValidName​(String name)
        Returns whether the given name is valid for publication.
        Parameters:
        name - the name to check, cannot be null
        Returns:
        whether the given name is valid for publication
      • getValidationStatus

        public static org.eclipse.core.runtime.IStatus getValidationStatus​(Publication publication)
        Returns validation status of given publication instance.
        Parameters:
        publication - the publication instance to get validation status for, cannot be null
        Returns:
        the validation status, never null
      • appendValidationStatus

        public static org.eclipse.core.runtime.IStatus appendValidationStatus​(Publication publication,
                                                                              org.eclipse.core.runtime.IStatus status)
        Append the given multi status validation to the given publication instance.
        Parameters:
        publication - the publication instance to append validation status for, cannot be null
        status - the status validation to append, cannot be null
        Returns:
        the updated status, never null