Scarab commit: svn commit: r10861 - branches/release/0.22/src: java/org/tigris/scarab/om webapp/WEB-INF/templates/viewIssue

Johannes Höchstädter <[email protected]>
Newsgroups gmane.comp.java.scarab.cvs
Message-ID <[email protected]>
Author: jhoech
Date: 2009-12-14 08:39:30-0800
New Revision: 10861

Modified:
   branches/release/0.22/src/java/org/tigris/scarab/om/Activity.java
   branches/release/0.22/src/webapp/WEB-INF/templates/viewIssue/ViewIssueTab5.vm

Log:
FIX - SCB3005 Entries in history for dependencies are correct now for depend type "blocking" ("blocking"/"blocked by").

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=10861&r1=10860&r2=10861
==============================================================================
--- 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-12-14 08:39:30-0800
@@ -208,15 +208,37 @@
      * @throws Exception
      */
     public String getOldValue(ScarabLocalizationTool l10n) 
+    throws Exception
+	{
+	    return getOldValue(null, l10n);
+	}
+    
+    /**
+     * Returns old value, before activity took place.
+     * @param issue : Instance of current issue. Is used to evaluate dependency type.
+     * @param l10n : Instance of localization.
+     * @return : Old value.
+     * @throws Exception
+     */
+    public String getOldValue(Issue issue, ScarabLocalizationTool l10n) 
         throws Exception
     {
         String value = null;
         if(   getType().equals(ActivityType.DEPENDENCY_DELETED)
            || getType().equals(ActivityType.DEPENDENCY_CHANGED))
          {
-             value = getDepend().getIssueRelatedByObserverId().getUniqueId()
-            + " " + l10n.get(DependTypeManager.getManager().getL10nKey(getOldValue()))
-             + " " + getDepend().getIssueRelatedByObservedId().getUniqueId();             
+        	if(issue != null 
+        			&& issue.getIssueId().intValue() != getDepend().getIssueRelatedByObservedId().getIssueId().intValue()
+        			&& getOldValue().equals("blocking")){
+            	value = getDepend().getIssueRelatedByObserverId().getUniqueId()
+                + " " + l10n.get("DependsOn") //deprecated, but method is used many times in scarab.
+                + " " + getDepend().getIssueRelatedByObservedId().getUniqueId(); 
+            }
+            else{
+            	value = getDepend().getIssueRelatedByObservedId().getUniqueId()
+            	+ " " + (getOldValue().equals("blocking") ? l10n.get("PrerequisiteFor") : l10n.get(DependTypeManager.getManager().getL10nKey(getOldValue())))
+                + " " + getDepend().getIssueRelatedByObserverId().getUniqueId();  
+            }            
          } else if( getType().equals(ActivityType.ATTACHMENT_REMOVED))
          {
              value = getAttachment().getFileName();
@@ -240,21 +262,42 @@
     }
     
     /**
-     * Returns new value, after activity took place.
+     * Returns new value, for activity.
+     * @param l10n
+     * @return New value.
+     * @throws Exception 
+     */
+    public String getNewValue(ScarabLocalizationTool l10n) throws Exception{
+        return getNewValue(null, l10n);
+    }
+    
+    /**
+     * Returns new value, for activity.
+     * @param issue : Instance of current issue.
      * @param l10n : Instance of localization.
      * @return : New value.
      * @throws Exception
      */
-    public String getNewValue(ScarabLocalizationTool l10n)
+    public String getNewValue(Issue issue, ScarabLocalizationTool l10n)
         throws Exception
     {
         String value = null;
         if(   getType().equals(ActivityType.DEPENDENCY_CREATED)
            || getType().equals(ActivityType.DEPENDENCY_CHANGED))
         {
-            value = getDepend().getIssueRelatedByObserverId().getUniqueId()
-            + " " + l10n.get(DependTypeManager.getManager().getL10nKey(getNewValue()))
-            + " " + getDepend().getIssueRelatedByObservedId().getUniqueId();             
+        	if(issue != null 
+        			&& issue.getIssueId().intValue() != getDepend().getIssueRelatedByObservedId().getIssueId().intValue()
+        			&& getNewValue().equals("blocking")){
+            	value = getDepend().getIssueRelatedByObserverId().getUniqueId()
+                + " " + l10n.get("DependsOn") //deprecated, but method is used many times in scarab.
+            	+ " " + getDepend().getIssueRelatedByObservedId().getUniqueId(); 
+            }
+            else{
+            	value = getDepend().getIssueRelatedByObservedId().getUniqueId()
+            	+ " " + (getNewValue().equals("blocking") ? l10n.get("PrerequisiteFor") : l10n.get(DependTypeManager.getManager().getL10nKey(getNewValue())))
+                + " " + getDepend().getIssueRelatedByObserverId().getUniqueId();  
+            }	
+           
         } else if( getType().equals(ActivityType.ATTACHMENT_CREATED))
         {
             value = getAttachment().getFileName();

Modified: branches/release/0.22/src/webapp/WEB-INF/templates/viewIssue/ViewIssueTab5.vm
Url: http://scarab.tigris.org/source/browse/scarab/branches/release/0.22/src/webapp/WEB-INF/templates/viewIssue/ViewIssueTab5.vm?view=diff&pathrev=10861&r1=10860&r2=10861
==============================================================================
--- branches/release/0.22/src/webapp/WEB-INF/templates/viewIssue/ViewIssueTab5.vm	(original)
+++ branches/release/0.22/src/webapp/WEB-INF/templates/viewIssue/ViewIssueTab5.vm	2009-12-14 08:39:30-0800
@@ -17,8 +17,8 @@
     <table width="100%">
     #foreach ($act in $activities)
         #if($currentIssue.isAttributeVisible($act.attribute, $user))
-          #set ($newValue = $act.getNewValue($l10n))
-          #set ($oldValue = $act.getOldValue($l10n))
+          #set ($newValue = $act.getNewValue($currentIssue, $l10n))
+          #set ($oldValue = $act.getOldValue($currentIssue, $l10n))
           <tr>
             <th width="14%">$act.getDisplayName($l10n)</th>
             #if( $oldValue.length()>0 )

------------------------------------------------------
http://scarab.tigris.org/ds/viewMessage.do?dsForumId=3577&dsMessageId=2430323
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.