[cvs] expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/ext/dbobj ISOCountryCodes.java

JCorporate Ltd jcorp at jcorp2.servlets.net
Fri Jun 4 13:02:56 PDT 2004


Update of /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/ext/dbobj
In directory jcorp2.servlets.net:/tmp/cvs-serv27744/expresso-web/WEB-INF/src/com/jcorporate/expresso/ext/dbobj

Modified Files:
	ISOCountryCodes.java 
Log Message:
cosmetic use of string constants


Index: ISOCountryCodes.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/ext/dbobj/ISOCountryCodes.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** ISOCountryCodes.java	6 Mar 2004 01:10:54 -0000	1.14
--- ISOCountryCodes.java	4 Jun 2004 20:02:50 -0000	1.15
***************
*** 69,72 ****
--- 69,73 ----
  import com.jcorporate.expresso.core.dbobj.RequestContext;
  import com.jcorporate.expresso.core.dbobj.SecuredDBObject;
+ import com.jcorporate.expresso.core.dbobj.DBField;
  import com.jcorporate.expresso.core.misc.StringUtil;
  import org.apache.oro.text.regex.MalformedPatternException;
***************
*** 88,95 ****
   * See www.iso.org/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/index.html
   * for the source of this data.
!  *
   * This is highly useful for registration data.  Allow a person to choose from a
   * dropdown box.  Also can check postal code against known regular expressions
   * depending on the iso country code associated with the registration.
   * @author Michael Rimov
   * @since Expresso 5.0
--- 89,97 ----
   * See www.iso.org/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/index.html
   * for the source of this data.
!  * <p/>
   * This is highly useful for registration data.  Allow a person to choose from a
   * dropdown box.  Also can check postal code against known regular expressions
   * depending on the iso country code associated with the registration.
+  *
   * @author Michael Rimov
   * @since Expresso 5.0
***************
*** 118,122 ****
      /**
       * Constructor
-      * @throws  DBException
       */
      public ISOCountryCodes()
--- 120,123 ----
***************
*** 128,133 ****
       * Constructor
       *
!      * @param  myConnection The DBConnection to use Locally
!      * @throws  DBException
       */
      public ISOCountryCodes(DBConnection myConnection)
--- 129,133 ----
       * Constructor
       *
!      * @param myConnection The DBConnection to use Locally
       */
      public ISOCountryCodes(DBConnection myConnection)
***************
*** 139,142 ****
--- 139,143 ----
       * Use over (String) constructor.  Initializes the object in the context
       * of the user who's uid belongs to the parameter.
+      *
       * @param uid the Uid of the user context
       * @throws DBException if there's an initialization problem
