Scarab commit: svn commit: r10829 - branches/release/0.22/src/java/org/tigris/scarab/om/Activity.java

Johannes Höchstädter <[email protected]>
Newsgroups gmane.comp.java.scarab.cvs
Message-ID <[email protected]>
Author: jhoech
Date: 2009-07-23 03:10:04-0700
New Revision: 10829

Modified:
   branches/release/0.22/src/java/org/tigris/scarab/om/Activity.java

Log:
FIX - SCB2992 Fix for unformatted data strings in for changed date attributes in history.


Modified: branches/release/0.22/src/java/org/tigris/scarab/om/Activity.java
Url: http://scarab.tigris.org/source/browse/scarab/branches/release/0.22/src/java/org/tigris/scarab/om/Activity.java?view=diff&pathrev=10829&r1=10828&r2=10829
==============================================================================
--- branches/release/0.22/src/java/org/tigris/scarab/om/Activity.java	(original)
+++ branches/release/0.22/src/java/org/tigris/scarab/om/Activity.java	2009-07-23 03:10:04-0700
@@ -53,6 +53,7 @@
 import org.apache.torque.util.Criteria;
 import java.sql.Connection;
 
+import org.tigris.scarab.attribute.DateAttribute;
 import org.tigris.scarab.notification.ActivityType;
 import org.tigris.scarab.om.Attachment;
 import org.tigris.scarab.services.cache.ScarabCache;
@@ -200,6 +201,12 @@
        return s.substring(0, end ) + "..."; 
     }
 
+    /**
+     * Returns old value, before activity took place.
+     * @param l10n : Instance of localization.
+     * @return : Old value.
+     * @throws Exception
+     */
     public String getOldValue(ScarabLocalizationTool l10n) 
         throws Exception
     {
@@ -220,11 +227,24 @@
          {
              value = getOldValue()!=null ? firstChars( getOldValue(), 50 ) : "";
          } else {
-             value = getOldValue()!=null ? getOldValue() : "";
+        	//assumption that an attribute was changed
+        	 if(getAttribute() != null && getAttribute().isDateAttribute()){
+         		value = DateAttribute.dateFormat(getOldValue()!=null ? getOldValue() : "",  L10NKeySet.ShortDateDisplay.getMessage(l10n));
+         	}
+         	else{
+         		value = getOldValue()!=null ? getOldValue() : "";
+         	}
          }
 
         return value;
     }
+    
+    /**
+     * Returns new value, after activity took place.
+     * @param l10n : Instance of localization.
+     * @return : New value.
+     * @throws Exception
+     */
     public String getNewValue(ScarabLocalizationTool l10n)
         throws Exception
     {
@@ -249,7 +269,14 @@
         {
             value = super.getDescription()!=null ? super.getDescription() : "";
         } else {
-            value = getNewValue()!=null ? getNewValue() : "";
+        	//assumption that an attribute was changed
+        	if(getAttribute() != null && getAttribute().isDateAttribute()){
+        		value = DateAttribute.dateFormat(getNewValue()!=null ? getNewValue() : "",  L10NKeySet.ShortDateDisplay.getMessage(l10n));
+        	}
+        	else{
+        		value = getNewValue()!=null ? getNewValue() : "";
+        	}
+            
         }
         return value;
     }

------------------------------------------------------
http://scarab.tigris.org/ds/viewMessage.do?dsForumId=3577&dsMessageId=2374722
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.