private static void validatePackageVersion(List<Package> packages) {
        final String exceptions = ".*\\b(oracle|tibco|demo|hub)\\b.*";
        String version = ApplicationContext.getMdwVersion();
        String mdwVersion = version.split("\\-")[0];

        List<Package> filteredPackages = packages.stream()
                .filter(e -> !mdwVersion.equals(e.getVersionString())
                        && e.getName().startsWith("com.centurylink.mdw")
                        && !e.getName().startsWith("com.centurylink.mdw.central"))
                .collect(Collectors.toList());
        List<Package> obsoletePackages = filteredPackages.stream()
                .filter(p2 -> !(p2.getName().matches(exceptions)))
                .collect(Collectors.toList());

        if (!obsoletePackages.isEmpty()){
            StringBuilder message=new StringBuilder();
            message.append( "\n****************************************\n"
                    + "** WARNING: These asset packages do not match current build version " + mdwVersion + "\n");
            for (Package p1 : obsoletePackages) {
                message.append("**   "+p1.getLabel()+"\n");
            }
            message.append("******************************************\n");
            logger.warn(message.toString());
        }
    }
private static void validatePackageVersion ( List < Package > packages ) { final String exceptions = ".*\\b(oracle|tibco|demo|hub)\\b.*" ; String version = ApplicationContext . getMdwVersion ( ) ; String mdwVersion = version . split ( "\\-" ) [ 0 ] ; List < Package > filteredPackages = packages . stream ( ) . filter ( e -> ! mdwVersion . equals ( e . getVersionString ( ) ) && e . getName ( ) . startsWith ( "com.centurylink.mdw" ) && ! e . getName ( ) . startsWith ( "com.centurylink.mdw.central" ) ) . collect ( Collectors . toList ( ) ) ; List < Package > obsoletePackages = filteredPackages . stream ( ) . filter ( p2 -> ! ( p2 . getName ( ) . matches ( exceptions ) ) ) . collect ( Collectors . toList ( ) ) ; if ( ! obsoletePackages . isEmpty ( ) ) { StringBuilder message = new StringBuilder ( ) ; message . append ( "\n****************************************\n" + "** WARNING: These asset packages do not match current build version " + mdwVersion + "\n" ) ; for ( Package p1 : obsoletePackages ) { message . append ( "**   " + p1 . getLabel ( ) + "\n" ) ; } message . append ( "******************************************\n" ) ; logger . warn ( message . toString ( ) ) ; } }
Method that gets invoked from load(). It checks if the
framework asset packages and current MDW build versions are the same.
Otherwise logs a warning message.