Class BslCompareUtils


  • public class BslCompareUtils
    extends Object
    Utility methods used for comparison and merge Bsl module.
    • Method Detail

      • readBslModuleContent

        public static BslModuleContentInfo readBslModuleContent​(BslModuleComparisonNode node,
                                                                IComparisonSession session,
                                                                ComparisonSide side,
                                                                boolean detectIsBinary,
                                                                IQualifiedNameFilePathConverter filePathConverter)
        Reads the Bsl module content on the specified comparison side.
        Parameters:
        node - the Bsl module comparison node to get content for, cannot be null
        session - the comparison session, cannot be null
        side - the comparison side to get content on, cannot be null
        detectIsBinary - tells whether to detect is Bsl module content is binary
        filePathConverter - the qualified name file path converted, cannot be null
        Returns:
        the Bsl module content info, never null
      • readBslModuleContent

        public static String readBslModuleContent​(BslModuleSectionComparisonNode node,
                                                  IComparisonSession session,
                                                  ComparisonSide side,
                                                  IQualifiedNameFilePathConverter filePathConverter)
        Reads the Bsl module content on the specified comparison side.
        Parameters:
        node - the Bsl module section comparison node to get content for, cannot be null
        session - the comparison session, cannot be null
        side - the comparison side to get content on, cannot be null
        filePathConverter - the qualified name file path converted, cannot be null
        Returns:
        the Bsl module content, may be null
      • readBslModuleContentOnMerge

        public static String readBslModuleContentOnMerge​(BslModuleComparisonNode node,
                                                         IMergeSession mergeSession,
                                                         ComparisonSide side,
                                                         IQualifiedNameFilePathConverter filePathConverter)
        Reads the Bsl module content on the specified comparison side on merge.
        Parameters:
        node - the Bsl module comparison node to get content for, cannot be null
        mergeSession - the merge session, cannot be null
        side - the comparison side to get content on, cannot be null
        filePathConverter - the qualified name file path converted, cannot be null
        Returns:
        the Bsl module content on merge, may be null
      • parseBslModuleContent

        public static org.eclipse.xtext.parser.IParseResult parseBslModuleContent​(BslModuleComparisonNode node,
                                                                                  IComparisonSession session,
                                                                                  ComparisonSide side,
                                                                                  IQualifiedNameFilePathConverter filePathConverter)
        Parses the Bsl module content stream on the specified comparison side.
        Parameters:
        node - the Bsl module comparison node to parse content for, cannot be null
        session - the comparison session, cannot be null
        side - the comparison side to parse content on, cannot be null
        filePathConverter - the qualified name file path converted, cannot be null
        Returns:
        the result of the parsing or null if nothing to parse or it failed
      • parseBslModuleContent

        public static org.eclipse.xtext.parser.IParseResult parseBslModuleContent​(InputStream inputStream)
        Parses the Bsl module content stream.
        Parameters:
        inputStream - the Bsl module input stream to parse, cannot be null
        Returns:
        the result of the parsing or null if it failed
      • getBslModuleContentStream

        public static InputStream getBslModuleContentStream​(BslModuleComparisonNode node,
                                                            IComparisonSession session,
                                                            ComparisonSide side,
                                                            IQualifiedNameFilePathConverter filePathConverter)
        Returns the Bsl module content stream on the specified comparison side.
        Parameters:
        node - the Bsl module comparison node to get content stream for, cannot be null
        session - the comparison session, cannot be null
        side - the comparison side to get content stream on, cannot be null
        filePathConverter - the qualified name file path converted, cannot be null
        Returns:
        the Bsl module content stream or null if there is no module on the specified comparison side
      • getBslModuleContentStreamOnMerge

        public static InputStream getBslModuleContentStreamOnMerge​(BslModuleComparisonNode node,
                                                                   IMergeSession mergeSession,
                                                                   ComparisonSide side,
                                                                   IQualifiedNameFilePathConverter filePathConverter)
        Returns the Bsl module content stream on the specified comparison side on merge.
        Parameters:
        node - the Bsl module comparison node to get content stream for, cannot be null
        mergeSession - the merge session, cannot be null
        side - the comparison side to get content stream on, cannot be null
        filePathConverter - the qualified name file path converted, cannot be null
        Returns:
        the Bsl module content stream or null if there is no module on the specified comparison side
      • getTrimmedLocalizedModuleSymlink

        public static String getTrimmedLocalizedModuleSymlink​(String symlink,
                                                              ISymbolicLinkLocalizer symbolicLinkLocalizer)
        Returns the trimmed localized Bsl module symlink.
        Parameters:
        symlink - the Bsl module symlink to localize, cannot be null
        symbolicLinkLocalizer - the symbolic link localizer, cannot be null
        Returns:
        the trimmed localized Bsl module symlink, never null
      • getLocalizedBslModuleName

        public static String getLocalizedBslModuleName​(String symlink,
                                                       String comparisonSideName,
                                                       ISymbolicLinkLocalizer symbolicLinkLocalizer)
        Returns the localized Bsl module node name.
        Parameters:
        symlink - the Bsl module node symlink, cannot be null
        comparisonSideName - the comparison side name, cannot be null
        symbolicLinkLocalizer - the symbolic link localizer, cannot be null
        Returns:
        the localized Bsl module node name, never null
      • mergeModuleUsingExternalTool

        public static ExternalMergeToolExecutionStatus mergeModuleUsingExternalTool​(BslModuleComparisonNode node,
                                                                                    IComparisonSession session,
                                                                                    ExternalMergeToolConfiguration externalMergeToolConfiguration,
                                                                                    boolean runAutoMergeByDefault,
                                                                                    String mainComparisonSideName,
                                                                                    String otherComparisonSideName,
                                                                                    File mergeResultFile,
                                                                                    IQualifiedNameFilePathConverter filePathConverter,
                                                                                    ISymbolicLinkLocalizer symbolicLinkLocalizer)
                                                                             throws IOException
        Merges the Bsl module using an external tool for the specified node.
        Parameters:
        node - the Bsl module node, should not be one side, cannot be null
        session - the comparison session, cannot be null
        externalMergeToolConfiguration - the external merge tool configuration, cannot be null
        runAutoMergeByDefault - true if needed to run automatic merge by default if possible, false otherwise
        mainComparisonSideName - the main comparison side name, cannot be null
        otherComparisonSideName - the other comparison side name, cannot be null
        mergeResultFile - the file to store merge result, cannot be null
        filePathConverter - the file path converter, cannot be null
        symbolicLinkLocalizer - the symbolic link localizer, cannot be null
        Returns:
        the external merge tool execution status, never null
        Throws:
        IOException - if failed to read Bsl module content