1 package org.jahia.security.license; 2 3 import org.jahia.utils.Version; 4 import org.jahia.bin.JahiaInterface; 5 import org.jahia.resourcebundle.ResourceMessage; 6 7 15 16 public class ReleaseNumberValidator extends VersionValidator { 17 18 public ReleaseNumberValidator(String name, String value, License license) { 19 super(name, value, license); 20 } 21 22 public boolean assertEquals(String value) { 23 internalVersion = new Version(Double.toString(JahiaInterface.RELEASE_NUMBER)); 24 if (super.assertEquals(value)) { 25 return true; 26 } else { 27 errorMessage = new ResourceMessage("org.jahia.security.license.ReleaseNumberValidator.invalidReleaseNumber.label", internalVersion, value); 28 return false; 29 } 30 } 31 32 public boolean assertInRange(String fromValue, String toValue) { 33 internalVersion = new Version(Double.toString(JahiaInterface.RELEASE_NUMBER)); 34 if (super.assertInRange(fromValue, toValue)) { 35 return true; 36 } else { 37 errorMessage = new ResourceMessage("org.jahia.security.license.ReleaseNumberValidator.releaseNumberNotInRange.label", internalVersion, fromValue, toValue); 38 return false; 39 } 40 } 41 42 } | Popular Tags |