You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2014/03/26 11:20:33 UTC

svn commit: r1581781 - in /syncope/branches/1_1_X: core/pom.xml core/src/main/java/org/apache/syncope/core/notification/NotificationManager.java core/src/test/java/org/apache/syncope/core/notification/NotificationTest.java pom.xml

Author: ilgrosso
Date: Wed Mar 26 10:20:33 2014
New Revision: 1581781

URL: http://svn.apache.org/r1581781
Log:
[SYNCOPE-487] White noise: formatting

Modified:
    syncope/branches/1_1_X/core/pom.xml
    syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/notification/NotificationManager.java
    syncope/branches/1_1_X/core/src/test/java/org/apache/syncope/core/notification/NotificationTest.java
    syncope/branches/1_1_X/pom.xml

Modified: syncope/branches/1_1_X/core/pom.xml
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/pom.xml?rev=1581781&r1=1581780&r2=1581781&view=diff
==============================================================================
--- syncope/branches/1_1_X/core/pom.xml (original)
+++ syncope/branches/1_1_X/core/pom.xml Wed Mar 26 10:20:33 2014
@@ -192,7 +192,7 @@ under the License.
     <dependency>
       <groupId>org.apache.velocity</groupId>
       <artifactId>velocity-tools</artifactId>
-	</dependency>
+    </dependency>
 	
     <dependency>
       <groupId>org.quartz-scheduler</groupId>

Modified: syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/notification/NotificationManager.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/notification/NotificationManager.java?rev=1581781&r1=1581780&r2=1581781&view=diff
==============================================================================
--- syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/notification/NotificationManager.java (original)
+++ syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/notification/NotificationManager.java Wed Mar 26 10:20:33 2014
@@ -70,7 +70,7 @@ import org.springframework.transaction.a
  *
  * @see NotificationTask
  */
