KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jahia > security > license > ReleaseNumberValidator


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 /**
8  * <p>Title: </p>
9  * <p>Description: </p>
10  * <p>Copyright: Copyright (c) 2002</p>
11  * <p>Company: Jahia Ltd</p>
12  * @author Serge Huber
13  * @version 1.0
14  */

15
16 public class ReleaseNumberValidator extends VersionValidator {
17
18     public ReleaseNumberValidator(String JavaDoc name, String JavaDoc value, License license) {
19         super(name, value, license);
20     }
21
22     public boolean assertEquals(String JavaDoc 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 JavaDoc fromValue, String JavaDoc 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