Scarab commit: svn commit: r10918 - trunk/src/java/org/tigris/scarab/notification/Notification.java

Hussayn Dabbous <[email protected]>
Newsgroups gmane.comp.java.scarab.cvs
Message-ID <[email protected]>
Author: dabbous
Date: 2010-02-24 13:01:50-0800
New Revision: 10918

Modified:
   trunk/src/java/org/tigris/scarab/notification/Notification.java

Log:
Logging entries now a little better readable.

Modified: trunk/src/java/org/tigris/scarab/notification/Notification.java
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/java/org/tigris/scarab/notification/Notification.java?view=diff&pathrev=10918&r1=10917&r2=10918
==============================================================================
--- trunk/src/java/org/tigris/scarab/notification/Notification.java	(original)
+++ trunk/src/java/org/tigris/scarab/notification/Notification.java	2010-02-24 13:01:50-0800
@@ -216,7 +216,7 @@
 
     /**
      * Check if the current combination of user/module/issue-content
-     * meets the conditions under whioch a notification shal be sent.
+     * meets the conditions under which a notification shall be sent.
      * Note: If the condition operator is set to "OR", any matching
      * notification option in any attribute will return true
      * If the operator is set to "AND" Each attribute for which options have
@@ -240,7 +240,12 @@
         Iterator<Condition> iter = conditions.iterator();
         Set<Integer>attributeIds = new HashSet<Integer>();
 
-        log.info("test sendNotification conditions -----------------------------------------------");
+        String forIssueId = "";
+        if(this.issue!=null)
+        {
+            forIssueId = "for issue " + this.issue.getIdPrefix()+ this.issue.getIdCount();
+        }
+        log.info("test sendNotification conditions "+forIssueId+" -------------");
         
         int matchCounter = 0;
         while(iter.hasNext())
@@ -254,7 +259,7 @@
             
             AttributeOption option = AttributeOptionManager.getInstance(optionId);
             
-            log.info("test  " + attribute.getName() + "=\"" + option.getName()    + "\"  (att:" + + attributeId + ",opt:" + optionId+")");
+            //log.info("test for " + attribute.getName() + "=\"" + option.getName()    + "\"  (att:" + + attributeId + ",opt:" + optionId+")");
             
             Iterator<Entry<String,AttributeValue>> attvalIterator = attributeValues.entrySet().iterator();
             while( attvalIterator.hasNext())
@@ -268,20 +273,22 @@
                 {
                     int aoi = av.getOptionId();
                     boolean match = aoi == optionId;
-                    log.info( ((match)? "match ":"      ") + att.getName()       + "=\"" + attOpt.getName()    + "\"  (att:" + attvalAttributeId + ",opt:" + attOpt.getOptionId());
+                    //log.info( ((match)? "match ":"      ") + att.getName()       + "=\"" + attOpt.getName()    + "\"  (att:" + attvalAttributeId + ",opt:" + attOpt.getOptionId());
                     if( match)
                     {
+                        String sendConditionMet = "SendCondition met. ("+attribute.getName() + "=\"" + option.getName()+")";
                         matchCounter++;
                         if ( operator.equals(OR) )
                         {
-                            log.info("SendCondition met. (any condition match terminated on first match");
+                            log.info(sendConditionMet + " -> (send notification)");
                             return true;  // quick exit. first match gives success.
                         }
+                        log.info(sendConditionMet);
                         break; // we can break the inner iteration (we found the match)
-                    }
-                    
+                    }                    
                 }
             }
+            
         }
 
         boolean match; // just in case no condition is defined, we return true
@@ -292,7 +299,14 @@
         }
         else
         {
-            log.info("Only " + matchCounter + " send Conditions out of "+attributeIds.size()+" match the required values");
+            if (attributeIds.size() > 0)
+            {
+                log.info("Only " + matchCounter + " send Conditions out of "+attributeIds.size()+" met. (Send is not triggered.)");
+            }
+            else
+            {
+                log.info("None of the available conditions was applicable to this issue. (Send is not triggered.)" );
+            }
             match = false;
         }

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