Package org.jasig.portal.version.om.Version

Examples of org.jasig.portal.version.om.Version.Field


     * @param from Version updating from
     * @param to Version updating to
     * @return true if the major and minor versions match and the from.patch value is less than or equal to the to.patch value
     */
    public static boolean canUpdate(Version from, Version to) {
        final Field mostSpecificMatchingField = getMostSpecificMatchingField(from, to);
        switch (mostSpecificMatchingField) {
            case LOCAL: {
                return true;
            }
            case PATCH:
View Full Code Here


            if (dbVersion == null) {
                throw new ApplicationContextException("No Version exists for " + product + " in the database. Please check the upgrade instructions for this release.");
            }
           
            final Version codeVersion = productVersionEntry.getValue();
            final Field mostSpecificMatchingField = VersionUtils.getMostSpecificMatchingField(dbVersion, codeVersion);
           
            switch (mostSpecificMatchingField) {
                //Versions completely match
                case LOCAL: {
                    logger.info("Software and Database versions are both {} for {}", dbVersion, product);
                    continue;
                }
                //Versions match except for local part
                case PATCH:
                //Versions match except for patch.local part
                case MINOR: {
                    //If db is before code and auto-update is enabled run hibernate-update
                    final Field upgradeField = mostSpecificMatchingField.getLessImportant();
                   
                    if (dbVersion.isBefore(codeVersion) &&
                            this.updatePolicy != null &&
                            (upgradeField.equals(this.updatePolicy) || upgradeField.isLessImportantThan(this.updatePolicy))) {
                        logger.info("Automatically updating database from {} to {} for {}", dbVersion, codeVersion, product);
                       
                        this.portalShellBuildHelper.hibernateUpdate("automated-hibernate-update", product, true, null);
                        continue;
                    }
View Full Code Here

TOP

Related Classes of org.jasig.portal.version.om.Version.Field

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.