remm        01/03/05 19:19:57

  Modified:    src/share/org/apache/slide/content
                        NodeRevisionDescriptor.java
  Log:
  - Use ISO date format for creation date.
  - Always use GMT dates.
  
  Revision  Changes    Path
  1.16      +28 -8     
jakarta-slide/src/share/org/apache/slide/content/NodeRevisionDescriptor.java
  
  Index: NodeRevisionDescriptor.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/content/NodeRevisionDescriptor.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- NodeRevisionDescriptor.java       2001/02/26 00:57:43     1.15
  +++ NodeRevisionDescriptor.java       2001/03/06 03:19:57     1.16
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/content/NodeRevisionDescriptor.java,v
 1.15 2001/02/26 00:57:43 remm Exp $
  - * $Revision: 1.15 $
  - * $Date: 2001/02/26 00:57:43 $
  + * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/content/NodeRevisionDescriptor.java,v
 1.16 2001/03/06 03:19:57 remm Exp $
  + * $Revision: 1.16 $
  + * $Date: 2001/03/06 03:19:57 $
    *
    * ====================================================================
    *
  @@ -70,6 +70,7 @@
   import java.util.Date;
   import java.util.StringTokenizer;
   import java.util.Locale;
  +import java.util.TimeZone;
   import java.text.SimpleDateFormat;
   import java.text.DateFormat;
   import java.text.ParseException;
  @@ -80,7 +81,7 @@
    * Node Revision Descriptor class.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Remy Maucherat</a>
  - * @version $Revision: 1.15 $
  + * @version $Revision: 1.16 $
    */
   public final class NodeRevisionDescriptor implements Serializable, Cloneable {
       
  @@ -162,10 +163,27 @@
           new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US),
           new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US),
           new SimpleDateFormat("EEEEEE, dd-MMM-yy HH:mm:ss zzz", Locale.US),
  -        new SimpleDateFormat("EEE MMMM d HH:mm:ss yyyy", Locale.US)
  +        new SimpleDateFormat("EEE MMMM d HH:mm:ss yyyy", Locale.US),
  +        new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")
       };
       
       
  +    /**
  +     * Simple date format for the creation date ISO representation (partial).
  +     */
  +    protected static final SimpleDateFormat creationDateFormat = 
  +        new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
  +
  +
  +    static {
  +        format.setTimeZone(TimeZone.getTimeZone("GMT"));
  +        creationDateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
  +        for (int i = 0; i < formats.length; i++) {
  +            formats[i].setTimeZone(TimeZone.getTimeZone("GMT"));
  +        }
  +    }
  +    
  +    
       // ----------------------------------------------------------- Constructors
       
       
  @@ -589,7 +607,8 @@
               return null;
           } else {
               if (creationDate.getValue() instanceof Date) {
  -                return format.format((Date) creationDate.getValue());
  +                return creationDateFormat.format
  +                    ((Date) creationDate.getValue());
               }
               return creationDate.getValue().toString();
           }
  @@ -629,7 +648,8 @@
        * @param creationDate New creation date
        */
       public void setCreationDate(Date creationDate) {
  -        setProperty(CREATION_DATE, creationDate, true);
  +        setProperty
  +            (CREATION_DATE, creationDateFormat.format(creationDate), true);
       }
       
       
  @@ -695,7 +715,7 @@
        * @param lastModified New last modified date
        */
       public void setLastModified(Date lastModified) {
  -        setProperty(LAST_MODIFIED, lastModified, true);
  +        setProperty(LAST_MODIFIED, format.format(lastModified), true);
       }
       
       
  
  
  

Reply via email to