-@Transactional(rollbackFor = {Throwable.class})
+@Transactional(rollbackFor = { Throwable.class })
 public class NotificationManager {
 
     /**
@@ -125,7 +125,7 @@ public class NotificationManager {
      */
     @Autowired
     private VelocityEngine velocityEngine;
-    
+
     /**
      * Velocity tool manager.
      */
@@ -193,47 +193,39 @@ public class NotificationManager {
 
         String htmlBody = mergeTemplateIntoString("mailTemplates/" + notification.getTemplate() + ".html.vm", model);
         String textBody = mergeTemplateIntoString("mailTemplates/" + notification.getTemplate() + ".txt.vm", model);
-        
+
         task.setHtmlBody(htmlBody);
         task.setTextBody(textBody);
-        
+
         return task;
     }
 
-    
-    
-    private String mergeTemplateIntoString(String templateLocation, Map<String, Object> model) {
-    	StringWriter result = new StringWriter();
-    	try {
-			Context velocityContext = createVelocityContext(model);
-			velocityEngine.mergeTemplate(templateLocation, SyncopeConstants.DEFAULT_ENCODING, velocityContext, result);
-		}
-		catch (VelocityException e) {
-			LOG.error("Could not get mail body", e);
-			return "";
-		}
-    	// ensure same behaviour as by using Spring VelocityEngineUtils.mergeTemplateIntoString()
-		catch (RuntimeException e) {
-			throw e;
-		}
-		catch (Exception e) {
-			LOG.error("Could not get mail body", e);
-			return "";
-		}
-    	return result.toString();
-    	
+    private String mergeTemplateIntoString(final String templateLocation, final Map<String, Object> model) {
+        StringWriter result = new StringWriter();
+        try {
+            Context velocityContext = createVelocityContext(model);
+            velocityEngine.mergeTemplate(templateLocation, SyncopeConstants.DEFAULT_ENCODING, velocityContext, result);
+        } catch (VelocityException e) {
+            LOG.error("Could not get mail body", e);
+        } catch (RuntimeException e) {
+            // ensure same behaviour as by using Spring VelocityEngineUtils.mergeTemplateIntoString()
+            throw e;
+        } catch (Exception e) {
+            LOG.error("Could not get mail body", e);
+        }
+
+        return result.toString();
     }
-    
-    
+
     /**
      * Create a Velocity Context for the given model, to be passed to the template for merging.
-     * 
+     *
      * @param model Velocity model
      * @return Velocity context
      */
     protected Context createVelocityContext(Map<String, Object> model) {
-    	Context toolContext = velocityToolManager.createContext();
-    	return new VelocityContext(model, toolContext);
+        Context toolContext = velocityToolManager.createContext();
+        return new VelocityContext(model, toolContext);
     }
 
     /**
@@ -279,7 +271,7 @@ public class NotificationManager {
                 LOG.debug("No events found about {}", attributable);
             } else if (attributableType == null || attributable == null || notification.getAbout() == null
                     || searchDAO.matches(attributable, notification.getAbout(),
-                    AttributableUtil.getInstance(attributableType))) {
+                            AttributableUtil.getInstance(attributableType))) {
 
                 LOG.debug("Creating notification task for events {} about {}", events, attributable);
 

Modified: syncope/branches/1_1_X/core/src/test/java/org/apache/syncope/core/notification/NotificationTest.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/test/java/org/apache/syncope/core/notification/NotificationTest.java?rev=1581781&r1=1581780&r2=1581781&view=diff
==============================================================================
--- syncope/branches/1_1_X/core/src/test/java/org/apache/syncope/core/notification/NotificationTest.java (original)
+++ syncope/branches/1_1_X/core/src/test/java/org/apache/syncope/core/notification/NotificationTest.java Wed Mar 26 10:20:33 2014
@@ -256,9 +256,10 @@ public class NotificationTest {
         assertNotNull(taskId);
         assertNotNull(textBody);
         assertTrue("Notification mail text doesn't contain expected content.",
-        		textBody.contains("Your email address is notificationtest@syncope.apache.org."));
+                textBody.contains("Your email address is notificationtest@syncope.apache.org."));
         assertTrue("Notification mail text doesn't contain expected content.",
-        		textBody.contains("Your email address inside a link: http://localhost/?email=notificationtest%40syncope.apache.org ."));
+                textBody.contains(
+                        "Your email address inside a link: http://localhost/?email=notificationtest%40syncope.apache.org ."));
 
         // 5. execute Notification task and verify e-mail
         taskController.execute(taskId, false);

Modified: syncope/branches/1_1_X/pom.xml
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/pom.xml?rev=1581781&r1=1581780&r2=1581781&view=diff
==============================================================================
--- syncope/branches/1_1_X/pom.xml (original)
+++ syncope/branches/1_1_X/pom.xml Wed Mar 26 10:20:33 2014
@@ -260,7 +260,7 @@ under the License.
       <email>gwimmel@apache.org</email>
     </developer>
     <developer>
-        <id>andreapatricelli</id>
+      <id>andreapatricelli</id>
       <name>Andrea Patricelli</name>
       <organization>Tirasa</organization>
       <organizationUrl>http://www.tirasa.net/</organizationUrl>
@@ -531,27 +531,27 @@ under the License.
         <artifactId>velocity-tools</artifactId>
         <version>${velocitytools.version}</version>
         <exclusions>
-  			<exclusion>
-  				<artifactId>struts-core</artifactId>
-  				<groupId>org.apache.struts</groupId>
-  			</exclusion>
-  			<exclusion>
-  				<artifactId>struts-taglib</artifactId>
-  				<groupId>org.apache.struts</groupId>
-  			</exclusion>
-  			<exclusion>
-  				<artifactId>struts-tiles</artifactId>
-  				<groupId>org.apache.struts</groupId>
-  			</exclusion>
-  			<exclusion>
-  				<artifactId>sslext</artifactId>
-  				<groupId>sslext</groupId>
-  			</exclusion>
-  			<exclusion>
-  				<artifactId>commons-beanutils</artifactId>
-  				<groupId>commons-beanutils</groupId>
-  			</exclusion>
-  		</exclusions>
+          <exclusion>
+            <artifactId>struts-core</artifactId>
+            <groupId>org.apache.struts</groupId>
+          </exclusion>
+          <exclusion>
+            <artifactId>struts-taglib</artifactId>
+            <groupId>org.apache.struts</groupId>
+          </exclusion>
+          <exclusion>
+            <artifactId>struts-tiles</artifactId>
+            <groupId>org.apache.struts</groupId>
+          </exclusion>
+          <exclusion>
+            <artifactId>sslext</artifactId>
+            <groupId>sslext</groupId>
+          </exclusion>
+          <exclusion>
+            <artifactId>commons-beanutils</artifactId>
+            <groupId>commons-beanutils</groupId>
+          </exclusion>
+        </exclusions>
       </dependency>
 
       <!-- Spring -->