***************
*** 160,172 ****
  
      /**
-      *
       * This function populates the table with the current listing of ISO country codes
!      * @see com.jcorporate.expresso.core.dbobj.DBObject#populateDefaultValues
       * @throws DBException if an error occurs while populating the table.
       */
      public synchronized void populateDefaultValues()
              throws DBException {
          int i;
!         String[][] localCodes = this.getCountryCodes();
          int len = localCodes.length;
  
--- 161,173 ----
  
      /**
       * This function populates the table with the current listing of ISO country codes
!      *
       * @throws DBException if an error occurs while populating the table.
+      * @see com.jcorporate.expresso.core.dbobj.DBObject#populateDefaultValues
       */
      public synchronized void populateDefaultValues()
              throws DBException {
          int i;
!         String[][] localCodes = getCountryCodes();
          int len = localCodes.length;
  
***************
*** 186,201 ****
       * Useful method for unit testing to make sure that everything got added during
       * setup as expected.
       * @return the length of what's expected to be in the table
       */
      public int getExpectedDefaultPopulation() {
!         String[][] countryCodes = this.getCountryCodes();
          return countryCodes.length;
      }
  
      /**
!      *
!      *
!      * @return    Vector of ValidValue Value/Description pairs for ISO Country Codes
!      * @throws    DBException If the values cannot be retrieved
       */
      public Vector getValues()
--- 187,201 ----
       * Useful method for unit testing to make sure that everything got added during
       * setup as expected.
+      *
       * @return the length of what's expected to be in the table
       */
      public int getExpectedDefaultPopulation() {
!         String[][] countryCodes = getCountryCodes();
          return countryCodes.length;
      }
  
      /**
!      * @return Vector of ValidValue Value/Description pairs for ISO Country Codes
!      * @throws DBException If the values cannot be retrieved
       */
      public Vector getValues()
***************
*** 208,216 ****
       * Checks a postal code for proper formatting The iso country definition
       * should already have been retrieved.
       * @param testPostalCode the postalCode to check
       * @return true if the postal code existed for this country
       * @throws DBException if the test code didn't match the regular expression
!      * stored in the database  OR if the regular expression in the database
!      * is syntactically invalid
       */
      public boolean checkPostalCode(String testPostalCode)
--- 208,217 ----
       * Checks a postal code for proper formatting The iso country definition
       * should already have been retrieved.
+      *
       * @param testPostalCode the postalCode to check
       * @return true if the postal code existed for this country
       * @throws DBException if the test code didn't match the regular expression
!      *                     stored in the database  OR if the regular expression in the database
!      *                     is syntactically invalid
       */
      public boolean checkPostalCode(String testPostalCode)
***************
*** 235,241 ****
      /**
       * Get's the regular expression patter to match against.
!      * @throws DBException if the mattern match is bad.
       * @param postalCodePattern the postalCode pattern to check
       * @return ORO Compiled Regular Expression Pattern
       */
      private synchronized Pattern getPattern(String postalCodePattern)
--- 236,243 ----
      /**
       * Get's the regular expression patter to match against.
!      *
       * @param postalCodePattern the postalCode pattern to check
       * @return ORO Compiled Regular Expression Pattern
+      * @throws DBException if the mattern match is bad.
       */
      private synchronized Pattern getPattern(String postalCodePattern)
***************
*** 245,249 ****
          if (p == null) {
              try {
!                 p = compiler.compile(postalCodePattern,Perl5Compiler.READ_ONLY_MASK);
                  regExpCache.addElement(postalCodePattern, p);
              } catch (MalformedPatternException mpe) {
--- 247,251 ----
          if (p == null) {
              try {
!                 p = compiler.compile(postalCodePattern, Perl5Compiler.READ_ONLY_MASK);
                  regExpCache.addElement(postalCodePattern, p);
              } catch (MalformedPatternException mpe) {
***************
*** 266,272 ****
          setDescription("ISO Country Codes");
          setCharset("ISO-8859-1");
!         addField(FLD_ISOCODE, "varchar", 10, false, "ISO Country Code");
!         addField(FLD_COUNTRY, "varchar", 128, false, "Country Name");
!         addField(FLD_POSTALREGEXP, "varchar", 128, true,
                  "Postal Code Valid Regular Expression");
          setStringFilter(FLD_ISOCODE, "stripFilter");
--- 268,274 ----
          setDescription("ISO Country Codes");
          setCharset("ISO-8859-1");
!         addField(FLD_ISOCODE, DBField.VARCHAR_TYPE, 10, false, "ISO Country Code");
!         addField(FLD_COUNTRY, DBField.VARCHAR_TYPE, 128, false, "Country Name");
!         addField(FLD_POSTALREGEXP, DBField.VARCHAR_TYPE, 128, true,
                  "Postal Code Valid Regular Expression");
          setStringFilter(FLD_ISOCODE, "stripFilter");
***************
*** 278,284 ****
  
      protected synchronized static String[][] getCountryCodes() {
!         synchronized(countryCodeLock) {
              if (countryCodes == null || countryCodes.get() == null) {
!                 countryCodes = new WeakReference(new String[][] {
                      {"United States", "US", ""}, {"Afghanistan", "AF", ""},
                      {"Albania", "AL", ""}, {"Algeria", "DZ", ""},
--- 280,286 ----
  
      protected synchronized static String[][] getCountryCodes() {
!         synchronized (countryCodeLock) {
              if (countryCodes == null || countryCodes.get() == null) {
!                 countryCodes = new WeakReference(new String[][]{
                      {"United States", "US", ""}, {"Afghanistan", "AF", ""},
                      {"Albania", "AL", ""}, {"Algeria", "DZ", ""},
***************
*** 390,394 ****
              }
  
!             return (String[][])countryCodes.get();
          }
      }
--- 392,396 ----
              }
  
!             return (String[][]) countryCodes.get();
          }
      }



More information about the cvs mailing list