# HG changeset patch
# User Christophe Capon <christophe.capon@vilogia.fr>
# Date 1269590732 -3600
# Branch 5.3.0
# Node ID c1cc5ea70ee2d80fd7bf4677f047994eea0e1ff1
# Parent  e279cd5bf8c7997b1d71eb212aeb7f50b88527bf
Applied Nuxeo formatting

diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-alert-api/src/main/java/org/nuxeo/ecm/alert/Alert.java
--- a/nuxeo-platform-alert-api/src/main/java/org/nuxeo/ecm/alert/Alert.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-alert-api/src/main/java/org/nuxeo/ecm/alert/Alert.java	Fri Mar 26 09:05:32 2010 +0100
@@ -2,43 +2,43 @@
 
 public class Alert {
 
-	private String alertProviderName;
+    private String alertProviderName;
 
-	private String alertName;
+    private String alertName;
 
-	private Object alertData;
+    private Object alertData;
 
-	public Alert() {
-	}
+    public Alert() {
+    }
 
-	public Alert(String providerName, String alertName, Object alertData) {
-		setAlertProviderName(providerName);
-		setAlertName(alertName);
-		setAlertData(alertData);
-	}
+    public Alert(String providerName, String alertName, Object alertData) {
+        setAlertProviderName(providerName);
+        setAlertName(alertName);
+        setAlertData(alertData);
+    }
 
-	public void setAlertProviderName(String alertProviderName) {
-		this.alertProviderName = alertProviderName;
-	}
+    public void setAlertProviderName(String alertProviderName) {
+        this.alertProviderName = alertProviderName;
+    }
 
-	public String getAlertProviderName() {
-		return alertProviderName;
-	}
+    public String getAlertProviderName() {
+        return alertProviderName;
+    }
 
-	public void setAlertData(Object alertData) {
-		this.alertData = alertData;
-	}
+    public void setAlertData(Object alertData) {
+        this.alertData = alertData;
+    }
 
-	public Object getAlertData() {
-		return alertData;
-	}
+    public Object getAlertData() {
+        return alertData;
+    }
 
-	public void setAlertName(String alertName) {
-		this.alertName = alertName;
-	}
+    public void setAlertName(String alertName) {
+        this.alertName = alertName;
+    }
 
-	public String getAlertName() {
-		return alertName;
-	}
+    public String getAlertName() {
+        return alertName;
+    }
 
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-alert-api/src/main/java/org/nuxeo/ecm/alert/AlertContext.java
--- a/nuxeo-platform-alert-api/src/main/java/org/nuxeo/ecm/alert/AlertContext.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-alert-api/src/main/java/org/nuxeo/ecm/alert/AlertContext.java	Fri Mar 26 09:05:32 2010 +0100
@@ -2,27 +2,24 @@
 
 public class AlertContext {
 
-	private boolean noPurge = false;
+    private boolean noPurge = false;
 
-	public void setNoPurge(boolean noPurge) {
-		this.noPurge = noPurge;
-	}
+    public void setNoPurge(boolean noPurge) {
+        this.noPurge = noPurge;
+    }
 
-	public boolean isNoPurge() {
-		return noPurge;
-	}
+    public boolean isNoPurge() {
+        return noPurge;
+    }
 
+    public void setEventId(String eventId) {
+        this.eventId = eventId;
+    }
 
-	public void setEventId(String eventId) {
-		this.eventId = eventId;
-	}
+    public String getEventId() {
+        return eventId;
+    }
 
-	public String getEventId() {
-		return eventId;
-	}
+    private String eventId = "none";
 
-
-	private String eventId = "none";
-	
-	
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-alert-api/src/main/java/org/nuxeo/ecm/alert/AlertEvent.java
--- a/nuxeo-platform-alert-api/src/main/java/org/nuxeo/ecm/alert/AlertEvent.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-alert-api/src/main/java/org/nuxeo/ecm/alert/AlertEvent.java	Fri Mar 26 09:05:32 2010 +0100
@@ -5,23 +5,25 @@
 
 public class AlertEvent {
 
-	public static final String MAIN_ALERT_EVENT = "sendMainAlertEvent";
-	public static final String SECONDARY_ALERT_EVENT = "sendSecondaryAlertEvent";
-	public static final String MANUAL_ALERT_EVENT = "sendManualAlertEvent";
+    public static final String MAIN_ALERT_EVENT = "sendMainAlertEvent";
 
-	private static List<String> allowedEvents = null;
-	
-	public static List<String> getAllowedEvents() {
-		
-		if (null == allowedEvents) {
-			allowedEvents = new ArrayList<String>();
-			allowedEvents.add(MAIN_ALERT_EVENT);
-			allowedEvents.add(SECONDARY_ALERT_EVENT);
-			allowedEvents.add(MAIN_ALERT_EVENT);
-		}
-	
-		return allowedEvents;
-	
-	}
-	
+    public static final String SECONDARY_ALERT_EVENT = "sendSecondaryAlertEvent";
+
+    public static final String MANUAL_ALERT_EVENT = "sendManualAlertEvent";
+
+    private static List<String> allowedEvents = null;
+
+    public static List<String> getAllowedEvents() {
+
+        if (null == allowedEvents) {
+            allowedEvents = new ArrayList<String>();
+            allowedEvents.add(MAIN_ALERT_EVENT);
+            allowedEvents.add(SECONDARY_ALERT_EVENT);
+            allowedEvents.add(MAIN_ALERT_EVENT);
+        }
+
+        return allowedEvents;
+
+    }
+
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-alert-api/src/main/java/org/nuxeo/ecm/alert/AlertManagementConstants.java
--- a/nuxeo-platform-alert-api/src/main/java/org/nuxeo/ecm/alert/AlertManagementConstants.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-alert-api/src/main/java/org/nuxeo/ecm/alert/AlertManagementConstants.java	Fri Mar 26 09:05:32 2010 +0100
@@ -27,6 +27,7 @@
 public interface AlertManagementConstants {
 
     public static final String BASE_EXTENSION_POINT = "alertManagementConfiguration";
+
     public static final String ALERT_PROVIDER_EXTENSION_POINT = "alertProvider";
 
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-alert-api/src/main/java/org/nuxeo/ecm/alert/AlertManagementDescriptor.java
--- a/nuxeo-platform-alert-api/src/main/java/org/nuxeo/ecm/alert/AlertManagementDescriptor.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-alert-api/src/main/java/org/nuxeo/ecm/alert/AlertManagementDescriptor.java	Fri Mar 26 09:05:32 2010 +0100
@@ -35,7 +35,7 @@
     private Class<? extends AlertManagementService> AlertManagementClass;
 
     public Class<? extends AlertManagementService> getAlertManagementClass() {
-	return AlertManagementClass;
+        return AlertManagementClass;
     }
 
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-alert-api/src/main/java/org/nuxeo/ecm/alert/AlertManagementService.java
--- a/nuxeo-platform-alert-api/src/main/java/org/nuxeo/ecm/alert/AlertManagementService.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-alert-api/src/main/java/org/nuxeo/ecm/alert/AlertManagementService.java	Fri Mar 26 09:05:32 2010 +0100
@@ -35,7 +35,8 @@
 
     /**
      * Process the alerts raised by the registered providers.
-     * @throws ClientException 
+     * 
+     * @throws ClientException
      */
 
     public void processAlerts(AlertContext ctx) throws ClientException;
@@ -57,7 +58,6 @@
 
     public void unRegisterProvider(String providerName);
 
-
     /**
      * Unregisters all alert providers
      * 
@@ -65,25 +65,20 @@
 
     public void unRegisterProviders();
 
-    
-
     /**
      * Return the list of all alert providers
      * 
      */
 
-    public Map<String, AlertProvider> getAlertProviders() ;
-    
-    
+    public Map<String, AlertProvider> getAlertProviders();
+
     /**
      * Allows to change the email helper
      * 
      * @param emailHelper the new emailHelper
      * @return previously registered emailHelper
      */
-    
-    public EmailHelper setEmailHelper(EmailHelper emailHelper); 
 
- 
- 
+    public EmailHelper setEmailHelper(EmailHelper emailHelper);
+
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-alert-api/src/main/java/org/nuxeo/ecm/alert/AlertManagementServiceImplComponent.java
--- a/nuxeo-platform-alert-api/src/main/java/org/nuxeo/ecm/alert/AlertManagementServiceImplComponent.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-alert-api/src/main/java/org/nuxeo/ecm/alert/AlertManagementServiceImplComponent.java	Fri Mar 26 09:05:32 2010 +0100
@@ -44,140 +44,155 @@
 
 public class AlertManagementServiceImplComponent extends DefaultComponent {
 
-	public static final String NAME = "com.nuxeo.vilogia.userpreferences.AlertManagementServiceComponent";
+    public static final String NAME = "com.nuxeo.vilogia.userpreferences.AlertManagementServiceComponent";
 
-	private static final Log log = LogFactory.getLog(AlertManagementService.class);
+    private static final Log log = LogFactory.getLog(AlertManagementService.class);
 
-	private static AlertManagementDescriptor descriptor;
+    private static AlertManagementDescriptor descriptor;
 
-	private static AlertManagementService alertManagementService;
+    private static AlertManagementService alertManagementService;
 
-	@Override
-	public void activate(ComponentContext context) {
-		log.info("AlertManagementService activated");
-	}
+    @Override
+    public void activate(ComponentContext context) {
+        log.info("AlertManagementService activated");
+    }
 
-	@Override
-	public void deactivate(ComponentContext context) {
-		log.info("AlertManagementService deactivated");
-	}
+    @Override
+    public void deactivate(ComponentContext context) {
+        log.info("AlertManagementService deactivated");
+    }
 
-	@Override
-	public <T> T getAdapter(Class<T> adapter) {
-		if (adapter == AlertManagementService.class) {
-			try {
-				return adapter.cast(getAlertManagementService());
-			} catch (Exception e) {
-				log.error("error fetching AlertManagementService: ", e);
-			}
-		}
-		return null;
-	}
+    @Override
+    public <T> T getAdapter(Class<T> adapter) {
+        if (adapter == AlertManagementService.class) {
+            try {
+                return adapter.cast(getAlertManagementService());
+            } catch (Exception e) {
+                log.error("error fetching AlertManagementService: ", e);
+            }
+        }
+        return null;
+    }
 
-	private AlertManagementService getAlertManagementService() throws ClientException {
+    private AlertManagementService getAlertManagementService()
+            throws ClientException {
 
-		if (alertManagementService == null) {
+        if (alertManagementService == null) {
 
-			Class<?> klass = descriptor.getAlertManagementClass();
+            Class<?> klass = descriptor.getAlertManagementClass();
 
-			if (klass == null) {
-				throw new ClientException("No class specified for the AlertManagement");
-			}
-			try {
-				alertManagementService = (AlertManagementService) klass.newInstance();
-			} catch (InstantiationException e) {
-				throw new ClientException("Failed to instantiate class " + klass, e);
-			} catch (IllegalAccessException e) {
-				throw new ClientException("Failed to instantiate class " + klass, e);
-			}
-		}
-		return alertManagementService;
-	}
+            if (klass == null) {
+                throw new ClientException(
+                        "No class specified for the AlertManagement");
+            }
+            try {
+                alertManagementService = (AlertManagementService) klass.newInstance();
+            } catch (InstantiationException e) {
+                throw new ClientException("Failed to instantiate class "
+                        + klass, e);
+            } catch (IllegalAccessException e) {
+                throw new ClientException("Failed to instantiate class "
+                        + klass, e);
+            }
+        }
+        return alertManagementService;
+    }
 
-	@Override
-	public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
-			throws ClientException {
+    @Override
+    public void registerContribution(Object contribution,
+            String extensionPoint, ComponentInstance contributor)
+            throws ClientException {
 
-		if (AlertManagementConstants.BASE_EXTENSION_POINT.equals(extensionPoint)) {
-			descriptor = (AlertManagementDescriptor) contribution;
-		} else if (AlertManagementConstants.ALERT_PROVIDER_EXTENSION_POINT.equals(extensionPoint)) {
+        if (AlertManagementConstants.BASE_EXTENSION_POINT.equals(extensionPoint)) {
+            descriptor = (AlertManagementDescriptor) contribution;
+        } else if (AlertManagementConstants.ALERT_PROVIDER_EXTENSION_POINT.equals(extensionPoint)) {
 
-			AlertProviderDescriptor desc = (AlertProviderDescriptor) contribution;
-			Class<?> klass = desc.getAlertProviderClass();
+            AlertProviderDescriptor desc = (AlertProviderDescriptor) contribution;
+            Class<?> klass = desc.getAlertProviderClass();
 
-			try {
+            try {
 
-				AlertManagementService svc = getAlertManagementService();
+                AlertManagementService svc = getAlertManagementService();
 
-				if (klass == null) {
-					log.info(String
-							.format("No class specified for %s AlertProvider, trying to remove", desc.getAlertProviderName()));
+                if (klass == null) {
+                    log.info(String.format(
+                            "No class specified for %s AlertProvider, trying to remove",
+                            desc.getAlertProviderName()));
 
-					svc.unRegisterProvider(desc.getAlertProviderName());
+                    svc.unRegisterProvider(desc.getAlertProviderName());
 
-				} else {
+                } else {
 
-					AlertProvider provider = (AlertProvider) klass.newInstance();
-					svc.registerProvider(desc.getAlertProviderName(), provider);
-				}
+                    AlertProvider provider = (AlertProvider) klass.newInstance();
+                    svc.registerProvider(desc.getAlertProviderName(), provider);
+                }
 
-			} catch (InstantiationException e) {
-				throw new ClientException("Failed to instantiate class " + klass, e);
-			} catch (IllegalAccessException e) {
-				throw new ClientException("Failed to instantiate class " + klass, e);
-			} catch (Exception e) {
-				throw new ClientException("Failed to get AlertManagementService", e);
-			}
+            } catch (InstantiationException e) {
+                throw new ClientException("Failed to instantiate class "
+                        + klass, e);
+            } catch (IllegalAccessException e) {
+                throw new ClientException("Failed to instantiate class "
+                        + klass, e);
+            } catch (Exception e) {
+                throw new ClientException(
+                        "Failed to get AlertManagementService", e);
+            }
 
-		} else {
-			log.error(String.format("Unknown %s extension point for AlertManagementService", extensionPoint));
-		}
+        } else {
+            log.error(String.format(
+                    "Unknown %s extension point for AlertManagementService",
+                    extensionPoint));
+        }
 
-	}
+    }
 
-	@Override
-	public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
-			throws ClientException {
-		if (AlertManagementConstants.BASE_EXTENSION_POINT.equals(extensionPoint)) {	
-						
-			releaseAlertManagementService();
+    @Override
+    public void unregisterContribution(Object contribution,
+            String extensionPoint, ComponentInstance contributor)
+            throws ClientException {
+        if (AlertManagementConstants.BASE_EXTENSION_POINT.equals(extensionPoint)) {
 
-			descriptor = null;
-			
-		} else if (AlertManagementConstants.ALERT_PROVIDER_EXTENSION_POINT.equals(extensionPoint)) {
+            releaseAlertManagementService();
 
-			AlertProviderDescriptor desc = (AlertProviderDescriptor) contribution;
+            descriptor = null;
 
-			try {
+        } else if (AlertManagementConstants.ALERT_PROVIDER_EXTENSION_POINT.equals(extensionPoint)) {
 
-				AlertManagementService svc = getAlertManagementService();
+            AlertProviderDescriptor desc = (AlertProviderDescriptor) contribution;
 
-					svc.unRegisterProvider(desc.getAlertProviderName());
+            try {
 
-			} catch (Exception e) {
-				throw new ClientException("Failed to get AlertManagementService", e);
-			}
+                AlertManagementService svc = getAlertManagementService();
 
-		} else {
-			log.error(String.format("Unknown %s extension point for AlertManagementService", extensionPoint));
-		}
+                svc.unRegisterProvider(desc.getAlertProviderName());
 
-	}
+            } catch (Exception e) {
+                throw new ClientException(
+                        "Failed to get AlertManagementService", e);
+            }
 
-	private void releaseAlertManagementService() throws ClientException {
-	
-		getAlertManagementService().unRegisterProviders();
+        } else {
+            log.error(String.format(
+                    "Unknown %s extension point for AlertManagementService",
+                    extensionPoint));
+        }
 
-		alertManagementService = null;
-			
-	}
+    }
 
-	public static void reset() {
-		alertManagementService = null;
-	}
+    private void releaseAlertManagementService() throws ClientException {
 
-	public static Class<? extends AlertManagementService> getAlertManagementClass() {
-		return descriptor.getAlertManagementClass();
-	}
+        getAlertManagementService().unRegisterProviders();
+
+        alertManagementService = null;
+
+    }
+
+    public static void reset() {
+        alertManagementService = null;
+    }
+
+    public static Class<? extends AlertManagementService> getAlertManagementClass() {
+        return descriptor.getAlertManagementClass();
+    }
 
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-alert-api/src/main/java/org/nuxeo/ecm/alert/AlertProvider.java
--- a/nuxeo-platform-alert-api/src/main/java/org/nuxeo/ecm/alert/AlertProvider.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-alert-api/src/main/java/org/nuxeo/ecm/alert/AlertProvider.java	Fri Mar 26 09:05:32 2010 +0100
@@ -11,39 +11,39 @@
 public interface AlertProvider {
 
     /**
-     * Initializes the rendering service, usually by registering the engines used by the alert
-     * provider
+     * Initializes the rendering service, usually by registering the engines
+     * used by the alert provider
      * 
      * @param rs rendering service to initialize
      */
-    
-    public List<String> getTemplateList();    
 
-        
+    public List<String> getTemplateList();
+
     /**
-     * Initializes the rendering service, usually by registering the engines used by the alert
-     * provider
+     * Initializes the rendering service, usually by registering the engines
+     * used by the alert provider
      * 
      * @param rs rendering service to initialize
-     * @throws ClientException 
+     * @throws ClientException
      */
-    
-    public Map<String, UserAlerts> getAllPendingAlerts(CoreSession coreSession) throws ClientException;
-    
-    
+
+    public Map<String, UserAlerts> getAllPendingAlerts(CoreSession coreSession)
+            throws ClientException;
+
     /**
      * 
      * @param coreSession: The core session
      * @param rs: rendering service to use
      * @param userName: the user name for whom to render alerts
-     * @param alerts : the alert list previously returned by {@link getAllPendingAlerts}
+     * @param alerts : the alert list previously returned by
+     *            {@link getAllPendingAlerts}
      * @param userSettings
      * @return An html string containing all the alerts for the specified user
      * @throws ClientException
      */
-    
-    public String renderAlerts(CoreSession coreSession, RenderingService rs, String userName, List<Alert> alerts, DocumentModel userSettings, AlertContext ctx) throws ClientException;
 
-    
+    public String renderAlerts(CoreSession coreSession, RenderingService rs,
+            String userName, List<Alert> alerts, DocumentModel userSettings,
+            AlertContext ctx) throws ClientException;
 
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-alert-api/src/main/java/org/nuxeo/ecm/alert/AlertProviderDescriptor.java
--- a/nuxeo-platform-alert-api/src/main/java/org/nuxeo/ecm/alert/AlertProviderDescriptor.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-alert-api/src/main/java/org/nuxeo/ecm/alert/AlertProviderDescriptor.java	Fri Mar 26 09:05:32 2010 +0100
@@ -33,18 +33,18 @@
 
     @XNode("@name")
     private String alertProviderName;
-    
+
     @XNode("@class")
     private Class<? extends AlertProvider> alertProviderClass;
 
     public Class<? extends AlertProvider> getAlertProviderClass() {
-	
-	return alertProviderClass;
-	
+
+        return alertProviderClass;
+
     }
 
     public String getAlertProviderName() {
-	return alertProviderName;
+        return alertProviderName;
     }
 
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-alert-api/src/main/java/org/nuxeo/ecm/alert/EmailHelper.java
--- a/nuxeo-platform-alert-api/src/main/java/org/nuxeo/ecm/alert/EmailHelper.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-alert-api/src/main/java/org/nuxeo/ecm/alert/EmailHelper.java	Fri Mar 26 09:05:32 2010 +0100
@@ -4,7 +4,7 @@
 
 public interface EmailHelper {
 
-	public abstract void sendmail(String subject, String to, String mailBody)
-			throws ClientException;
+    public abstract void sendmail(String subject, String to, String mailBody)
+            throws ClientException;
 
 }
\ No newline at end of file
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-alert-api/src/main/java/org/nuxeo/ecm/alert/UserAlerts.java
--- a/nuxeo-platform-alert-api/src/main/java/org/nuxeo/ecm/alert/UserAlerts.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-alert-api/src/main/java/org/nuxeo/ecm/alert/UserAlerts.java	Fri Mar 26 09:05:32 2010 +0100
@@ -4,34 +4,33 @@
 import java.util.List;
 
 public class UserAlerts {
-    
+
     private String userName;
-    
+
     private List<Alert> alerts;
 
-    protected UserAlerts() {}
-    
+    protected UserAlerts() {
+    }
+
     public UserAlerts(String userName) {
-	this.userName = userName;
-	this.alerts = new ArrayList<Alert>();
+        this.userName = userName;
+        this.alerts = new ArrayList<Alert>();
     }
-    
-    
+
     public void setUserName(String userName) {
-	this.userName = userName;
+        this.userName = userName;
     }
 
     public String getUserName() {
-	return userName;
+        return userName;
     }
 
     public void setAlerts(List<Alert> alerts) {
-	this.alerts = alerts;
+        this.alerts = alerts;
     }
 
     public List<Alert> getAlerts() {
-	return alerts;
+        return alerts;
     }
 
-
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-alert-core/src/main/java/org/nuxeo/ecm/alert/core/AlertManagementServiceImpl.java
--- a/nuxeo-platform-alert-core/src/main/java/org/nuxeo/ecm/alert/core/AlertManagementServiceImpl.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-alert-core/src/main/java/org/nuxeo/ecm/alert/core/AlertManagementServiceImpl.java	Fri Mar 26 09:05:32 2010 +0100
@@ -131,7 +131,7 @@
             close(coreSession, ctx);
 
         } catch (Exception e) {
-            
+
             throw new ClientException("processAlerts failed", e);
 
         }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-alert-core/src/main/java/org/nuxeo/ecm/alert/core/listener/AlertEventListener.java
--- a/nuxeo-platform-alert-core/src/main/java/org/nuxeo/ecm/alert/core/listener/AlertEventListener.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-alert-core/src/main/java/org/nuxeo/ecm/alert/core/listener/AlertEventListener.java	Fri Mar 26 09:05:32 2010 +0100
@@ -36,8 +36,9 @@
 import org.nuxeo.runtime.api.Framework;
 
 /**
- * Listens for all the events mentions in the {@link AlertEvent} interface. These events are triggered either by a scheduler or
- * manually, and request the alert manager to send all pending alerts.
+ * Listens for all the events mentions in the {@link AlertEvent} interface.
+ * These events are triggered either by a scheduler or manually, and request the
+ * alert manager to send all pending alerts.
  * 
  * @see {@link AlertManagementService}
  * 
@@ -46,98 +47,104 @@
 
 public class AlertEventListener implements EventListener {
 
-	/**
-	 * The current alert management service
-	 */
+    /**
+     * The current alert management service
+     */
 
-	private static AlertManagementService service = null;
+    private static AlertManagementService service = null;
 
-	/**
-	 * Gets the alert management service
-	 * 
-	 * @return The alert management service
-	 * @throws Exception
-	 */
+    /**
+     * Gets the alert management service
+     * 
+     * @return The alert management service
+     * @throws Exception
+     */
 
-	private static AlertManagementService getService() throws Exception {
+    private static AlertManagementService getService() throws Exception {
 
-		if (service == null)
-			service = Framework.getService(AlertManagementService.class);
+        if (service == null)
+            service = Framework.getService(AlertManagementService.class);
 
-		return service;
+        return service;
 
-	}
+    }
 
-	private static final Log log = LogFactory.getLog(AlertEventListener.class);
+    private static final Log log = LogFactory.getLog(AlertEventListener.class);
 
-	/**
-	 * Processes the alert request events
-	 * 
-	 * @param event
-	 *            The event to process. All events not listed in the {@link AlertEvent} class are ignored.
-	 */
+    /**
+     * Processes the alert request events
+     * 
+     * @param event The event to process. All events not listed in the
+     *            {@link AlertEvent} class are ignored.
+     */
 
-	public void handleEvent(Event event) {
+    public void handleEvent(Event event) {
 
-		String eventId = event.getName();
+        String eventId = event.getName();
 
-		if (!AlertEvent.getAllowedEvents().contains(eventId)) {
-			return;
-		}
+        if (!AlertEvent.getAllowedEvents().contains(eventId)) {
+            return;
+        }
 
-		log.debug(String.format("Received %s event", eventId));
-		log.trace(String.format("event.isCanceled()=%s", event.isCanceled() ? "true" : "false"));
-		log.trace(String.format("event.isCommitEvent()=%s", event.isCommitEvent() ? "true" : "false"));
-		log.trace(String.format("event.isImmediate()=%s", event.isImmediate() ? "true" : "false"));
-		log.trace(String.format("event.isInline()=%s", event.isInline() ? "true" : "false"));
-		log.trace(String.format("event.isLocal()=%s", event.isLocal() ? "true" : "false"));
-		log.trace(String.format("event.isMarkedForRollBack()=%s", event.isMarkedForRollBack() ? "true" : "false"));
-		log.trace(String.format("event.isPublic()=%s", event.isPublic() ? "true" : "false"));
+        log.debug(String.format("Received %s event", eventId));
+        log.trace(String.format("event.isCanceled()=%s",
+                event.isCanceled() ? "true" : "false"));
+        log.trace(String.format("event.isCommitEvent()=%s",
+                event.isCommitEvent() ? "true" : "false"));
+        log.trace(String.format("event.isImmediate()=%s",
+                event.isImmediate() ? "true" : "false"));
+        log.trace(String.format("event.isInline()=%s",
+                event.isInline() ? "true" : "false"));
+        log.trace(String.format("event.isLocal()=%s", event.isLocal() ? "true"
+                : "false"));
+        log.trace(String.format("event.isMarkedForRollBack()=%s",
+                event.isMarkedForRollBack() ? "true" : "false"));
+        log.trace(String.format("event.isPublic()=%s",
+                event.isPublic() ? "true" : "false"));
 
-		LoginContext loginContext = null;
-		CoreSession coreSession = null;
+        LoginContext loginContext = null;
+        CoreSession coreSession = null;
 
-		try {
+        try {
 
-			// Open a system session
-			log.trace("Open a system session");
-			loginContext = Framework.login();
-			RepositoryManager mgr = Framework.getService(RepositoryManager.class);
-			Repository repository = mgr.getDefaultRepository();
-			if (repository != null) {
-				coreSession = repository.open();
-			} else {
-				log.error("Unable to open the default repository");
-			}
-			if (coreSession == null) {
-				log.error("Unable to open the core session");
-				return;
-			}
+            // Open a system session
+            log.trace("Open a system session");
+            loginContext = Framework.login();
+            RepositoryManager mgr = Framework.getService(RepositoryManager.class);
+            Repository repository = mgr.getDefaultRepository();
+            if (repository != null) {
+                coreSession = repository.open();
+            } else {
+                log.error("Unable to open the default repository");
+            }
+            if (coreSession == null) {
+                log.error("Unable to open the core session");
+                return;
+            }
 
-			// Create the alert context and start alert processing
-			log.debug("Start alert processing");
-			AlertContext ctxt = new AlertContext();
-			ctxt.setNoPurge(false);
-			ctxt.setEventId(eventId);
-			getService().processAlerts(ctxt);
-			log.debug("Successfully performed alert processing");
-		
+            // Create the alert context and start alert processing
+            log.debug("Start alert processing");
+            AlertContext ctxt = new AlertContext();
+            ctxt.setNoPurge(false);
+            ctxt.setEventId(eventId);
+            getService().processAlerts(ctxt);
+            log.debug("Successfully performed alert processing");
 
-		} catch (Exception e) {
-			log.error("Error during the alert processing", e);
-		} finally {
+        } catch (Exception e) {
+            log.error("Error during the alert processing", e);
+        } finally {
 
-			// Try to end graciously
-			if (coreSession != null) {
-				CoreInstance.getInstance().close(coreSession);
-			}
-			if (loginContext != null) {
-				try {
-					loginContext.logout();
-				} catch (LoginException e) {
-				}
-			}
-		}
-	}
+            // Try to end graciously
+            if (coreSession != null) {
+                CoreInstance.getInstance().close(coreSession);
+            }
+            if (loginContext != null) {
+                try {
+                    loginContext.logout();
+                } catch (LoginException e) {
+                }
+            }
+        }
+    }
 
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-alert-core/src/main/java/org/nuxeo/ecm/alert/rendering/EmailHelperImpl.java
--- a/nuxeo-platform-alert-core/src/main/java/org/nuxeo/ecm/alert/rendering/EmailHelperImpl.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-alert-core/src/main/java/org/nuxeo/ecm/alert/rendering/EmailHelperImpl.java	Fri Mar 26 09:05:32 2010 +0100
@@ -39,70 +39,70 @@
  */
 public class EmailHelperImpl implements EmailHelper {
 
-	private static final Log log = LogFactory.getLog(EmailHelper.class);
+    private static final Log log = LogFactory.getLog(EmailHelper.class);
 
-	protected static boolean javaMailNotAvailable = false;
+    protected static boolean javaMailNotAvailable = false;
 
-	private InternetAddress fromAddress = null;
+    private InternetAddress fromAddress = null;
 
-	private Session session = null;
+    private Session session = null;
 
-	public EmailHelperImpl() {
-	}
+    public EmailHelperImpl() {
+    }
 
-	public void sendmail(String subject, String to, String mailBody) throws ClientException {
+    public void sendmail(String subject, String to, String mailBody)
+            throws ClientException {
 
-		try {
+        try {
 
-			MimeMessage msg = new MimeMessage(getMailSession());
+            MimeMessage msg = new MimeMessage(getMailSession());
 
-			msg.setFrom(getFromAddress());
-			msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(
-					(String) to, false));
-			msg.setSentDate(new Date());
-			msg.setSubject(subject);
-			msg.setContent(mailBody, "text/html; charset=utf-8");
+            msg.setFrom(getFromAddress());
+            msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(
+                    (String) to, false));
+            msg.setSentDate(new Date());
+            msg.setSubject(subject);
+            msg.setContent(mailBody, "text/html; charset=utf-8");
 
-			try {
-				Transport.send(msg);
-			} catch (Exception e) {
-				log.error(String.format("Unable to send alert mail to %s (%s)", to, e.getMessage()));
-			}
+            try {
+                Transport.send(msg);
+            } catch (Exception e) {
+                log.error(String.format("Unable to send alert mail to %s (%s)",
+                        to, e.getMessage()));
+            }
 
-			try {
-				File f = new File("/tmp/notification.html");
-				if (f.exists())
-					f.delete();
-				FileWriter fw = new FileWriter(f);
-				fw.write(mailBody);
-				fw.close();
-			} catch (Exception e) {
+            try {
+                File f = new File("/tmp/notification.html");
+                if (f.exists())
+                    f.delete();
+                FileWriter fw = new FileWriter(f);
+                fw.write(mailBody);
+                fw.close();
+            } catch (Exception e) {
 
-			}
+            }
 
-		}
+        }
 
-		catch (Exception e) {
-			throw new ClientException("Unable to send mail", e);
-		}
-	}
+        catch (Exception e) {
+            throw new ClientException("Unable to send mail", e);
+        }
+    }
 
-	private InternetAddress getFromAddress()
-			throws AddressException {
-		if (fromAddress == null)
-			fromAddress = new InternetAddress(getMailSession().getProperty("mail.from"));
-		return fromAddress;
-	}
-	
-	private Session getMailSession() {
+    private InternetAddress getFromAddress() throws AddressException {
+        if (fromAddress == null)
+            fromAddress = new InternetAddress(getMailSession().getProperty(
+                    "mail.from"));
+        return fromAddress;
+    }
 
-		if (session == null)
-			session = EmailSessionFactory.getSession();
+    private Session getMailSession() {
 
-		return session;
+        if (session == null)
+            session = EmailSessionFactory.getSession();
 
-	}
+        return session;
 
-
+    }
 
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-alert-core/src/main/java/org/nuxeo/ecm/alert/rendering/EmailSessionFactory.java
--- a/nuxeo-platform-alert-core/src/main/java/org/nuxeo/ecm/alert/rendering/EmailSessionFactory.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-alert-core/src/main/java/org/nuxeo/ecm/alert/rendering/EmailSessionFactory.java	Fri Mar 26 09:05:32 2010 +0100
@@ -11,46 +11,46 @@
 
 public class EmailSessionFactory {
 
-	protected static boolean javaMailNotAvailable = false;
+    protected static boolean javaMailNotAvailable = false;
 
-	private static final Log log = LogFactory.getLog(EmailSessionFactory.class);
+    private static final Log log = LogFactory.getLog(EmailSessionFactory.class);
 
-	public static boolean isJavaMailFault() { return javaMailNotAvailable; }
-	
-	/**
-	 * Gets the session from the JNDI.
-	 */
-	public static Session getSession() {
-		
-		Session session = null;
-		
-		if (javaMailNotAvailable) {
-			return null;
-		}
-		// First, try to get the session from JNDI, as would be done under J2EE.
-		try {
-			NotificationService service = (NotificationService) Framework
-					.getRuntime().getComponent(NotificationService.NAME);
-			InitialContext ic = new InitialContext();
-			session = (Session) ic.lookup(service.getMailSessionJndiName());
-		} catch (Exception ex) {
+    public static boolean isJavaMailFault() {
+        return javaMailNotAvailable;
+    }
 
-			try {
-				log
-						.warn("Unable to find Java mail API, trying to fallback on TOMCAT configuration");
-				NotificationService service = (NotificationService) Framework
-						.getRuntime().getComponent(NotificationService.NAME);
-				InitialContext ic = new InitialContext();
-				Context envCtx = (Context) ic.lookup("java:comp/env");
-				session = (Session) envCtx.lookup(service.getMailSessionJndiName());
-				
-			} catch (Exception ex2) {
-				javaMailNotAvailable = true;
-			}
-		}
+    /**
+     * Gets the session from the JNDI.
+     */
+    public static Session getSession() {
 
-		return session;
-	}
+        Session session = null;
 
+        if (javaMailNotAvailable) {
+            return null;
+        }
+        // First, try to get the session from JNDI, as would be done under J2EE.
+        try {
+            NotificationService service = (NotificationService) Framework.getRuntime().getComponent(
+                    NotificationService.NAME);
+            InitialContext ic = new InitialContext();
+            session = (Session) ic.lookup(service.getMailSessionJndiName());
+        } catch (Exception ex) {
+
+            try {
+                log.warn("Unable to find Java mail API, trying to fallback on TOMCAT configuration");
+                NotificationService service = (NotificationService) Framework.getRuntime().getComponent(
+                        NotificationService.NAME);
+                InitialContext ic = new InitialContext();
+                Context envCtx = (Context) ic.lookup("java:comp/env");
+                session = (Session) envCtx.lookup(service.getMailSessionJndiName());
+
+            } catch (Exception ex2) {
+                javaMailNotAvailable = true;
+            }
+        }
+
+        return session;
+    }
 
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-alert-core/src/main/java/org/nuxeo/ecm/alert/rendering/HtmlEscapeMethod.java
--- a/nuxeo-platform-alert-core/src/main/java/org/nuxeo/ecm/alert/rendering/HtmlEscapeMethod.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-alert-core/src/main/java/org/nuxeo/ecm/alert/rendering/HtmlEscapeMethod.java	Fri Mar 26 09:05:32 2010 +0100
@@ -32,7 +32,7 @@
 public class HtmlEscapeMethod implements TemplateMethodModel {
 
     @SuppressWarnings("unchecked")
-	public Object exec(List arg0) throws TemplateModelException {
+    public Object exec(List arg0) throws TemplateModelException {
         if (arg0.size() != 1) {
             throw new IllegalArgumentException();
         }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-alert-core/src/main/java/org/nuxeo/ecm/alert/rendering/HtmlFooterRenderingContext.java
--- a/nuxeo-platform-alert-core/src/main/java/org/nuxeo/ecm/alert/rendering/HtmlFooterRenderingContext.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-alert-core/src/main/java/org/nuxeo/ecm/alert/rendering/HtmlFooterRenderingContext.java	Fri Mar 26 09:05:32 2010 +0100
@@ -14,26 +14,28 @@
 
     @Override
     public <T> T getAdapter(Class<T> adapter) {
-	if (adapter.isAssignableFrom(getClass())) {
-	    return adapter.cast(this);
-	} else if (adapter.isAssignableFrom(DocumentModel.class)) {
-	    return adapter.cast(getDocuments());
-	}
-	return null;
+        if (adapter.isAssignableFrom(getClass())) {
+            return adapter.cast(this);
+        } else if (adapter.isAssignableFrom(DocumentModel.class)) {
+            return adapter.cast(getDocuments());
+        }
+        return null;
     }
 
     public void setDocuments(List<DocumentModel> doc) {
-	put(CTX_PARAM_DOCUMENTS, doc);
+        put(CTX_PARAM_DOCUMENTS, doc);
     }
 
     @SuppressWarnings("unchecked")
     public List<DocumentModel> getDocuments() {
-	return (List<DocumentModel>) get(CTX_PARAM_DOCUMENTS);
+        return (List<DocumentModel>) get(CTX_PARAM_DOCUMENTS);
     }
 
     @Override
     public boolean accept(RenderingEngine engine) {
-	if (engine.getFormatName().equals("alertFooter")) return true;
-	else return false;
+        if (engine.getFormatName().equals("alertFooter"))
+            return true;
+        else
+            return false;
     }
 }
\ No newline at end of file
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-alert-core/src/main/java/org/nuxeo/ecm/alert/rendering/HtmlHeader1RenderingContext.java
--- a/nuxeo-platform-alert-core/src/main/java/org/nuxeo/ecm/alert/rendering/HtmlHeader1RenderingContext.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-alert-core/src/main/java/org/nuxeo/ecm/alert/rendering/HtmlHeader1RenderingContext.java	Fri Mar 26 09:05:32 2010 +0100
@@ -14,26 +14,28 @@
 
     @Override
     public <T> T getAdapter(Class<T> adapter) {
-	if (adapter.isAssignableFrom(getClass())) {
-	    return adapter.cast(this);
-	} else if (adapter.isAssignableFrom(DocumentModel.class)) {
-	    return adapter.cast(getDocuments());
-	}
-	return null;
+        if (adapter.isAssignableFrom(getClass())) {
+            return adapter.cast(this);
+        } else if (adapter.isAssignableFrom(DocumentModel.class)) {
+            return adapter.cast(getDocuments());
+        }
+        return null;
     }
 
     public void setDocuments(List<DocumentModel> doc) {
-	put(CTX_PARAM_DOCUMENTS, doc);
+        put(CTX_PARAM_DOCUMENTS, doc);
     }
 
     @SuppressWarnings("unchecked")
     public List<DocumentModel> getDocuments() {
-	return (List<DocumentModel>) get(CTX_PARAM_DOCUMENTS);
+        return (List<DocumentModel>) get(CTX_PARAM_DOCUMENTS);
     }
 
     @Override
     public boolean accept(RenderingEngine engine) {
-	if (engine.getFormatName().equals("alertHeader1")) return true;
-	else return false;
+        if (engine.getFormatName().equals("alertHeader1"))
+            return true;
+        else
+            return false;
     }
 }
\ No newline at end of file
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-alert-core/src/main/java/org/nuxeo/ecm/alert/rendering/HtmlHeader2RenderingContext.java
--- a/nuxeo-platform-alert-core/src/main/java/org/nuxeo/ecm/alert/rendering/HtmlHeader2RenderingContext.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-alert-core/src/main/java/org/nuxeo/ecm/alert/rendering/HtmlHeader2RenderingContext.java	Fri Mar 26 09:05:32 2010 +0100
@@ -14,26 +14,28 @@
 
     @Override
     public <T> T getAdapter(Class<T> adapter) {
-	if (adapter.isAssignableFrom(getClass())) {
-	    return adapter.cast(this);
-	} else if (adapter.isAssignableFrom(DocumentModel.class)) {
-	    return adapter.cast(getDocuments());
-	}
-	return null;
+        if (adapter.isAssignableFrom(getClass())) {
+            return adapter.cast(this);
+        } else if (adapter.isAssignableFrom(DocumentModel.class)) {
+            return adapter.cast(getDocuments());
+        }
+        return null;
     }
 
     public void setDocuments(List<DocumentModel> doc) {
-	put(CTX_PARAM_DOCUMENTS, doc);
+        put(CTX_PARAM_DOCUMENTS, doc);
     }
 
     @SuppressWarnings("unchecked")
     public List<DocumentModel> getDocuments() {
-	return (List<DocumentModel>) get(CTX_PARAM_DOCUMENTS);
+        return (List<DocumentModel>) get(CTX_PARAM_DOCUMENTS);
     }
 
     @Override
     public boolean accept(RenderingEngine engine) {
-	if (engine.getFormatName().equals("alertHeader2")) return true;
-	else return false;
+        if (engine.getFormatName().equals("alertHeader2"))
+            return true;
+        else
+            return false;
     }
 }
\ No newline at end of file
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-alert-core/src/test/java/org/nuxeo/ecm/alert/core/AlertProvider1.java
--- a/nuxeo-platform-alert-core/src/test/java/org/nuxeo/ecm/alert/core/AlertProvider1.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-alert-core/src/test/java/org/nuxeo/ecm/alert/core/AlertProvider1.java	Fri Mar 26 09:05:32 2010 +0100
@@ -18,52 +18,54 @@
 
 public class AlertProvider1 implements AlertProvider {
 
-	public static final String TEST_STRING = "This is the test string 1";
+    public static final String TEST_STRING = "This is the test string 1";
 
-	public Map<String, UserAlerts> getAllPendingAlerts(CoreSession coreSession) {
+    public Map<String, UserAlerts> getAllPendingAlerts(CoreSession coreSession) {
 
-		Map<String, UserAlerts> result = new HashMap<String, UserAlerts>();
+        Map<String, UserAlerts> result = new HashMap<String, UserAlerts>();
 
-		UserAlerts a = new UserAlerts("testuser");
-		a.getAlerts().add(new Alert("AlertProvider1", "testAlert1", TEST_STRING));
+        UserAlerts a = new UserAlerts("testuser");
+        a.getAlerts().add(
+                new Alert("AlertProvider1", "testAlert1", TEST_STRING));
 
-		result.put("testuser", a);
+        result.put("testuser", a);
 
-		return result;
-	}
+        return result;
+    }
 
-	public String renderAlerts(CoreSession coreSession, RenderingService rs, String userName, List<Alert> alerts,
-			DocumentModel userSettings, AlertContext ctxt) throws ClientException {
+    public String renderAlerts(CoreSession coreSession, RenderingService rs,
+            String userName, List<Alert> alerts, DocumentModel userSettings,
+            AlertContext ctxt) throws ClientException {
 
-		String result = "";
+        String result = "";
 
-		try {
-			RenderingContext1 ctx = new RenderingContext1();
-			ctx.put("template", "test1");
+        try {
+            RenderingContext1 ctx = new RenderingContext1();
+            ctx.put("template", "test1");
 
-			for (Alert a : alerts) {
-				if (a.getAlertProviderName().equals("AlertProvider1")) {
-					ctx.put("teststring", a.getAlertData().toString());
-					break;
-				}
-			}
+            for (Alert a : alerts) {
+                if (a.getAlertProviderName().equals("AlertProvider1")) {
+                    ctx.put("teststring", a.getAlertData().toString());
+                    break;
+                }
+            }
 
-			Collection<RenderingResult> render = rs.process(ctx);
-			if (render.size() > 0) {
-				result = (String) render.iterator().next().getOutcome();
-			}
+            Collection<RenderingResult> render = rs.process(ctx);
+            if (render.size() > 0) {
+                result = (String) render.iterator().next().getOutcome();
+            }
 
-		} catch (Exception e) {
-		}
+        } catch (Exception e) {
+        }
 
-		return result;
+        return result;
 
-	}
+    }
 
-	public List<String> getTemplateList() {
-		List<String> result = new ArrayList<String>();
-		result.add("test1");
-		return result;
-	}
+    public List<String> getTemplateList() {
+        List<String> result = new ArrayList<String>();
+        result.add("test1");
+        return result;
+    }
 
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-alert-core/src/test/java/org/nuxeo/ecm/alert/core/AlertProvider2.java
--- a/nuxeo-platform-alert-core/src/test/java/org/nuxeo/ecm/alert/core/AlertProvider2.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-alert-core/src/test/java/org/nuxeo/ecm/alert/core/AlertProvider2.java	Fri Mar 26 09:05:32 2010 +0100
@@ -18,52 +18,54 @@
 
 public class AlertProvider2 implements AlertProvider {
 
-	public static final String TEST_STRING = "This is the test string 2";
+    public static final String TEST_STRING = "This is the test string 2";
 
-	public Map<String, UserAlerts> getAllPendingAlerts(CoreSession coreSession) {
+    public Map<String, UserAlerts> getAllPendingAlerts(CoreSession coreSession) {
 
-		Map<String, UserAlerts> result = new HashMap<String, UserAlerts>();
+        Map<String, UserAlerts> result = new HashMap<String, UserAlerts>();
 
-		UserAlerts a = new UserAlerts("testuser");
-		a.getAlerts().add(new Alert("AlertProvider2", "testAlert2", TEST_STRING));
+        UserAlerts a = new UserAlerts("testuser");
+        a.getAlerts().add(
+                new Alert("AlertProvider2", "testAlert2", TEST_STRING));
 
-		result.put("testuser", a);
+        result.put("testuser", a);
 
-		return result;
-	}
+        return result;
+    }
 
-	public String renderAlerts(CoreSession coreSession, RenderingService rs, String userName, List<Alert> alerts,
-			DocumentModel userSettings, AlertContext ctxt) throws ClientException {
+    public String renderAlerts(CoreSession coreSession, RenderingService rs,
+            String userName, List<Alert> alerts, DocumentModel userSettings,
+            AlertContext ctxt) throws ClientException {
 
-		String result = "";
+        String result = "";
 
-		try {
-			RenderingContext2 ctx = new RenderingContext2();
-			ctx.put("template", "test2");
+        try {
+            RenderingContext2 ctx = new RenderingContext2();
+            ctx.put("template", "test2");
 
-			for (Alert a : alerts) {
-				if (a.getAlertProviderName().equals("AlertProvider2")) {
-					ctx.put("teststring", a.getAlertData().toString());
-					break;
-				}
-			}
+            for (Alert a : alerts) {
+                if (a.getAlertProviderName().equals("AlertProvider2")) {
+                    ctx.put("teststring", a.getAlertData().toString());
+                    break;
+                }
+            }
 
-			Collection<RenderingResult> render = rs.process(ctx);
-			if (render.size() > 0) {
-				result = (String) render.iterator().next().getOutcome();
-			}
+            Collection<RenderingResult> render = rs.process(ctx);
+            if (render.size() > 0) {
+                result = (String) render.iterator().next().getOutcome();
+            }
 
-		} catch (Exception e) {
-		}
+        } catch (Exception e) {
+        }
 
-		return result;
+        return result;
 
-	}
+    }
 
-	public List<String> getTemplateList() {
-		List<String> result = new ArrayList<String>();
-		result.add("test2");
-		return result;
-	}
+    public List<String> getTemplateList() {
+        List<String> result = new ArrayList<String>();
+        result.add("test2");
+        return result;
+    }
 
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-alert-core/src/test/java/org/nuxeo/ecm/alert/core/EmailHelperMock.java
--- a/nuxeo-platform-alert-core/src/test/java/org/nuxeo/ecm/alert/core/EmailHelperMock.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-alert-core/src/test/java/org/nuxeo/ecm/alert/core/EmailHelperMock.java	Fri Mar 26 09:05:32 2010 +0100
@@ -5,40 +5,42 @@
 
 public class EmailHelperMock implements EmailHelper {
 
-	private String lastSubject;
-	private String lastTo ;
-	private String lastBody ;
-	
-	public void sendmail(String subject, String to, String mailBody)
-			throws ClientException {
-		setLastBody(mailBody);
-		setLastSubject(subject);
-		setLastTo(to);
-	
-	}
+    private String lastSubject;
 
-	public void setLastSubject(String lastSubject) {
-		this.lastSubject = lastSubject;
-	}
+    private String lastTo;
 
-	public String getLastSubject() {
-		return lastSubject;
-	}
+    private String lastBody;
 
-	public void setLastTo(String lastTo) {
-		this.lastTo = lastTo;
-	}
+    public void sendmail(String subject, String to, String mailBody)
+            throws ClientException {
+        setLastBody(mailBody);
+        setLastSubject(subject);
+        setLastTo(to);
 
-	public String getLastTo() {
-		return lastTo;
-	}
+    }
 
-	public void setLastBody(String lastBody) {
-		this.lastBody = lastBody;
-	}
+    public void setLastSubject(String lastSubject) {
+        this.lastSubject = lastSubject;
+    }
 
-	public String getLastBody() {
-		return lastBody;
-	}
+    public String getLastSubject() {
+        return lastSubject;
+    }
+
+    public void setLastTo(String lastTo) {
+        this.lastTo = lastTo;
+    }
+
+    public String getLastTo() {
+        return lastTo;
+    }
+
+    public void setLastBody(String lastBody) {
+        this.lastBody = lastBody;
+    }
+
+    public String getLastBody() {
+        return lastBody;
+    }
 
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-alert-core/src/test/java/org/nuxeo/ecm/alert/core/FakeUserManagerImpl.java
--- a/nuxeo-platform-alert-core/src/test/java/org/nuxeo/ecm/alert/core/FakeUserManagerImpl.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-alert-core/src/test/java/org/nuxeo/ecm/alert/core/FakeUserManagerImpl.java	Fri Mar 26 09:05:32 2010 +0100
@@ -42,13 +42,13 @@
 
 /**
  * @author Florent Guillaume
- *
+ * 
  */
 public class FakeUserManagerImpl implements UserManager {
-	
-	private static final long serialVersionUID = 1L;
 
-	String userListingMode;
+    private static final long serialVersionUID = 1L;
+
+    String userListingMode;
 
     String groupListingMode;
 
@@ -216,18 +216,21 @@
 
     public NuxeoPrincipal getPrincipal(String username) throws ClientException {
 
-    	if (!virtualUsers.containsKey(username)) {
-    		return null;
-    	}
-    	
-    	VirtualUserDescriptor desc = virtualUsers.get(username);
-    	Map<String, Serializable> props = desc.getProperties();
-    	
-    	NuxeoPrincipalImpl principal = new NuxeoPrincipalImpl(username);
-    	if (props.containsKey("email")) principal.setEmail((String)props.get("email"));
-    	if (props.containsKey("first")) principal.setFirstName((String)props.get("first"));
-    	if (props.containsKey("last")) principal.setLastName((String)props.get("last"));
-    	
+        if (!virtualUsers.containsKey(username)) {
+            return null;
+        }
+
+        VirtualUserDescriptor desc = virtualUsers.get(username);
+        Map<String, Serializable> props = desc.getProperties();
+
+        NuxeoPrincipalImpl principal = new NuxeoPrincipalImpl(username);
+        if (props.containsKey("email"))
+            principal.setEmail((String) props.get("email"));
+        if (props.containsKey("first"))
+            principal.setFirstName((String) props.get("first"));
+        if (props.containsKey("last"))
+            principal.setLastName((String) props.get("last"));
+
         return principal;
     }
 
@@ -275,7 +278,8 @@
     }
 
     public void setConfiguration(UserManagerDescriptor descriptor) {
-    	WrappedUserManagerDescriptor desc = new WrappedUserManagerDescriptor(descriptor);
+        WrappedUserManagerDescriptor desc = new WrappedUserManagerDescriptor(
+                descriptor);
         setDefaultGroup(desc.getDefaultGroup());
         setRootLogin(desc.getRootLogin());
         setUserSortField(desc.getUserSortField());
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-alert-core/src/test/java/org/nuxeo/ecm/alert/core/RenderingContext1.java
--- a/nuxeo-platform-alert-core/src/test/java/org/nuxeo/ecm/alert/core/RenderingContext1.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-alert-core/src/test/java/org/nuxeo/ecm/alert/core/RenderingContext1.java	Fri Mar 26 09:05:32 2010 +0100
@@ -14,26 +14,28 @@
 
     @Override
     public <T> T getAdapter(Class<T> adapter) {
-	if (adapter.isAssignableFrom(getClass())) {
-	    return adapter.cast(this);
-	} else if (adapter.isAssignableFrom(DocumentModel.class)) {
-	    return adapter.cast(getDocuments());
-	}
-	return null;
+        if (adapter.isAssignableFrom(getClass())) {
+            return adapter.cast(this);
+        } else if (adapter.isAssignableFrom(DocumentModel.class)) {
+            return adapter.cast(getDocuments());
+        }
+        return null;
     }
 
     public void setDocuments(List<DocumentModel> doc) {
-	put(CTX_PARAM_DOCUMENTS, doc);
+        put(CTX_PARAM_DOCUMENTS, doc);
     }
 
     @SuppressWarnings("unchecked")
     public List<DocumentModel> getDocuments() {
-	return (List<DocumentModel>) get(CTX_PARAM_DOCUMENTS);
+        return (List<DocumentModel>) get(CTX_PARAM_DOCUMENTS);
     }
 
     @Override
     public boolean accept(RenderingEngine engine) {
-	if (engine.getFormatName().equals("test1")) return true;
-	else return false;
+        if (engine.getFormatName().equals("test1"))
+            return true;
+        else
+            return false;
     }
 }
\ No newline at end of file
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-alert-core/src/test/java/org/nuxeo/ecm/alert/core/RenderingContext2.java
--- a/nuxeo-platform-alert-core/src/test/java/org/nuxeo/ecm/alert/core/RenderingContext2.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-alert-core/src/test/java/org/nuxeo/ecm/alert/core/RenderingContext2.java	Fri Mar 26 09:05:32 2010 +0100
@@ -8,34 +8,34 @@
 
 public class RenderingContext2 extends DefaultRenderingContext {
 
-	private static final long serialVersionUID = 1626664498541223492L;
+    private static final long serialVersionUID = 1626664498541223492L;
 
-	public static final String CTX_PARAM_DOCUMENTS = "docs";
+    public static final String CTX_PARAM_DOCUMENTS = "docs";
 
-	@Override
-	public <T> T getAdapter(Class<T> adapter) {
-		if (adapter.isAssignableFrom(getClass())) {
-			return adapter.cast(this);
-		} else if (adapter.isAssignableFrom(DocumentModel.class)) {
-			return adapter.cast(getDocuments());
-		}
-		return null;
-	}
+    @Override
+    public <T> T getAdapter(Class<T> adapter) {
+        if (adapter.isAssignableFrom(getClass())) {
+            return adapter.cast(this);
+        } else if (adapter.isAssignableFrom(DocumentModel.class)) {
+            return adapter.cast(getDocuments());
+        }
+        return null;
+    }
 
-	public void setDocuments(List<DocumentModel> doc) {
-		put(CTX_PARAM_DOCUMENTS, doc);
-	}
+    public void setDocuments(List<DocumentModel> doc) {
+        put(CTX_PARAM_DOCUMENTS, doc);
+    }
 
-	@SuppressWarnings("unchecked")
-	public List<DocumentModel> getDocuments() {
-		return (List<DocumentModel>) get(CTX_PARAM_DOCUMENTS);
-	}
+    @SuppressWarnings("unchecked")
+    public List<DocumentModel> getDocuments() {
+        return (List<DocumentModel>) get(CTX_PARAM_DOCUMENTS);
+    }
 
-	@Override
-	public boolean accept(RenderingEngine engine) {
-		if (engine.getFormatName().equals("test2"))
-			return true;
-		else
-			return false;
-	}
+    @Override
+    public boolean accept(RenderingEngine engine) {
+        if (engine.getFormatName().equals("test2"))
+            return true;
+        else
+            return false;
+    }
 }
\ No newline at end of file
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-alert-core/src/test/java/org/nuxeo/ecm/alert/core/RepositoryOSGITestCase.java
--- a/nuxeo-platform-alert-core/src/test/java/org/nuxeo/ecm/alert/core/RepositoryOSGITestCase.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-alert-core/src/test/java/org/nuxeo/ecm/alert/core/RepositoryOSGITestCase.java	Fri Mar 26 09:05:32 2010 +0100
@@ -18,6 +18,7 @@
  */
 
 package org.nuxeo.ecm.alert.core;
+
 import java.io.Serializable;
 import java.util.HashMap;
 import java.util.Map;
@@ -49,172 +50,175 @@
     public static final String REPOSITORY_NAME = "demo";
 
     public static final String DOMAIN_NAME = "demo-domain";
-    
+
     protected Repository repository;
 
     private CoreSession coreSession;
 
     protected DocumentModel rootWorkspace = null;
-    
+
     protected DocumentModel domain = null;
 
     protected RepositoryOSGITestCase() {
     }
 
     protected RepositoryOSGITestCase(String name) {
-	super(name);
+        super(name);
     }
 
     protected void undeployBundle(String name) throws BundleException {
-	osgi.getRegistry().getBundle(name).uninstall();
+        osgi.getRegistry().getBundle(name).uninstall();
     }
-    
-    
+
     @Override
     public void setUp() throws Exception {
-	super.setUp();
-	
-	deployBundle("org.nuxeo.ecm.core.schema");
-	deployBundle("org.nuxeo.ecm.core.api");
-	deployBundle("org.nuxeo.ecm.core.event");
-	deployBundle("org.nuxeo.ecm.core");
-	deployBundle("org.nuxeo.ecm.core.jcr");
-	deployBundle("org.nuxeo.ecm.platform.usermanager.api");
-	deployBundle("org.nuxeo.ecm.platform.usermanager");
-	
+        super.setUp();
+
+        deployBundle("org.nuxeo.ecm.core.schema");
+        deployBundle("org.nuxeo.ecm.core.api");
+        deployBundle("org.nuxeo.ecm.core.event");
+        deployBundle("org.nuxeo.ecm.core");
+        deployBundle("org.nuxeo.ecm.core.jcr");
+        deployBundle("org.nuxeo.ecm.platform.usermanager.api");
+        deployBundle("org.nuxeo.ecm.platform.usermanager");
+
     }
 
     @Override
     public void tearDown() throws Exception {
-	
-	Framework.getLocalService(EventService.class).waitForAsyncCompletion();
-	releaseCoreSession(coreSession);
-	coreSession = null;
-	releaseRepository();
 
-	undeployBundle("org.nuxeo.ecm.platform.usermanager");
-	undeployBundle("org.nuxeo.ecm.platform.usermanager.api");
-	undeployBundle("org.nuxeo.ecm.core.jcr");
-	undeployBundle("org.nuxeo.ecm.core");
-	undeployBundle("org.nuxeo.ecm.core.event");
-	undeployBundle("org.nuxeo.ecm.core.api");
-	undeployBundle("org.nuxeo.ecm.core.schema");
-	
-	super.tearDown();
+        Framework.getLocalService(EventService.class).waitForAsyncCompletion();
+        releaseCoreSession(coreSession);
+        coreSession = null;
+        releaseRepository();
+
+        undeployBundle("org.nuxeo.ecm.platform.usermanager");
+        undeployBundle("org.nuxeo.ecm.platform.usermanager.api");
+        undeployBundle("org.nuxeo.ecm.core.jcr");
+        undeployBundle("org.nuxeo.ecm.core");
+        undeployBundle("org.nuxeo.ecm.core.event");
+        undeployBundle("org.nuxeo.ecm.core.api");
+        undeployBundle("org.nuxeo.ecm.core.schema");
+
+        super.tearDown();
     }
 
     protected void initRepository() throws Exception {
-	
-	if (repository == null) {
-	    // the repository should be deployed the last
-	    // after any other bundle that is doctypes
-	    // this is nuxeo-core-jcr-connector-test
-	    repositoryDeploy();
-	    repository = NXCore.getRepositoryService().getRepositoryManager().getRepository(REPOSITORY_NAME);
-	    createRootWorkspace();
-	}
-	
+
+        if (repository == null) {
+            // the repository should be deployed the last
+            // after any other bundle that is doctypes
+            // this is nuxeo-core-jcr-connector-test
+            repositoryDeploy();
+            repository = NXCore.getRepositoryService().getRepositoryManager().getRepository(
+                    REPOSITORY_NAME);
+            createRootWorkspace();
+        }
+
     }
 
     protected void openRepositoryAsUser(String userName) throws Exception {
-	initRepository();
-	coreSession = openCoreSession(userName);
+        initRepository();
+        coreSession = openCoreSession(userName);
     }
 
     protected void closeRepository() throws Exception {
-	releaseCoreSession(coreSession);
-	coreSession = null;
-	releaseRepository();
-	repositoryUndeploy();
+        releaseCoreSession(coreSession);
+        coreSession = null;
+        releaseRepository();
+        repositoryUndeploy();
     }
-    
+
     protected void repositoryDeploy() throws Exception {
-	if (!isRepositoryBundleDeployed) {
-	    deployBundle("org.nuxeo.ecm.core.jcr-connector");
-	    isRepositoryBundleDeployed = true;
-	}
+        if (!isRepositoryBundleDeployed) {
+            deployBundle("org.nuxeo.ecm.core.jcr-connector");
+            isRepositoryBundleDeployed = true;
+        }
     }
 
     protected void repositoryUndeploy() throws Exception {
-	if (isRepositoryBundleDeployed) {
-	    undeployBundle("org.nuxeo.ecm.core.jcr-connector");
-	    isRepositoryBundleDeployed = false;
-	}
+        if (isRepositoryBundleDeployed) {
+            undeployBundle("org.nuxeo.ecm.core.jcr-connector");
+            isRepositoryBundleDeployed = false;
+        }
     }
 
-
     public void openRepository() throws Exception {
-	openRepositoryAsUser("Administrator");
+        openRepositoryAsUser("Administrator");
     }
 
     public void openRepositoryWithSystemPrivileges() throws Exception {
-	openRepositoryAsUser(null);
+        openRepositoryAsUser(null);
     }
 
     public CoreSession getCoreSession() {
-	return coreSession;
+        return coreSession;
     }
 
     protected Repository getRepository() {
-	return repository;
+        return repository;
     }
 
     private void createRootWorkspace() throws ClientException {
 
-	CoreSession adminSession = openCoreSession("Administrator");
-	assertNotNull(adminSession);
-	domain = adminSession.createDocumentModel("/", RepositoryOSGITestCase.DOMAIN_NAME, "Domain");
-	domain = adminSession.createDocument(domain);
-	assertNotNull(domain);
-	domain = adminSession.saveDocument(domain);
-	rootWorkspace = adminSession.createDocumentModel(domain.getPathAsString(), RepositoryOSGITestCase.ROOT_WORKSPACE_NAME, "Workspace");
-	assertNotNull(rootWorkspace);
-	rootWorkspace = adminSession.createDocument(rootWorkspace);
-	rootWorkspace = adminSession.saveDocument(rootWorkspace);
-	adminSession.save();
-	CoreInstance.getInstance().close(adminSession);
-	
+        CoreSession adminSession = openCoreSession("Administrator");
+        assertNotNull(adminSession);
+        domain = adminSession.createDocumentModel("/",
+                RepositoryOSGITestCase.DOMAIN_NAME, "Domain");
+        domain = adminSession.createDocument(domain);
+        assertNotNull(domain);
+        domain = adminSession.saveDocument(domain);
+        rootWorkspace = adminSession.createDocumentModel(
+                domain.getPathAsString(),
+                RepositoryOSGITestCase.ROOT_WORKSPACE_NAME, "Workspace");
+        assertNotNull(rootWorkspace);
+        rootWorkspace = adminSession.createDocument(rootWorkspace);
+        rootWorkspace = adminSession.saveDocument(rootWorkspace);
+        adminSession.save();
+        CoreInstance.getInstance().close(adminSession);
+
     }
 
-    protected CoreSession openCoreSession(String userName) throws ClientException {
+    protected CoreSession openCoreSession(String userName)
+            throws ClientException {
 
-	CoreSession result = null;
-	Map<String, Serializable> ctx = new HashMap<String, Serializable>();
-	ctx.put("username", userName);
-	result = CoreInstance.getInstance().open(REPOSITORY_NAME, ctx);
-	assertNotNull(result);
-	return result;
-	
+        CoreSession result = null;
+        Map<String, Serializable> ctx = new HashMap<String, Serializable>();
+        ctx.put("username", userName);
+        result = CoreInstance.getInstance().open(REPOSITORY_NAME, ctx);
+        assertNotNull(result);
+        return result;
+
     }
 
     public void changeUser(String newUser) throws ClientException {
-	releaseCoreSession(coreSession);
-	coreSession = openCoreSession(newUser);
+        releaseCoreSession(coreSession);
+        coreSession = openCoreSession(newUser);
     }
 
     public void releaseRepository() {
-	if (repository != null) {
-	    repository.shutdown();
-	    repository = null;
-	}
+        if (repository != null) {
+            repository.shutdown();
+            repository = null;
+        }
     }
 
     public void releaseCoreSession(CoreSession session) {
-	if (session != null) {
-	    CoreInstance.getInstance().close(session);
-	}
+        if (session != null) {
+            CoreInstance.getInstance().close(session);
+        }
     }
 
     protected Session getSession() throws DocumentException {
-	return repository.getSession(null);
+        return repository.getSession(null);
     }
 
     protected EventServiceImpl eventService;
 
     protected void waitForEventsDispatched() {
-	if (eventService == null) {
-	    eventService = (EventServiceImpl) Framework.getLocalService(EventService.class);
-	}
-	eventService.waitForAsyncCompletion();
+        if (eventService == null) {
+            eventService = (EventServiceImpl) Framework.getLocalService(EventService.class);
+        }
+        eventService.waitForAsyncCompletion();
     }
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-alert-core/src/test/java/org/nuxeo/ecm/alert/core/TestAlertCore.java
--- a/nuxeo-platform-alert-core/src/test/java/org/nuxeo/ecm/alert/core/TestAlertCore.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-alert-core/src/test/java/org/nuxeo/ecm/alert/core/TestAlertCore.java	Fri Mar 26 09:05:32 2010 +0100
@@ -37,119 +37,120 @@
 
 public class TestAlertCore extends RepositoryOSGITestCase {
 
-	private AlertManagementService service;
+    private AlertManagementService service;
 
-	private EmailHelperMock mock = new EmailHelperMock();
+    private EmailHelperMock mock = new EmailHelperMock();
 
-	@Override
-	public void setUp() throws Exception {
+    @Override
+    public void setUp() throws Exception {
 
-		super.setUp();
+        super.setUp();
 
-		// Bundle to be tested
-		deployBundle("org.nuxeo.ecm.usersettings.types");
-		deployBundle("org.nuxeo.ecm.usersettings.api");
-		deployBundle("org.nuxeo.ecm.usersettings.core");
-		deployBundle("org.nuxeo.ecm.platform.userworkspace.types");
-		deployBundle("org.nuxeo.ecm.platform.userworkspace.api");
-		deployBundle("org.nuxeo.ecm.platform.userworkspace.core");
+        // Bundle to be tested
+        deployBundle("org.nuxeo.ecm.usersettings.types");
+        deployBundle("org.nuxeo.ecm.usersettings.api");
+        deployBundle("org.nuxeo.ecm.usersettings.core");
+        deployBundle("org.nuxeo.ecm.platform.userworkspace.types");
+        deployBundle("org.nuxeo.ecm.platform.userworkspace.api");
+        deployBundle("org.nuxeo.ecm.platform.userworkspace.core");
 
-		deployBundle("org.nuxeo.ecm.usersettings.alert.types");
-		deployBundle("org.nuxeo.ecm.usersettings.alert.core");
+        deployBundle("org.nuxeo.ecm.usersettings.alert.types");
+        deployBundle("org.nuxeo.ecm.usersettings.alert.core");
 
-		deployBundle("org.nuxeo.ecm.directory.types.contrib");
-		deployBundle("org.nuxeo.ecm.platform.notification.api");
-		deployBundle("org.nuxeo.ecm.platform.notification.core");
+        deployBundle("org.nuxeo.ecm.directory.types.contrib");
+        deployBundle("org.nuxeo.ecm.platform.notification.api");
+        deployBundle("org.nuxeo.ecm.platform.notification.core");
 
-		deployBundle("org.nuxeo.theme.core");
-		deployBundle("org.nuxeo.theme.html");
+        deployBundle("org.nuxeo.theme.core");
+        deployBundle("org.nuxeo.theme.html");
 
-		deployBundle("org.nuxeo.ecm.platform.url.api");
-		deployBundle("org.nuxeo.ecm.platform.url.core");
+        deployBundle("org.nuxeo.ecm.platform.url.api");
+        deployBundle("org.nuxeo.ecm.platform.url.core");
 
-		deployBundle("org.nuxeo.ecm.alert.api");
-		deployBundle("org.nuxeo.ecm.alert.core");
+        deployBundle("org.nuxeo.ecm.alert.api");
+        deployBundle("org.nuxeo.ecm.alert.core");
 
-		service = Framework.getLocalService(AlertManagementService.class);
-		assertNotNull(service);
-		assertEquals(0, service.getAlertProviders().size());
+        service = Framework.getLocalService(AlertManagementService.class);
+        assertNotNull(service);
+        assertEquals(0, service.getAlertProviders().size());
 
-		deployBundle("org.nuxeo.ecm.alert.core.test");
-		assertEquals(2, service.getAlertProviders().size());
+        deployBundle("org.nuxeo.ecm.alert.core.test");
+        assertEquals(2, service.getAlertProviders().size());
 
-		service.setEmailHelper(mock);
+        service.setEmailHelper(mock);
 
-		// Initialize the test environment
-		openRepository();
+        // Initialize the test environment
+        openRepository();
 
-	}
+    }
 
-	@Override
-	public void tearDown() throws Exception {
+    @Override
+    public void tearDown() throws Exception {
 
-		try {
-			Framework.getLocalService(EventService.class).waitForAsyncCompletion();
-		} catch (Exception e) {
-		}
+        try {
+            Framework.getLocalService(EventService.class).waitForAsyncCompletion();
+        } catch (Exception e) {
+        }
 
-		closeRepository();
+        closeRepository();
 
-		undeployBundle("org.nuxeo.ecm.alert.core.test");
-		undeployBundle("org.nuxeo.ecm.alert.core");
-		undeployBundle("org.nuxeo.ecm.alert.api");
+        undeployBundle("org.nuxeo.ecm.alert.core.test");
+        undeployBundle("org.nuxeo.ecm.alert.core");
+        undeployBundle("org.nuxeo.ecm.alert.api");
 
-		undeployBundle("org.nuxeo.ecm.platform.url.core");
-		undeployBundle("org.nuxeo.ecm.platform.url.api");
+        undeployBundle("org.nuxeo.ecm.platform.url.core");
+        undeployBundle("org.nuxeo.ecm.platform.url.api");
 
-		undeployBundle("org.nuxeo.theme.html");
-		undeployBundle("org.nuxeo.theme.core");
+        undeployBundle("org.nuxeo.theme.html");
+        undeployBundle("org.nuxeo.theme.core");
 
-		undeployBundle("org.nuxeo.ecm.platform.notification.core");
-		undeployBundle("org.nuxeo.ecm.platform.notification.api");
-		undeployBundle("org.nuxeo.ecm.directory.types.contrib");
+        undeployBundle("org.nuxeo.ecm.platform.notification.core");
+        undeployBundle("org.nuxeo.ecm.platform.notification.api");
+        undeployBundle("org.nuxeo.ecm.directory.types.contrib");
 
-		undeployBundle("org.nuxeo.ecm.usersettings.alert.core");
-		undeployBundle("org.nuxeo.ecm.usersettings.alert.types");
+        undeployBundle("org.nuxeo.ecm.usersettings.alert.core");
+        undeployBundle("org.nuxeo.ecm.usersettings.alert.types");
 
-		undeployBundle("org.nuxeo.ecm.platform.userworkspace.core");
-		undeployBundle("org.nuxeo.ecm.platform.userworkspace.api");
-		undeployBundle("org.nuxeo.ecm.platform.userworkspace.types");
+        undeployBundle("org.nuxeo.ecm.platform.userworkspace.core");
+        undeployBundle("org.nuxeo.ecm.platform.userworkspace.api");
+        undeployBundle("org.nuxeo.ecm.platform.userworkspace.types");
 
-		undeployBundle("org.nuxeo.ecm.usersettings.core");
-		undeployBundle("org.nuxeo.ecm.usersettings.api");
-		undeployBundle("org.nuxeo.ecm.usersettings.types");
+        undeployBundle("org.nuxeo.ecm.usersettings.core");
+        undeployBundle("org.nuxeo.ecm.usersettings.api");
+        undeployBundle("org.nuxeo.ecm.usersettings.types");
 
-		super.tearDown();
+        super.tearDown();
 
-	}
+    }
 
-	public void testStartup() {
-	}
+    public void testStartup() {
+    }
 
-	public void test2Providers() throws ClientException {
-		
-		AlertContext ctx = new AlertContext();
-		ctx.setEventId(AlertEvent.MANUAL_ALERT_EVENT);
-		service.processAlerts(ctx);
-		assertEquals(mock.getLastTo(), "testuser@domain.com");
-		assertEquals(mock.getLastSubject(), AlertManagementImplConstants.MAIL_SUBJECT);
+    public void test2Providers() throws ClientException {
 
-	}
-	
-	public String getFileContents(InputStream filename) throws IOException {
-		
-		char[] buffer = new char[512];
-		StringBuilder builder = new StringBuilder();
-		InputStreamReader reader = new InputStreamReader(filename);
-		BufferedReader buffReader = new BufferedReader(reader);
-		try {
-			int len;
-			while (((len = buffReader.read(buffer, 0, buffer.length)) != -1)) {
-				builder.append(buffer, 0, len);
-			}
-		} finally {
-			buffReader.close();
-		}
-		return builder.toString();
-	}
+        AlertContext ctx = new AlertContext();
+        ctx.setEventId(AlertEvent.MANUAL_ALERT_EVENT);
+        service.processAlerts(ctx);
+        assertEquals(mock.getLastTo(), "testuser@domain.com");
+        assertEquals(mock.getLastSubject(),
+                AlertManagementImplConstants.MAIL_SUBJECT);
+
+    }
+
+    public String getFileContents(InputStream filename) throws IOException {
+
+        char[] buffer = new char[512];
+        StringBuilder builder = new StringBuilder();
+        InputStreamReader reader = new InputStreamReader(filename);
+        BufferedReader buffReader = new BufferedReader(reader);
+        try {
+            int len;
+            while (((len = buffReader.read(buffer, 0, buffer.length)) != -1)) {
+                builder.append(buffer, 0, len);
+            }
+        } finally {
+            buffReader.close();
+        }
+        return builder.toString();
+    }
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-alert-core/src/test/java/org/nuxeo/ecm/alert/core/WrappedUserManagerDescriptor.java
--- a/nuxeo-platform-alert-core/src/test/java/org/nuxeo/ecm/alert/core/WrappedUserManagerDescriptor.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-alert-core/src/test/java/org/nuxeo/ecm/alert/core/WrappedUserManagerDescriptor.java	Fri Mar 26 09:05:32 2010 +0100
@@ -8,176 +8,142 @@
 
 public class WrappedUserManagerDescriptor extends UserManagerDescriptor {
 
-	/**
+    /**
      * 
      */
     private static final long serialVersionUID = 1738447024467990837L;
 
+    public WrappedUserManagerDescriptor(UserManagerDescriptor init) {
+        this.merge(init);
+    }
 
-    public WrappedUserManagerDescriptor(UserManagerDescriptor init) {
-		this.merge(init);
-	}
+    protected void setUserManagerClass(Class<?> userManagerClass) {
+        this.userManagerClass = userManagerClass;
+    }
 
+    protected Class<?> getUserManagerClass() {
+        return userManagerClass;
+    }
 
-	protected void setUserManagerClass(Class<?> userManagerClass) {
-		this.userManagerClass = userManagerClass;
-	}
+    protected void setDefaultGroup(String defaultGroup) {
+        this.defaultGroup = defaultGroup;
+    }
 
+    protected String getDefaultGroup() {
+        return defaultGroup;
+    }
 
-	protected Class<?> getUserManagerClass() {
-		return userManagerClass;
-	}
+    protected void setRootLogin(String rootLogin) {
+        this.rootLogin = rootLogin;
+    }
 
+    protected String getRootLogin() {
+        return rootLogin;
+    }
 
-	protected void setDefaultGroup(String defaultGroup) {
-		this.defaultGroup = defaultGroup;
-	}
+    protected void setUserSortField(String userSortField) {
+        this.userSortField = userSortField;
+    }
 
+    protected String getUserSortField() {
+        return userSortField;
+    }
 
-	protected String getDefaultGroup() {
-		return defaultGroup;
-	}
+    protected void setGroupSortField(String groupSortField) {
+        this.groupSortField = groupSortField;
+    }
 
+    protected String getGroupSortField() {
+        return groupSortField;
+    }
 
-	protected void setRootLogin(String rootLogin) {
-		this.rootLogin = rootLogin;
-	}
+    protected void setUserDirectoryName(String userDirectoryName) {
+        this.userDirectoryName = userDirectoryName;
+    }
 
+    protected String getUserDirectoryName() {
+        return userDirectoryName;
+    }
 
-	protected String getRootLogin() {
-		return rootLogin;
-	}
+    protected void setUserEmailField(String userEmailField) {
+        this.userEmailField = userEmailField;
+    }
 
+    protected String getUserEmailField() {
+        return userEmailField;
+    }
 
-	protected void setUserSortField(String userSortField) {
-		this.userSortField = userSortField;
-	}
+    protected void setUserListingMode(String userListingMode) {
+        this.userListingMode = userListingMode;
+    }
 
+    protected String getUserListingMode() {
+        return userListingMode;
+    }
 
-	protected String getUserSortField() {
-		return userSortField;
-	}
+    protected void setAnonymousUser(VirtualUserDescriptor anonymousUser) {
+        this.anonymousUser = anonymousUser;
+    }
 
+    protected VirtualUserDescriptor getAnonymousUser() {
+        return anonymousUser;
+    }
 
-	protected void setGroupSortField(String groupSortField) {
-		this.groupSortField = groupSortField;
-	}
+    protected void setVirtualUsers(
+            Map<String, VirtualUserDescriptor> virtualUsers) {
+        this.virtualUsers = virtualUsers;
+    }
 
+    protected Map<String, VirtualUserDescriptor> getVirtualUsers() {
+        return virtualUsers;
+    }
 
-	protected String getGroupSortField() {
-		return groupSortField;
-	}
+    protected void setGroupDirectoryName(String groupDirectoryName) {
+        this.groupDirectoryName = groupDirectoryName;
+    }
 
+    protected String getGroupDirectoryName() {
+        return groupDirectoryName;
+    }
 
-	protected void setUserDirectoryName(String userDirectoryName) {
-		this.userDirectoryName = userDirectoryName;
-	}
+    protected void setGroupMembersField(String groupMembersField) {
+        this.groupMembersField = groupMembersField;
+    }
 
+    protected String getGroupMembersField() {
+        return groupMembersField;
+    }
 
-	protected String getUserDirectoryName() {
-		return userDirectoryName;
-	}
+    protected void setGroupSubGroupsField(String groupSubGroupsField) {
+        this.groupSubGroupsField = groupSubGroupsField;
+    }
 
+    protected String getGroupSubGroupsField() {
+        return groupSubGroupsField;
+    }
 
-	protected void setUserEmailField(String userEmailField) {
-		this.userEmailField = userEmailField;
-	}
+    protected void setGroupParentGroupsField(String groupParentGroupsField) {
+        this.groupParentGroupsField = groupParentGroupsField;
+    }
 
+    protected String getGroupParentGroupsField() {
+        return groupParentGroupsField;
+    }
 
-	protected String getUserEmailField() {
-		return userEmailField;
-	}
+    protected void setGroupListingMode(String groupListingMode) {
+        this.groupListingMode = groupListingMode;
+    }
 
+    protected String getGroupListingMode() {
+        return groupListingMode;
+    }
 
-	protected void setUserListingMode(String userListingMode) {
-		this.userListingMode = userListingMode;
-	}
+    protected void setUserPasswordPattern(Pattern userPasswordPattern) {
+        this.userPasswordPattern = userPasswordPattern;
+    }
 
+    protected Pattern getUserPasswordPattern() {
+        return userPasswordPattern;
+    }
 
-	protected String getUserListingMode() {
-		return userListingMode;
-	}
-
-
-	protected void setAnonymousUser(VirtualUserDescriptor anonymousUser) {
-		this.anonymousUser = anonymousUser;
-	}
-
-
-	protected VirtualUserDescriptor getAnonymousUser() {
-		return anonymousUser;
-	}
-
-
-	protected void setVirtualUsers(Map<String, VirtualUserDescriptor> virtualUsers) {
-		this.virtualUsers = virtualUsers;
-	}
-
-
-	protected Map<String, VirtualUserDescriptor> getVirtualUsers() {
-		return virtualUsers;
-	}
-
-
-	protected void setGroupDirectoryName(String groupDirectoryName) {
-		this.groupDirectoryName = groupDirectoryName;
-	}
-
-
-	protected String getGroupDirectoryName() {
-		return groupDirectoryName;
-	}
-
-
-	protected void setGroupMembersField(String groupMembersField) {
-		this.groupMembersField = groupMembersField;
-	}
-
-
-	protected String getGroupMembersField() {
-		return groupMembersField;
-	}
-
-
-	protected void setGroupSubGroupsField(String groupSubGroupsField) {
-		this.groupSubGroupsField = groupSubGroupsField;
-	}
-
-
-	protected String getGroupSubGroupsField() {
-		return groupSubGroupsField;
-	}
-
-
-	protected void setGroupParentGroupsField(String groupParentGroupsField) {
-		this.groupParentGroupsField = groupParentGroupsField;
-	}
-
-
-	protected String getGroupParentGroupsField() {
-		return groupParentGroupsField;
-	}
-
-
-	protected void setGroupListingMode(String groupListingMode) {
-		this.groupListingMode = groupListingMode;
-	}
-
-
-	protected String getGroupListingMode() {
-		return groupListingMode;
-	}
-
-
-	protected void setUserPasswordPattern(Pattern userPasswordPattern) {
-		this.userPasswordPattern = userPasswordPattern;
-	}
-
-
-	protected Pattern getUserPasswordPattern() {
-		return userPasswordPattern;
-	}
-
-
-	
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-alert-deferred-core/src/main/java/org/nuxeo/ecm/alert/deferred/core/AlertInfo.java
--- a/nuxeo-platform-alert-deferred-core/src/main/java/org/nuxeo/ecm/alert/deferred/core/AlertInfo.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-alert-deferred-core/src/main/java/org/nuxeo/ecm/alert/deferred/core/AlertInfo.java	Fri Mar 26 09:05:32 2010 +0100
@@ -2,48 +2,46 @@
 
 import org.nuxeo.ecm.core.api.DocumentRef;
 
-
 public class AlertInfo {
 
-	private DocumentRef docRef;
-	
-	private String userName;
-	
-	private String alertText;
-	
-	private String alertDate;
+    private DocumentRef docRef;
 
-	public String getUserName() {
-		return userName;
-	}
+    private String userName;
 
-	public void setUserName(String userName) {
-		this.userName = userName;
-	}
+    private String alertText;
 
-	public String getAlertText() {
-		return alertText;
-	}
+    private String alertDate;
 
-	public void setAlertText(String alertText) {
-		this.alertText = alertText;
-	}
+    public String getUserName() {
+        return userName;
+    }
 
-	public void setDocRef(DocumentRef docRef) {
-		this.docRef = docRef;
-	}
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
 
-	public DocumentRef getDocRef() {
-		return docRef;
-	}
+    public String getAlertText() {
+        return alertText;
+    }
 
-	public void setAlertDate(String alertDate) {
-		this.alertDate = alertDate;
-	}
+    public void setAlertText(String alertText) {
+        this.alertText = alertText;
+    }
 
-	public String getAlertDate() {
-		return alertDate;
-	}
-	
-	
+    public void setDocRef(DocumentRef docRef) {
+        this.docRef = docRef;
+    }
+
+    public DocumentRef getDocRef() {
+        return docRef;
+    }
+
+    public void setAlertDate(String alertDate) {
+        this.alertDate = alertDate;
+    }
+
+    public String getAlertDate() {
+        return alertDate;
+    }
+
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-alert-deferred-core/src/main/java/org/nuxeo/ecm/alert/deferred/core/DeferredRenderingContext.java
--- a/nuxeo-platform-alert-deferred-core/src/main/java/org/nuxeo/ecm/alert/deferred/core/DeferredRenderingContext.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-alert-deferred-core/src/main/java/org/nuxeo/ecm/alert/deferred/core/DeferredRenderingContext.java	Fri Mar 26 09:05:32 2010 +0100
@@ -14,27 +14,29 @@
 
     @Override
     public <T> T getAdapter(Class<T> adapter) {
-	if (adapter.isAssignableFrom(getClass())) {
-	    return adapter.cast(this);
-	} else if (adapter.isAssignableFrom(DocumentModel.class)) {
-	    return adapter.cast(getDocuments());
-	}
-	return null;
+        if (adapter.isAssignableFrom(getClass())) {
+            return adapter.cast(this);
+        } else if (adapter.isAssignableFrom(DocumentModel.class)) {
+            return adapter.cast(getDocuments());
+        }
+        return null;
     }
 
     public void setDocuments(List<DocumentModel> doc) {
-	put(CTX_PARAM_DOCUMENTS, doc);
+        put(CTX_PARAM_DOCUMENTS, doc);
     }
 
     @SuppressWarnings("unchecked")
     public List<DocumentModel> getDocuments() {
-	return (List<DocumentModel>) get(CTX_PARAM_DOCUMENTS);
+        return (List<DocumentModel>) get(CTX_PARAM_DOCUMENTS);
     }
-    
+
     @Override
     public boolean accept(RenderingEngine engine) {
-	if (engine.getFormatName().equals("deferredAlert")) return true;
-	else return false;
+        if (engine.getFormatName().equals("deferredAlert"))
+            return true;
+        else
+            return false;
     }
 
 }
\ No newline at end of file
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-alert-lock-core/src/main/java/org/nuxeo/ecm/alert/lock/core/LockDescriptor.java
--- a/nuxeo-platform-alert-lock-core/src/main/java/org/nuxeo/ecm/alert/lock/core/LockDescriptor.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-alert-lock-core/src/main/java/org/nuxeo/ecm/alert/lock/core/LockDescriptor.java	Fri Mar 26 09:05:32 2010 +0100
@@ -7,35 +7,33 @@
 public class LockDescriptor {
 
     private DocumentRef docRef;
-    
+
     private Date since;
-    
+
     private String locker;
 
     public void setDocRef(DocumentRef docRef) {
-	this.docRef = docRef;
+        this.docRef = docRef;
     }
 
     public DocumentRef getDocRef() {
-	return docRef;
+        return docRef;
     }
 
     public void setSince(Date since) {
-	this.since = since;
+        this.since = since;
     }
 
     public Date getSince() {
-	return since;
+        return since;
     }
 
     public void setLocker(String locker) {
-	this.locker = locker;
+        this.locker = locker;
     }
 
     public String getLocker() {
-	return locker;
+        return locker;
     }
-    
-    
-    
+
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-alert-lock-core/src/main/java/org/nuxeo/ecm/alert/lock/core/LockInfo.java
--- a/nuxeo-platform-alert-lock-core/src/main/java/org/nuxeo/ecm/alert/lock/core/LockInfo.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-alert-lock-core/src/main/java/org/nuxeo/ecm/alert/lock/core/LockInfo.java	Fri Mar 26 09:05:32 2010 +0100
@@ -3,37 +3,45 @@
 import java.text.SimpleDateFormat;
 import java.util.Date;
 
-
 public class LockInfo {
 
     private static SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
-    
+
     private String docTitle;
+
     private Date lockedSince;
+
     private String docUrl;
-    
+
     public void setDocTitle(String docTitle) {
-	this.docTitle = docTitle;
+        this.docTitle = docTitle;
     }
+
     public String getDocTitle() {
-	return docTitle;
+        return docTitle;
     }
+
     public void setLockedSince(Date lockedSince) {
-	this.lockedSince = lockedSince;
+        this.lockedSince = lockedSince;
     }
+
     public Date getLockedSince() {
-	return lockedSince;
+        return lockedSince;
     }
+
     public String getLockedSinceAsString() {
-	if (lockedSince == null) return "-";
-	else return df.format(lockedSince);
+        if (lockedSince == null)
+            return "-";
+        else
+            return df.format(lockedSince);
     }
-    
+
     public void setDocUrl(String docUrl) {
-	this.docUrl = docUrl;
+        this.docUrl = docUrl;
     }
+
     public String getDocUrl() {
-	return docUrl;
+        return docUrl;
     }
-    
+
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-alert-lock-core/src/main/java/org/nuxeo/ecm/alert/lock/core/LockRenderingContext.java
--- a/nuxeo-platform-alert-lock-core/src/main/java/org/nuxeo/ecm/alert/lock/core/LockRenderingContext.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-alert-lock-core/src/main/java/org/nuxeo/ecm/alert/lock/core/LockRenderingContext.java	Fri Mar 26 09:05:32 2010 +0100
@@ -14,27 +14,29 @@
 
     @Override
     public <T> T getAdapter(Class<T> adapter) {
-	if (adapter.isAssignableFrom(getClass())) {
-	    return adapter.cast(this);
-	} else if (adapter.isAssignableFrom(DocumentModel.class)) {
-	    return adapter.cast(getDocuments());
-	}
-	return null;
+        if (adapter.isAssignableFrom(getClass())) {
+            return adapter.cast(this);
+        } else if (adapter.isAssignableFrom(DocumentModel.class)) {
+            return adapter.cast(getDocuments());
+        }
+        return null;
     }
 
     public void setDocuments(List<DocumentModel> doc) {
-	put(CTX_PARAM_DOCUMENTS, doc);
+        put(CTX_PARAM_DOCUMENTS, doc);
     }
 
     @SuppressWarnings("unchecked")
     public List<DocumentModel> getDocuments() {
-	return (List<DocumentModel>) get(CTX_PARAM_DOCUMENTS);
+        return (List<DocumentModel>) get(CTX_PARAM_DOCUMENTS);
     }
 
     @Override
     public boolean accept(RenderingEngine engine) {
-	if (engine.getFormatName().equals("lockAlert")) return true;
-	else return false;
+        if (engine.getFormatName().equals("lockAlert"))
+            return true;
+        else
+            return false;
     }
 
 }
\ No newline at end of file
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-alert-task-core/src/main/java/org/nuxeo/ecm/alert/task/core/DocumentInfo.java
--- a/nuxeo-platform-alert-task-core/src/main/java/org/nuxeo/ecm/alert/task/core/DocumentInfo.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-alert-task-core/src/main/java/org/nuxeo/ecm/alert/task/core/DocumentInfo.java	Fri Mar 26 09:05:32 2010 +0100
@@ -5,39 +5,53 @@
 
 public class DocumentInfo {
 
-	private static SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
-	private String docUrl;
-	private String docTitle;
-	private Date dueDate;
-	private boolean late;
-	
-	public void setDocUrl(String docUrl) {
-		this.docUrl = docUrl;
-	}
-	public String getDocUrl() {
-		return docUrl;
-	}
-	public void setDocTitle(String docTitle) {
-		this.docTitle = docTitle;
-	}
-	public String getDocTitle() {
-		return docTitle;
-	}
-	public void setDueDate(Date dueDate) {
-		this.dueDate = dueDate;
-	}
-	public Date getDueDate() {
-		return dueDate;
-	}
-	public String getDueDateStr() {
-		if (dueDate == null) return "-";
-		else return df.format(dueDate);
-	}
-	public void setLate(boolean isLate) {
-	    this.late = isLate;
-	}
-	public boolean getLate() {
-	    return late;
-	}
-	
+    private static SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
+
+    private String docUrl;
+
+    private String docTitle;
+
+    private Date dueDate;
+
+    private boolean late;
+
+    public void setDocUrl(String docUrl) {
+        this.docUrl = docUrl;
+    }
+
+    public String getDocUrl() {
+        return docUrl;
+    }
+
+    public void setDocTitle(String docTitle) {
+        this.docTitle = docTitle;
+    }
+
+    public String getDocTitle() {
+        return docTitle;
+    }
+
+    public void setDueDate(Date dueDate) {
+        this.dueDate = dueDate;
+    }
+
+    public Date getDueDate() {
+        return dueDate;
+    }
+
+    public String getDueDateStr() {
+        if (dueDate == null)
+            return "-";
+        else
+            return df.format(dueDate);
+    }
+
+    public void setLate(boolean isLate) {
+        this.late = isLate;
+    }
+
+    public boolean getLate() {
+        return late;
+    }
+
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-alert-task-core/src/main/java/org/nuxeo/ecm/alert/task/core/TaskDescriptor.java
--- a/nuxeo-platform-alert-task-core/src/main/java/org/nuxeo/ecm/alert/task/core/TaskDescriptor.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-alert-task-core/src/main/java/org/nuxeo/ecm/alert/task/core/TaskDescriptor.java	Fri Mar 26 09:05:32 2010 +0100
@@ -7,71 +7,76 @@
 public class TaskDescriptor {
 
     private String actor;
+
     private Date dueDate;
+
     private String name;
+
     private String documentId;
+
     private String repositoryName;
 
     public void setDueDate(Date dueDate) {
-	this.dueDate = dueDate;
+        this.dueDate = dueDate;
     }
 
     public Date getDueDate() {
-	return dueDate;
+        return dueDate;
     }
 
     public void setName(String name) {
-	this.name = name;
+        this.name = name;
     }
 
     public String getName() {
-	return name;
+        return name;
     }
 
     public void setDocumentId(String documentId) {
-	this.documentId = documentId;
+        this.documentId = documentId;
     }
 
     public String getDocumentId() {
-	return documentId;
+        return documentId;
     }
 
     public void setRepositoryName(String repositoryName) {
-	this.repositoryName = repositoryName;
+        this.repositoryName = repositoryName;
     }
 
     public String getRepositoryName() {
-	return repositoryName;
+        return repositoryName;
     }
 
     public void setActor(String actor) {
-	this.actor = actor;
+        this.actor = actor;
     }
 
     public String getActor() {
-	return actor;
+        return actor;
     }
 
     public TaskDescriptor cloneForUser(String userName) {
 
-	TaskDescriptor result = new TaskDescriptor();
-	result.setName(this.name);
-	result.setActor(userName);
-	result.setDocumentId(this.documentId);
-	result.setDueDate(this.dueDate);
-	result.setRepositoryName(this.repositoryName);
-	return result;
-    
+        TaskDescriptor result = new TaskDescriptor();
+        result.setName(this.name);
+        result.setActor(userName);
+        result.setDocumentId(this.documentId);
+        result.setDueDate(this.dueDate);
+        result.setRepositoryName(this.repositoryName);
+        return result;
+
     }
-    
+
     public List<TaskDescriptor> cloneForUsers(List<String> userNames) {
 
-	List<TaskDescriptor> result = new ArrayList<TaskDescriptor>();
-	
-	for (String s : userNames) result.add(cloneForUser(s));
-	
-	return result;
-	
+        List<TaskDescriptor> result = new ArrayList<TaskDescriptor>();
+
+        for (String s : userNames)
+            result.add(cloneForUser(s));
+
+        return result;
+
     }
 
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-alert-task-core/src/main/java/org/nuxeo/ecm/alert/task/core/TaskRenderingContext.java
--- a/nuxeo-platform-alert-task-core/src/main/java/org/nuxeo/ecm/alert/task/core/TaskRenderingContext.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-alert-task-core/src/main/java/org/nuxeo/ecm/alert/task/core/TaskRenderingContext.java	Fri Mar 26 09:05:32 2010 +0100
@@ -14,27 +14,29 @@
 
     @Override
     public <T> T getAdapter(Class<T> adapter) {
-	if (adapter.isAssignableFrom(getClass())) {
-	    return adapter.cast(this);
-	} else if (adapter.isAssignableFrom(DocumentModel.class)) {
-	    return adapter.cast(getDocuments());
-	}
-	return null;
+        if (adapter.isAssignableFrom(getClass())) {
+            return adapter.cast(this);
+        } else if (adapter.isAssignableFrom(DocumentModel.class)) {
+            return adapter.cast(getDocuments());
+        }
+        return null;
     }
 
     public void setDocuments(List<DocumentModel> doc) {
-	put(CTX_PARAM_DOCUMENTS, doc);
+        put(CTX_PARAM_DOCUMENTS, doc);
     }
 
     @SuppressWarnings("unchecked")
     public List<DocumentModel> getDocuments() {
-	return (List<DocumentModel>) get(CTX_PARAM_DOCUMENTS);
+        return (List<DocumentModel>) get(CTX_PARAM_DOCUMENTS);
     }
-    
+
     @Override
     public boolean accept(RenderingEngine engine) {
-	if (engine.getFormatName().equals("taskAlert")) return true;
-	else return false;
+        if (engine.getFormatName().equals("taskAlert"))
+            return true;
+        else
+            return false;
     }
 
 }
\ No newline at end of file
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-alert-task-core/src/main/java/org/nuxeo/ecm/alert/task/core/WorkflowHelper.java
--- a/nuxeo-platform-alert-task-core/src/main/java/org/nuxeo/ecm/alert/task/core/WorkflowHelper.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-alert-task-core/src/main/java/org/nuxeo/ecm/alert/task/core/WorkflowHelper.java	Fri Mar 26 09:05:32 2010 +0100
@@ -99,7 +99,7 @@
         ArrayList<TaskDescriptor> result = new ArrayList<TaskDescriptor>();
 
         try {
-            
+
             JbpmService service = getJbpmService();
             JbpmContext ctxt = service.getConfiguration().createJbpmContext();
             Session s = ctxt.getSession();
@@ -119,12 +119,11 @@
             ctxt.close();
 
             return result;
-        }
-        catch(Exception e) {
+        } catch (Exception e) {
             log.error("Unable to retrieve jbpmService", e);
         }
 
-         return new ArrayList<TaskDescriptor>();
+        return new ArrayList<TaskDescriptor>();
 
     }
 
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-alert-test/src/main/java/org/nuxeo/ecm/alert/core/test/EmailHelperMock.java
--- a/nuxeo-platform-alert-test/src/main/java/org/nuxeo/ecm/alert/core/test/EmailHelperMock.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-alert-test/src/main/java/org/nuxeo/ecm/alert/core/test/EmailHelperMock.java	Fri Mar 26 09:05:32 2010 +0100
@@ -5,40 +5,42 @@
 
 public class EmailHelperMock implements EmailHelper {
 
-	private String lastSubject;
-	private String lastTo ;
-	private String lastBody ;
-	
-	public void sendmail(String subject, String to, String mailBody)
-			throws ClientException {
-		setLastBody(mailBody);
-		setLastSubject(subject);
-		setLastTo(to);
-	
-	}
+    private String lastSubject;
 
-	public void setLastSubject(String lastSubject) {
-		this.lastSubject = lastSubject;
-	}
+    private String lastTo;
 
-	public String getLastSubject() {
-		return lastSubject;
-	}
+    private String lastBody;
 
-	public void setLastTo(String lastTo) {
-		this.lastTo = lastTo;
-	}
+    public void sendmail(String subject, String to, String mailBody)
+            throws ClientException {
+        setLastBody(mailBody);
+        setLastSubject(subject);
+        setLastTo(to);
 
-	public String getLastTo() {
-		return lastTo;
-	}
+    }
 
-	public void setLastBody(String lastBody) {
-		this.lastBody = lastBody;
-	}
+    public void setLastSubject(String lastSubject) {
+        this.lastSubject = lastSubject;
+    }
 
-	public String getLastBody() {
-		return lastBody;
-	}
+    public String getLastSubject() {
+        return lastSubject;
+    }
+
+    public void setLastTo(String lastTo) {
+        this.lastTo = lastTo;
+    }
+
+    public String getLastTo() {
+        return lastTo;
+    }
+
+    public void setLastBody(String lastBody) {
+        this.lastBody = lastBody;
+    }
+
+    public String getLastBody() {
+        return lastBody;
+    }
 
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-alert-test/src/main/java/org/nuxeo/ecm/alert/core/test/FireAlertEventRestlet.java
--- a/nuxeo-platform-alert-test/src/main/java/org/nuxeo/ecm/alert/core/test/FireAlertEventRestlet.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-alert-test/src/main/java/org/nuxeo/ecm/alert/core/test/FireAlertEventRestlet.java	Fri Mar 26 09:05:32 2010 +0100
@@ -17,77 +17,79 @@
 @Scope(EVENT)
 public class FireAlertEventRestlet extends BaseNuxeoRestlet {
 
-	private final String ERROR_TEMPLATE = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\" > "
-			+ "<html xmlns=\"http://www.w3.org/1999/xhtml\">"
-			+ "<head><title>Error</title></head>"
-			+ "<body>%%TEXT%%</body></html>";
+    private final String ERROR_TEMPLATE = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\" > "
+            + "<html xmlns=\"http://www.w3.org/1999/xhtml\">"
+            + "<head><title>Error</title></head>"
+            + "<body>%%TEXT%%</body></html>";
 
-	@Override
-	public void handle(Request req, Response res) {
+    @Override
+    public void handle(Request req, Response res) {
 
-		boolean byMail = false;
-		boolean purge = false;
+        boolean byMail = false;
+        boolean purge = false;
 
-		try {
-			String mail = getHttpRequest(req).getParameter("mail");
-			if (mail!=null) byMail = Boolean.parseBoolean(mail);
-		} catch (Exception e) {
-		}
+        try {
+            String mail = getHttpRequest(req).getParameter("mail");
+            if (mail != null)
+                byMail = Boolean.parseBoolean(mail);
+        } catch (Exception e) {
+        }
 
-		try {
-			String spurge = getHttpRequest(req).getParameter("purge");
-			if (spurge!=null) purge = Boolean.parseBoolean(spurge);
-		} catch (Exception e) {
-		}
-		
-		String html = processAlerts(byMail, purge);
+        try {
+            String spurge = getHttpRequest(req).getParameter("purge");
+            if (spurge != null)
+                purge = Boolean.parseBoolean(spurge);
+        } catch (Exception e) {
+        }
 
-		res.setEntity(html, MediaType.TEXT_HTML);
+        String html = processAlerts(byMail, purge);
 
-	}
+        res.setEntity(html, MediaType.TEXT_HTML);
 
-	private String processAlerts(boolean bymail, boolean purge) {
+    }
 
-		EmailHelperMock testHelper = new EmailHelperMock();
-		EmailHelper initialHelper = null;
-		AlertManagementService alertService = null;
+    private String processAlerts(boolean bymail, boolean purge) {
 
-		try {
+        EmailHelperMock testHelper = new EmailHelperMock();
+        EmailHelper initialHelper = null;
+        AlertManagementService alertService = null;
 
-			alertService = Framework.getService(AlertManagementService.class);
+        try {
 
-			if (alertService != null) {
-				if (!bymail)
-					initialHelper = alertService.setEmailHelper(testHelper);
-				AlertContext ctxt = new AlertContext();
-				ctxt.setNoPurge(!purge);
-				alertService.processAlerts(ctxt);
-				String result = testHelper.getLastBody();
-				alertService.setEmailHelper(initialHelper);
-				if (result == null || result.length() == 0)
-					result = buildHtmlMessage("Aucune alerte");
-				return result;
-			} else {
-				return buildHtmlMessage("Unable to retrieve AlertManagementService");
-			}
+            alertService = Framework.getService(AlertManagementService.class);
 
-		} catch (Exception e) {
+            if (alertService != null) {
+                if (!bymail)
+                    initialHelper = alertService.setEmailHelper(testHelper);
+                AlertContext ctxt = new AlertContext();
+                ctxt.setNoPurge(!purge);
+                alertService.processAlerts(ctxt);
+                String result = testHelper.getLastBody();
+                alertService.setEmailHelper(initialHelper);
+                if (result == null || result.length() == 0)
+                    result = buildHtmlMessage("Aucune alerte");
+                return result;
+            } else {
+                return buildHtmlMessage("Unable to retrieve AlertManagementService");
+            }
 
-			if (initialHelper != null) {
-				if (!bymail)
-					alertService.setEmailHelper(initialHelper);
-			}
+        } catch (Exception e) {
 
-			StringBuilder bdr = new StringBuilder();
-			bdr.append("<b>" + e.getMessage() + "</b><br/>");
-			return buildHtmlMessage(bdr.toString());
+            if (initialHelper != null) {
+                if (!bymail)
+                    alertService.setEmailHelper(initialHelper);
+            }
 
-		}
+            StringBuilder bdr = new StringBuilder();
+            bdr.append("<b>" + e.getMessage() + "</b><br/>");
+            return buildHtmlMessage(bdr.toString());
 
-	}
+        }
 
-	private String buildHtmlMessage(String text) {
-		return ERROR_TEMPLATE.replace("%%TEXT%%", text.replace("\n", "<br/>"));
-	}
+    }
+
+    private String buildHtmlMessage(String text) {
+        return ERROR_TEMPLATE.replace("%%TEXT%%", text.replace("\n", "<br/>"));
+    }
 
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-alert-test/src/main/java/org/nuxeo/ecm/alert/core/test/ScheduleAlertEventRestlet.java
--- a/nuxeo-platform-alert-test/src/main/java/org/nuxeo/ecm/alert/core/test/ScheduleAlertEventRestlet.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-alert-test/src/main/java/org/nuxeo/ecm/alert/core/test/ScheduleAlertEventRestlet.java	Fri Mar 26 09:05:32 2010 +0100
@@ -17,22 +17,22 @@
 @Scope(EVENT)
 public class ScheduleAlertEventRestlet extends BaseNuxeoRestlet {
 
-	@Override
-	public void handle(Request req, Response res) {
+    @Override
+    public void handle(Request req, Response res) {
 
-		String eventId = AlertEvent.MAIN_ALERT_EVENT;
-		
-		if (getHttpRequest(req).getParameter("event") != null) {
-			eventId = getHttpRequest(req).getParameter("event");
-		}
-		
-		try {
-			Framework.getService(EventService.class).fireEvent(eventId, new EventContextImpl());
-		} catch (Exception e) {
-			req.setEntity(e.getMessage(), MediaType.TEXT_PLAIN);
-		}
-		
-	}
+        String eventId = AlertEvent.MAIN_ALERT_EVENT;
 
+        if (getHttpRequest(req).getParameter("event") != null) {
+            eventId = getHttpRequest(req).getParameter("event");
+        }
+
+        try {
+            Framework.getService(EventService.class).fireEvent(eventId,
+                    new EventContextImpl());
+        } catch (Exception e) {
+            req.setEntity(e.getMessage(), MediaType.TEXT_PLAIN);
+        }
+
+    }
 
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-deferredalert-api/src/main/java/org/nuxeo/ecm/deferredalert/DeferredAlertManagementDescriptor.java
--- a/nuxeo-platform-deferredalert-api/src/main/java/org/nuxeo/ecm/deferredalert/DeferredAlertManagementDescriptor.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-deferredalert-api/src/main/java/org/nuxeo/ecm/deferredalert/DeferredAlertManagementDescriptor.java	Fri Mar 26 09:05:32 2010 +0100
@@ -35,7 +35,7 @@
     private Class<? extends DeferredAlertManagementService> DeferredAlertManagementClass;
 
     public Class<? extends DeferredAlertManagementService> getDeferredAlertManagementClass() {
-	return DeferredAlertManagementClass;
+        return DeferredAlertManagementClass;
     }
 
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-deferredalert-api/src/main/java/org/nuxeo/ecm/deferredalert/DeferredAlertManagementService.java
--- a/nuxeo-platform-deferredalert-api/src/main/java/org/nuxeo/ecm/deferredalert/DeferredAlertManagementService.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-deferredalert-api/src/main/java/org/nuxeo/ecm/deferredalert/DeferredAlertManagementService.java	Fri Mar 26 09:05:32 2010 +0100
@@ -32,10 +32,12 @@
  */
 public interface DeferredAlertManagementService extends Serializable {
 
-	public void storeAlerts(String userName, List<String> alerts) throws ClientException;
+    public void storeAlerts(String userName, List<String> alerts)
+            throws ClientException;
 
-	public void resetAlerts(String userName) throws ClientException;
+    public void resetAlerts(String userName) throws ClientException;
 
-	public List<String> getPendingAlerts(String userName) throws ClientException;
+    public List<String> getPendingAlerts(String userName)
+            throws ClientException;
 
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-deferredalert-core/src/main/java/org/nuxeo/ecm/deferredalert/core/DeferredAlertManagementServiceImpl.java
--- a/nuxeo-platform-deferredalert-core/src/main/java/org/nuxeo/ecm/deferredalert/core/DeferredAlertManagementServiceImpl.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-deferredalert-core/src/main/java/org/nuxeo/ecm/deferredalert/core/DeferredAlertManagementServiceImpl.java	Fri Mar 26 09:05:32 2010 +0100
@@ -48,103 +48,113 @@
  * 
  */
 
-public class DeferredAlertManagementServiceImpl implements DeferredAlertManagementService {
+public class DeferredAlertManagementServiceImpl implements
+        DeferredAlertManagementService {
 
-	private CoreSession adminSession = null;
+    private CoreSession adminSession = null;
 
-	private LoginContext loginContext = null;
+    private LoginContext loginContext = null;
 
-	private static final long serialVersionUID = -2643607647191744171L;
+    private static final long serialVersionUID = -2643607647191744171L;
 
-	private static final Log log = LogFactory.getLog(DeferredAlertManagementServiceImpl.class);
+    private static final Log log = LogFactory.getLog(DeferredAlertManagementServiceImpl.class);
 
-	private CoreSession getAdminSession() throws ClientException {
+    private CoreSession getAdminSession() throws ClientException {
 
-		try {
-			if (adminSession == null) {
+        try {
+            if (adminSession == null) {
 
-				loginContext = Framework.login();
+                loginContext = Framework.login();
 
-				if (loginContext == null) {
-					log.warn("loginContext is null, probably in a test environment, continuing and hope for he best");
-				}
+                if (loginContext == null) {
+                    log.warn("loginContext is null, probably in a test environment, continuing and hope for he best");
+                }
 
-				RepositoryManager mgr = Framework.getService(RepositoryManager.class);
-				Repository repository = mgr.getDefaultRepository();
-				adminSession = repository.open();
-			}
-		} catch (Exception e) {
-			throw new ClientException("Unable to open core session", e);
-		}
+                RepositoryManager mgr = Framework.getService(RepositoryManager.class);
+                Repository repository = mgr.getDefaultRepository();
+                adminSession = repository.open();
+            }
+        } catch (Exception e) {
+            throw new ClientException("Unable to open core session", e);
+        }
 
-		return adminSession;
+        return adminSession;
 
-	}
+    }
 
-	public DeferredAlertManagementServiceImpl() {
-		log.trace("Instanciating DeferredAlertManagementServiceImpl");
-	}
+    public DeferredAlertManagementServiceImpl() {
+        log.trace("Instanciating DeferredAlertManagementServiceImpl");
+    }
 
-	public List<String> getPendingAlerts(String userName) throws ClientException {
+    public List<String> getPendingAlerts(String userName)
+            throws ClientException {
 
-		DocumentModelList docs = getPendingAlertDocs(userName);
+        DocumentModelList docs = getPendingAlertDocs(userName);
 
-		List<String> result = new ArrayList<String>();
-		
-		for (DocumentModel doc : docs) {
-			result.add(new DeferredAlertWrapper(doc).getAlertText());
-		}
-		
-		return result;
-	}
+        List<String> result = new ArrayList<String>();
 
-	private DocumentModelList getPendingAlertDocs(String userName) throws ClientException {
-		DocumentModelList docs = getAdminSession().getChildren(getUserWorkspace(getAdminSession(), userName).getRef(), DeferredAlertType.DOCTYPE);
-		return docs;
-	}
+        for (DocumentModel doc : docs) {
+            result.add(new DeferredAlertWrapper(doc).getAlertText());
+        }
 
-	public void resetAlerts(String userName) throws ClientException {
+        return result;
+    }
 
-		DocumentModelList pending = getPendingAlertDocs(userName);
-		
-		for (DocumentModel doc : pending) {
-			DeferredAlertWrapper.delete(getAdminSession(), new DeferredAlertWrapper(doc));
-		}
-		
-		getAdminSession().save();
-		
-	}
+    private DocumentModelList getPendingAlertDocs(String userName)
+            throws ClientException {
+        DocumentModelList docs = getAdminSession().getChildren(
+                getUserWorkspace(getAdminSession(), userName).getRef(),
+                DeferredAlertType.DOCTYPE);
+        return docs;
+    }
 
-	public void storeAlerts(String userName, List<String> alerts) throws ClientException {
+    public void resetAlerts(String userName) throws ClientException {
 
-		DocumentModel uws = getUserWorkspace(getAdminSession(), userName);
-		
-		for (String alert : alerts) {
-			DeferredAlertWrapper.create(getAdminSession(), uws.getPathAsString(), userName, alert);
-		}
-		
-		getAdminSession().save();
+        DocumentModelList pending = getPendingAlertDocs(userName);
 
-	}
+        for (DocumentModel doc : pending) {
+            DeferredAlertWrapper.delete(getAdminSession(),
+                    new DeferredAlertWrapper(doc));
+        }
 
-	protected DocumentModel getUserWorkspace(CoreSession session, String userName) throws ClientException {
+        getAdminSession().save();
 
-		try {
+    }
 
-			UserWorkspaceService uws = Framework.getService(UserWorkspaceService.class);
+    public void storeAlerts(String userName, List<String> alerts)
+            throws ClientException {
 
-			DocumentModel userWorkspace = uws.getCurrentUserPersonalWorkspace(userName, getAdminSession().getRootDocument());
+        DocumentModel uws = getUserWorkspace(getAdminSession(), userName);
 
-			getAdminSession().save();
+        for (String alert : alerts) {
+            DeferredAlertWrapper.create(getAdminSession(),
+                    uws.getPathAsString(), userName, alert);
+        }
 
-			return userWorkspace;
+        getAdminSession().save();
 
-		} catch (ClientException e) {
-			throw e;
-		} catch (Exception e) {
-			throw new ClientException(e);
-		}
+    }
 
-	}
+    protected DocumentModel getUserWorkspace(CoreSession session,
+            String userName) throws ClientException {
+
+        try {
+
+            UserWorkspaceService uws = Framework.getService(UserWorkspaceService.class);
+
+            DocumentModel userWorkspace = uws.getCurrentUserPersonalWorkspace(
+                    userName, getAdminSession().getRootDocument());
+
+            getAdminSession().save();
+
+            return userWorkspace;
+
+        } catch (ClientException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new ClientException(e);
+        }
+
+    }
 
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-deferredalert-core/src/main/java/org/nuxeo/ecm/deferredalert/core/DeferredAlertManagementServiceImplComponent.java
--- a/nuxeo-platform-deferredalert-core/src/main/java/org/nuxeo/ecm/deferredalert/core/DeferredAlertManagementServiceImplComponent.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-deferredalert-core/src/main/java/org/nuxeo/ecm/deferredalert/core/DeferredAlertManagementServiceImplComponent.java	Fri Mar 26 09:05:32 2010 +0100
@@ -39,97 +39,108 @@
  * @author <a href="mailto:christophe.capon@vilogia.fr">Christophe Capon</a>
  */
 
-public class DeferredAlertManagementServiceImplComponent extends DefaultComponent {
+public class DeferredAlertManagementServiceImplComponent extends
+        DefaultComponent {
 
-	public static final String NAME = "org.nuxeo.ecm.deferredalert.DeferredAlertManagementServiceImplComponent";
+    public static final String NAME = "org.nuxeo.ecm.deferredalert.DeferredAlertManagementServiceImplComponent";
 
-	private static final Log log = LogFactory.getLog(DeferredAlertManagementService.class);
+    private static final Log log = LogFactory.getLog(DeferredAlertManagementService.class);
 
-	private static DeferredAlertManagementDescriptor descriptor;
+    private static DeferredAlertManagementDescriptor descriptor;
 
-	private static DeferredAlertManagementService deferredAlertManagementService;
+    private static DeferredAlertManagementService deferredAlertManagementService;
 
-	@Override
-	public void activate(ComponentContext context) {
-		log.info("DeferredAlertManagementService activated");
-	}
+    @Override
+    public void activate(ComponentContext context) {
+        log.info("DeferredAlertManagementService activated");
+    }
 
-	@Override
-	public void deactivate(ComponentContext context) {
-		log.info("DeferredAlertManagementService deactivated");
-	}
+    @Override
+    public void deactivate(ComponentContext context) {
+        log.info("DeferredAlertManagementService deactivated");
+    }
 
-	@Override
-	public <T> T getAdapter(Class<T> adapter) {
-		if (adapter == DeferredAlertManagementService.class) {
-			try {
-				return adapter.cast(getDeferredAlertManagementService());
-			} catch (Exception e) {
-				log.error("error fetching DeferredAlertManagementService: ", e);
-			}
-		}
-		return null;
-	}
+    @Override
+    public <T> T getAdapter(Class<T> adapter) {
+        if (adapter == DeferredAlertManagementService.class) {
+            try {
+                return adapter.cast(getDeferredAlertManagementService());
+            } catch (Exception e) {
+                log.error("error fetching DeferredAlertManagementService: ", e);
+            }
+        }
+        return null;
+    }
 
-	private DeferredAlertManagementService getDeferredAlertManagementService() throws ClientException {
+    private DeferredAlertManagementService getDeferredAlertManagementService()
+            throws ClientException {
 
-		if (deferredAlertManagementService == null) {
+        if (deferredAlertManagementService == null) {
 
-			Class<?> klass = descriptor.getDeferredAlertManagementClass();
+            Class<?> klass = descriptor.getDeferredAlertManagementClass();
 
-			if (klass == null) {
-				throw new ClientException("No class specified for the DeferredAlertManagement");
-			}
-			try {
-				deferredAlertManagementService = (DeferredAlertManagementService) klass.newInstance();
-			} catch (InstantiationException e) {
-				throw new ClientException("Failed to instantiate class " + klass, e);
-			} catch (IllegalAccessException e) {
-				throw new ClientException("Failed to instantiate class " + klass, e);
-			}
-		}
-		return deferredAlertManagementService;
-	}
+            if (klass == null) {
+                throw new ClientException(
+                        "No class specified for the DeferredAlertManagement");
+            }
+            try {
+                deferredAlertManagementService = (DeferredAlertManagementService) klass.newInstance();
+            } catch (InstantiationException e) {
+                throw new ClientException("Failed to instantiate class "
+                        + klass, e);
+            } catch (IllegalAccessException e) {
+                throw new ClientException("Failed to instantiate class "
+                        + klass, e);
+            }
+        }
+        return deferredAlertManagementService;
+    }
 
-	@Override
-	public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
-			throws ClientException {
+    @Override
+    public void registerContribution(Object contribution,
+            String extensionPoint, ComponentInstance contributor)
+            throws ClientException {
 
-		if (DeferredAlertManagementConstants.BASE_EXTENSION_POINT.equals(extensionPoint)) {
-			descriptor = (DeferredAlertManagementDescriptor) contribution;
-		} else {
-			log.error(String.format("Unknown %s extension point for DeferredAlertManagementService", extensionPoint));
-		}
+        if (DeferredAlertManagementConstants.BASE_EXTENSION_POINT.equals(extensionPoint)) {
+            descriptor = (DeferredAlertManagementDescriptor) contribution;
+        } else {
+            log.error(String.format(
+                    "Unknown %s extension point for DeferredAlertManagementService",
+                    extensionPoint));
+        }
 
-	}
+    }
 
-	@Override
-	public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
-			throws ClientException {
-		if (DeferredAlertManagementConstants.BASE_EXTENSION_POINT.equals(extensionPoint)) {	
-						
-			releaseDeferredAlertManagementService();
+    @Override
+    public void unregisterContribution(Object contribution,
+            String extensionPoint, ComponentInstance contributor)
+            throws ClientException {
+        if (DeferredAlertManagementConstants.BASE_EXTENSION_POINT.equals(extensionPoint)) {
 
-			descriptor = null;
-			
-		} else {
-			log.error(String.format("Unknown %s extension point for AlertManagementService", extensionPoint));
-		}
+            releaseDeferredAlertManagementService();
 
-	}
+            descriptor = null;
 
-	private void releaseDeferredAlertManagementService() throws ClientException {
-	
-		deferredAlertManagementService = null;
-			
-	}
+        } else {
+            log.error(String.format(
+                    "Unknown %s extension point for AlertManagementService",
+                    extensionPoint));
+        }
 
-	public static void reset() {
-		deferredAlertManagementService = null;
-	}
+    }
 
-	public static Class<? extends DeferredAlertManagementService> getDeferredAlertManagementClass() {
-		return descriptor.getDeferredAlertManagementClass();
-	}
+    private void releaseDeferredAlertManagementService() throws ClientException {
+
+        deferredAlertManagementService = null;
+
+    }
+
+    public static void reset() {
+        deferredAlertManagementService = null;
+    }
+
+    public static Class<? extends DeferredAlertManagementService> getDeferredAlertManagementClass() {
+        return descriptor.getDeferredAlertManagementClass();
+    }
 
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-deferredalert-types/src/main/java/com/nuxeo/ecm/deferredalert/types/DeferredAlertType.java
--- a/nuxeo-platform-deferredalert-types/src/main/java/com/nuxeo/ecm/deferredalert/types/DeferredAlertType.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-deferredalert-types/src/main/java/com/nuxeo/ecm/deferredalert/types/DeferredAlertType.java	Fri Mar 26 09:05:32 2010 +0100
@@ -3,10 +3,13 @@
 public interface DeferredAlertType {
 
     public static final String SCHEMA = "deferredalert";
+
     public static final String DOCTYPE = "DeferredAlert";
+
     public static final String SCHEMA_PREFIX = "deferred";
 
     public static final String PROP_USERNAME = "userName";
+
     public static final String PROP_ALERT_TEXT = "alertText";
 
 }
\ No newline at end of file
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-deferredalert-types/src/main/java/com/nuxeo/ecm/deferredalert/types/DeferredAlertWrapper.java
--- a/nuxeo-platform-deferredalert-types/src/main/java/com/nuxeo/ecm/deferredalert/types/DeferredAlertWrapper.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-deferredalert-types/src/main/java/com/nuxeo/ecm/deferredalert/types/DeferredAlertWrapper.java	Fri Mar 26 09:05:32 2010 +0100
@@ -10,69 +10,79 @@
 import org.nuxeo.ecm.core.api.DocumentRef;
 import org.nuxeo.ecm.core.api.impl.DocumentModelImpl;
 
-public class DeferredAlertWrapper  {
+public class DeferredAlertWrapper {
 
-    private static SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy hh:mm");
+    private static SimpleDateFormat df = new SimpleDateFormat(
+            "dd/MM/yyyy hh:mm");
 
-	public DocumentModel alertDoc;
+    public DocumentModel alertDoc;
 
-	
-	public static DeferredAlertWrapper create(CoreSession session, String path) throws ClientException {
-		return create(session, path, null);
-	}
-	
-	public static DeferredAlertWrapper create(CoreSession session, String path, String username) throws ClientException {
-		return create(session, path, username, null);
-	}
-	
-	public static DeferredAlertWrapper create(CoreSession session, String path, String username, String alert) throws ClientException {
-		DocumentModel doc = session.createDocumentModel(path, getRandomId(), DeferredAlertType.DOCTYPE);
-		DeferredAlertWrapper def = new DeferredAlertWrapper(doc);
-		def.setUserName(username);
-		def.setAlertText(alert);
-		session.createDocument(doc);
-		return def;
-	}
-	
-	public static void delete(CoreSession session, DeferredAlertWrapper doc) throws ClientException {
-		session.removeDocument(doc.getDocument().getRef());
-	}
-	
-	private static String getRandomId() {
-		return new SimpleDateFormat("yyyyMMddhhmmssSSS").format(new Date());
-	}
-	
-	public DeferredAlertWrapper(DocumentModel doc) throws ClientException {
-		alertDoc = doc;
-	}
-	
-	public void setUserName(String userName) throws ClientException {
-		alertDoc.setProperty(DeferredAlertType.SCHEMA, DeferredAlertType.PROP_USERNAME, userName);
-	}
+    public static DeferredAlertWrapper create(CoreSession session, String path)
+            throws ClientException {
+        return create(session, path, null);
+    }
 
-	public String getUserName() throws ClientException {
-		return (String) alertDoc.getProperty(DeferredAlertType.SCHEMA, DeferredAlertType.PROP_USERNAME);
-	}
+    public static DeferredAlertWrapper create(CoreSession session, String path,
+            String username) throws ClientException {
+        return create(session, path, username, null);
+    }
 
-	public void setAlertText(String alertText) throws ClientException {
-		alertDoc.setProperty(DeferredAlertType.SCHEMA, DeferredAlertType.PROP_ALERT_TEXT, alertText);
-	}
+    public static DeferredAlertWrapper create(CoreSession session, String path,
+            String username, String alert) throws ClientException {
+        DocumentModel doc = session.createDocumentModel(path, getRandomId(),
+                DeferredAlertType.DOCTYPE);
+        DeferredAlertWrapper def = new DeferredAlertWrapper(doc);
+        def.setUserName(username);
+        def.setAlertText(alert);
+        session.createDocument(doc);
+        return def;
+    }
 
-	public String getAlertText() throws ClientException {
-		return (String) alertDoc.getProperty(DeferredAlertType.SCHEMA, DeferredAlertType.PROP_ALERT_TEXT);
-	}
+    public static void delete(CoreSession session, DeferredAlertWrapper doc)
+            throws ClientException {
+        session.removeDocument(doc.getDocument().getRef());
+    }
 
-	public DocumentModel getDocument() throws ClientException {
-		return alertDoc;
-	}
-	
-	public String getCreationDateAsString() throws ClientException {
-		return df.format(getCreationDate());
-	}
-	
-	public Date getCreationDate() throws ClientException {
-		GregorianCalendar cal = (GregorianCalendar)alertDoc.getProperty("dublincore", "created");
-		return cal.getTime();
-	}
+    private static String getRandomId() {
+        return new SimpleDateFormat("yyyyMMddhhmmssSSS").format(new Date());
+    }
+
+    public DeferredAlertWrapper(DocumentModel doc) throws ClientException {
+        alertDoc = doc;
+    }
+
+    public void setUserName(String userName) throws ClientException {
+        alertDoc.setProperty(DeferredAlertType.SCHEMA,
+                DeferredAlertType.PROP_USERNAME, userName);
+    }
+
+    public String getUserName() throws ClientException {
+        return (String) alertDoc.getProperty(DeferredAlertType.SCHEMA,
+                DeferredAlertType.PROP_USERNAME);
+    }
+
+    public void setAlertText(String alertText) throws ClientException {
+        alertDoc.setProperty(DeferredAlertType.SCHEMA,
+                DeferredAlertType.PROP_ALERT_TEXT, alertText);
+    }
+
+    public String getAlertText() throws ClientException {
+        return (String) alertDoc.getProperty(DeferredAlertType.SCHEMA,
+                DeferredAlertType.PROP_ALERT_TEXT);
+    }
+
+    public DocumentModel getDocument() throws ClientException {
+        return alertDoc;
+    }
+
+    public String getCreationDateAsString() throws ClientException {
+        return df.format(getCreationDate());
+    }
+
+    public Date getCreationDate() throws ClientException {
+        GregorianCalendar cal = (GregorianCalendar) alertDoc.getProperty(
+                "dublincore", "created");
+        return cal.getTime();
+    }
 
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-deferredalert-types/src/test/java/com/nuxeo/ecm/deferredalert/types/RepositoryOSGITestCase.java
--- a/nuxeo-platform-deferredalert-types/src/test/java/com/nuxeo/ecm/deferredalert/types/RepositoryOSGITestCase.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-deferredalert-types/src/test/java/com/nuxeo/ecm/deferredalert/types/RepositoryOSGITestCase.java	Fri Mar 26 09:05:32 2010 +0100
@@ -50,156 +50,157 @@
     public static final String REPOSITORY_NAME = "demo";
 
     public static final String DOMAIN_NAME = "demo-domain";
-    
-    
+
     protected Repository repository;
 
     protected CoreSession coreSession;
 
     protected DocumentModel rootWorkspace = null;
-    
+
     protected DocumentModel domain = null;
 
     protected RepositoryOSGITestCase() {
     }
 
     protected RepositoryOSGITestCase(String name) {
-	super(name);
+        super(name);
     }
 
     protected void undeployBundle(String name) throws BundleException {
-	osgi.getRegistry().getBundle(name).uninstall();
+        osgi.getRegistry().getBundle(name).uninstall();
     }
-    
-    
+
     @Override
     public void setUp() throws Exception {
-	super.setUp();
-	
-	deployBundle("org.nuxeo.ecm.core.schema");
-	deployBundle("org.nuxeo.ecm.core.api");
-	deployBundle("org.nuxeo.ecm.core.event");
-	deployBundle("org.nuxeo.ecm.core");
-	deployBundle("org.nuxeo.ecm.core.jcr");
-	
+        super.setUp();
+
+        deployBundle("org.nuxeo.ecm.core.schema");
+        deployBundle("org.nuxeo.ecm.core.api");
+        deployBundle("org.nuxeo.ecm.core.event");
+        deployBundle("org.nuxeo.ecm.core");
+        deployBundle("org.nuxeo.ecm.core.jcr");
+
     }
 
     @Override
     public void tearDown() throws Exception {
-	
-	Framework.getLocalService(EventService.class).waitForAsyncCompletion();
-	releaseCoreSession();
-	releaseRepository();
-	
-	deployBundle("org.nuxeo.ecm.core.jcr");
-	deployBundle("org.nuxeo.ecm.core");
-	deployBundle("org.nuxeo.ecm.core.event");
-	deployBundle("org.nuxeo.ecm.core.api");
-	deployBundle("org.nuxeo.ecm.core.schema");
 
-	super.tearDown();
+        Framework.getLocalService(EventService.class).waitForAsyncCompletion();
+        releaseCoreSession();
+        releaseRepository();
+
+        deployBundle("org.nuxeo.ecm.core.jcr");
+        deployBundle("org.nuxeo.ecm.core");
+        deployBundle("org.nuxeo.ecm.core.event");
+        deployBundle("org.nuxeo.ecm.core.api");
+        deployBundle("org.nuxeo.ecm.core.schema");
+
+        super.tearDown();
     }
 
     protected void openRepositoryAsUser(String userName) throws Exception {
-	if (repository == null) {
-	    // the repository should be deployed the last
-	    // after any other bundle that is doctypes
-	    // this is nuxeo-core-jcr-connector-test
-	    repositoryDeploy();
-	    repository = NXCore.getRepositoryService().getRepositoryManager().getRepository(REPOSITORY_NAME);
-	}
-	openCoreSession(userName);
+        if (repository == null) {
+            // the repository should be deployed the last
+            // after any other bundle that is doctypes
+            // this is nuxeo-core-jcr-connector-test
+            repositoryDeploy();
+            repository = NXCore.getRepositoryService().getRepositoryManager().getRepository(
+                    REPOSITORY_NAME);
+        }
+        openCoreSession(userName);
     }
 
     protected void closeRepository() throws Exception {
-	releaseCoreSession();
-	releaseRepository();
-	repositoryUndeploy();
+        releaseCoreSession();
+        releaseRepository();
+        repositoryUndeploy();
     }
-    
+
     protected void repositoryDeploy() throws Exception {
-	if (!isRepositoryBundleDeployed) {
-	    deployBundle("org.nuxeo.ecm.core.jcr-connector");
-	    isRepositoryBundleDeployed = true;
-	}
+        if (!isRepositoryBundleDeployed) {
+            deployBundle("org.nuxeo.ecm.core.jcr-connector");
+            isRepositoryBundleDeployed = true;
+        }
     }
 
     protected void repositoryUndeploy() throws Exception {
-	if (isRepositoryBundleDeployed) {
-	    undeployBundle("org.nuxeo.ecm.core.jcr-connector");
-	    isRepositoryBundleDeployed = false;
-	}
+        if (isRepositoryBundleDeployed) {
+            undeployBundle("org.nuxeo.ecm.core.jcr-connector");
+            isRepositoryBundleDeployed = false;
+        }
     }
 
-
     public void openRepository() throws Exception {
-	openRepositoryAsUser("Administrator");
+        openRepositoryAsUser("Administrator");
     }
 
     public void openRepositoryWithSystemPrivileges() throws Exception {
-	openRepositoryAsUser(null);
+        openRepositoryAsUser(null);
     }
 
     public CoreSession getCoreSession() {
-	return coreSession;
+        return coreSession;
     }
 
     protected Repository getRepository() {
-	return repository;
+        return repository;
     }
 
     protected DocumentModel getRootWorkspace() throws ClientException {
-	if (rootWorkspace == null)
-	    createRootWorkspace();
-	return rootWorkspace;
+        if (rootWorkspace == null)
+            createRootWorkspace();
+        return rootWorkspace;
     }
 
     private void createRootWorkspace() throws ClientException {
-	domain = coreSession.createDocumentModel("/", RepositoryOSGITestCase.DOMAIN_NAME, "Domain");
-	domain = coreSession.createDocument(domain);
-	assertNotNull(domain);
-	rootWorkspace = coreSession.createDocumentModel(domain.getPathAsString(), RepositoryOSGITestCase.ROOT_WORKSPACE_NAME, "Workspace");
-	assertNotNull(rootWorkspace);
-	rootWorkspace = coreSession.createDocument(rootWorkspace);
-	coreSession.save();
+        domain = coreSession.createDocumentModel("/",
+                RepositoryOSGITestCase.DOMAIN_NAME, "Domain");
+        domain = coreSession.createDocument(domain);
+        assertNotNull(domain);
+        rootWorkspace = coreSession.createDocumentModel(
+                domain.getPathAsString(),
+                RepositoryOSGITestCase.ROOT_WORKSPACE_NAME, "Workspace");
+        assertNotNull(rootWorkspace);
+        rootWorkspace = coreSession.createDocument(rootWorkspace);
+        coreSession.save();
     }
 
     protected void openCoreSession(String userName) throws ClientException {
-	Map<String, Serializable> ctx = new HashMap<String, Serializable>();
-	ctx.put("username", userName);
-	coreSession = CoreInstance.getInstance().open(REPOSITORY_NAME, ctx);
-	assertNotNull(coreSession);
+        Map<String, Serializable> ctx = new HashMap<String, Serializable>();
+        ctx.put("username", userName);
+        coreSession = CoreInstance.getInstance().open(REPOSITORY_NAME, ctx);
+        assertNotNull(coreSession);
     }
 
     public void changeUser(String newUser) throws ClientException {
-	releaseCoreSession();
-	openCoreSession(newUser);
+        releaseCoreSession();
+        openCoreSession(newUser);
     }
 
     public void releaseRepository() {
-	if (repository != null) {
-	    repository.shutdown();
-	    repository = null;
-	}
+        if (repository != null) {
+            repository.shutdown();
+            repository = null;
+        }
     }
 
     public void releaseCoreSession() {
-	if (coreSession != null) {
-	    CoreInstance.getInstance().close(coreSession);
-	    coreSession = null;
-	}
+        if (coreSession != null) {
+            CoreInstance.getInstance().close(coreSession);
+            coreSession = null;
+        }
     }
 
     protected Session getSession() throws DocumentException {
-	return repository.getSession(null);
+        return repository.getSession(null);
     }
 
     protected EventServiceImpl eventService;
 
     protected void waitForEventsDispatched() {
-	if (eventService == null) {
-	    eventService = (EventServiceImpl) Framework.getLocalService(EventService.class);
-	}
-	eventService.waitForAsyncCompletion();
+        if (eventService == null) {
+            eventService = (EventServiceImpl) Framework.getLocalService(EventService.class);
+        }
+        eventService.waitForAsyncCompletion();
     }
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-deferredalert-types/src/test/java/com/nuxeo/ecm/deferredalert/types/TestAlertSettings.java
--- a/nuxeo-platform-deferredalert-types/src/test/java/com/nuxeo/ecm/deferredalert/types/TestAlertSettings.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-deferredalert-types/src/test/java/com/nuxeo/ecm/deferredalert/types/TestAlertSettings.java	Fri Mar 26 09:05:32 2010 +0100
@@ -35,93 +35,101 @@
  */
 public class TestAlertSettings extends RepositoryOSGITestCase {
 
-	private static final String TEST_USERNAME1 = "testusername";
-	private static final String TEST_USERNAME2 = "testusername2";
-	private static final String TEST_ALERT_TEXT = "alerttext";
+    private static final String TEST_USERNAME1 = "testusername";
 
-	private CoreSession session;
-	private DocumentModel root;
+    private static final String TEST_USERNAME2 = "testusername2";
 
-	@Override
-	public void setUp() throws Exception {
+    private static final String TEST_ALERT_TEXT = "alerttext";
 
-		super.setUp();
+    private CoreSession session;
 
-		deployBundle("org.nuxeo.ecm.deferredalert.types");
-		
-		// Initialize the test environment
-		openRepositoryAsUser("Administrator");
-		session = getCoreSession();
-		root = getRootWorkspace();
+    private DocumentModel root;
 
-		checkDeployment();
+    @Override
+    public void setUp() throws Exception {
 
-	}
+        super.setUp();
 
-	private void checkDeployment() throws Exception {
-		
-		SchemaManager smgr = Framework.getService(SchemaManager.class);
-		assertNotNull(smgr);
-		assertNotNull(smgr.getSchema(DeferredAlertType.SCHEMA));
-		assertNotNull(smgr.getDocumentType(DeferredAlertType.DOCTYPE));
+        deployBundle("org.nuxeo.ecm.deferredalert.types");
 
-	}
+        // Initialize the test environment
+        openRepositoryAsUser("Administrator");
+        session = getCoreSession();
+        root = getRootWorkspace();
 
-	@Override
-	public void tearDown() throws Exception {
+        checkDeployment();
 
-		try {
-			Framework.getLocalService(EventService.class).waitForAsyncCompletion();
-		} catch (Exception e) {
-		}
+    }
 
-		undeployBundle("org.nuxeo.ecm.deferredalert.types");
+    private void checkDeployment() throws Exception {
 
-		closeRepository();
-		super.tearDown();
+        SchemaManager smgr = Framework.getService(SchemaManager.class);
+        assertNotNull(smgr);
+        assertNotNull(smgr.getSchema(DeferredAlertType.SCHEMA));
+        assertNotNull(smgr.getDocumentType(DeferredAlertType.DOCTYPE));
 
-	}
+    }
 
-	public void testCreateAlertDocument() throws Exception {
-		DocumentModel doc = createAlertSettingsDoc();
-		Object o = doc.getProperty(DeferredAlertType.SCHEMA, DeferredAlertType.PROP_USERNAME);
-		assertNotNull(o);
-		assertTrue(o instanceof String);
-		assertEquals(TEST_USERNAME1, (String) o);
-		session.removeDocument(new IdRef(doc.getId()));
-	}
+    @Override
+    public void tearDown() throws Exception {
 
-	public void testWrapper() throws Exception {
-		DocumentModel doc = createAlertSettingsDoc();
-		DeferredAlertWrapper w = new DeferredAlertWrapper(doc);
-		assertEquals(TEST_USERNAME1, w.getUserName());
-		assertEquals(TEST_ALERT_TEXT, w.getAlertText());
-		w.setUserName(TEST_USERNAME2);
-		session.saveDocument(doc);
-		assertEquals(TEST_USERNAME2, w.getUserName());
-		session.removeDocument(new IdRef(doc.getId()));
-	}
+        try {
+            Framework.getLocalService(EventService.class).waitForAsyncCompletion();
+        } catch (Exception e) {
+        }
 
-	private DocumentModel createAlertSettingsDoc() throws ClientException {
+        undeployBundle("org.nuxeo.ecm.deferredalert.types");
 
-		DocumentModel testDoc = session.createDocumentModel(root.getPathAsString(), "TestDeferredAlert", "DeferredAlert");
-		assertNotNull(testDoc);
+        closeRepository();
+        super.tearDown();
 
-		testDoc.setProperty(DeferredAlertType.SCHEMA, DeferredAlertType.PROP_USERNAME, TEST_USERNAME1);
-		testDoc.setProperty(DeferredAlertType.SCHEMA, DeferredAlertType.PROP_ALERT_TEXT, TEST_ALERT_TEXT);
+    }
 
-		testDoc = session.createDocument(testDoc);
-		session.saveDocument(testDoc);
-		return testDoc;
+    public void testCreateAlertDocument() throws Exception {
+        DocumentModel doc = createAlertSettingsDoc();
+        Object o = doc.getProperty(DeferredAlertType.SCHEMA,
+                DeferredAlertType.PROP_USERNAME);
+        assertNotNull(o);
+        assertTrue(o instanceof String);
+        assertEquals(TEST_USERNAME1, (String) o);
+        session.removeDocument(new IdRef(doc.getId()));
+    }
 
-	}
+    public void testWrapper() throws Exception {
+        DocumentModel doc = createAlertSettingsDoc();
+        DeferredAlertWrapper w = new DeferredAlertWrapper(doc);
+        assertEquals(TEST_USERNAME1, w.getUserName());
+        assertEquals(TEST_ALERT_TEXT, w.getAlertText());
+        w.setUserName(TEST_USERNAME2);
+        session.saveDocument(doc);
+        assertEquals(TEST_USERNAME2, w.getUserName());
+        session.removeDocument(new IdRef(doc.getId()));
+    }
 
-	public void testWrapperCreate() throws Exception {
-		DeferredAlertWrapper w = DeferredAlertWrapper.create(session, getRootWorkspace().getPathAsString(), TEST_USERNAME1, TEST_ALERT_TEXT);
-		assertEquals(TEST_USERNAME1, w.getUserName());
-		assertEquals(TEST_ALERT_TEXT, w.getAlertText());
-		DeferredAlertWrapper.delete(session, w);
-	}
+    private DocumentModel createAlertSettingsDoc() throws ClientException {
 
+        DocumentModel testDoc = session.createDocumentModel(
+                root.getPathAsString(), "TestDeferredAlert", "DeferredAlert");
+        assertNotNull(testDoc);
+
+        testDoc.setProperty(DeferredAlertType.SCHEMA,
+                DeferredAlertType.PROP_USERNAME, TEST_USERNAME1);
+        testDoc.setProperty(DeferredAlertType.SCHEMA,
+                DeferredAlertType.PROP_ALERT_TEXT, TEST_ALERT_TEXT);
+
+        testDoc = session.createDocument(testDoc);
+        session.saveDocument(testDoc);
+        return testDoc;
+
+    }
+
+    public void testWrapperCreate() throws Exception {
+        DeferredAlertWrapper w = DeferredAlertWrapper.create(session,
+                getRootWorkspace().getPathAsString(), TEST_USERNAME1,
+                TEST_ALERT_TEXT);
+        assertEquals(TEST_USERNAME1, w.getUserName());
+        assertEquals(TEST_ALERT_TEXT, w.getAlertText());
+        DeferredAlertWrapper.delete(session, w);
+    }
 
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/ec/notification/NotificationEventListener.java
--- a/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/ec/notification/NotificationEventListener.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/ec/notification/NotificationEventListener.java	Fri Mar 26 09:05:32 2010 +0100
@@ -69,10 +69,9 @@
 
     private EmailHelper emailHelper = new EmailHelper();
 
-	protected DeferredNotificationHelper deferredHelper = new DeferredNotificationHelper();
+    protected DeferredNotificationHelper deferredHelper = new DeferredNotificationHelper();
 
-	protected UserSettingsService userSettingsService;
-
+    protected UserSettingsService userSettingsService;
 
     public void handleEvent(EventBundle events) throws ClientException {
 
@@ -232,99 +231,108 @@
         String userDest = (String) eventInfo.get(NotificationConstants.DESTINATION_KEY);
         NotificationImpl notif = (NotificationImpl) eventInfo.get(NotificationConstants.NOTIFICATION_KEY);
 
-		AlertSettingsWrapper as = getAlertSettings(userDest);
+        AlertSettingsWrapper as = getAlertSettings(userDest);
 
-		String notificationPolicy = as.getNotificationPolicy();
+        String notificationPolicy = as.getNotificationPolicy();
 
-		if (AlertSettingsType.NOTIFICATION_POLICY_BOTH.equals(notificationPolicy)) {
-	        sendImmediateNotification(ctx, eventId, eventInfo, userDest, notif);
-			storeDeferredNotification(ctx, eventId, eventInfo, userDest, notif);
-		} else if (AlertSettingsType.NOTIFICATION_POLICY_SUMMARY.equals(notificationPolicy)) {
-			storeDeferredNotification(ctx, eventId, eventInfo, userDest, notif);
-		} else if (AlertSettingsType.NOTIFICATION_POLICY_IMMEDIATE.equals(notificationPolicy)) {
-	        sendImmediateNotification(ctx, eventId, eventInfo, userDest, notif);
-		} else {
-			log.warn(String.format("Unexpected value for notificationPolicy : %s", as.getNotificationPolicy()));
-	        sendImmediateNotification(ctx, eventId, eventInfo, userDest, notif);
-		}
+        if (AlertSettingsType.NOTIFICATION_POLICY_BOTH.equals(notificationPolicy)) {
+            sendImmediateNotification(ctx, eventId, eventInfo, userDest, notif);
+            storeDeferredNotification(ctx, eventId, eventInfo, userDest, notif);
+        } else if (AlertSettingsType.NOTIFICATION_POLICY_SUMMARY.equals(notificationPolicy)) {
+            storeDeferredNotification(ctx, eventId, eventInfo, userDest, notif);
+        } else if (AlertSettingsType.NOTIFICATION_POLICY_IMMEDIATE.equals(notificationPolicy)) {
+            sendImmediateNotification(ctx, eventId, eventInfo, userDest, notif);
+        } else {
+            log.warn(String.format(
+                    "Unexpected value for notificationPolicy : %s",
+                    as.getNotificationPolicy()));
+            sendImmediateNotification(ctx, eventId, eventInfo, userDest, notif);
+        }
 
-
-        
     }
 
-	private void storeDeferredNotification(DocumentEventContext ctx, String eventId, Map<String, Serializable> eventInfo,
-			String userPrincipal, NotificationImpl notif) throws ClientException {
-		
+    private void storeDeferredNotification(DocumentEventContext ctx,
+            String eventId, Map<String, Serializable> eventInfo,
+            String userPrincipal, NotificationImpl notif)
+            throws ClientException {
+
         Map<String, Object> infoMap = new HashMap<String, Object>();
 
-		NuxeoPrincipal recepient = NotificationServiceHelper.getUsersService().getPrincipal(userPrincipal);
-		// XXX hack, principals have only one model
-		DataModel model = recepient.getModel().getDataModels().values().iterator().next();
-		String email = (String) model.getData("email");
-		String mailTemplate = "d_" + notif.getTemplate();
+        NuxeoPrincipal recepient = NotificationServiceHelper.getUsersService().getPrincipal(
+                userPrincipal);
+        // XXX hack, principals have only one model
+        DataModel model = recepient.getModel().getDataModels().values().iterator().next();
+        String email = (String) model.getData("email");
+        String mailTemplate = "d_" + notif.getTemplate();
 
-		infoMap.put("mail.to", email);
+        infoMap.put("mail.to", email);
 
-		String authorUsername = (String) infoMap.get("author");
+        String authorUsername = (String) infoMap.get("author");
 
-		if (authorUsername != null) {
-			NuxeoPrincipal author = NotificationServiceHelper.getUsersService().getPrincipal(authorUsername);
-			infoMap.put("principalAuthor", author);
-		}
+        if (authorUsername != null) {
+            NuxeoPrincipal author = NotificationServiceHelper.getUsersService().getPrincipal(
+                    authorUsername);
+            infoMap.put("principalAuthor", author);
+        }
 
-		// mail.put("doc", docMessage); - should be already there
+        // mail.put("doc", docMessage); - should be already there
 
-		String subject = notif.getSubject() == null ? "Notification" : notif.getSubject();
-		if (notif.getSubjectTemplate() != null) {
-			subject = notif.getSubjectTemplate();
-		}
+        String subject = notif.getSubject() == null ? "Notification"
+                : notif.getSubject();
+        if (notif.getSubjectTemplate() != null) {
+            subject = notif.getSubjectTemplate();
+        }
 
-		subject = NotificationServiceHelper.getNotificationService().getEMailSubjectPrefix() + subject;
+        subject = NotificationServiceHelper.getNotificationService().getEMailSubjectPrefix()
+                + subject;
 
-		infoMap.put("subject", subject);
-		infoMap.put("template", mailTemplate);
-		
+        infoMap.put("subject", subject);
+        infoMap.put("template", mailTemplate);
+
         // Transferring all data from event to email
         for (String key : eventInfo.keySet()) {
             infoMap.put(key, eventInfo.get(key));
             log.debug("Mail prop: " + key);
         }
 
-		try {
-			deferredHelper.storeNotification(infoMap, userPrincipal);
-		} catch (Exception e) {
-			throw new ClientException("Failed to send notification email ", e);
-		}
-	}
+        try {
+            deferredHelper.storeNotification(infoMap, userPrincipal);
+        } catch (Exception e) {
+            throw new ClientException("Failed to send notification email ", e);
+        }
+    }
 
-	private AlertSettingsWrapper getAlertSettings(String userPrincipal) throws ClientException {
+    private AlertSettingsWrapper getAlertSettings(String userPrincipal)
+            throws ClientException {
 
-		DocumentModelList alertDocList = (DocumentModelList) getuserSettingsService().getUserSettings(userPrincipal, AlertSettingsType.DOCTYPE);
+        DocumentModelList alertDocList = (DocumentModelList) getuserSettingsService().getUserSettings(
+                userPrincipal, AlertSettingsType.DOCTYPE);
 
-		DocumentModel alertDoc = alertDocList.get(0);
-		
-		return new AlertSettingsWrapper(alertDoc);
+        DocumentModel alertDoc = alertDocList.get(0);
 
+        return new AlertSettingsWrapper(alertDoc);
 
-	}
+    }
 
-	private UserSettingsService getuserSettingsService() throws ClientException {
+    private UserSettingsService getuserSettingsService() throws ClientException {
 
-		try {
-			if (userSettingsService == null) {
-				userSettingsService = Framework.getService(UserSettingsService.class);
-			}
+        try {
+            if (userSettingsService == null) {
+                userSettingsService = Framework.getService(UserSettingsService.class);
+            }
 
-			return userSettingsService;
-		} catch (Exception e) {
-			throw new ClientException("Unable to get UserSettingsService", e);
-		}
+            return userSettingsService;
+        } catch (Exception e) {
+            throw new ClientException("Unable to get UserSettingsService", e);
+        }
 
-	}
+    }
 
-	private void sendImmediateNotification(DocumentEventContext ctx, String eventId, Map<String, Serializable> eventInfo,
-			String userDest, NotificationImpl notif) throws ClientException, PropertyException {
-		// send email
+    private void sendImmediateNotification(DocumentEventContext ctx,
+            String eventId, Map<String, Serializable> eventInfo,
+            String userDest, NotificationImpl notif) throws ClientException,
+            PropertyException {
+        // send email
         NuxeoPrincipal recepient = NotificationServiceHelper.getUsersService().getPrincipal(
                 userDest);
         if (recepient == null) {
@@ -383,7 +391,7 @@
         } catch (Exception e) {
             throw new ClientException("Failed to send notification email ", e);
         }
-	}
+    }
 
     /**
      * Adds the concerned users to the list of targeted users for these
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/ec/notification/defer/DeferredNotificationHelper.java
--- a/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/ec/notification/defer/DeferredNotificationHelper.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/ec/notification/defer/DeferredNotificationHelper.java	Fri Mar 26 09:05:32 2010 +0100
@@ -74,59 +74,61 @@
  */
 public class DeferredNotificationHelper {
 
-	private static DeferredAlertManagementService service = null;
+    private static DeferredAlertManagementService service = null;
 
-	private static final Log log = LogFactory.getLog(DeferredNotificationHelper.class);
+    private static final Log log = LogFactory.getLog(DeferredNotificationHelper.class);
 
-	// used for loading templates from strings
-	private final Configuration stringCfg = new Configuration();
+    // used for loading templates from strings
+    private final Configuration stringCfg = new Configuration();
 
-	/* Only static methods here chaps */
-	public DeferredNotificationHelper() {
-	}
+    /* Only static methods here chaps */
+    public DeferredNotificationHelper() {
+    }
 
-	private DeferredAlertManagementService getService() throws Exception {
+    private DeferredAlertManagementService getService() throws Exception {
 
-		if (service == null) service = Framework.getService(DeferredAlertManagementService.class);
-		
-		return service;
-	}
+        if (service == null)
+            service = Framework.getService(DeferredAlertManagementService.class);
 
-	/**
-	 * Static Method: sendmail(Map mail).
-	 * 
-	 * @param mail
-	 *            A map of the settings
-	 * @param userPrincipal 
-	 */
-	public void storeNotification(Map<String, Object> mail, String userPrincipal) throws Exception {
+        return service;
+    }
 
-		RenderingService rs = Framework.getService(RenderingService.class);
+    /**
+     * Static Method: sendmail(Map mail).
+     * 
+     * @param mail A map of the settings
+     * @param userPrincipal
+     */
+    public void storeNotification(Map<String, Object> mail, String userPrincipal)
+            throws Exception {
 
-		DocumentRenderingContext context = new DocumentRenderingContext();
-		context.remove("doc");
-		context.putAll(mail);
-		context.setDocument((DocumentModel) mail.get("document"));
+        RenderingService rs = Framework.getService(RenderingService.class);
 
-		rs.registerEngine(new DeferredNotificationsRenderingEngine((String) mail.get(NotificationConstants.TEMPLATE_KEY)));
+        DocumentRenderingContext context = new DocumentRenderingContext();
+        context.remove("doc");
+        context.putAll(mail);
+        context.setDocument((DocumentModel) mail.get("document"));
 
-		LoginContext lc = Framework.login();
+        rs.registerEngine(new DeferredNotificationsRenderingEngine(
+                (String) mail.get(NotificationConstants.TEMPLATE_KEY)));
 
-		Collection<RenderingResult> results = rs.process(context);
-		String bodyMail = "<HTML><P>No parsing Succeded !!!</P></HTML>";
+        LoginContext lc = Framework.login();
 
-		for (RenderingResult result : results) {
-			bodyMail = (String) result.getOutcome();
-		}
+        Collection<RenderingResult> results = rs.process(context);
+        String bodyMail = "<HTML><P>No parsing Succeded !!!</P></HTML>";
 
-		List<String> alerts = new ArrayList<String>();
-		alerts.add(bodyMail);
-		
-		getService().storeAlerts(userPrincipal, alerts);
-		
-		lc.logout();
+        for (RenderingResult result : results) {
+            bodyMail = (String) result.getOutcome();
+        }
 
-		rs.unregisterEngine("ftl");
+        List<String> alerts = new ArrayList<String>();
+        alerts.add(bodyMail);
 
-	}
+        getService().storeAlerts(userPrincipal, alerts);
+
+        lc.logout();
+
+        rs.unregisterEngine("ftl");
+
+    }
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/ec/notification/defer/DeferredNotificationsRenderingEngine.java
--- a/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/ec/notification/defer/DeferredNotificationsRenderingEngine.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/ec/notification/defer/DeferredNotificationsRenderingEngine.java	Fri Mar 26 09:05:32 2010 +0100
@@ -32,18 +32,19 @@
 /**
  * @author <a href="mailto:npaslaru@nuxeo.com">Narcis Paslaru</a>
  */
-public class DeferredNotificationsRenderingEngine extends DocumentRenderingEngine {
+public class DeferredNotificationsRenderingEngine extends
+        DocumentRenderingEngine {
 
     private final String template;
 
-    public DeferredNotificationsRenderingEngine(String template){
+    public DeferredNotificationsRenderingEngine(String template) {
         this.template = template;
     }
 
     @Override
     public Configuration createConfiguration() throws Exception {
         Configuration cfg = super.createConfiguration();
-        cfg.setSharedVariable("htmlEscape", new HtmlEscapeMethod() );
+        cfg.setSharedVariable("htmlEscape", new HtmlEscapeMethod());
         return cfg;
     }
 
@@ -57,7 +58,8 @@
         return template;
     }
 
-    class NotifsRenderingJob extends DefaultRenderingResult implements FreemarkerRenderingJob {
+    class NotifsRenderingJob extends DefaultRenderingResult implements
+            FreemarkerRenderingJob {
 
         private static final long serialVersionUID = -7133062841713259967L;
 
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/ec/notification/email/EmailHelper.java
--- a/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/ec/notification/email/EmailHelper.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/ec/notification/email/EmailHelper.java	Fri Mar 26 09:05:32 2010 +0100
@@ -53,7 +53,7 @@
  * <p>
  * An email helper:
  * <p>
- *
+ * 
  * <pre>
  * Hashtable mail = new Hashtable();
  * mail.put(&quot;from&quot;, &quot;dion@almaer.com&quot;);
@@ -63,9 +63,9 @@
  * &lt;p&gt;
  * EmailHelper.sendmail(mail);
  * </pre>
- *
+ * 
  * Currently only supports one email in to address
- *
+ * 
  * @author <a href="mailto:npaslaru@nuxeo.com">Narcis Paslaru</a>
  * @author <a href="mailto:tmartins@nuxeo.com">Thierry Martins</a>
  */
@@ -84,13 +84,13 @@
 
     /**
      * Static Method: sendmail(Map mail).
-     *
+     * 
      * @param mail A map of the settings
      */
     public void sendmail(Map<String, Object> mail) throws Exception {
 
         Session session = getSession();
-        if (javaMailNotAvailable || session==null) {
+        if (javaMailNotAvailable || session == null) {
             log.warn("Not sending email since JavaMail is not configured");
             return;
         }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/ec/notification/email/NotificationsRenderingEngine.java
--- a/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/ec/notification/email/NotificationsRenderingEngine.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/ec/notification/email/NotificationsRenderingEngine.java	Fri Mar 26 09:05:32 2010 +0100
@@ -36,14 +36,14 @@
 
     private final String template;
 
-    public NotificationsRenderingEngine(String template){
+    public NotificationsRenderingEngine(String template) {
         this.template = template;
     }
 
     @Override
     public Configuration createConfiguration() throws Exception {
         Configuration cfg = super.createConfiguration();
-        cfg.setSharedVariable("htmlEscape", new HtmlEscapeMethod() );
+        cfg.setSharedVariable("htmlEscape", new HtmlEscapeMethod());
         return cfg;
     }
 
@@ -57,7 +57,8 @@
         return null;
     }
 
-    class NotifsRenderingJob extends DefaultRenderingResult implements FreemarkerRenderingJob {
+    class NotifsRenderingJob extends DefaultRenderingResult implements
+            FreemarkerRenderingJob {
 
         private static final long serialVersionUID = -7133062841713259967L;
 
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/ec/notification/email/templates/NuxeoTemplatesLoader.java
--- a/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/ec/notification/email/templates/NuxeoTemplatesLoader.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/ec/notification/email/templates/NuxeoTemplatesLoader.java	Fri Mar 26 09:05:32 2010 +0100
@@ -29,7 +29,7 @@
 
 /**
  * @author <a href="mailto:npaslaru@nuxeo.com">Narcis Paslaru</a>
- *
+ * 
  */
 public class NuxeoTemplatesLoader extends URLTemplateLoader {
 
@@ -38,8 +38,8 @@
     @Override
     protected URL getURL(String name) {
         log.debug("Searching for template with name : " + name);
-        return NotificationServiceHelper.getNotificationService()
-                .getTemplateURL(name);
+        return NotificationServiceHelper.getNotificationService().getTemplateURL(
+                name);
     }
 
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/ec/notification/service/GeneralSettingsDescriptor.java
--- a/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/ec/notification/service/GeneralSettingsDescriptor.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/ec/notification/service/GeneralSettingsDescriptor.java	Fri Mar 26 09:05:32 2010 +0100
@@ -24,7 +24,7 @@
 
 /**
  * @author <a href="mailto:npaslaru@nuxeo.com">Narcis Paslaru</a>
- *
+ * 
  */
 @XObject("settings")
 public class GeneralSettingsDescriptor {
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/ec/notification/service/NotificationDescriptor.java
--- a/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/ec/notification/service/NotificationDescriptor.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/ec/notification/service/NotificationDescriptor.java	Fri Mar 26 09:05:32 2010 +0100
@@ -30,7 +30,7 @@
 /**
  * @author <a href="mailto:npaslaru@nuxeo.com">Narcis Paslaru</a>
  * @author <a href="mailto:tmartins@nuxeo.com">Thierry Martins</a>
- *
+ * 
  */
 @XObject("notification")
 public class NotificationDescriptor implements Notification {
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/ec/notification/service/NotificationEventDescriptor.java
--- a/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/ec/notification/service/NotificationEventDescriptor.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/ec/notification/service/NotificationEventDescriptor.java	Fri Mar 26 09:05:32 2010 +0100
@@ -24,7 +24,7 @@
 
 /**
  * @author <a href="mailto:npaslaru@nuxeo.com">Narcis Paslaru</a>
- *
+ * 
  */
 @XObject("event")
 public class NotificationEventDescriptor {
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/ec/notification/service/NotificationRegistryImpl.java
--- a/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/ec/notification/service/NotificationRegistryImpl.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/ec/notification/service/NotificationRegistryImpl.java	Fri Mar 26 09:05:32 2010 +0100
@@ -48,8 +48,9 @@
 
     public void registerNotification(Notification notif, List<String> events) {
         Notification notification = new NotificationImpl(notif.getName(),
-                notif.getTemplate(), notif.getChannel(), notif.getSubjectTemplate(), notif.getAutoSubscribed(),
-                 notif.getSubject(), notif.getAvailableIn(), notif.getLabel());
+                notif.getTemplate(), notif.getChannel(),
+                notif.getSubjectTemplate(), notif.getAutoSubscribed(),
+                notif.getSubject(), notif.getAvailableIn(), notif.getLabel());
         if (notif.getEnabled()) {
             notificationList.add(notification);
             if (events != null && !events.isEmpty()) {
@@ -64,8 +65,9 @@
 
     public void unregisterNotification(Notification notif, List<String> events) {
         NotificationImpl notification = new NotificationImpl(notif.getName(),
-                notif.getTemplate(), notif.getChannel(), notif.getSubjectTemplate(),
-                notif.getAutoSubscribed(), notif.getSubject(), notif.getAvailableIn(), notif.getLabel());
+                notif.getTemplate(), notif.getChannel(),
+                notif.getSubjectTemplate(), notif.getAutoSubscribed(),
+                notif.getSubject(), notif.getAvailableIn(), notif.getLabel());
         notificationList.remove(notification);
         if (events != null && !events.isEmpty()) {
             for (String event : events) {
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/ec/notification/service/NotificationService.java
--- a/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/ec/notification/service/NotificationService.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/ec/notification/service/NotificationService.java	Fri Mar 26 09:05:32 2010 +0100
@@ -69,488 +69,529 @@
  * @author <a href="mailto:npaslaru@nuxeo.com">Narcis Paslaru</a>
  * 
  */
-public class NotificationService extends DefaultComponent implements NotificationManager {
+public class NotificationService extends DefaultComponent implements
+        NotificationManager {
 
-	public static final ComponentName NAME = new ComponentName("org.nuxeo.ecm.platform.ec.notification.service.NotificationService");
+    public static final ComponentName NAME = new ComponentName(
+            "org.nuxeo.ecm.platform.ec.notification.service.NotificationService");
 
-	private static final Log log = LogFactory.getLog(NotificationService.class);
+    private static final Log log = LogFactory.getLog(NotificationService.class);
 
-	protected EmailHelper emailHelper = new EmailHelper();
-	
-	public static final String SUBSCRIPTION_NAME = "UserSubscription";
+    protected EmailHelper emailHelper = new EmailHelper();
 
-	// FIXME: performance issue when putting URLs in a Map.
-	protected static final Map<String, URL> TEMPLATES_MAP = new HashMap<String, URL>();
+    public static final String SUBSCRIPTION_NAME = "UserSubscription";
 
-	protected GeneralSettingsDescriptor generalSettings;
+    // FIXME: performance issue when putting URLs in a Map.
+    protected static final Map<String, URL> TEMPLATES_MAP = new HashMap<String, URL>();
 
-	protected NotificationRegistry notificationRegistry;
+    protected GeneralSettingsDescriptor generalSettings;
 
-	protected DocumentViewCodecManager docLocator;
+    protected NotificationRegistry notificationRegistry;
 
-	protected DeferredNotificationHelper deferredHelper = new DeferredNotificationHelper();
+    protected DocumentViewCodecManager docLocator;
 
-	protected UserSettingsService userSettingsService;
+    protected DeferredNotificationHelper deferredHelper = new DeferredNotificationHelper();
 
-	@Override
-	@SuppressWarnings("unchecked")
-	public <T> T getAdapter(Class<T> adapter) {
-		if (adapter.isAssignableFrom(NotificationManager.class)) {
-			return (T) this;
-		}
-		return null;
-	}
+    protected UserSettingsService userSettingsService;
 
-	@Override
-	public void activate(ComponentContext context) throws Exception {
-		notificationRegistry = new NotificationRegistryImpl();
+    @Override
+    @SuppressWarnings("unchecked")
+    public <T> T getAdapter(Class<T> adapter) {
+        if (adapter.isAssignableFrom(NotificationManager.class)) {
+            return (T) this;
+        }
+        return null;
+    }
 
-		// init default settings
-		generalSettings = new GeneralSettingsDescriptor();
-		generalSettings.serverPrefix = "http://localhost:8080/nuxeo/";
-		generalSettings.eMailSubjectPrefix = "[Nuxeo]";
-		generalSettings.mailSessionJndiName = "java:/Mail";
-	}
+    @Override
+    public void activate(ComponentContext context) throws Exception {
+        notificationRegistry = new NotificationRegistryImpl();
 
-	@Override
-	public void deactivate(ComponentContext context) throws Exception {
-		notificationRegistry.clear();
-		notificationRegistry = null;
-	}
+        // init default settings
+        generalSettings = new GeneralSettingsDescriptor();
+        generalSettings.serverPrefix = "http://localhost:8080/nuxeo/";
+        generalSettings.eMailSubjectPrefix = "[Nuxeo]";
+        generalSettings.mailSessionJndiName = "java:/Mail";
+    }
 
-	@Override
-	public void registerExtension(Extension extension) throws Exception {
-		log.info("Registering notification extention");
-		String xp = extension.getExtensionPoint();
-		if ("notifications".equals(xp)) {
-			Object[] contribs = extension.getContributions();
-			for (Object contrib : contribs) {
-				try {
-					NotificationDescriptor notifDesc = (NotificationDescriptor) contrib;
-					notificationRegistry.registerNotification(notifDesc, getNames(notifDesc.getEvents()));
-				} catch (Exception e) {
-					log.error(e);
-				}
-			}
-		} else if ("templates".equals(xp)) {
-			Object[] contribs = extension.getContributions();
-			for (Object contrib : contribs) {
-				try {
-					TemplateDescriptor templateDescriptor = (TemplateDescriptor) contrib;
-					templateDescriptor.setContext(extension.getContext());
-					registerTemplate(templateDescriptor);
-				} catch (Exception e) {
-					log.error(e);
-				}
-			}
-		} else if ("generalSettings".equals(xp)) {
-			Object[] contribs = extension.getContributions();
-			for (Object contrib : contribs) {
-				try {
-					generalSettings = (GeneralSettingsDescriptor) contrib;
-				} catch (Exception e) {
-					log.error(e);
-				}
-			}
-		}
-	}
+    @Override
+    public void deactivate(ComponentContext context) throws Exception {
+        notificationRegistry.clear();
+        notificationRegistry = null;
+    }
 
-	private static List<String> getNames(List<NotificationEventDescriptor> events) {
-		List<String> eventNames = new ArrayList<String>();
-		for (NotificationEventDescriptor descriptor : events) {
-			eventNames.add(descriptor.name);
-		}
-		return eventNames;
-	}
+    @Override
+    public void registerExtension(Extension extension) throws Exception {
+        log.info("Registering notification extention");
+        String xp = extension.getExtensionPoint();
+        if ("notifications".equals(xp)) {
+            Object[] contribs = extension.getContributions();
+            for (Object contrib : contribs) {
+                try {
+                    NotificationDescriptor notifDesc = (NotificationDescriptor) contrib;
+                    notificationRegistry.registerNotification(notifDesc,
+                            getNames(notifDesc.getEvents()));
+                } catch (Exception e) {
+                    log.error(e);
+                }
+            }
+        } else if ("templates".equals(xp)) {
+            Object[] contribs = extension.getContributions();
+            for (Object contrib : contribs) {
+                try {
+                    TemplateDescriptor templateDescriptor = (TemplateDescriptor) contrib;
+                    templateDescriptor.setContext(extension.getContext());
+                    registerTemplate(templateDescriptor);
+                } catch (Exception e) {
+                    log.error(e);
+                }
+            }
+        } else if ("generalSettings".equals(xp)) {
+            Object[] contribs = extension.getContributions();
+            for (Object contrib : contribs) {
+                try {
+                    generalSettings = (GeneralSettingsDescriptor) contrib;
+                } catch (Exception e) {
+                    log.error(e);
+                }
+            }
+        }
+    }
 
-	@Override
-	public void unregisterExtension(Extension extension) throws Exception {
-		String xp = extension.getExtensionPoint();
-		if ("notifications".equals(xp)) {
-			Object[] contribs = extension.getContributions();
-			for (Object contrib : contribs) {
-				try {
-					NotificationDescriptor notifDesc = (NotificationDescriptor) contrib;
-					notificationRegistry.unregisterNotification(notifDesc, getNames(notifDesc.getEvents()));
-				} catch (Exception e) {
-					log.error(e);
-				}
-			}
-		} else if ("templates".equals(xp)) {
-			Object[] contribs = extension.getContributions();
-			for (Object contrib : contribs) {
-				try {
-					TemplateDescriptor templateDescriptor = (TemplateDescriptor) contrib;
-					templateDescriptor.setContext(extension.getContext());
-					unregisterTemplate(templateDescriptor);
-				} catch (Exception e) {
-					log.error(e);
-				}
-			}
-		}
-	}
+    private static List<String> getNames(
+            List<NotificationEventDescriptor> events) {
+        List<String> eventNames = new ArrayList<String>();
+        for (NotificationEventDescriptor descriptor : events) {
+            eventNames.add(descriptor.name);
+        }
+        return eventNames;
+    }
 
-	public NotificationRegistry getNotificationRegistry() {
-		return notificationRegistry;
-	}
+    @Override
+    public void unregisterExtension(Extension extension) throws Exception {
+        String xp = extension.getExtensionPoint();
+        if ("notifications".equals(xp)) {
+            Object[] contribs = extension.getContributions();
+            for (Object contrib : contribs) {
+                try {
+                    NotificationDescriptor notifDesc = (NotificationDescriptor) contrib;
+                    notificationRegistry.unregisterNotification(notifDesc,
+                            getNames(notifDesc.getEvents()));
+                } catch (Exception e) {
+                    log.error(e);
+                }
+            }
+        } else if ("templates".equals(xp)) {
+            Object[] contribs = extension.getContributions();
+            for (Object contrib : contribs) {
+                try {
+                    TemplateDescriptor templateDescriptor = (TemplateDescriptor) contrib;
+                    templateDescriptor.setContext(extension.getContext());
+                    unregisterTemplate(templateDescriptor);
+                } catch (Exception e) {
+                    log.error(e);
+                }
+            }
+        }
+    }
 
-	public List<String> getSubscribers(String notification, String docId) throws ClientException {
-		PlacefulService service;
-		try {
-			service = NotificationServiceHelper.getPlacefulService();
-		} catch (Exception e) {
-			throw new ClientException(e);
-		}
-		String className = service.getAnnotationRegistry().get(SUBSCRIPTION_NAME);
-		// Class klass =
-		// Thread.currentThread().getContextClassLoader().loadClass(className);
-		String shortClassName = className.substring(className.lastIndexOf('.') + 1);
+    public NotificationRegistry getNotificationRegistry() {
+        return notificationRegistry;
+    }
 
-		Map<String, Object> paramMap = new HashMap<String, Object>();
-		paramMap.put("notification", notification);
-		paramMap.put("docId", docId);
+    public List<String> getSubscribers(String notification, String docId)
+            throws ClientException {
+        PlacefulService service;
+        try {
+            service = NotificationServiceHelper.getPlacefulService();
+        } catch (Exception e) {
+            throw new ClientException(e);
+        }
+        String className = service.getAnnotationRegistry().get(
+                SUBSCRIPTION_NAME);
+        // Class klass =
+        // Thread.currentThread().getContextClassLoader().loadClass(className);
+        String shortClassName = className.substring(className.lastIndexOf('.') + 1);
 
-		PlacefulService serviceBean = NotificationServiceHelper.getPlacefulServiceBean();
-		List<Annotation> subscriptions = new ArrayList<Annotation>();
-		subscriptions = serviceBean.getAnnotationListByParamMap(paramMap, shortClassName);
-		List<String> subscribers = new ArrayList<String>();
-		for (Object obj : subscriptions) {
-			UserSubscription subscription = (UserSubscription) obj;
-			subscribers.add(subscription.getUserId());
-		}
-		return subscribers;
-	}
+        Map<String, Object> paramMap = new HashMap<String, Object>();
+        paramMap.put("notification", notification);
+        paramMap.put("docId", docId);
 
-	public List<String> getSubscriptionsForUserOnDocument(String username, String docId) throws ClassNotFoundException,
-			ClientException {
-		PlacefulService service;
-		try {
-			service = NotificationServiceHelper.getPlacefulService();
-		} catch (Exception e) {
-			throw new ClientException(e);
-		}
-		String className = service.getAnnotationRegistry().get(SUBSCRIPTION_NAME);
-		// Class klass =
-		// Thread.currentThread().getContextClassLoader().loadClass(className);
-		String shortClassName = className.substring(className.lastIndexOf('.') + 1);
+        PlacefulService serviceBean = NotificationServiceHelper.getPlacefulServiceBean();
+        List<Annotation> subscriptions = new ArrayList<Annotation>();
+        subscriptions = serviceBean.getAnnotationListByParamMap(paramMap,
+                shortClassName);
+        List<String> subscribers = new ArrayList<String>();
+        for (Object obj : subscriptions) {
+            UserSubscription subscription = (UserSubscription) obj;
+            subscribers.add(subscription.getUserId());
+        }
+        return subscribers;
+    }
 
-		Map<String, Object> paramMap = new HashMap<String, Object>();
-		if (username != null) {
-			paramMap.put("userId", username);
-		}
-		if (docId != null) {
-			paramMap.put("docId", docId);
-		}
-		PlacefulService serviceBean = NotificationServiceHelper.getPlacefulServiceBean();
+    public List<String> getSubscriptionsForUserOnDocument(String username,
+            String docId) throws ClassNotFoundException, ClientException {
+        PlacefulService service;
+        try {
+            service = NotificationServiceHelper.getPlacefulService();
+        } catch (Exception e) {
+            throw new ClientException(e);
+        }
+        String className = service.getAnnotationRegistry().get(
+                SUBSCRIPTION_NAME);
+        // Class klass =
+        // Thread.currentThread().getContextClassLoader().loadClass(className);
+        String shortClassName = className.substring(className.lastIndexOf('.') + 1);
 
-		List<Annotation> subscriptions = serviceBean.getAnnotationListByParamMap(paramMap, shortClassName);
-		List<String> subscribers = new ArrayList<String>();
-		for (Object obj : subscriptions) {
-			UserSubscription subscription = (UserSubscription) obj;
-			subscribers.add(subscription.getNotification());
-		}
-		return subscribers;
-	}
+        Map<String, Object> paramMap = new HashMap<String, Object>();
+        if (username != null) {
+            paramMap.put("userId", username);
+        }
+        if (docId != null) {
+            paramMap.put("docId", docId);
+        }
+        PlacefulService serviceBean = NotificationServiceHelper.getPlacefulServiceBean();
 
-	public void addSubscription(String username, String notification, DocumentModel doc, Boolean sendConfirmationEmail,
-			NuxeoPrincipal principal, String notificationName) throws ClientException {
+        List<Annotation> subscriptions = serviceBean.getAnnotationListByParamMap(
+                paramMap, shortClassName);
+        List<String> subscribers = new ArrayList<String>();
+        for (Object obj : subscriptions) {
+            UserSubscription subscription = (UserSubscription) obj;
+            subscribers.add(subscription.getNotification());
+        }
+        return subscribers;
+    }
 
-		PlacefulService serviceBean = NotificationServiceHelper.getPlacefulServiceBean();
-		UserSubscription subscription = new UserSubscription(notification, username, doc.getId());
-		serviceBean.setAnnotation(subscription);
+    public void addSubscription(String username, String notification,
+            DocumentModel doc, Boolean sendConfirmationEmail,
+            NuxeoPrincipal principal, String notificationName)
+            throws ClientException {
 
-		// send event for email if necessary
-		if (sendConfirmationEmail) {
-			raiseConfirmationEvent(principal, doc, username, notificationName);
-		}
-	}
+        PlacefulService serviceBean = NotificationServiceHelper.getPlacefulServiceBean();
+        UserSubscription subscription = new UserSubscription(notification,
+                username, doc.getId());
+        serviceBean.setAnnotation(subscription);
 
-	protected EventProducer producer;
+        // send event for email if necessary
+        if (sendConfirmationEmail) {
+            raiseConfirmationEvent(principal, doc, username, notificationName);
+        }
+    }
 
-	protected void doFireEvent(Event event) throws ClientException {
-		if (producer == null) {
-			try {
-				producer = Framework.getService(EventProducer.class);
-			} catch (Exception e) {
-				throw new ClientRuntimeException("Unable to get MessageProducer : ", e);
-			}
-		}
-		producer.fireEvent(event);
-	}
+    protected EventProducer producer;
 
-	private void raiseConfirmationEvent(NuxeoPrincipal principal, DocumentModel doc, String username, String notification) {
+    protected void doFireEvent(Event event) throws ClientException {
+        if (producer == null) {
+            try {
+                producer = Framework.getService(EventProducer.class);
+            } catch (Exception e) {
+                throw new ClientRuntimeException(
+                        "Unable to get MessageProducer : ", e);
+            }
+        }
+        producer.fireEvent(event);
+    }
 
-		Map<String, Serializable> options = new HashMap<String, Serializable>();
+    private void raiseConfirmationEvent(NuxeoPrincipal principal,
+            DocumentModel doc, String username, String notification) {
 
-		// Name of the current repository
-		options.put(CoreEventConstants.REPOSITORY_NAME, doc.getRepositoryName());
+        Map<String, Serializable> options = new HashMap<String, Serializable>();
 
-		// Add the session ID
-		options.put(CoreEventConstants.SESSION_ID, doc.getSessionId());
+        // Name of the current repository
+        options.put(CoreEventConstants.REPOSITORY_NAME, doc.getRepositoryName());
 
-		// options for confirmation email
-		options.put("recipients", username);
-		options.put("notifName", notification);
+        // Add the session ID
+        options.put(CoreEventConstants.SESSION_ID, doc.getSessionId());
 
-		CoreSession session = CoreInstance.getInstance().getSession(doc.getSessionId());
-		DocumentEventContext ctx = new DocumentEventContext(session, principal, doc);
-		ctx.setCategory(DocumentEventCategories.EVENT_CLIENT_NOTIF_CATEGORY);
-		ctx.setProperties(options);
-		Event event = ctx.newEvent(DocumentEventTypes.SUBSCRIPTION_ASSIGNED);
+        // options for confirmation email
+        options.put("recipients", username);
+        options.put("notifName", notification);
 
-		try {
-			doFireEvent(event);
-		} catch (ClientException e) {
-			throw new ClientRuntimeException("Cannot fire event " + event, e);
-		}
-	}
+        CoreSession session = CoreInstance.getInstance().getSession(
+                doc.getSessionId());
+        DocumentEventContext ctx = new DocumentEventContext(session, principal,
+                doc);
+        ctx.setCategory(DocumentEventCategories.EVENT_CLIENT_NOTIF_CATEGORY);
+        ctx.setProperties(options);
+        Event event = ctx.newEvent(DocumentEventTypes.SUBSCRIPTION_ASSIGNED);
 
-	public void removeSubscription(String username, String notification, String docId) throws ClientException {
-		PlacefulService serviceBean = NotificationServiceHelper.getPlacefulServiceBean();
-		Map<String, Object> paramMap = new HashMap<String, Object>();
-		paramMap.put("userId", username);
-		paramMap.put("docId", docId);
-		paramMap.put("notification", notification);
+        try {
+            doFireEvent(event);
+        } catch (ClientException e) {
+            throw new ClientRuntimeException("Cannot fire event " + event, e);
+        }
+    }
 
-		serviceBean.removeAnnotationListByParamMap(paramMap, SUBSCRIPTION_NAME);
-		/*
-		 * List<Annotation> subscriptions = serviceBean
-		 * .getAnnotationListByParamMap(paramMap, SUBSCRIPTION_NAME); if
-		 * (subscriptions != null && subscriptions.size() > 0) { for (Annotation
-		 * subscription : subscriptions) { if (subscription != null) {
-		 * serviceBean.removeAnnotation(subscription); } } }
-		 */
-	}
+    public void removeSubscription(String username, String notification,
+            String docId) throws ClientException {
+        PlacefulService serviceBean = NotificationServiceHelper.getPlacefulServiceBean();
+        Map<String, Object> paramMap = new HashMap<String, Object>();
+        paramMap.put("userId", username);
+        paramMap.put("docId", docId);
+        paramMap.put("notification", notification);
 
-	public List<String> getUsersSubscribedToNotificationOnDocument(String notification, String docId) throws ClientException {
-		PlacefulService serviceBean = NotificationServiceHelper.getPlacefulServiceBean();
-		Map<String, Object> paramMap = new HashMap<String, Object>();
-		paramMap.put("docId", docId);
-		paramMap.put("notification", notification);
-		List<String> subscribers = new ArrayList<String>();
-		List<Annotation> subscriptions = serviceBean.getAnnotationListByParamMap(paramMap, SUBSCRIPTION_NAME);
-		for (Annotation annoSubscription : subscriptions) {
-			UserSubscription subscription = (UserSubscription) annoSubscription;
-			subscribers.add(subscription.getUserId());
-		}
-		return subscribers;
-	}
+        serviceBean.removeAnnotationListByParamMap(paramMap, SUBSCRIPTION_NAME);
+        /*
+         * List<Annotation> subscriptions = serviceBean
+         * .getAnnotationListByParamMap(paramMap, SUBSCRIPTION_NAME); if
+         * (subscriptions != null && subscriptions.size() > 0) { for (Annotation
+         * subscription : subscriptions) { if (subscription != null) {
+         * serviceBean.removeAnnotation(subscription); } } }
+         */
+    }
 
-	private static void registerTemplate(TemplateDescriptor td) {
-		if (td.src != null && td.src.length() > 0) {
-			URL url = td.getContext().getResource(td.src);
-			TEMPLATES_MAP.put(td.name, url);
-		}
-	}
+    public List<String> getUsersSubscribedToNotificationOnDocument(
+            String notification, String docId) throws ClientException {
+        PlacefulService serviceBean = NotificationServiceHelper.getPlacefulServiceBean();
+        Map<String, Object> paramMap = new HashMap<String, Object>();
+        paramMap.put("docId", docId);
+        paramMap.put("notification", notification);
+        List<String> subscribers = new ArrayList<String>();
+        List<Annotation> subscriptions = serviceBean.getAnnotationListByParamMap(
+                paramMap, SUBSCRIPTION_NAME);
+        for (Annotation annoSubscription : subscriptions) {
+            UserSubscription subscription = (UserSubscription) annoSubscription;
+            subscribers.add(subscription.getUserId());
+        }
+        return subscribers;
+    }
 
-	private static void unregisterTemplate(TemplateDescriptor td) {
-		if (td.name != null) {
-			TEMPLATES_MAP.remove(td.name);
-		}
-	}
+    private static void registerTemplate(TemplateDescriptor td) {
+        if (td.src != null && td.src.length() > 0) {
+            URL url = td.getContext().getResource(td.src);
+            TEMPLATES_MAP.put(td.name, url);
+        }
+    }
 
-	public static URL getTemplateURL(String name) {
-		return TEMPLATES_MAP.get(name);
-	}
+    private static void unregisterTemplate(TemplateDescriptor td) {
+        if (td.name != null) {
+            TEMPLATES_MAP.remove(td.name);
+        }
+    }
 
-	public String getServerUrlPrefix() {
-		return generalSettings.getServerPrefix();
-	}
+    public static URL getTemplateURL(String name) {
+        return TEMPLATES_MAP.get(name);
+    }
 
-	public String getEMailSubjectPrefix() {
-		return generalSettings.getEMailSubjectPrefix();
-	}
+    public String getServerUrlPrefix() {
+        return generalSettings.getServerPrefix();
+    }
 
-	public String getMailSessionJndiName() {
-		return generalSettings.getMailSessionJndiName();
-	}
+    public String getEMailSubjectPrefix() {
+        return generalSettings.getEMailSubjectPrefix();
+    }
 
-	public Notification getNotificationByName(String selectedNotification) {
-		List<Notification> listNotif = notificationRegistry.getNotifications();
-		for (Notification notification : listNotif) {
-			if (notification.getName().equals(selectedNotification)) {
-				return notification;
-			}
-		}
-		return null;
-	}
+    public String getMailSessionJndiName() {
+        return generalSettings.getMailSessionJndiName();
+    }
 
-	public void sendNotification(String notificationName, Map<String, Object> infoMap, String userPrincipal) throws ClientException {
+    public Notification getNotificationByName(String selectedNotification) {
+        List<Notification> listNotif = notificationRegistry.getNotifications();
+        for (Notification notification : listNotif) {
+            if (notification.getName().equals(selectedNotification)) {
+                return notification;
+            }
+        }
+        return null;
+    }
 
-		AlertSettingsWrapper as = getAlertSettings(userPrincipal);
+    public void sendNotification(String notificationName,
+            Map<String, Object> infoMap, String userPrincipal)
+            throws ClientException {
 
-		String notificationPolicy = as.getNotificationPolicy();
+        AlertSettingsWrapper as = getAlertSettings(userPrincipal);
 
-		if (AlertSettingsType.NOTIFICATION_POLICY_BOTH.equals(notificationPolicy)) {
-			sendImmediateNotification(notificationName, infoMap, userPrincipal);
-			storeDeferredNotification(notificationName, infoMap, userPrincipal);
-		} else if (AlertSettingsType.NOTIFICATION_POLICY_SUMMARY.equals(notificationPolicy)) {
-			storeDeferredNotification(notificationName, infoMap, userPrincipal);
-		} else if (AlertSettingsType.NOTIFICATION_POLICY_IMMEDIATE.equals(notificationPolicy)) {
-			sendImmediateNotification(notificationName, infoMap, userPrincipal);
-		} else {
-			log.warn(String.format("Unexpected value for notificationPolicy : %s", as.getNotificationPolicy()));
-			sendImmediateNotification(notificationName, infoMap, userPrincipal);
-		}
+        String notificationPolicy = as.getNotificationPolicy();
 
-	}
+        if (AlertSettingsType.NOTIFICATION_POLICY_BOTH.equals(notificationPolicy)) {
+            sendImmediateNotification(notificationName, infoMap, userPrincipal);
+            storeDeferredNotification(notificationName, infoMap, userPrincipal);
+        } else if (AlertSettingsType.NOTIFICATION_POLICY_SUMMARY.equals(notificationPolicy)) {
+            storeDeferredNotification(notificationName, infoMap, userPrincipal);
+        } else if (AlertSettingsType.NOTIFICATION_POLICY_IMMEDIATE.equals(notificationPolicy)) {
+            sendImmediateNotification(notificationName, infoMap, userPrincipal);
+        } else {
+            log.warn(String.format(
+                    "Unexpected value for notificationPolicy : %s",
+                    as.getNotificationPolicy()));
+            sendImmediateNotification(notificationName, infoMap, userPrincipal);
+        }
 
-	private void storeDeferredNotification(String notificationName, Map<String, Object> infoMap, String userPrincipal) throws ClientException {
-		
-		Notification notif = getNotificationByName(notificationName);
+    }
 
-		NuxeoPrincipal recepient = NotificationServiceHelper.getUsersService().getPrincipal(userPrincipal);
-		// XXX hack, principals have only one model
-		DataModel model = recepient.getModel().getDataModels().values().iterator().next();
-		String email = (String) model.getData("email");
-		String mailTemplate = "d_" + notif.getTemplate();
+    private void storeDeferredNotification(String notificationName,
+            Map<String, Object> infoMap, String userPrincipal)
+            throws ClientException {
 
-		infoMap.put("mail.to", email);
+        Notification notif = getNotificationByName(notificationName);
 
-		String authorUsername = (String) infoMap.get("author");
+        NuxeoPrincipal recepient = NotificationServiceHelper.getUsersService().getPrincipal(
+                userPrincipal);
+        // XXX hack, principals have only one model
+        DataModel model = recepient.getModel().getDataModels().values().iterator().next();
+        String email = (String) model.getData("email");
+        String mailTemplate = "d_" + notif.getTemplate();
 
-		if (authorUsername != null) {
-			NuxeoPrincipal author = NotificationServiceHelper.getUsersService().getPrincipal(authorUsername);
-			infoMap.put("principalAuthor", author);
-		}
+        infoMap.put("mail.to", email);
 
-		// mail.put("doc", docMessage); - should be already there
+        String authorUsername = (String) infoMap.get("author");
 
-		String subject = notif.getSubject() == null ? "Notification" : notif.getSubject();
-		if (notif.getSubjectTemplate() != null) {
-			subject = notif.getSubjectTemplate();
-		}
+        if (authorUsername != null) {
+            NuxeoPrincipal author = NotificationServiceHelper.getUsersService().getPrincipal(
+                    authorUsername);
+            infoMap.put("principalAuthor", author);
+        }
 
-		subject = NotificationServiceHelper.getNotificationService().getEMailSubjectPrefix() + subject;
+        // mail.put("doc", docMessage); - should be already there
 
-		infoMap.put("subject", subject);
-		infoMap.put("template", mailTemplate);
+        String subject = notif.getSubject() == null ? "Notification"
+                : notif.getSubject();
+        if (notif.getSubjectTemplate() != null) {
+            subject = notif.getSubjectTemplate();
+        }
 
-		try {
-			deferredHelper.storeNotification(infoMap, userPrincipal);
-		} catch (Exception e) {
-			throw new ClientException("Failed to send notification email ", e);
-		}
-	}
+        subject = NotificationServiceHelper.getNotificationService().getEMailSubjectPrefix()
+                + subject;
 
-	private AlertSettingsWrapper getAlertSettings(String userPrincipal) throws ClientException {
+        infoMap.put("subject", subject);
+        infoMap.put("template", mailTemplate);
 
-		DocumentModelList alertDocList = (DocumentModelList) getuserSettingsService().getUserSettings(userPrincipal, AlertSettingsType.DOCTYPE);
+        try {
+            deferredHelper.storeNotification(infoMap, userPrincipal);
+        } catch (Exception e) {
+            throw new ClientException("Failed to send notification email ", e);
+        }
+    }
 
-		DocumentModel alertDoc = alertDocList.get(0);
-		
-		return new AlertSettingsWrapper(alertDoc);
+    private AlertSettingsWrapper getAlertSettings(String userPrincipal)
+            throws ClientException {
 
+        DocumentModelList alertDocList = (DocumentModelList) getuserSettingsService().getUserSettings(
+                userPrincipal, AlertSettingsType.DOCTYPE);
 
-	}
+        DocumentModel alertDoc = alertDocList.get(0);
 
-	private UserSettingsService getuserSettingsService() throws ClientException {
+        return new AlertSettingsWrapper(alertDoc);
 
-		try {
-			if (userSettingsService == null) {
-				userSettingsService = Framework.getService(UserSettingsService.class);
-			}
+    }
 
-			return userSettingsService;
-		} catch (Exception e) {
-			throw new ClientException("Unable to get UserSettingsService", e);
-		}
+    private UserSettingsService getuserSettingsService() throws ClientException {
 
-	}
+        try {
+            if (userSettingsService == null) {
+                userSettingsService = Framework.getService(UserSettingsService.class);
+            }
 
-	private void sendImmediateNotification(String notificationName, Map<String, Object> infoMap, String userPrincipal)
-			throws ClientException, PropertyException {
-		Notification notif = getNotificationByName(notificationName);
+            return userSettingsService;
+        } catch (Exception e) {
+            throw new ClientException("Unable to get UserSettingsService", e);
+        }
 
-		NuxeoPrincipal recepient = NotificationServiceHelper.getUsersService().getPrincipal(userPrincipal);
-		// XXX hack, principals have only one model
-		DataModel model = recepient.getModel().getDataModels().values().iterator().next();
-		String email = (String) model.getData("email");
-		String mailTemplate = notif.getTemplate();
+    }
 
-		infoMap.put("mail.to", email);
+    private void sendImmediateNotification(String notificationName,
+            Map<String, Object> infoMap, String userPrincipal)
+            throws ClientException, PropertyException {
+        Notification notif = getNotificationByName(notificationName);
 
-		String authorUsername = (String) infoMap.get("author");
+        NuxeoPrincipal recepient = NotificationServiceHelper.getUsersService().getPrincipal(
+                userPrincipal);
+        // XXX hack, principals have only one model
+        DataModel model = recepient.getModel().getDataModels().values().iterator().next();
+        String email = (String) model.getData("email");
+        String mailTemplate = notif.getTemplate();
 
-		if (authorUsername != null) {
-			NuxeoPrincipal author = NotificationServiceHelper.getUsersService().getPrincipal(authorUsername);
-			infoMap.put("principalAuthor", author);
-		}
+        infoMap.put("mail.to", email);
 
-		// mail.put("doc", docMessage); - should be already there
+        String authorUsername = (String) infoMap.get("author");
 
-		String subject = notif.getSubject() == null ? "Notification" : notif.getSubject();
-		if (notif.getSubjectTemplate() != null) {
-			subject = notif.getSubjectTemplate();
-		}
+        if (authorUsername != null) {
+            NuxeoPrincipal author = NotificationServiceHelper.getUsersService().getPrincipal(
+                    authorUsername);
+            infoMap.put("principalAuthor", author);
+        }
 
-		subject = NotificationServiceHelper.getNotificationService().getEMailSubjectPrefix() + subject;
+        // mail.put("doc", docMessage); - should be already there
 
-		infoMap.put("subject", subject);
-		infoMap.put("template", mailTemplate);
+        String subject = notif.getSubject() == null ? "Notification"
+                : notif.getSubject();
+        if (notif.getSubjectTemplate() != null) {
+            subject = notif.getSubjectTemplate();
+        }
 
-		try {
-			emailHelper.sendmail(infoMap);
-		} catch (Exception e) {
-			throw new ClientException("Failed to send notification email ", e);
-		}
-	}
+        subject = NotificationServiceHelper.getNotificationService().getEMailSubjectPrefix()
+                + subject;
 
-	public void sendDocumentByMail(DocumentModel doc, String freemarkerTemplateName, String subject, String comment,
-			NuxeoPrincipal sender, List<String> sendTo) {
-		Map<String, Object> infoMap = new HashMap<String, Object>();
-		infoMap.put("document", doc);
-		infoMap.put("subject", subject);
-		infoMap.put("comment", comment);
-		infoMap.put("sender", sender);
+        infoMap.put("subject", subject);
+        infoMap.put("template", mailTemplate);
 
-		DocumentLocation docLoc = new DocumentLocationImpl(doc);
-		DocumentView docView = new DocumentViewImpl(docLoc);
-		docView.setViewId("view_documents");
-		infoMap.put("docUrl", getDocLocator().getUrlFromDocumentView(docView, true,
-				NotificationServiceHelper.getNotificationService().getServerUrlPrefix()));
+        try {
+            emailHelper.sendmail(infoMap);
+        } catch (Exception e) {
+            throw new ClientException("Failed to send notification email ", e);
+        }
+    }
 
-		if (freemarkerTemplateName == null) {
-			freemarkerTemplateName = "defaultNotifTemplate";
-		}
-		infoMap.put("template", freemarkerTemplateName);
+    public void sendDocumentByMail(DocumentModel doc,
+            String freemarkerTemplateName, String subject, String comment,
+            NuxeoPrincipal sender, List<String> sendTo) {
+        Map<String, Object> infoMap = new HashMap<String, Object>();
+        infoMap.put("document", doc);
+        infoMap.put("subject", subject);
+        infoMap.put("comment", comment);
+        infoMap.put("sender", sender);
 
-		for (String to : sendTo) {
-			infoMap.put("mail.to", to);
-			try {
-				emailHelper.sendmail(infoMap);
-			} catch (Exception e) {
-				log.debug("Failed to send notification email " + e);
-			}
-		}
-	}
+        DocumentLocation docLoc = new DocumentLocationImpl(doc);
+        DocumentView docView = new DocumentViewImpl(docLoc);
+        docView.setViewId("view_documents");
+        infoMap.put(
+                "docUrl",
+                getDocLocator().getUrlFromDocumentView(
+                        docView,
+                        true,
+                        NotificationServiceHelper.getNotificationService().getServerUrlPrefix()));
 
-	private DocumentViewCodecManager getDocLocator() {
-		if (docLocator == null) {
-			try {
-				docLocator = Framework.getService(DocumentViewCodecManager.class);
-			} catch (Exception e) {
-				log.info("Could not get service for document view manager");
-			}
-		}
+        if (freemarkerTemplateName == null) {
+            freemarkerTemplateName = "defaultNotifTemplate";
+        }
+        infoMap.put("template", freemarkerTemplateName);
 
-		return docLocator;
-	}
+        for (String to : sendTo) {
+            infoMap.put("mail.to", to);
+            try {
+                emailHelper.sendmail(infoMap);
+            } catch (Exception e) {
+                log.debug("Failed to send notification email " + e);
+            }
+        }
+    }
 
-	public List<Notification> getNotificationsForSubscriptions(String parentType) {
-		return notificationRegistry.getNotificationsForSubscriptions(parentType);
-	}
+    private DocumentViewCodecManager getDocLocator() {
+        if (docLocator == null) {
+            try {
+                docLocator = Framework.getService(DocumentViewCodecManager.class);
+            } catch (Exception e) {
+                log.info("Could not get service for document view manager");
+            }
+        }
 
-	public List<Notification> getNotificationsForEvents(String eventId) {
-		return notificationRegistry.getNotificationsForEvent(eventId);
-	}
+        return docLocator;
+    }
 
-	public EmailHelper getEmailHelper() {
-		return emailHelper;
-	}
+    public List<Notification> getNotificationsForSubscriptions(String parentType) {
+        return notificationRegistry.getNotificationsForSubscriptions(parentType);
+    }
 
-	public void setEmailHelper(EmailHelper emailHelper) {
-		this.emailHelper = emailHelper;
-	}
+    public List<Notification> getNotificationsForEvents(String eventId) {
+        return notificationRegistry.getNotificationsForEvent(eventId);
+    }
+
+    public EmailHelper getEmailHelper() {
+        return emailHelper;
+    }
+
+    public void setEmailHelper(EmailHelper emailHelper) {
+        this.emailHelper = emailHelper;
+    }
 
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/ec/notification/service/NotificationServiceHelper.java
--- a/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/ec/notification/service/NotificationServiceHelper.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/ec/notification/service/NotificationServiceHelper.java	Fri Mar 26 09:05:32 2010 +0100
@@ -26,7 +26,7 @@
 
 /**
  * @author <a href="mailto:npaslaru@nuxeo.com">Narcis Paslaru</a>
- *
+ * 
  */
 public final class NotificationServiceHelper {
 
@@ -47,7 +47,7 @@
     public static PlacefulService getPlacefulService() {
         return (PlacefulService) Framework.getRuntime().getComponent(
                 PlacefulService.ID);
-//        return Framework.getService(PlacefulService.class);
+        // return Framework.getService(PlacefulService.class);
     }
 
     public static PlacefulService getPlacefulServiceBean()
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/ec/notification/service/TemplateDescriptor.java
--- a/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/ec/notification/service/TemplateDescriptor.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/ec/notification/service/TemplateDescriptor.java	Fri Mar 26 09:05:32 2010 +0100
@@ -25,7 +25,7 @@
 
 /**
  * @author <a href="mailto:npaslaru@nuxeo.com">Narcis Paslaru</a>
- *
+ * 
  */
 @XObject("template")
 public class TemplateDescriptor {
@@ -40,7 +40,6 @@
     // the schema file
     private RuntimeContext context;
 
-
     public TemplateDescriptor() {
     }
 
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/RenderingContext.java
--- a/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/RenderingContext.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/RenderingContext.java	Fri Mar 26 09:05:32 2010 +0100
@@ -30,20 +30,22 @@
  * The org.nuxeo.runtime.model.Adaptable interface may be used to add adapting
  * capabilities to context objects. This may be used to retrieve adapters to
  * other type of contexts (like the freemarker one).
- *
+ * 
  * @author <a href="mailto:dm@nuxeo.com">Dragos Mihalache</a>
- *
+ * 
  */
-public interface RenderingContext extends Map<String, Object>, Adaptable, Serializable {
+public interface RenderingContext extends Map<String, Object>, Adaptable,
+        Serializable {
 
     /**
      * Either or not this rendering context accepts the given engine.
      * <p>
      * If the engione is not acepted it will be ignored by the rendering service
      * when processing this context
-     *
+     * 
      * @param engine the engine to test
-     * @return true if the engine is eligible to process this context, false otherwise
+     * @return true if the engine is eligible to process this context, false
+     *         otherwise
      */
     boolean accept(RenderingEngine engine);
 
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/RenderingEngine.java
--- a/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/RenderingEngine.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/RenderingEngine.java	Fri Mar 26 09:05:32 2010 +0100
@@ -20,9 +20,9 @@
 
 /**
  * A RenderingEngine will be instantiated by the RenderingService according with
- * the descriptor specified for it. The specific implementation of a RenderingEngine
- * must be in classpath for it to be instantiated and used.
- *
+ * the descriptor specified for it. The specific implementation of a
+ * RenderingEngine must be in classpath for it to be instantiated and used.
+ * 
  * @author <a href="mailto:dm@nuxeo.com">Dragos Mihalache</a>
  */
 public interface RenderingEngine {
@@ -32,9 +32,9 @@
     /**
      * Processes the given context and return a rendering result.
      * <p>
-     * The processing must never return null. If some error occurs it must
-     * throw an exception.
-     *
+     * The processing must never return null. If some error occurs it must throw
+     * an exception.
+     * 
      * @param ctx the context to process
      */
     RenderingResult process(RenderingContext ctx) throws RenderingException;
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/RenderingException.java
--- a/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/RenderingException.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/RenderingException.java	Fri Mar 26 09:05:32 2010 +0100
@@ -21,7 +21,7 @@
 
 /**
  * @author <a href="mailto:dm@nuxeo.com">Dragos Mihalache</a>
- *
+ * 
  */
 public class RenderingException extends Exception {
 
@@ -42,5 +42,4 @@
         super(cause);
     }
 
-
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/RenderingResult.java
--- a/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/RenderingResult.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/RenderingResult.java	Fri Mar 26 09:05:32 2010 +0100
@@ -24,39 +24,39 @@
 
 import org.nuxeo.runtime.model.Adaptable;
 
-
 /**
- * A rendering result is an object that wraps a rendering result and give several methods
- * to retrieve the rendering outcome.
+ * A rendering result is an object that wraps a rendering result and give
+ * several methods to retrieve the rendering outcome.
  * <p>
  * The default one is to expose the rendering outcome as a stream.
  * <p>
- * Specialized results may be retrieved using {@link Adaptable#getAdapter(Class)} method
- *
+ * Specialized results may be retrieved using
+ * {@link Adaptable#getAdapter(Class)} method
+ * 
  * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a>
  * @author <a href="mailto:dm@nuxeo.com">Dragos Mihalache</a>
  */
 public interface RenderingResult extends Adaptable, Serializable {
 
     /**
-     * Gets the format name of the result. This can be use to identify the
-     * type of the result. The format name can be a mime type or any
+     * Gets the format name of the result. This can be use to identify the type
+     * of the result. The format name can be a mime type or any
      * application-defined format.
-     *
+     * 
      * @return the format name
      */
     String getFormatName();
 
     /**
      * Gets the rendering result as a stream.
-     *
+     * 
      * @return the stream or null if the outcome cannot be expressed as a stream
      */
     InputStream getStream();
 
     /**
      * Gets the rendering result object.
-     *
+     * 
      * @return the rendering result. must never be null
      */
     Object getOutcome();
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/RenderingService.java
--- a/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/RenderingService.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/RenderingService.java	Fri Mar 26 09:05:32 2010 +0100
@@ -22,14 +22,14 @@
 
 /**
  * RenderingService core infrastructure.
- *
+ * 
  * @author <a href="mailto:dm@nuxeo.com">Dragos Mihalache</a>
  */
 public interface RenderingService {
 
     /**
      * Processes the given context and returns a collection of results.
-     *
+     * 
      * @param ctx the context
      * @return the result
      * @throws RenderingException
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/impl/DefaultRenderingContext.java
--- a/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/impl/DefaultRenderingContext.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/impl/DefaultRenderingContext.java	Fri Mar 26 09:05:32 2010 +0100
@@ -28,12 +28,12 @@
  * Abstract RenderingContext subclass that adds capabilities of storing a
  * DocumentModel and retrieve RenderingConfig associated with the current set
  * DocumentModel.
- *
+ * 
  * @author <a href="mailto:dm@nuxeo.com">Dragos Mihalache</a>
- *
+ * 
  */
-public class DefaultRenderingContext extends HashMap<String, Object>
-        implements RenderingContext {
+public class DefaultRenderingContext extends HashMap<String, Object> implements
+        RenderingContext {
 
     private static final long serialVersionUID = -5442029141468819238L;
 
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/impl/DefaultRenderingResult.java
--- a/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/impl/DefaultRenderingResult.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/impl/DefaultRenderingResult.java	Fri Mar 26 09:05:32 2010 +0100
@@ -26,7 +26,7 @@
 
 /**
  * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a>
- *
+ * 
  */
 public abstract class DefaultRenderingResult implements RenderingResult {
 
@@ -36,7 +36,7 @@
 
     /**
      * Constructor taking a rendering result name as argument.
-     *
+     * 
      * @param formatName
      */
     protected DefaultRenderingResult(String formatName) {
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/impl/DocumentRenderingContext.java
--- a/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/impl/DocumentRenderingContext.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/impl/DocumentRenderingContext.java	Fri Mar 26 09:05:32 2010 +0100
@@ -25,9 +25,9 @@
  * Abstract RenderingContext subclass that adds capabilities of storing a
  * DocumentModel and retrieve RenderingConfig associated with the current set
  * DocumentModel.
- *
+ * 
  * @author <a href="mailto:dm@nuxeo.com">Dragos Mihalache</a>
- *
+ * 
  */
 public class DocumentRenderingContext extends DefaultRenderingContext {
 
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/impl/RenderingEngineDescriptor.java
--- a/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/impl/RenderingEngineDescriptor.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/impl/RenderingEngineDescriptor.java	Fri Mar 26 09:05:32 2010 +0100
@@ -24,11 +24,13 @@
 /**
  * Rendering Engine Descriptor objects instantiated with configuration from
  * contributions like:
- *
+ * 
  * <pre>
  *  &lt;engine name=”the_format_name” class=”rendering_engine_impl_class”/&gt;
- * </pre>. Also instantiate rendering engine as defined in contribution.
- *
+ * </pre>
+ * 
+ * . Also instantiate rendering engine as defined in contribution.
+ * 
  * @author <a href="mailto:dm@nuxeo.com">Dragos Mihalache</a>
  */
 public class RenderingEngineDescriptor {
@@ -51,8 +53,8 @@
         return klass;
     }
 
-    public RenderingEngine newInstance()
-            throws InstantiationException, IllegalAccessException {
+    public RenderingEngine newInstance() throws InstantiationException,
+            IllegalAccessException {
         return klass.newInstance();
     }
 
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/impl/RenderingServiceImpl.java
--- a/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/impl/RenderingServiceImpl.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/impl/RenderingServiceImpl.java	Fri Mar 26 09:05:32 2010 +0100
@@ -36,7 +36,7 @@
 
 /**
  * Implementation of RenderingService
- *
+ * 
  * @author <a href="mailto:dm@nuxeo.com">Dragos Mihalache</a>
  */
 public class RenderingServiceImpl extends DefaultComponent implements
@@ -92,7 +92,8 @@
                 if (result != null) {
                     ret.add(result);
                 } else if (log.isDebugEnabled()) {
-                    log.debug("rendering ignored by the engine "+ engine.getFormatName());
+                    log.debug("rendering ignored by the engine "
+                            + engine.getFormatName());
                 }
             }
         }
@@ -102,8 +103,8 @@
     public void registerEngine(RenderingEngine engine) {
         RenderingEngine existing = engines.put(engine.getFormatName(), engine);
         if (existing != null) {
-            log.debug("Replaced existing RenderingEngine " +
-                    engine.getFormatName());
+            log.debug("Replaced existing RenderingEngine "
+                    + engine.getFormatName());
         } else if (log.isDebugEnabled()) {
             log.debug("Registered RenderingEngine " + engine.getFormatName());
         }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/template/DocumentFieldAccessor.java
--- a/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/template/DocumentFieldAccessor.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/template/DocumentFieldAccessor.java	Fri Mar 26 09:05:32 2010 +0100
@@ -27,7 +27,7 @@
 
 /**
  * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a>
- *
+ * 
  */
 public abstract class DocumentFieldAccessor {
 
@@ -35,7 +35,6 @@
 
     public static final Map<String, DocumentFieldAccessor> accessors = new HashMap<String, DocumentFieldAccessor>();
 
-
     protected DocumentFieldAccessor(String name) {
         this.name = name;
         accessors.put(name, this);
@@ -67,7 +66,6 @@
 
     public abstract Object getValue(DocumentModel doc);
 
-
     public static DocumentFieldAccessor ID = new DocumentFieldAccessor("id") {
         @Override
         public Object getValue(DocumentModel doc) {
@@ -96,24 +94,27 @@
         }
     };
 
-    public static DocumentFieldAccessor FACETS = new DocumentFieldAccessor("facets") {
+    public static DocumentFieldAccessor FACETS = new DocumentFieldAccessor(
+            "facets") {
         @Override
         public Object getValue(DocumentModel doc) {
             return doc.getDeclaredFacets();
         }
     };
 
-    public static DocumentFieldAccessor SCHEMAS = new DocumentFieldAccessor("schemas") {
+    public static DocumentFieldAccessor SCHEMAS = new DocumentFieldAccessor(
+            "schemas") {
         @Override
         public Object getValue(DocumentModel doc) {
             return doc.getDeclaredSchemas();
         }
     };
 
-    public static DocumentFieldAccessor SYSTEM = new DocumentFieldAccessor("system") {
+    public static DocumentFieldAccessor SYSTEM = new DocumentFieldAccessor(
+            "system") {
         @Override
         public Object getValue(DocumentModel doc) {
-            return null; //TODO
+            return null; // TODO
         }
     };
 
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/template/DocumentModelAdapter.java
--- a/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/template/DocumentModelAdapter.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/template/DocumentModelAdapter.java	Fri Mar 26 09:05:32 2010 +0100
@@ -39,13 +39,17 @@
 
 /**
  * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a>
- *
+ * 
  */
-public class DocumentModelAdapter implements TemplateHashModelEx, AdapterTemplateModel {
+public class DocumentModelAdapter implements TemplateHashModelEx,
+        AdapterTemplateModel {
 
     protected final DocumentModel doc;
+
     protected final ObjectWrapper wrapper;
+
     private TemplateCollectionModel keys;
+
     private int size = -1;
 
     // id, name, path, type, schemas, facets, system, schema1, schema2, ...
@@ -78,14 +82,16 @@
         }
         if (part != null) {
             // TODO it is easier for now to export the part as a map
-            // may be in future we may want to implement a property template model
+            // may be in future we may want to implement a property template
+            // model
             try {
                 DocumentValueExporter exporter = new DocumentValueExporter();
                 Map<String, Serializable> map = exporter.run(part);
                 return wrapper.wrap(map);
             } catch (PropertyException e) {
                 throw new TemplateModelException(
-                        "Failed to get value for schema root property: "+key, e);
+                        "Failed to get value for schema root property: " + key,
+                        e);
             }
         }
         return wrapper.wrap(null);
@@ -105,7 +111,7 @@
             String[] schemas = doc.getDeclaredSchemas();
             keysCol.addAll(Arrays.asList(schemas));
             size = keysCol.size();
-            keys = (TemplateCollectionModel)wrapper.wrap(keysCol);
+            keys = (TemplateCollectionModel) wrapper.wrap(keysCol);
         }
         return keys;
     }
@@ -124,12 +130,13 @@
         } catch (ClientException e) {
             throw new TemplateModelException(e);
         }
-        return (TemplateCollectionModel)wrapper.wrap(values);
+        return (TemplateCollectionModel) wrapper.wrap(values);
     }
 
     public int size() throws TemplateModelException {
         if (size == -1) {
-            size = DocumentFieldAccessor.getAcessorsCount() + doc.getDeclaredSchemas().length;
+            size = DocumentFieldAccessor.getAcessorsCount()
+                    + doc.getDeclaredSchemas().length;
         }
         return size;
     }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/template/DocumentObjectWrapper.java
--- a/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/template/DocumentObjectWrapper.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/template/DocumentObjectWrapper.java	Fri Mar 26 09:05:32 2010 +0100
@@ -27,7 +27,7 @@
 
 /**
  * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a>
- *
+ * 
  */
 public class DocumentObjectWrapper extends DefaultObjectWrapper {
 
@@ -35,7 +35,7 @@
     protected TemplateModel handleUnknownType(Object obj)
             throws TemplateModelException {
         if (obj instanceof DocumentModel) {
-            return new DocumentModelAdapter((DocumentModel)obj);
+            return new DocumentModelAdapter((DocumentModel) obj);
         }
         return super.handleUnknownType(obj);
     }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/template/DocumentRenderingEngine.java
--- a/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/template/DocumentRenderingEngine.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/template/DocumentRenderingEngine.java	Fri Mar 26 09:05:32 2010 +0100
@@ -23,7 +23,7 @@
 
 /**
  * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a>
- *
+ * 
  */
 public abstract class DocumentRenderingEngine extends FreemarkerRenderingEngine {
 
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/template/DocumentValueExporter.java
--- a/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/template/DocumentValueExporter.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/template/DocumentValueExporter.java	Fri Mar 26 09:05:32 2010 +0100
@@ -34,7 +34,7 @@
 
 /**
  * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a>
- *
+ * 
  */
 @SuppressWarnings("unchecked")
 public class DocumentValueExporter implements PropertyVisitor {
@@ -45,7 +45,8 @@
         return result;
     }
 
-    public Map<String, Serializable> run(DocumentPart dp) throws PropertyException {
+    public Map<String, Serializable> run(DocumentPart dp)
+            throws PropertyException {
         dp.accept(this, result);
         return result;
     }
@@ -54,11 +55,13 @@
         return false;
     }
 
-    public Object visit(DocumentPart property, Object arg) throws PropertyException {
+    public Object visit(DocumentPart property, Object arg)
+            throws PropertyException {
         return arg;
     }
 
-    public Object visit(MapProperty property, Object arg) throws PropertyException {
+    public Object visit(MapProperty property, Object arg)
+            throws PropertyException {
         Serializable value = null;
         if (property.isContainer()) {
             value = new HashMap<String, Serializable>();
@@ -66,7 +69,7 @@
             value = property.getValue();
         }
         if (property.getParent().isList()) {
-        //if (arg instanceof Collection) {
+            // if (arg instanceof Collection) {
             ((Collection<Serializable>) arg).add(value);
         } else {
             ((Map<String, Serializable>) arg).put(
@@ -75,7 +78,8 @@
         return value;
     }
 
-    public Object visit(ListProperty property, Object arg) throws PropertyException {
+    public Object visit(ListProperty property, Object arg)
+            throws PropertyException {
         Serializable value = null;
         if (property.isContainer()) {
             value = new ArrayList<Serializable>();
@@ -83,7 +87,7 @@
             value = property.getValue();
         }
         if (property.getParent().isList()) {
-        //if (arg instanceof Collection) {
+            // if (arg instanceof Collection) {
             ((Collection<Serializable>) arg).add(value);
         } else {
             ((Map<String, Serializable>) arg).put(
@@ -92,9 +96,10 @@
         return value;
     }
 
-    public Object visit(ScalarProperty property, Object arg) throws PropertyException {
+    public Object visit(ScalarProperty property, Object arg)
+            throws PropertyException {
         if (property.getParent().isList()) {
-        //if (arg instanceof Collection) {
+            // if (arg instanceof Collection) {
             ((Collection<Serializable>) arg).add(property.getValue());
         } else {
             ((Map<String, Serializable>) arg).put(
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/template/FreemarkerRenderingEngine.java
--- a/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/template/FreemarkerRenderingEngine.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/template/FreemarkerRenderingEngine.java	Fri Mar 26 09:05:32 2010 +0100
@@ -29,7 +29,7 @@
 
 /**
  * Base class for RenderingEngine implementation that will work with freemarker.
- *
+ * 
  * @author <a href="mailto:dm@nuxeo.com">Dragos Mihalache</a>
  */
 public abstract class FreemarkerRenderingEngine implements RenderingEngine {
@@ -40,9 +40,9 @@
      * TODO : It works like this but this default implementation should return
      * just a <code>new Configuration()</code> There should be a class that
      * extends this class and overrides this but that brokes it right now.
-     *
+     * 
      * TODO: write a clear TODO
-     *
+     * 
      * @return
      * @throws Exception
      */
@@ -53,7 +53,7 @@
         return config;
     }
 
-    protected abstract FreemarkerRenderingJob createJob(RenderingContext ctx) ;
+    protected abstract FreemarkerRenderingJob createJob(RenderingContext ctx);
 
     public RenderingResult process(RenderingContext ctx)
             throws RenderingException {
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/template/FreemarkerRenderingJob.java
--- a/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/template/FreemarkerRenderingJob.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/rendering/template/FreemarkerRenderingJob.java	Fri Mar 26 09:05:32 2010 +0100
@@ -25,7 +25,7 @@
 
 /**
  * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a>
- *
+ * 
  */
 public interface FreemarkerRenderingJob {
 
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-notification-core/src/test/java/org/nuxeo/ecm/platform/ec/notification/EmailHelperMock.java
--- a/nuxeo-platform-notification-core/src/test/java/org/nuxeo/ecm/platform/ec/notification/EmailHelperMock.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-notification-core/src/test/java/org/nuxeo/ecm/platform/ec/notification/EmailHelperMock.java	Fri Mar 26 09:05:32 2010 +0100
@@ -27,6 +27,7 @@
 
 public class EmailHelperMock extends EmailHelper {
     public Log log = LogFactory.getLog(this.getClass());
+
     public int compteur = 0;
 
     @Override
@@ -34,7 +35,7 @@
         compteur++;
         log.info("Faking send mail : ");
         for (String key : mail.keySet()) {
-               log.info(key+" : "+mail.get(key));
+            log.info(key + " : " + mail.get(key));
         }
 
     }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-notification-core/src/test/java/org/nuxeo/ecm/platform/ec/notification/NotificationEventListenerTest.java
--- a/nuxeo-platform-notification-core/src/test/java/org/nuxeo/ecm/platform/ec/notification/NotificationEventListenerTest.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-notification-core/src/test/java/org/nuxeo/ecm/platform/ec/notification/NotificationEventListenerTest.java	Fri Mar 26 09:05:32 2010 +0100
@@ -33,7 +33,7 @@
 
 /**
  * Simple test Case for DocUIDGeneratorListener
- *
+ * 
  * @author Julien Thimonier <jt@nuxeo.com>
  */
 public class NotificationEventListenerTest extends RepositoryOSGITestCase {
@@ -63,14 +63,12 @@
 
         // Injection of the EmailHelper Mock to track mails sending
         EventService eventService = Framework.getService(EventService.class);
-        List<PostCommitEventListener> listeners = eventService
-                .getPostCommitEventListeners();
+        List<PostCommitEventListener> listeners = eventService.getPostCommitEventListeners();
 
         for (PostCommitEventListener postCommitEventListener : listeners) {
             if (postCommitEventListener.getClass().equals(
                     NotificationEventListener.class)) {
-                ((NotificationEventListener) postCommitEventListener)
-                        .setEmailHelper(emailHelperMock);
+                ((NotificationEventListener) postCommitEventListener).setEmailHelper(emailHelperMock);
             }
         }
         log.info("setup Finnished");
@@ -102,26 +100,28 @@
     }
 
     public void testListener() throws ClientException {
-//        EventService eventService = Framework.getLocalService(EventService.class);
-//        PlacefulServiceImpl placefulServiceImpl = (PlacefulServiceImpl) Framework.getLocalService(PlacefulService.class);
-//        DocumentModel noteDoc = createNoteDocument();
-//        // Record notification
-//        UserSubscription userSubscription = new UserSubscription(
-//                "Workflow Change", "user:"
-//                        + getCoreSession().getPrincipal().getName(),
-//                noteDoc.getId());
-//        placefulServiceImpl.setAnnotation(userSubscription);
-//
-//        // Trigger notification
-//        DocumentEventContext ctx = new DocumentEventContext(getCoreSession(),
-//                getCoreSession().getPrincipal(), noteDoc);
-//        ctx.setProperty("recipients", new Object[] { "jt@nuxeo.com" });
-//        ctx.getProperties().put("comment", "RAS");
-//        eventService.fireEvent(ctx.newEvent("workflowAbandoned"));
-//        getCoreSession().save();
-//        waitForAsyncExec();
-//        // Check that at least one email has been sending
-//        assertTrue(emailHelperMock.getCompteur() > 0);
+        // EventService eventService =
+        // Framework.getLocalService(EventService.class);
+        // PlacefulServiceImpl placefulServiceImpl = (PlacefulServiceImpl)
+        // Framework.getLocalService(PlacefulService.class);
+        // DocumentModel noteDoc = createNoteDocument();
+        // // Record notification
+        // UserSubscription userSubscription = new UserSubscription(
+        // "Workflow Change", "user:"
+        // + getCoreSession().getPrincipal().getName(),
+        // noteDoc.getId());
+        // placefulServiceImpl.setAnnotation(userSubscription);
+        //
+        // // Trigger notification
+        // DocumentEventContext ctx = new DocumentEventContext(getCoreSession(),
+        // getCoreSession().getPrincipal(), noteDoc);
+        // ctx.setProperty("recipients", new Object[] { "jt@nuxeo.com" });
+        // ctx.getProperties().put("comment", "RAS");
+        // eventService.fireEvent(ctx.newEvent("workflowAbandoned"));
+        // getCoreSession().save();
+        // waitForAsyncExec();
+        // // Check that at least one email has been sending
+        // assertTrue(emailHelperMock.getCompteur() > 0);
     }
 
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-notification-core/src/test/java/org/nuxeo/ecm/platform/ec/notification/TestRegisterNotificationService.java
--- a/nuxeo-platform-notification-core/src/test/java/org/nuxeo/ecm/platform/ec/notification/TestRegisterNotificationService.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-notification-core/src/test/java/org/nuxeo/ecm/platform/ec/notification/TestRegisterNotificationService.java	Fri Mar 26 09:05:32 2010 +0100
@@ -30,9 +30,9 @@
 import org.nuxeo.runtime.test.NXRuntimeTestCase;
 
 /**
- *
+ * 
  * @author <a href="mailto:rspivak@nuxeo.com">Ruslan Spivak</a>
- *
+ * 
  */
 public class TestRegisterNotificationService extends NXRuntimeTestCase {
 
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-usersettings-alert-core/src/main/java/org/nuxeo/ecm/usersettings/alert/core/AlertSettingsConstants.java
--- a/nuxeo-platform-usersettings-alert-core/src/main/java/org/nuxeo/ecm/usersettings/alert/core/AlertSettingsConstants.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-usersettings-alert-core/src/main/java/org/nuxeo/ecm/usersettings/alert/core/AlertSettingsConstants.java	Fri Mar 26 09:05:32 2010 +0100
@@ -1,10 +1,11 @@
 package org.nuxeo.ecm.usersettings.alert.core;
 
-
 public interface AlertSettingsConstants {
 
     public static final String DOC_PREFIX = "nuxeoAlertSettings_";
+
     public static final String TITLE = "alertsettings.title";
+
     public static final String DESCRIPTION = "alertsettings.description";
 
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-usersettings-alert-core/src/main/java/org/nuxeo/ecm/usersettings/alert/core/AlertSettingsProvider.java
--- a/nuxeo-platform-usersettings-alert-core/src/main/java/org/nuxeo/ecm/usersettings/alert/core/AlertSettingsProvider.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-usersettings-alert-core/src/main/java/org/nuxeo/ecm/usersettings/alert/core/AlertSettingsProvider.java	Fri Mar 26 09:05:32 2010 +0100
@@ -20,19 +20,20 @@
 
     private static final Log log = LogFactory.getLog(AlertSettingsProvider.class);
 
-    public DocumentModelList getUserSettings(DocumentModel userWorkspace, CoreSession coreSession, String userName)
-	    throws ClientException {
+    public DocumentModelList getUserSettings(DocumentModel userWorkspace,
+            CoreSession coreSession, String userName) throws ClientException {
 
-	DocumentModelList list = coreSession.getChildren(userWorkspace.getRef(), "AlertSettings");
+        DocumentModelList list = coreSession.getChildren(
+                userWorkspace.getRef(), "AlertSettings");
 
-	if (list.size() > 0)
-	    return list;
+        if (list.size() > 0)
+            return list;
 
-	DocumentModelListImpl result = new DocumentModelListImpl();
+        DocumentModelListImpl result = new DocumentModelListImpl();
 
-	result.add(getUserSettings(userName, coreSession, userWorkspace));
+        result.add(getUserSettings(userName, coreSession, userWorkspace));
 
-	return result;
+        return result;
 
     }
 
@@ -42,23 +43,26 @@
      * @param userName The user we want to retrieve the preferences for
      * @param userCoreSession Current CoreSession
      * @param context Document context
-     * @param userWorkspace The user workspace in which the preferences document is created
+     * @param userWorkspace The user workspace in which the preferences document
+     *            is created
      * @return The user preferences document
      * @throws ClientException
      */
 
-    protected DocumentModel findUserSettings(String userName, CoreSession userCoreSession, DocumentModel userWorkspace)
-	    throws ClientException {
+    protected DocumentModel findUserSettings(String userName,
+            CoreSession userCoreSession, DocumentModel userWorkspace)
+            throws ClientException {
 
-	PathRef docRef = new PathRef(userWorkspace.getPathAsString(), AlertSettingsConstants.DOC_PREFIX + userName);
+        PathRef docRef = new PathRef(userWorkspace.getPathAsString(),
+                AlertSettingsConstants.DOC_PREFIX + userName);
 
-	DocumentModel result = null;
+        DocumentModel result = null;
 
-	if (userCoreSession.exists(docRef)) {
-	    result = userCoreSession.getDocument(docRef);
-	}
+        if (userCoreSession.exists(docRef)) {
+            result = userCoreSession.getDocument(docRef);
+        }
 
-	return result;
+        return result;
 
     }
 
@@ -74,75 +78,80 @@
      * 
      */
 
-    public DocumentModel getUserSettings(String userName, CoreSession userCoreSession, DocumentModel userWorkspace)
-	    throws ClientException {
+    public DocumentModel getUserSettings(String userName,
+            CoreSession userCoreSession, DocumentModel userWorkspace)
+            throws ClientException {
 
-	DocumentModel currentUserPreferences = findUserSettings(userName, userCoreSession, userWorkspace);
+        DocumentModel currentUserPreferences = findUserSettings(userName,
+                userCoreSession, userWorkspace);
 
-	if (currentUserPreferences == null)
-	    currentUserPreferences = createUserSettings(userCoreSession, userName, userWorkspace);
+        if (currentUserPreferences == null)
+            currentUserPreferences = createUserSettings(userCoreSession,
+                    userName, userWorkspace);
 
-	return currentUserPreferences;
+        return currentUserPreferences;
 
     }
 
-    protected DocumentModel createUserSettings(CoreSession userCoreSession, String userName, DocumentModel userWorkspace)
-	    throws ClientException {
+    protected DocumentModel createUserSettings(CoreSession userCoreSession,
+            String userName, DocumentModel userWorkspace)
+            throws ClientException {
 
-	log.info(String.format("Creating user settings document for user %s in %s", userName, userWorkspace.getPathAsString()));
+        log.info(String.format(
+                "Creating user settings document for user %s in %s", userName,
+                userWorkspace.getPathAsString()));
 
-	String parent = userWorkspace.getPathAsString();
+        String parent = userWorkspace.getPathAsString();
 
-	DocumentModel doc = userCoreSession.createDocumentModel(parent, AlertSettingsConstants.DOC_PREFIX + userName,
-		"AlertSettings");
+        DocumentModel doc = userCoreSession.createDocumentModel(parent,
+                AlertSettingsConstants.DOC_PREFIX + userName, "AlertSettings");
 
-	String title = getSafeMessage(AlertSettingsConstants.TITLE);
-	String description = getSafeMessage(AlertSettingsConstants.DESCRIPTION);
+        String title = getSafeMessage(AlertSettingsConstants.TITLE);
+        String description = getSafeMessage(AlertSettingsConstants.DESCRIPTION);
 
-	doc.setProperty("dublincore", "title", title);
-	doc.setProperty("dublincore", "description", description);
-	doc.setProperty("usersettings", "user", userName);
+        doc.setProperty("dublincore", "title", title);
+        doc.setProperty("dublincore", "description", description);
+        doc.setProperty("usersettings", "user", userName);
 
-	AlertSettingsWrapper w = new AlertSettingsWrapper(doc);
+        AlertSettingsWrapper w = new AlertSettingsWrapper(doc);
 
-	w.setNotificationPolicy(AlertSettingsType.NOTIFICATION_POLICY_BOTH);
-	w.setSummaryFrequency(AlertSettingsType.SUMMARY_FREQUENCY_DAILY);
-	w.setAlertDeliveryChannel(AlertSettingsType.ALERT_CHANNEL_HTML_MAIL);
-	w.setIncludeFutureTasks(true);
-	w.setIncludeFutureTasksDelay(7L);
-	w.setIncludeTasksWithoutDueDate(false);
+        w.setNotificationPolicy(AlertSettingsType.NOTIFICATION_POLICY_BOTH);
+        w.setSummaryFrequency(AlertSettingsType.SUMMARY_FREQUENCY_DAILY);
+        w.setAlertDeliveryChannel(AlertSettingsType.ALERT_CHANNEL_HTML_MAIL);
+        w.setIncludeFutureTasks(true);
+        w.setIncludeFutureTasksDelay(7L);
+        w.setIncludeTasksWithoutDueDate(false);
 
-	doc = userCoreSession.createDocument(doc);
+        doc = userCoreSession.createDocument(doc);
 
-	userCoreSession.save();
+        userCoreSession.save();
 
-	return doc;
+        return doc;
 
     }
 
     private String getSafeMessage(String key) {
-	try {
-	    return Messages.instance().get(key);
-	}
-	catch(Exception e) {
-	    return key;
-	}
+        try {
+            return Messages.instance().get(key);
+        } catch (Exception e) {
+            return key;
+        }
     }
 
     public Boolean isTypeSupported(String type) {
 
-	if ("AlertSettings".equals(type))
-	    return true;
+        if ("AlertSettings".equals(type))
+            return true;
 
-	return false;
+        return false;
     }
 
     public Boolean isTypeSupported(DocumentType type) {
 
-	if ("AlertSettings".equals(type.getName()))
-	    return true;
+        if ("AlertSettings".equals(type.getName()))
+            return true;
 
-	return false;
+        return false;
     }
 
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-usersettings-alert-core/src/test/java/org/nuxeo/ecm/usersettings/alert/core/RepositoryOSGITestCase.java
--- a/nuxeo-platform-usersettings-alert-core/src/test/java/org/nuxeo/ecm/usersettings/alert/core/RepositoryOSGITestCase.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-usersettings-alert-core/src/test/java/org/nuxeo/ecm/usersettings/alert/core/RepositoryOSGITestCase.java	Fri Mar 26 09:05:32 2010 +0100
@@ -52,156 +52,157 @@
     public static final String REPOSITORY_NAME = "demo";
 
     public static final String DOMAIN_NAME = "demo-domain";
-    
-    
+
     protected Repository repository;
 
     protected CoreSession coreSession;
 
     protected DocumentModel rootWorkspace = null;
-    
+
     protected DocumentModel domain = null;
 
     protected RepositoryOSGITestCase() {
     }
 
     protected RepositoryOSGITestCase(String name) {
-	super(name);
+        super(name);
     }
 
     protected void undeployBundle(String name) throws BundleException {
-	osgi.getRegistry().getBundle(name).uninstall();
+        osgi.getRegistry().getBundle(name).uninstall();
     }
-    
-    
+
     @Override
     public void setUp() throws Exception {
-	super.setUp();
-	
-	deployBundle("org.nuxeo.ecm.core.schema");
-	deployBundle("org.nuxeo.ecm.core.api");
-	deployBundle("org.nuxeo.ecm.core.event");
-	deployBundle("org.nuxeo.ecm.core");
-	deployBundle("org.nuxeo.ecm.core.jcr");
-	
+        super.setUp();
+
+        deployBundle("org.nuxeo.ecm.core.schema");
+        deployBundle("org.nuxeo.ecm.core.api");
+        deployBundle("org.nuxeo.ecm.core.event");
+        deployBundle("org.nuxeo.ecm.core");
+        deployBundle("org.nuxeo.ecm.core.jcr");
+
     }
 
     @Override
     public void tearDown() throws Exception {
-	
-	Framework.getLocalService(EventService.class).waitForAsyncCompletion();
-	releaseCoreSession();
-	releaseRepository();
-	
-	deployBundle("org.nuxeo.ecm.core.jcr");
-	deployBundle("org.nuxeo.ecm.core");
-	deployBundle("org.nuxeo.ecm.core.event");
-	deployBundle("org.nuxeo.ecm.core.api");
-	deployBundle("org.nuxeo.ecm.core.schema");
 
-	super.tearDown();
+        Framework.getLocalService(EventService.class).waitForAsyncCompletion();
+        releaseCoreSession();
+        releaseRepository();
+
+        deployBundle("org.nuxeo.ecm.core.jcr");
+        deployBundle("org.nuxeo.ecm.core");
+        deployBundle("org.nuxeo.ecm.core.event");
+        deployBundle("org.nuxeo.ecm.core.api");
+        deployBundle("org.nuxeo.ecm.core.schema");
+
+        super.tearDown();
     }
 
     protected void openRepositoryAsUser(String userName) throws Exception {
-	if (repository == null) {
-	    // the repository should be deployed the last
-	    // after any other bundle that is doctypes
-	    // this is nuxeo-core-jcr-connector-test
-	    repositoryDeploy();
-	    repository = NXCore.getRepositoryService().getRepositoryManager().getRepository(REPOSITORY_NAME);
-	}
-	openCoreSession(userName);
+        if (repository == null) {
+            // the repository should be deployed the last
+            // after any other bundle that is doctypes
+            // this is nuxeo-core-jcr-connector-test
+            repositoryDeploy();
+            repository = NXCore.getRepositoryService().getRepositoryManager().getRepository(
+                    REPOSITORY_NAME);
+        }
+        openCoreSession(userName);
     }
 
     protected void closeRepository() throws Exception {
-	releaseCoreSession();
-	releaseRepository();
-	repositoryUndeploy();
+        releaseCoreSession();
+        releaseRepository();
+        repositoryUndeploy();
     }
-    
+
     protected void repositoryDeploy() throws Exception {
-	if (!isRepositoryBundleDeployed) {
-	    deployBundle("org.nuxeo.ecm.core.jcr-connector");
-	    isRepositoryBundleDeployed = true;
-	}
+        if (!isRepositoryBundleDeployed) {
+            deployBundle("org.nuxeo.ecm.core.jcr-connector");
+            isRepositoryBundleDeployed = true;
+        }
     }
 
     protected void repositoryUndeploy() throws Exception {
-	if (isRepositoryBundleDeployed) {
-	    undeployBundle("org.nuxeo.ecm.core.jcr-connector");
-	    isRepositoryBundleDeployed = false;
-	}
+        if (isRepositoryBundleDeployed) {
+            undeployBundle("org.nuxeo.ecm.core.jcr-connector");
+            isRepositoryBundleDeployed = false;
+        }
     }
 
-
     public void openRepository() throws Exception {
-	openRepositoryAsUser("Administrator");
+        openRepositoryAsUser("Administrator");
     }
 
     public void openRepositoryWithSystemPrivileges() throws Exception {
-	openRepositoryAsUser(null);
+        openRepositoryAsUser(null);
     }
 
     public CoreSession getCoreSession() {
-	return coreSession;
+        return coreSession;
     }
 
     protected Repository getRepository() {
-	return repository;
+        return repository;
     }
 
     protected DocumentModel getRootWorkspace() throws ClientException {
-	if (rootWorkspace == null)
-	    createRootWorkspace();
-	return rootWorkspace;
+        if (rootWorkspace == null)
+            createRootWorkspace();
+        return rootWorkspace;
     }
 
     private void createRootWorkspace() throws ClientException {
-	domain = coreSession.createDocumentModel("/", RepositoryOSGITestCase.DOMAIN_NAME, "Domain");
-	domain = coreSession.createDocument(domain);
-	assertNotNull(domain);
-	rootWorkspace = coreSession.createDocumentModel(domain.getPathAsString(), RepositoryOSGITestCase.ROOT_WORKSPACE_NAME, "Workspace");
-	assertNotNull(rootWorkspace);
-	rootWorkspace = coreSession.createDocument(rootWorkspace);
-	coreSession.save();
+        domain = coreSession.createDocumentModel("/",
+                RepositoryOSGITestCase.DOMAIN_NAME, "Domain");
+        domain = coreSession.createDocument(domain);
+        assertNotNull(domain);
+        rootWorkspace = coreSession.createDocumentModel(
+                domain.getPathAsString(),
+                RepositoryOSGITestCase.ROOT_WORKSPACE_NAME, "Workspace");
+        assertNotNull(rootWorkspace);
+        rootWorkspace = coreSession.createDocument(rootWorkspace);
+        coreSession.save();
     }
 
     protected void openCoreSession(String userName) throws ClientException {
-	Map<String, Serializable> ctx = new HashMap<String, Serializable>();
-	ctx.put("username", userName);
-	coreSession = CoreInstance.getInstance().open(REPOSITORY_NAME, ctx);
-	assertNotNull(coreSession);
+        Map<String, Serializable> ctx = new HashMap<String, Serializable>();
+        ctx.put("username", userName);
+        coreSession = CoreInstance.getInstance().open(REPOSITORY_NAME, ctx);
+        assertNotNull(coreSession);
     }
 
     public void changeUser(String newUser) throws ClientException {
-	releaseCoreSession();
-	openCoreSession(newUser);
+        releaseCoreSession();
+        openCoreSession(newUser);
     }
 
     public void releaseRepository() {
-	if (repository != null) {
-	    repository.shutdown();
-	    repository = null;
-	}
+        if (repository != null) {
+            repository.shutdown();
+            repository = null;
+        }
     }
 
     public void releaseCoreSession() {
-	if (coreSession != null) {
-	    CoreInstance.getInstance().close(coreSession);
-	    coreSession = null;
-	}
+        if (coreSession != null) {
+            CoreInstance.getInstance().close(coreSession);
+            coreSession = null;
+        }
     }
 
     protected Session getSession() throws DocumentException {
-	return repository.getSession(null);
+        return repository.getSession(null);
     }
 
     protected EventServiceImpl eventService;
 
     protected void waitForEventsDispatched() {
-	if (eventService == null) {
-	    eventService = (EventServiceImpl) Framework.getLocalService(EventService.class);
-	}
-	eventService.waitForAsyncCompletion();
+        if (eventService == null) {
+            eventService = (EventServiceImpl) Framework.getLocalService(EventService.class);
+        }
+        eventService.waitForAsyncCompletion();
     }
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-usersettings-alert-core/src/test/java/org/nuxeo/ecm/usersettings/alert/core/TestAlertSettings.java
--- a/nuxeo-platform-usersettings-alert-core/src/test/java/org/nuxeo/ecm/usersettings/alert/core/TestAlertSettings.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-usersettings-alert-core/src/test/java/org/nuxeo/ecm/usersettings/alert/core/TestAlertSettings.java	Fri Mar 26 09:05:32 2010 +0100
@@ -1,4 +1,5 @@
 package org.nuxeo.ecm.usersettings.alert.core;
+
 /*
  * (C) Copyright 2006-2007 Nuxeo SAS (http://nuxeo.com/) and contributors.
  *
@@ -18,8 +19,6 @@
  * $Id: TestMultiDirectory.java 30378 2008-02-20 17:37:26Z gracinet $
  */
 
-
-
 import org.nuxeo.ecm.core.api.CoreSession;
 import org.nuxeo.ecm.core.api.DocumentModel;
 import org.nuxeo.ecm.core.api.DocumentModelList;
@@ -36,87 +35,90 @@
 public class TestAlertSettings extends RepositoryOSGITestCase {
 
     private CoreSession session;
+
     private UserSettingsService service;
 
-    
     @Override
     public void setUp() throws Exception {
 
-	super.setUp();
+        super.setUp();
 
-	// Bundle to be tested
-	deployBundle("org.nuxeo.ecm.usersettings.types");
-	deployBundle("org.nuxeo.ecm.usersettings.api");
-	deployBundle("org.nuxeo.ecm.usersettings.core");
-	deployBundle("org.nuxeo.ecm.usersettings.alert.types");
-	deployBundle("org.nuxeo.ecm.usersettings.alert.core");
-	deployBundle("org.nuxeo.ecm.platform.userworkspace.types");
-	deployBundle("org.nuxeo.ecm.platform.userworkspace.api");
-	deployBundle("org.nuxeo.ecm.platform.userworkspace.core");
+        // Bundle to be tested
+        deployBundle("org.nuxeo.ecm.usersettings.types");
+        deployBundle("org.nuxeo.ecm.usersettings.api");
+        deployBundle("org.nuxeo.ecm.usersettings.core");
+        deployBundle("org.nuxeo.ecm.usersettings.alert.types");
+        deployBundle("org.nuxeo.ecm.usersettings.alert.core");
+        deployBundle("org.nuxeo.ecm.platform.userworkspace.types");
+        deployBundle("org.nuxeo.ecm.platform.userworkspace.api");
+        deployBundle("org.nuxeo.ecm.platform.userworkspace.core");
 
-	// Initialize the test environment
-	openRepositoryAsUser("Administrator");
-	session = getCoreSession();
-	getRootWorkspace();
+        // Initialize the test environment
+        openRepositoryAsUser("Administrator");
+        session = getCoreSession();
+        getRootWorkspace();
 
-	service = Framework.getLocalService(UserSettingsService.class);
+        service = Framework.getLocalService(UserSettingsService.class);
 
     }
 
-
     @Override
     public void tearDown() throws Exception {
 
-	try {
-	    Framework.getLocalService(EventService.class).waitForAsyncCompletion();
-	} catch (Exception e) {
-	}
+        try {
+            Framework.getLocalService(EventService.class).waitForAsyncCompletion();
+        } catch (Exception e) {
+        }
 
-	closeRepository();
+        closeRepository();
 
-	undeployBundle("org.nuxeo.ecm.platform.userworkspace.core");
-	undeployBundle("org.nuxeo.ecm.platform.userworkspace.api"); 
-	undeployBundle("org.nuxeo.ecm.platform.userworkspace.types");
-	undeployBundle("org.nuxeo.ecm.usersettings.alert.core");
-	undeployBundle("org.nuxeo.ecm.usersettings.alert.types");
-	undeployBundle("org.nuxeo.ecm.usersettings.core");
-	undeployBundle("org.nuxeo.ecm.usersettings.api");
-	undeployBundle("org.nuxeo.ecm.usersettings.types");
+        undeployBundle("org.nuxeo.ecm.platform.userworkspace.core");
+        undeployBundle("org.nuxeo.ecm.platform.userworkspace.api");
+        undeployBundle("org.nuxeo.ecm.platform.userworkspace.types");
+        undeployBundle("org.nuxeo.ecm.usersettings.alert.core");
+        undeployBundle("org.nuxeo.ecm.usersettings.alert.types");
+        undeployBundle("org.nuxeo.ecm.usersettings.core");
+        undeployBundle("org.nuxeo.ecm.usersettings.api");
+        undeployBundle("org.nuxeo.ecm.usersettings.types");
 
-	super.tearDown();
+        super.tearDown();
 
     }
 
     public void testGetAllCurrentUserSettings() throws Exception {
-	
-	assertEquals(1, service.getAllRegisteredProviders().size());
-	DocumentModelList result = service.getCurrentUserSettings(session, AlertSettingsType.DOCTYPE);
-	assertNotNull(result);
-	assertEquals(1, result.size());
-	DocumentModel doc = result.get(0);
-	assertTrue(doc.getType().equals(AlertSettingsType.DOCTYPE));
-	AlertSettingsWrapper w = new AlertSettingsWrapper(doc);
 
-	assertTrue(w.getNotificationPolicy().equals(AlertSettingsType.NOTIFICATION_POLICY_BOTH));
-	assertTrue(w.getSummaryFrequency().equals(AlertSettingsType.SUMMARY_FREQUENCY_DAILY));
-	assertTrue(w.getIncludeFutureTasks());
-	assertTrue(7L==w.getIncludeFutureTasksDelay());
-	assertFalse(w.getIncludeTasksWithoutDueDate());
+        assertEquals(1, service.getAllRegisteredProviders().size());
+        DocumentModelList result = service.getCurrentUserSettings(session,
+                AlertSettingsType.DOCTYPE);
+        assertNotNull(result);
+        assertEquals(1, result.size());
+        DocumentModel doc = result.get(0);
+        assertTrue(doc.getType().equals(AlertSettingsType.DOCTYPE));
+        AlertSettingsWrapper w = new AlertSettingsWrapper(doc);
 
-	w.setNotificationPolicy(AlertSettingsType.NOTIFICATION_POLICY_IMMEDIATE);
-	w.setSummaryFrequency(AlertSettingsType.SUMMARY_FREQUENCY_NEVER);
-	w.setIncludeFutureTasks(false);
-	w.setIncludeFutureTasksDelay(15L);
-	w.setIncludeTasksWithoutDueDate(true);
-	
-	session.saveDocument(doc);
-	
-	assertTrue(w.getNotificationPolicy().equals(AlertSettingsType.NOTIFICATION_POLICY_IMMEDIATE));
-	assertTrue(w.getSummaryFrequency().equals(AlertSettingsType.SUMMARY_FREQUENCY_NEVER));
-	assertFalse(w.getIncludeFutureTasks());
-	assertTrue(15L==w.getIncludeFutureTasksDelay());
-	assertTrue(w.getIncludeTasksWithoutDueDate());
+        assertTrue(w.getNotificationPolicy().equals(
+                AlertSettingsType.NOTIFICATION_POLICY_BOTH));
+        assertTrue(w.getSummaryFrequency().equals(
+                AlertSettingsType.SUMMARY_FREQUENCY_DAILY));
+        assertTrue(w.getIncludeFutureTasks());
+        assertTrue(7L == w.getIncludeFutureTasksDelay());
+        assertFalse(w.getIncludeTasksWithoutDueDate());
 
+        w.setNotificationPolicy(AlertSettingsType.NOTIFICATION_POLICY_IMMEDIATE);
+        w.setSummaryFrequency(AlertSettingsType.SUMMARY_FREQUENCY_NEVER);
+        w.setIncludeFutureTasks(false);
+        w.setIncludeFutureTasksDelay(15L);
+        w.setIncludeTasksWithoutDueDate(true);
+
+        session.saveDocument(doc);
+
+        assertTrue(w.getNotificationPolicy().equals(
+                AlertSettingsType.NOTIFICATION_POLICY_IMMEDIATE));
+        assertTrue(w.getSummaryFrequency().equals(
+                AlertSettingsType.SUMMARY_FREQUENCY_NEVER));
+        assertFalse(w.getIncludeFutureTasks());
+        assertTrue(15L == w.getIncludeFutureTasksDelay());
+        assertTrue(w.getIncludeTasksWithoutDueDate());
 
     }
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-usersettings-alert-types/src/main/java/org/nuxeo/em/usersettings/alert/types/AlertSettingsType.java
--- a/nuxeo-platform-usersettings-alert-types/src/main/java/org/nuxeo/em/usersettings/alert/types/AlertSettingsType.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-usersettings-alert-types/src/main/java/org/nuxeo/em/usersettings/alert/types/AlertSettingsType.java	Fri Mar 26 09:05:32 2010 +0100
@@ -3,25 +3,37 @@
 public interface AlertSettingsType {
 
     public static final String SCHEMA = "alertsettings";
+
     public static final String DOCTYPE = "AlertSettings";
+
     public static final String SCHEMA_PREFIX = "alert";
 
     public static final String PROP_INCLUDE_TASKS_WITHOUT_DUE_DATE = "includeTasksWithoutDueDate";
+
     public static final String PROP_INCLUDE_FUTURE_TASKS_DELAY = "includeFutureTasksDelay";
+
     public static final String PROP_INCLUDE_FUTURE_TASKS = "includeFutureTasks";
+
     public static final String PROP_SUMMARY_FREQUENCY = "summaryFrequency";
+
     public static final String PROP_NOTIFICATION_POLICY = "notificationPolicy";
+
     public static final String PROP_ALERT_CHANNEL = "alertChannel";
 
     public static final String NOTIFICATION_POLICY_IMMEDIATE = "immediate";
+
     public static final String NOTIFICATION_POLICY_SUMMARY = "summary";
+
     public static final String NOTIFICATION_POLICY_BOTH = "both";
 
     public static final String SUMMARY_FREQUENCY_NEVER = "never";
+
     public static final String SUMMARY_FREQUENCY_TWICE_DAY = "twice";
+
     public static final String SUMMARY_FREQUENCY_DAILY = "daily";
 
     public static final String ALERT_CHANNEL_TEXT_MAIL = "textmail";
+
     public static final String ALERT_CHANNEL_HTML_MAIL = "htmlmail";
-    
+
 }
\ No newline at end of file
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-usersettings-alert-types/src/main/java/org/nuxeo/em/usersettings/alert/types/AlertSettingsWrapper.java
--- a/nuxeo-platform-usersettings-alert-types/src/main/java/org/nuxeo/em/usersettings/alert/types/AlertSettingsWrapper.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-usersettings-alert-types/src/main/java/org/nuxeo/em/usersettings/alert/types/AlertSettingsWrapper.java	Fri Mar 26 09:05:32 2010 +0100
@@ -7,69 +7,90 @@
 
 public class AlertSettingsWrapper implements AlertSettingsType {
 
-	public DocumentModel doc;
+    public DocumentModel doc;
 
-	public AlertSettingsWrapper(DocumentModel userSettings) throws ClientException {
+    public AlertSettingsWrapper(DocumentModel userSettings)
+            throws ClientException {
 
-		doc = userSettings;
+        doc = userSettings;
 
-	}
+    }
 
-	public void setUser(String user) throws ClientException {
-		doc.setProperty(UserSettingsType.SCHEMA, UserSettingsType.PROP_USER, user);
-	}
+    public void setUser(String user) throws ClientException {
+        doc.setProperty(UserSettingsType.SCHEMA, UserSettingsType.PROP_USER,
+                user);
+    }
 
-	public String getUser() throws ClientException {
-		return (String) doc.getProperty(UserSettingsType.SCHEMA, UserSettingsType.PROP_USER);
-	}
+    public String getUser() throws ClientException {
+        return (String) doc.getProperty(UserSettingsType.SCHEMA,
+                UserSettingsType.PROP_USER);
+    }
 
-	public void setNotificationPolicy(String notificationPolicy) throws ClientException {
-		doc.setProperty(AlertSettingsType.SCHEMA, AlertSettingsType.PROP_NOTIFICATION_POLICY, notificationPolicy);
-	}
+    public void setNotificationPolicy(String notificationPolicy)
+            throws ClientException {
+        doc.setProperty(AlertSettingsType.SCHEMA,
+                AlertSettingsType.PROP_NOTIFICATION_POLICY, notificationPolicy);
+    }
 
-	public String getNotificationPolicy() throws ClientException {
-		return (String) doc.getProperty(AlertSettingsType.SCHEMA, AlertSettingsType.PROP_NOTIFICATION_POLICY);
-	}
+    public String getNotificationPolicy() throws ClientException {
+        return (String) doc.getProperty(AlertSettingsType.SCHEMA,
+                AlertSettingsType.PROP_NOTIFICATION_POLICY);
+    }
 
-	public void setSummaryFrequency(String summaryFrequency) throws ClientException {
-		doc.setProperty(AlertSettingsType.SCHEMA, AlertSettingsType.PROP_SUMMARY_FREQUENCY, summaryFrequency);
-	}
+    public void setSummaryFrequency(String summaryFrequency)
+            throws ClientException {
+        doc.setProperty(AlertSettingsType.SCHEMA,
+                AlertSettingsType.PROP_SUMMARY_FREQUENCY, summaryFrequency);
+    }
 
-	public String getSummaryFrequency() throws ClientException {
-		return (String) doc.getProperty(AlertSettingsType.SCHEMA, AlertSettingsType.PROP_SUMMARY_FREQUENCY);
-	}
+    public String getSummaryFrequency() throws ClientException {
+        return (String) doc.getProperty(AlertSettingsType.SCHEMA,
+                AlertSettingsType.PROP_SUMMARY_FREQUENCY);
+    }
 
-	public void setIncludeFutureTasks(Boolean includeFutureTasks) throws ClientException {
-		doc.setProperty(AlertSettingsType.SCHEMA, AlertSettingsType.PROP_INCLUDE_FUTURE_TASKS, includeFutureTasks);
-	}
+    public void setIncludeFutureTasks(Boolean includeFutureTasks)
+            throws ClientException {
+        doc.setProperty(AlertSettingsType.SCHEMA,
+                AlertSettingsType.PROP_INCLUDE_FUTURE_TASKS, includeFutureTasks);
+    }
 
-	public Boolean getIncludeFutureTasks() throws ClientException {
-		return (Boolean) doc.getProperty(AlertSettingsType.SCHEMA, AlertSettingsType.PROP_INCLUDE_FUTURE_TASKS);
-	}
+    public Boolean getIncludeFutureTasks() throws ClientException {
+        return (Boolean) doc.getProperty(AlertSettingsType.SCHEMA,
+                AlertSettingsType.PROP_INCLUDE_FUTURE_TASKS);
+    }
 
-	public void setIncludeFutureTasksDelay(Long includeFutureTasksDelay) throws ClientException {
-		doc.setProperty(AlertSettingsType.SCHEMA, AlertSettingsType.PROP_INCLUDE_FUTURE_TASKS_DELAY, includeFutureTasksDelay);
-	}
+    public void setIncludeFutureTasksDelay(Long includeFutureTasksDelay)
+            throws ClientException {
+        doc.setProperty(AlertSettingsType.SCHEMA,
+                AlertSettingsType.PROP_INCLUDE_FUTURE_TASKS_DELAY,
+                includeFutureTasksDelay);
+    }
 
-	public Long getIncludeFutureTasksDelay() throws ClientException {
-		return (Long) doc.getProperty(AlertSettingsType.SCHEMA, AlertSettingsType.PROP_INCLUDE_FUTURE_TASKS_DELAY);
-	}
+    public Long getIncludeFutureTasksDelay() throws ClientException {
+        return (Long) doc.getProperty(AlertSettingsType.SCHEMA,
+                AlertSettingsType.PROP_INCLUDE_FUTURE_TASKS_DELAY);
+    }
 
-	public void setIncludeTasksWithoutDueDate(Boolean includeTasksWithoutDueDate) throws ClientException {
-		doc
-				.setProperty(AlertSettingsType.SCHEMA, AlertSettingsType.PROP_INCLUDE_TASKS_WITHOUT_DUE_DATE,
-						includeTasksWithoutDueDate);
-	}
+    public void setIncludeTasksWithoutDueDate(Boolean includeTasksWithoutDueDate)
+            throws ClientException {
+        doc.setProperty(AlertSettingsType.SCHEMA,
+                AlertSettingsType.PROP_INCLUDE_TASKS_WITHOUT_DUE_DATE,
+                includeTasksWithoutDueDate);
+    }
 
-	public Boolean getIncludeTasksWithoutDueDate() throws ClientException {
-		return (Boolean) doc.getProperty(AlertSettingsType.SCHEMA, AlertSettingsType.PROP_INCLUDE_TASKS_WITHOUT_DUE_DATE);
-	}
+    public Boolean getIncludeTasksWithoutDueDate() throws ClientException {
+        return (Boolean) doc.getProperty(AlertSettingsType.SCHEMA,
+                AlertSettingsType.PROP_INCLUDE_TASKS_WITHOUT_DUE_DATE);
+    }
 
-	public void setAlertDeliveryChannel(String alertChannel) throws ClientException {
-		doc.setProperty(AlertSettingsType.SCHEMA, AlertSettingsType.PROP_ALERT_CHANNEL, alertChannel);
-	}
+    public void setAlertDeliveryChannel(String alertChannel)
+            throws ClientException {
+        doc.setProperty(AlertSettingsType.SCHEMA,
+                AlertSettingsType.PROP_ALERT_CHANNEL, alertChannel);
+    }
 
-	public String getAlertDeliveryChannel() throws ClientException {
-		return (String) doc.getProperty(AlertSettingsType.SCHEMA, AlertSettingsType.PROP_ALERT_CHANNEL);
-	}
+    public String getAlertDeliveryChannel() throws ClientException {
+        return (String) doc.getProperty(AlertSettingsType.SCHEMA,
+                AlertSettingsType.PROP_ALERT_CHANNEL);
+    }
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-usersettings-alert-types/src/test/java/com/nuxeo/ecm/alertsettings/types/RepositoryOSGITestCase.java
--- a/nuxeo-platform-usersettings-alert-types/src/test/java/com/nuxeo/ecm/alertsettings/types/RepositoryOSGITestCase.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-usersettings-alert-types/src/test/java/com/nuxeo/ecm/alertsettings/types/RepositoryOSGITestCase.java	Fri Mar 26 09:05:32 2010 +0100
@@ -50,156 +50,157 @@
     public static final String REPOSITORY_NAME = "demo";
 
     public static final String DOMAIN_NAME = "demo-domain";
-    
-    
+
     protected Repository repository;
 
     protected CoreSession coreSession;
 
     protected DocumentModel rootWorkspace = null;
-    
+
     protected DocumentModel domain = null;
 
     protected RepositoryOSGITestCase() {
     }
 
     protected RepositoryOSGITestCase(String name) {
-	super(name);
+        super(name);
     }
 
     protected void undeployBundle(String name) throws BundleException {
-	osgi.getRegistry().getBundle(name).uninstall();
+        osgi.getRegistry().getBundle(name).uninstall();
     }
-    
-    
+
     @Override
     public void setUp() throws Exception {
-	super.setUp();
-	
-	deployBundle("org.nuxeo.ecm.core.schema");
-	deployBundle("org.nuxeo.ecm.core.api");
-	deployBundle("org.nuxeo.ecm.core.event");
-	deployBundle("org.nuxeo.ecm.core");
-	deployBundle("org.nuxeo.ecm.core.jcr");
-	
+        super.setUp();
+
+        deployBundle("org.nuxeo.ecm.core.schema");
+        deployBundle("org.nuxeo.ecm.core.api");
+        deployBundle("org.nuxeo.ecm.core.event");
+        deployBundle("org.nuxeo.ecm.core");
+        deployBundle("org.nuxeo.ecm.core.jcr");
+
     }
 
     @Override
     public void tearDown() throws Exception {
-	
-	Framework.getLocalService(EventService.class).waitForAsyncCompletion();
-	releaseCoreSession();
-	releaseRepository();
-	
-	deployBundle("org.nuxeo.ecm.core.jcr");
-	deployBundle("org.nuxeo.ecm.core");
-	deployBundle("org.nuxeo.ecm.core.event");
-	deployBundle("org.nuxeo.ecm.core.api");
-	deployBundle("org.nuxeo.ecm.core.schema");
 
-	super.tearDown();
+        Framework.getLocalService(EventService.class).waitForAsyncCompletion();
+        releaseCoreSession();
+        releaseRepository();
+
+        deployBundle("org.nuxeo.ecm.core.jcr");
+        deployBundle("org.nuxeo.ecm.core");
+        deployBundle("org.nuxeo.ecm.core.event");
+        deployBundle("org.nuxeo.ecm.core.api");
+        deployBundle("org.nuxeo.ecm.core.schema");
+
+        super.tearDown();
     }
 
     protected void openRepositoryAsUser(String userName) throws Exception {
-	if (repository == null) {
-	    // the repository should be deployed the last
-	    // after any other bundle that is doctypes
-	    // this is nuxeo-core-jcr-connector-test
-	    repositoryDeploy();
-	    repository = NXCore.getRepositoryService().getRepositoryManager().getRepository(REPOSITORY_NAME);
-	}
-	openCoreSession(userName);
+        if (repository == null) {
+            // the repository should be deployed the last
+            // after any other bundle that is doctypes
+            // this is nuxeo-core-jcr-connector-test
+            repositoryDeploy();
+            repository = NXCore.getRepositoryService().getRepositoryManager().getRepository(
+                    REPOSITORY_NAME);
+        }
+        openCoreSession(userName);
     }
 
     protected void closeRepository() throws Exception {
-	releaseCoreSession();
-	releaseRepository();
-	repositoryUndeploy();
+        releaseCoreSession();
+        releaseRepository();
+        repositoryUndeploy();
     }
-    
+
     protected void repositoryDeploy() throws Exception {
-	if (!isRepositoryBundleDeployed) {
-	    deployBundle("org.nuxeo.ecm.core.jcr-connector");
-	    isRepositoryBundleDeployed = true;
-	}
+        if (!isRepositoryBundleDeployed) {
+            deployBundle("org.nuxeo.ecm.core.jcr-connector");
+            isRepositoryBundleDeployed = true;
+        }
     }
 
     protected void repositoryUndeploy() throws Exception {
-	if (isRepositoryBundleDeployed) {
-	    undeployBundle("org.nuxeo.ecm.core.jcr-connector");
-	    isRepositoryBundleDeployed = false;
-	}
+        if (isRepositoryBundleDeployed) {
+            undeployBundle("org.nuxeo.ecm.core.jcr-connector");
+            isRepositoryBundleDeployed = false;
+        }
     }
 
-
     public void openRepository() throws Exception {
-	openRepositoryAsUser("Administrator");
+        openRepositoryAsUser("Administrator");
     }
 
     public void openRepositoryWithSystemPrivileges() throws Exception {
-	openRepositoryAsUser(null);
+        openRepositoryAsUser(null);
     }
 
     public CoreSession getCoreSession() {
-	return coreSession;
+        return coreSession;
     }
 
     protected Repository getRepository() {
-	return repository;
+        return repository;
     }
 
     protected DocumentModel getRootWorkspace() throws ClientException {
-	if (rootWorkspace == null)
-	    createRootWorkspace();
-	return rootWorkspace;
+        if (rootWorkspace == null)
+            createRootWorkspace();
+        return rootWorkspace;
     }
 
     private void createRootWorkspace() throws ClientException {
-	domain = coreSession.createDocumentModel("/", RepositoryOSGITestCase.DOMAIN_NAME, "Domain");
-	domain = coreSession.createDocument(domain);
-	assertNotNull(domain);
-	rootWorkspace = coreSession.createDocumentModel(domain.getPathAsString(), RepositoryOSGITestCase.ROOT_WORKSPACE_NAME, "Workspace");
-	assertNotNull(rootWorkspace);
-	rootWorkspace = coreSession.createDocument(rootWorkspace);
-	coreSession.save();
+        domain = coreSession.createDocumentModel("/",
+                RepositoryOSGITestCase.DOMAIN_NAME, "Domain");
+        domain = coreSession.createDocument(domain);
+        assertNotNull(domain);
+        rootWorkspace = coreSession.createDocumentModel(
+                domain.getPathAsString(),
+                RepositoryOSGITestCase.ROOT_WORKSPACE_NAME, "Workspace");
+        assertNotNull(rootWorkspace);
+        rootWorkspace = coreSession.createDocument(rootWorkspace);
+        coreSession.save();
     }
 
     protected void openCoreSession(String userName) throws ClientException {
-	Map<String, Serializable> ctx = new HashMap<String, Serializable>();
-	ctx.put("username", userName);
-	coreSession = CoreInstance.getInstance().open(REPOSITORY_NAME, ctx);
-	assertNotNull(coreSession);
+        Map<String, Serializable> ctx = new HashMap<String, Serializable>();
+        ctx.put("username", userName);
+        coreSession = CoreInstance.getInstance().open(REPOSITORY_NAME, ctx);
+        assertNotNull(coreSession);
     }
 
     public void changeUser(String newUser) throws ClientException {
-	releaseCoreSession();
-	openCoreSession(newUser);
+        releaseCoreSession();
+        openCoreSession(newUser);
     }
 
     public void releaseRepository() {
-	if (repository != null) {
-	    repository.shutdown();
-	    repository = null;
-	}
+        if (repository != null) {
+            repository.shutdown();
+            repository = null;
+        }
     }
 
     public void releaseCoreSession() {
-	if (coreSession != null) {
-	    CoreInstance.getInstance().close(coreSession);
-	    coreSession = null;
-	}
+        if (coreSession != null) {
+            CoreInstance.getInstance().close(coreSession);
+            coreSession = null;
+        }
     }
 
     protected Session getSession() throws DocumentException {
-	return repository.getSession(null);
+        return repository.getSession(null);
     }
 
     protected EventServiceImpl eventService;
 
     protected void waitForEventsDispatched() {
-	if (eventService == null) {
-	    eventService = (EventServiceImpl) Framework.getLocalService(EventService.class);
-	}
-	eventService.waitForAsyncCompletion();
+        if (eventService == null) {
+            eventService = (EventServiceImpl) Framework.getLocalService(EventService.class);
+        }
+        eventService.waitForAsyncCompletion();
     }
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-usersettings-alert-types/src/test/java/com/nuxeo/ecm/alertsettings/types/TestAlertSettings.java
--- a/nuxeo-platform-usersettings-alert-types/src/test/java/com/nuxeo/ecm/alertsettings/types/TestAlertSettings.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-usersettings-alert-types/src/test/java/com/nuxeo/ecm/alertsettings/types/TestAlertSettings.java	Fri Mar 26 09:05:32 2010 +0100
@@ -19,7 +19,6 @@
 
 package com.nuxeo.ecm.alertsettings.types;
 
-
 import org.nuxeo.ecm.core.api.ClientException;
 import org.nuxeo.ecm.core.api.CoreSession;
 import org.nuxeo.ecm.core.api.DocumentModel;
@@ -32,78 +31,76 @@
 
 import com.nuxeo.ecm.usersettings.types.UserSettingsType;
 
-
-
 /**
  * @author <a href="mailto:christophe.capon@vilogia.fr">Christophe Capon</a>
  */
 public class TestAlertSettings extends RepositoryOSGITestCase {
 
-    
     private static final String TEST_USERNAME1 = "testusername";
+
     private static final String TEST_USERNAME2 = "testusername2";
-    
+
     private CoreSession session;
+
     private DocumentModel root;
 
-    
     @Override
     public void setUp() throws Exception {
 
-	super.setUp();
+        super.setUp();
 
-	// Bundle to be tested
-	deployBundle("org.nuxeo.ecm.usersettings.types");
-	deployBundle("org.nuxeo.ecm.usersettings.api");
-	deployBundle("org.nuxeo.ecm.usersettings.alert.types");
+        // Bundle to be tested
+        deployBundle("org.nuxeo.ecm.usersettings.types");
+        deployBundle("org.nuxeo.ecm.usersettings.api");
+        deployBundle("org.nuxeo.ecm.usersettings.alert.types");
 
+        // Initialize the test environment
+        openRepositoryAsUser("Administrator");
+        session = getCoreSession();
+        root = getRootWorkspace();
 
-	// Initialize the test environment
-	openRepositoryAsUser("Administrator");
-	session = getCoreSession();
-	root = getRootWorkspace();
-
-	checkDeployment();
+        checkDeployment();
 
     }
 
     private void checkDeployment() throws Exception {
-	SchemaManager smgr = Framework.getService(SchemaManager.class);
+        SchemaManager smgr = Framework.getService(SchemaManager.class);
 
-	assertNotNull(smgr);
+        assertNotNull(smgr);
 
-	assertNotNull(smgr.getSchema(UserSettingsType.SCHEMA));
-	assertNotNull(smgr.getSchema(AlertSettingsType.SCHEMA));
+        assertNotNull(smgr.getSchema(UserSettingsType.SCHEMA));
+        assertNotNull(smgr.getSchema(AlertSettingsType.SCHEMA));
 
-	assertNotNull(smgr.getDocumentType(UserSettingsType.DOCTYPE));
-	assertNotNull(smgr.getDocumentType(AlertSettingsType.DOCTYPE));
+        assertNotNull(smgr.getDocumentType(UserSettingsType.DOCTYPE));
+        assertNotNull(smgr.getDocumentType(AlertSettingsType.DOCTYPE));
 
     }
 
     @Override
     public void tearDown() throws Exception {
 
-	try {
-	    Framework.getLocalService(EventService.class).waitForAsyncCompletion();
-	} catch (Exception e) {
-	}
+        try {
+            Framework.getLocalService(EventService.class).waitForAsyncCompletion();
+        } catch (Exception e) {
+        }
 
-	closeRepository();
+        closeRepository();
 
-	undeployBundle("org.nuxeo.ecm.usersettings.alert.types");
-	undeployBundle("org.nuxeo.ecm.usersettings.api");
-	undeployBundle("org.nuxeo.ecm.usersettings.types");
+        undeployBundle("org.nuxeo.ecm.usersettings.alert.types");
+        undeployBundle("org.nuxeo.ecm.usersettings.api");
+        undeployBundle("org.nuxeo.ecm.usersettings.types");
 
-	super.tearDown();
+        super.tearDown();
 
     }
 
     public void testCreateAlertSettingsDocument() throws Exception {
         DocumentModel doc = createAlertSettingsDoc();
-        Object o = doc.getProperty(UserSettingsType.SCHEMA, UserSettingsType.PROP_USER);
+        Object o = doc.getProperty(UserSettingsType.SCHEMA,
+                UserSettingsType.PROP_USER);
         assertNotNull(o);
         assertTrue(o instanceof String);
-        assertEquals(TEST_USERNAME1, (String)o);
+        assertEquals(TEST_USERNAME1, (String) o);
         session.removeDocument(new IdRef(doc.getId()));
     }
 
@@ -112,37 +109,48 @@
         AlertSettingsWrapper w = new AlertSettingsWrapper(doc);
         assertEquals(TEST_USERNAME1, w.getUser());
         assertFalse(w.getIncludeFutureTasks());
-        assertTrue(20L==w.getIncludeFutureTasksDelay());
+        assertTrue(20L == w.getIncludeFutureTasksDelay());
         assertFalse(w.getIncludeTasksWithoutDueDate());
-        assertEquals(AlertSettingsType.NOTIFICATION_POLICY_BOTH, w.getNotificationPolicy());
-        assertEquals(AlertSettingsType.SUMMARY_FREQUENCY_DAILY, w.getSummaryFrequency());
-        assertEquals(AlertSettingsType.ALERT_CHANNEL_TEXT_MAIL, w.getAlertDeliveryChannel());
+        assertEquals(AlertSettingsType.NOTIFICATION_POLICY_BOTH,
+                w.getNotificationPolicy());
+        assertEquals(AlertSettingsType.SUMMARY_FREQUENCY_DAILY,
+                w.getSummaryFrequency());
+        assertEquals(AlertSettingsType.ALERT_CHANNEL_TEXT_MAIL,
+                w.getAlertDeliveryChannel());
         w.setUser(TEST_USERNAME2);
         session.saveDocument(doc);
-        assertEquals(TEST_USERNAME2, w.getUser());        
+        assertEquals(TEST_USERNAME2, w.getUser());
         session.removeDocument(new IdRef(doc.getId()));
     }
 
     private DocumentModel createAlertSettingsDoc() throws ClientException {
-	
-	DocumentModel testDoc = session.createDocumentModel(root.getPathAsString(), "UserSettingsInstance", "AlertSettings");
+
+        DocumentModel testDoc = session.createDocumentModel(
+                root.getPathAsString(), "UserSettingsInstance", "AlertSettings");
         assertNotNull(testDoc);
-        
-        testDoc.setProperty(UserSettingsType.SCHEMA, UserSettingsType.PROP_USER, TEST_USERNAME1);
-        testDoc.setProperty(AlertSettingsType.SCHEMA, AlertSettingsType.PROP_INCLUDE_FUTURE_TASKS, false);
-        testDoc.setProperty(AlertSettingsType.SCHEMA, AlertSettingsType.PROP_INCLUDE_FUTURE_TASKS_DELAY, 20);
-        testDoc.setProperty(AlertSettingsType.SCHEMA, AlertSettingsType.PROP_INCLUDE_TASKS_WITHOUT_DUE_DATE, false);
-        testDoc.setProperty(AlertSettingsType.SCHEMA, AlertSettingsType.PROP_NOTIFICATION_POLICY, AlertSettingsType.NOTIFICATION_POLICY_BOTH);
-        testDoc.setProperty(AlertSettingsType.SCHEMA, AlertSettingsType.PROP_SUMMARY_FREQUENCY, AlertSettingsType.SUMMARY_FREQUENCY_DAILY);
-        testDoc.setProperty(AlertSettingsType.SCHEMA, AlertSettingsType.PROP_ALERT_CHANNEL, AlertSettingsType.ALERT_CHANNEL_TEXT_MAIL);
+
+        testDoc.setProperty(UserSettingsType.SCHEMA,
+                UserSettingsType.PROP_USER, TEST_USERNAME1);
+        testDoc.setProperty(AlertSettingsType.SCHEMA,
+                AlertSettingsType.PROP_INCLUDE_FUTURE_TASKS, false);
+        testDoc.setProperty(AlertSettingsType.SCHEMA,
+                AlertSettingsType.PROP_INCLUDE_FUTURE_TASKS_DELAY, 20);
+        testDoc.setProperty(AlertSettingsType.SCHEMA,
+                AlertSettingsType.PROP_INCLUDE_TASKS_WITHOUT_DUE_DATE, false);
+        testDoc.setProperty(AlertSettingsType.SCHEMA,
+                AlertSettingsType.PROP_NOTIFICATION_POLICY,
+                AlertSettingsType.NOTIFICATION_POLICY_BOTH);
+        testDoc.setProperty(AlertSettingsType.SCHEMA,
+                AlertSettingsType.PROP_SUMMARY_FREQUENCY,
+                AlertSettingsType.SUMMARY_FREQUENCY_DAILY);
+        testDoc.setProperty(AlertSettingsType.SCHEMA,
+                AlertSettingsType.PROP_ALERT_CHANNEL,
+                AlertSettingsType.ALERT_CHANNEL_TEXT_MAIL);
 
         testDoc = session.createDocument(testDoc);
         session.saveDocument(testDoc);
-	return testDoc;
-	
+        return testDoc;
+
     }
-    
-    
 
- 
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-usersettings-alert-web/src/main/java/org/nuxeo/ecm/usersettings/alert/web/impl/AlertSettingsActionsBean.java
--- a/nuxeo-platform-usersettings-alert-web/src/main/java/org/nuxeo/ecm/usersettings/alert/web/impl/AlertSettingsActionsBean.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-usersettings-alert-web/src/main/java/org/nuxeo/ecm/usersettings/alert/web/impl/AlertSettingsActionsBean.java	Fri Mar 26 09:05:32 2010 +0100
@@ -49,7 +49,6 @@
 
     private static final String DOCUMENT_VIEW = "view_documents";
 
-
     // Rux INA-252: another cause of passivation error
     @In(required = true)
     private transient NavigationContext navigationContext;
@@ -59,15 +58,14 @@
 
     public String update(DocumentActions docActions) throws ClientException {
 
-	// Call the standard save method
-	docActions.updateDocument();
-	
-	// Go to the parent workspace, ie the general settings page
-	navigationContext.setCurrentDocument(documentManager.getDocument(navigationContext.getCurrentDocument().getParentRef()));
+        // Call the standard save method
+        docActions.updateDocument();
 
-	return DOCUMENT_VIEW;
+        // Go to the parent workspace, ie the general settings page
+        navigationContext.setCurrentDocument(documentManager.getDocument(navigationContext.getCurrentDocument().getParentRef()));
+
+        return DOCUMENT_VIEW;
 
     }
 
-
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-usersettings-api/src/main/java/org/nuxeo/ecm/usersettings/UserSettingsConstants.java
--- a/nuxeo-platform-usersettings-api/src/main/java/org/nuxeo/ecm/usersettings/UserSettingsConstants.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-usersettings-api/src/main/java/org/nuxeo/ecm/usersettings/UserSettingsConstants.java	Fri Mar 26 09:05:32 2010 +0100
@@ -1,8 +1,8 @@
 package org.nuxeo.ecm.usersettings;
 
-
 public interface UserSettingsConstants {
 
     public static final String BASE_EXTENSION_POINT = "userSettingsConfiguration";
+
     public static final String SETTINGS_PROVIDER_EXTENSION_POINT = "userSettingsProvider";
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-usersettings-api/src/main/java/org/nuxeo/ecm/usersettings/UserSettingsDescriptor.java
--- a/nuxeo-platform-usersettings-api/src/main/java/org/nuxeo/ecm/usersettings/UserSettingsDescriptor.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-usersettings-api/src/main/java/org/nuxeo/ecm/usersettings/UserSettingsDescriptor.java	Fri Mar 26 09:05:32 2010 +0100
@@ -35,7 +35,7 @@
     private Class<? extends UserSettingsService> userSettingsClass;
 
     public Class<? extends UserSettingsService> getUserSettingsClass() {
-	return userSettingsClass;
+        return userSettingsClass;
     }
 
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-usersettings-api/src/main/java/org/nuxeo/ecm/usersettings/UserSettingsProvider.java
--- a/nuxeo-platform-usersettings-api/src/main/java/org/nuxeo/ecm/usersettings/UserSettingsProvider.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-usersettings-api/src/main/java/org/nuxeo/ecm/usersettings/UserSettingsProvider.java	Fri Mar 26 09:05:32 2010 +0100
@@ -8,10 +8,11 @@
 
 public interface UserSettingsProvider {
 
-    public Boolean isTypeSupported(String type) ;
+    public Boolean isTypeSupported(String type);
 
-    public Boolean isTypeSupported(DocumentType type) ;    
+    public Boolean isTypeSupported(DocumentType type);
 
-    public DocumentModelList getUserSettings(DocumentModel userWorkspace, CoreSession coreSession, String userName) throws ClientException;
+    public DocumentModelList getUserSettings(DocumentModel userWorkspace,
+            CoreSession coreSession, String userName) throws ClientException;
 
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-usersettings-api/src/main/java/org/nuxeo/ecm/usersettings/UserSettingsProviderDescriptor.java
--- a/nuxeo-platform-usersettings-api/src/main/java/org/nuxeo/ecm/usersettings/UserSettingsProviderDescriptor.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-usersettings-api/src/main/java/org/nuxeo/ecm/usersettings/UserSettingsProviderDescriptor.java	Fri Mar 26 09:05:32 2010 +0100
@@ -33,18 +33,18 @@
 
     @XNode("@name")
     private String userSettingsProviderName;
-    
+
     @XNode("@class")
     private Class<? extends UserSettingsProvider> userSettingsProviderClass;
 
     public Class<? extends UserSettingsProvider> getProviderClass() {
-	
-	return userSettingsProviderClass;
-	
+
+        return userSettingsProviderClass;
+
     }
 
     public String getProviderName() {
-	return userSettingsProviderName;
+        return userSettingsProviderName;
     }
 
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-usersettings-api/src/main/java/org/nuxeo/ecm/usersettings/UserSettingsService.java
--- a/nuxeo-platform-usersettings-api/src/main/java/org/nuxeo/ecm/usersettings/UserSettingsService.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-usersettings-api/src/main/java/org/nuxeo/ecm/usersettings/UserSettingsService.java	Fri Mar 26 09:05:32 2010 +0100
@@ -9,32 +9,43 @@
 
 public interface UserSettingsService {
 
-    public DocumentModelList getCurrentUserSettings(CoreSession coreSession) throws ClientException;
+    public DocumentModelList getCurrentUserSettings(CoreSession coreSession)
+            throws ClientException;
 
-    public DocumentModelList getCurrentUserSettings(CoreSession coreSession, DocumentType filter) throws ClientException;
+    public DocumentModelList getCurrentUserSettings(CoreSession coreSession,
+            DocumentType filter) throws ClientException;
 
-    public DocumentModelList getCurrentUserSettings(CoreSession coreSession, String type) throws ClientException;
+    public DocumentModelList getCurrentUserSettings(CoreSession coreSession,
+            String type) throws ClientException;
 
-    public DocumentModelList getUserSettings(String userName) throws ClientException;
+    public DocumentModelList getUserSettings(String userName)
+            throws ClientException;
 
-    public DocumentModelList getUserSettings(String userName, DocumentType filter) throws ClientException;
+    public DocumentModelList getUserSettings(String userName,
+            DocumentType filter) throws ClientException;
 
-    public DocumentModelList getUserSettings(String userName, String type) throws ClientException;
+    public DocumentModelList getUserSettings(String userName, String type)
+            throws ClientException;
 
-    public DocumentModelList getUserSettings(CoreSession coreSession, String userName) throws ClientException;
+    public DocumentModelList getUserSettings(CoreSession coreSession,
+            String userName) throws ClientException;
 
-    public DocumentModelList getUserSettings(CoreSession coreSession, String userName, DocumentType filter) throws ClientException;
+    public DocumentModelList getUserSettings(CoreSession coreSession,
+            String userName, DocumentType filter) throws ClientException;
 
-    public DocumentModelList getUserSettings(CoreSession coreSession, String userName, String type) throws ClientException;
+    public DocumentModelList getUserSettings(CoreSession coreSession,
+            String userName, String type) throws ClientException;
 
-    public void registerProvider(String providerName, UserSettingsProvider provider) throws ClientException ;
+    public void registerProvider(String providerName,
+            UserSettingsProvider provider) throws ClientException;
 
-    public void unRegisterProvider(String providerName) throws ClientException ;
-    
-    public Map<String, UserSettingsProvider> getAllRegisteredProviders() throws ClientException ;
-    
+    public void unRegisterProvider(String providerName) throws ClientException;
+
+    public Map<String, UserSettingsProvider> getAllRegisteredProviders()
+            throws ClientException;
+
     public void initService() throws Exception;
-    
+
     public void termService() throws Exception;
 
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-usersettings-api/src/main/java/org/nuxeo/ecm/usersettings/UserSettingsServiceImplComponent.java
--- a/nuxeo-platform-usersettings-api/src/main/java/org/nuxeo/ecm/usersettings/UserSettingsServiceImplComponent.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-usersettings-api/src/main/java/org/nuxeo/ecm/usersettings/UserSettingsServiceImplComponent.java	Fri Mar 26 09:05:32 2010 +0100
@@ -13,7 +13,8 @@
 import org.nuxeo.runtime.model.DefaultComponent;
 
 /**
- * This component is used to register the service that provide the userworkspace service support.
+ * This component is used to register the service that provide the userworkspace
+ * service support.
  * 
  * @author btatar
  * @author Damien METZLER (damien.metzler@leroymerlin.fr)
@@ -31,156 +32,176 @@
 
     @Override
     public void activate(ComponentContext context) {
-	log.info("UserSettingsService activated");
+        log.info("UserSettingsService activated");
     }
 
     @Override
     public void deactivate(ComponentContext context) {
-	log.info("UserSettingsService deactivated");
+        log.info("UserSettingsService deactivated");
     }
 
     @Override
     public <T> T getAdapter(Class<T> adapter) {
-	if (adapter == UserSettingsService.class) {
-	    try {
-		return adapter.cast(getUserSettingsService());
-	    } catch (Exception e) {
-		log.error("error fetching UserSettingsService: ", e);
-	    }
-	}
-	return null;
+        if (adapter == UserSettingsService.class) {
+            try {
+                return adapter.cast(getUserSettingsService());
+            } catch (Exception e) {
+                log.error("error fetching UserSettingsService: ", e);
+            }
+        }
+        return null;
     }
 
     private UserSettingsService getUserSettingsService() throws ClientException {
 
-	if (userSettingsService == null) {
+        if (userSettingsService == null) {
 
-	    Class<?> klass = descriptor.getUserSettingsClass();
+            Class<?> klass = descriptor.getUserSettingsClass();
 
-	    if (klass == null) {
-		throw new ClientException("No class specified for the userPreferences");
-	    }
-	    try {
-		userSettingsService = (UserSettingsService) klass.newInstance();
-		userSettingsService.initService();
-	    } catch (Exception e) {
-		throw new ClientException("Failed to instantiate class " + klass, e);
-	    }
-	}
-	return userSettingsService;
+            if (klass == null) {
+                throw new ClientException(
+                        "No class specified for the userPreferences");
+            }
+            try {
+                userSettingsService = (UserSettingsService) klass.newInstance();
+                userSettingsService.initService();
+            } catch (Exception e) {
+                throw new ClientException("Failed to instantiate class "
+                        + klass, e);
+            }
+        }
+        return userSettingsService;
     }
 
     @Override
-    public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
-	    throws ClientException {
+    public void registerContribution(Object contribution,
+            String extensionPoint, ComponentInstance contributor)
+            throws ClientException {
 
-	if (UserSettingsConstants.BASE_EXTENSION_POINT.equals(extensionPoint)) {
-	    descriptor = (UserSettingsDescriptor) contribution;	    
-	    log.info(String.format("Registered %s extension point with %s class.", extensionPoint,contribution.getClass().getName()));
-	} else if (UserSettingsConstants.SETTINGS_PROVIDER_EXTENSION_POINT.equals(extensionPoint)) {
-	    registerUserSettingsProvider(contribution, extensionPoint, contributor);
-	} else {
-	    throw new ClientException(extensionPoint + " is not a valid extension point.");
-	}
+        if (UserSettingsConstants.BASE_EXTENSION_POINT.equals(extensionPoint)) {
+            descriptor = (UserSettingsDescriptor) contribution;
+            log.info(String.format(
+                    "Registered %s extension point with %s class.",
+                    extensionPoint, contribution.getClass().getName()));
+        } else if (UserSettingsConstants.SETTINGS_PROVIDER_EXTENSION_POINT.equals(extensionPoint)) {
+            registerUserSettingsProvider(contribution, extensionPoint,
+                    contributor);
+        } else {
+            throw new ClientException(extensionPoint
+                    + " is not a valid extension point.");
+        }
 
     }
 
-    private void registerUserSettingsProvider(Object contribution, String extensionPoint, ComponentInstance contributor)
-	    throws ClientException {
+    private void registerUserSettingsProvider(Object contribution,
+            String extensionPoint, ComponentInstance contributor)
+            throws ClientException {
 
-	UserSettingsProviderDescriptor desc = (UserSettingsProviderDescriptor) contribution;
-	
-	Class<?> klass = desc.getProviderClass();
+        UserSettingsProviderDescriptor desc = (UserSettingsProviderDescriptor) contribution;
 
-	try {
+        Class<?> klass = desc.getProviderClass();
 
-	    UserSettingsService svc = getUserSettingsService();
+        try {
 
-	    if (klass == null) {
-		log.info(String.format("No class specified for %s AlertProvider, trying to remove", desc.getProviderName()));
-		svc.unRegisterProvider(desc.getProviderName());
-	    } else {
-		UserSettingsProvider provider = (UserSettingsProvider) klass.newInstance();
-		svc.registerProvider(desc.getProviderName(), provider);
-		log.info(String.format("Registered %s extension point with %s name.", extensionPoint, desc.getProviderName()));
-	    }
+            UserSettingsService svc = getUserSettingsService();
 
-	} catch (InstantiationException e) {
-	    throw new ClientException("Failed to instantiate class " + klass, e);
-	} catch (IllegalAccessException e) {
-	    throw new ClientException("Failed to instantiate class " + klass, e);
-	} catch (Exception e) {
-	    throw new ClientException("Failed to get UserSettingsService", e);
-	}
+            if (klass == null) {
+                log.info(String.format(
+                        "No class specified for %s AlertProvider, trying to remove",
+                        desc.getProviderName()));
+                svc.unRegisterProvider(desc.getProviderName());
+            } else {
+                UserSettingsProvider provider = (UserSettingsProvider) klass.newInstance();
+                svc.registerProvider(desc.getProviderName(), provider);
+                log.info(String.format(
+                        "Registered %s extension point with %s name.",
+                        extensionPoint, desc.getProviderName()));
+            }
+
+        } catch (InstantiationException e) {
+            throw new ClientException("Failed to instantiate class " + klass, e);
+        } catch (IllegalAccessException e) {
+            throw new ClientException("Failed to instantiate class " + klass, e);
+        } catch (Exception e) {
+            throw new ClientException("Failed to get UserSettingsService", e);
+        }
 
     }
 
     private void unregisterPendingProviders() throws ClientException {
 
-	try {
+        try {
 
-	    UserSettingsService svc = getUserSettingsService();
+            UserSettingsService svc = getUserSettingsService();
 
-	    List<String> names = new ArrayList<String>();
-	    Iterator<Entry<String, UserSettingsProvider>> it = svc.getAllRegisteredProviders().entrySet().iterator();
-	    while (it.hasNext())
-		names.add(it.next().getKey());
-	    for (String name : names) {
-		log.info(String.format("Unregistering pending settings provider %s", name));
-		svc.unRegisterProvider(name);
-	    }
+            List<String> names = new ArrayList<String>();
+            Iterator<Entry<String, UserSettingsProvider>> it = svc.getAllRegisteredProviders().entrySet().iterator();
+            while (it.hasNext())
+                names.add(it.next().getKey());
+            for (String name : names) {
+                log.info(String.format(
+                        "Unregistering pending settings provider %s", name));
+                svc.unRegisterProvider(name);
+            }
 
-	} catch (Exception e) {
-	    throw new ClientException("Failed to unregister UserSettingsService", e);
-	}
+        } catch (Exception e) {
+            throw new ClientException(
+                    "Failed to unregister UserSettingsService", e);
+        }
 
     }
 
-    private void unregisterUserSettingsProvider(Object contribution, String extensionPoint, ComponentInstance contributor)
-	    throws ClientException {
+    private void unregisterUserSettingsProvider(Object contribution,
+            String extensionPoint, ComponentInstance contributor)
+            throws ClientException {
 
-	UserSettingsProviderDescriptor desc = (UserSettingsProviderDescriptor) contribution;
+        UserSettingsProviderDescriptor desc = (UserSettingsProviderDescriptor) contribution;
 
-	try {
+        try {
 
-	    UserSettingsService svc = getUserSettingsService();
+            UserSettingsService svc = getUserSettingsService();
 
-	    svc.unRegisterProvider(desc.getProviderName());
+            svc.unRegisterProvider(desc.getProviderName());
 
-	    log.info(String.format("Unregistering settings provider %s", desc.getProviderName()));
-		
-	} catch (Exception e) {
-	    throw new ClientException("Failed to unregister UserSettingsService", e);
-	}
+            log.info(String.format("Unregistering settings provider %s",
+                    desc.getProviderName()));
+
+        } catch (Exception e) {
+            throw new ClientException(
+                    "Failed to unregister UserSettingsService", e);
+        }
 
     }
 
     @Override
-    public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
-	    throws ClientException {
+    public void unregisterContribution(Object contribution,
+            String extensionPoint, ComponentInstance contributor)
+            throws ClientException {
 
-	if (UserSettingsConstants.BASE_EXTENSION_POINT.equals(extensionPoint)) {
-	    unregisterPendingProviders();
-	    try {
-		userSettingsService.termService();
-	    } catch (Exception e) {
-		log.error("Error when terminating service", e);
-	    }
-	    descriptor = null;
-	} else if (UserSettingsConstants.SETTINGS_PROVIDER_EXTENSION_POINT.equals(extensionPoint)) {
-	    unregisterUserSettingsProvider(contribution, extensionPoint, contributor);
-	} else {
-	    throw new ClientException(extensionPoint + " is not a valid extension point.");
-	}
+        if (UserSettingsConstants.BASE_EXTENSION_POINT.equals(extensionPoint)) {
+            unregisterPendingProviders();
+            try {
+                userSettingsService.termService();
+            } catch (Exception e) {
+                log.error("Error when terminating service", e);
+            }
+            descriptor = null;
+        } else if (UserSettingsConstants.SETTINGS_PROVIDER_EXTENSION_POINT.equals(extensionPoint)) {
+            unregisterUserSettingsProvider(contribution, extensionPoint,
+                    contributor);
+        } else {
+            throw new ClientException(extensionPoint
+                    + " is not a valid extension point.");
+        }
 
     }
 
     public static void reset() {
-	userSettingsService = null;
+        userSettingsService = null;
     }
 
     public static Class<? extends UserSettingsService> getUserSettingsClass() {
-	return descriptor.getUserSettingsClass();
+        return descriptor.getUserSettingsClass();
     }
 
 }
\ No newline at end of file
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-usersettings-core/src/main/java/org/nuxeo/ecm/usersettings/core/UserSettingsImplConstants.java
--- a/nuxeo-platform-usersettings-core/src/main/java/org/nuxeo/ecm/usersettings/core/UserSettingsImplConstants.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-usersettings-core/src/main/java/org/nuxeo/ecm/usersettings/core/UserSettingsImplConstants.java	Fri Mar 26 09:05:32 2010 +0100
@@ -1,9 +1,9 @@
 package org.nuxeo.ecm.usersettings.core;
 
-
 public interface UserSettingsImplConstants {
 
     public static final String DOC_PREFIX = "nuxeoUserSettings_";
+
     public static final String TITLE = "usersettings.title";
 
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-usersettings-core/src/main/java/org/nuxeo/ecm/usersettings/core/UserSettingsServiceImpl.java
--- a/nuxeo-platform-usersettings-core/src/main/java/org/nuxeo/ecm/usersettings/core/UserSettingsServiceImpl.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-usersettings-core/src/main/java/org/nuxeo/ecm/usersettings/core/UserSettingsServiceImpl.java	Fri Mar 26 09:05:32 2010 +0100
@@ -69,7 +69,7 @@
     private DocumentModel root;
 
     private void term() throws Exception {
-	closeSession();
+        closeSession();
     }
 
     private void init() throws Exception {
@@ -77,137 +77,149 @@
 
     private void closeSession() throws LoginException {
 
-	if (adminSession != null) {
-	    Repository.close(adminSession);
-	    adminSession = null;
-	}
+        if (adminSession != null) {
+            Repository.close(adminSession);
+            adminSession = null;
+        }
 
-	if (loginContext != null) {
-	    loginContext.logout();
-	    loginContext = null;
-	}
+        if (loginContext != null) {
+            loginContext.logout();
+            loginContext = null;
+        }
 
     }
 
     private CoreSession getAdminSession() throws ClientException {
 
-	try {
-	    if (adminSession == null) {
+        try {
+            if (adminSession == null) {
 
-		loginContext = Framework.login();
+                loginContext = Framework.login();
 
-		if (loginContext == null) {
-		    log.warn("loginContext is null, probably in a test environment, continuing and hope for he best");
-		}
+                if (loginContext == null) {
+                    log.warn("loginContext is null, probably in a test environment, continuing and hope for he best");
+                }
 
-		RepositoryManager mgr = Framework.getService(RepositoryManager.class);
-		Repository repository = mgr.getDefaultRepository();
-		adminSession = repository.open();
-	    }
-	} catch (Exception e) {
-	    throw new ClientException("Unable to open core session", e);
-	}
+                RepositoryManager mgr = Framework.getService(RepositoryManager.class);
+                Repository repository = mgr.getDefaultRepository();
+                adminSession = repository.open();
+            }
+        } catch (Exception e) {
+            throw new ClientException("Unable to open core session", e);
+        }
 
-	return adminSession;
+        return adminSession;
 
     }
 
-    public void registerProvider(String providerName, UserSettingsProvider provider) throws ClientException {
+    public void registerProvider(String providerName,
+            UserSettingsProvider provider) throws ClientException {
 
-	if (UserSettingsProviders.containsKey(providerName)) {
+        if (UserSettingsProviders.containsKey(providerName)) {
 
-	    log.error(String.format("%s UserSettings provider already exists and cannot be registered", providerName));
+            log.error(String.format(
+                    "%s UserSettings provider already exists and cannot be registered",
+                    providerName));
 
-	} else {
+        } else {
 
-	    UserSettingsProviders.put(providerName, provider);
+            UserSettingsProviders.put(providerName, provider);
 
-	    log.info(String.format("%s UserSettings provider registered", providerName));
+            log.info(String.format("%s UserSettings provider registered",
+                    providerName));
 
-	}
+        }
 
     }
 
     public void unRegisterProvider(String providerName) throws ClientException {
 
-	if (!UserSettingsProviders.containsKey(providerName)) {
+        if (!UserSettingsProviders.containsKey(providerName)) {
 
-	    log.error(String.format("%s UserSettings provider does not exist and cannot be removed", providerName));
+            log.error(String.format(
+                    "%s UserSettings provider does not exist and cannot be removed",
+                    providerName));
 
-	} else {
+        } else {
 
-	    UserSettingsProviders.remove(providerName);
+            UserSettingsProviders.remove(providerName);
 
-	    log.info(String.format("%s UserSettings provider removed", providerName));
+            log.info(String.format("%s UserSettings provider removed",
+                    providerName));
 
-	}
+        }
 
     }
 
-    public DocumentModelList getUserSettings(CoreSession userSession, String userName) throws ClientException {
+    public DocumentModelList getUserSettings(CoreSession userSession,
+            String userName) throws ClientException {
 
-	DocumentModelList result = findUserSettings(userSession, userName, getUserWorkspace(userSession, userName), null);
+        DocumentModelList result = findUserSettings(userSession, userName,
+                getUserWorkspace(userSession, userName), null);
 
-	return result;
+        return result;
 
     }
 
-    public DocumentModelList getUserSettings(CoreSession userSession, String userName, DocumentType filter)
-	    throws ClientException {
+    public DocumentModelList getUserSettings(CoreSession userSession,
+            String userName, DocumentType filter) throws ClientException {
 
-	DocumentModelList result = findUserSettings(userSession, userName, getUserWorkspace(userSession, userName), filter
-		.getName());
+        DocumentModelList result = findUserSettings(userSession, userName,
+                getUserWorkspace(userSession, userName), filter.getName());
 
-	return result;
+        return result;
     }
 
-    public DocumentModelList getUserSettings(CoreSession userSession, String userName, String type) throws ClientException {
+    public DocumentModelList getUserSettings(CoreSession userSession,
+            String userName, String type) throws ClientException {
 
-	DocumentModelList result = findUserSettings(userSession, userName, getUserWorkspace(userSession, userName), type);
+        DocumentModelList result = findUserSettings(userSession, userName,
+                getUserWorkspace(userSession, userName), type);
 
-	return result;
+        return result;
     }
 
     public void initService() throws Exception {
-	init();
+        init();
     }
 
     public void termService() throws Exception {
-	term();
+        term();
     }
 
-    private DocumentModelList findUserSettings(CoreSession userSession, String userName, DocumentModel userWorkspace, String type)
-	    throws ClientException {
+    private DocumentModelList findUserSettings(CoreSession userSession,
+            String userName, DocumentModel userWorkspace, String type)
+            throws ClientException {
 
-	initRoot(userSession, userName, userWorkspace);
+        initRoot(userSession, userName, userWorkspace);
 
-	DocumentModelList result = new DocumentModelListImpl();
+        DocumentModelList result = new DocumentModelListImpl();
 
-	if (UserSettingsType.DOCTYPE.equals(type)) {
-	    result.add(root);
-	    return result;
-	}
+        if (UserSettingsType.DOCTYPE.equals(type)) {
+            result.add(root);
+            return result;
+        }
 
-	if (UserSettingsProviders.size() == 0) {
-	    log.warn("No provider has been registered in the UserSettings service");
-	    return result;
-	}
+        if (UserSettingsProviders.size() == 0) {
+            log.warn("No provider has been registered in the UserSettings service");
+            return result;
+        }
 
-	Iterator<Entry<String, UserSettingsProvider>> it = UserSettingsProviders.entrySet().iterator();
+        Iterator<Entry<String, UserSettingsProvider>> it = UserSettingsProviders.entrySet().iterator();
 
-	while (it.hasNext()) {
+        while (it.hasNext()) {
 
-	    UserSettingsProvider prov = it.next().getValue();
+            UserSettingsProvider prov = it.next().getValue();
 
-	    if (type == null || prov.isTypeSupported(type)) {
-		result.addAll(prov.getUserSettings(root, userSession, userName));
-	    }
+            if (type == null || prov.isTypeSupported(type)) {
+                result.addAll(prov.getUserSettings(root, userSession, userName));
+            }
 
-	}
+        }
 
-	userSession.save();
+        userSession.save();
 
-	return result;
+        return result;
     }
 
     /**
@@ -218,108 +230,124 @@
      * @throws ClientException
      */
 
-    protected DocumentModel getUserWorkspace(CoreSession session, String userName) throws ClientException {
+    protected DocumentModel getUserWorkspace(CoreSession session,
+            String userName) throws ClientException {
 
-	try {
-	    
-	    UserWorkspaceService uws = Framework.getService(UserWorkspaceService.class);
+        try {
 
-	    DocumentModel userWorkspace = uws.getCurrentUserPersonalWorkspace(userName, getAdminSession().getRootDocument());
+            UserWorkspaceService uws = Framework.getService(UserWorkspaceService.class);
 
-	    getAdminSession().save();
+            DocumentModel userWorkspace = uws.getCurrentUserPersonalWorkspace(
+                    userName, getAdminSession().getRootDocument());
 
-	    return userWorkspace;
+            getAdminSession().save();
 
-	}
-	catch (ClientException e) {
-	    throw e;
-	}
-	catch (Exception e) {
-	    throw new ClientException(e);
-	}
+            return userWorkspace;
+
+        } catch (ClientException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new ClientException(e);
+        }
 
     }
 
-    public DocumentModelList getUserSettings(String userName) throws ClientException {
+    public DocumentModelList getUserSettings(String userName)
+            throws ClientException {
 
-	return getUserSettings(getAdminSession(), userName);
+        return getUserSettings(getAdminSession(), userName);
 
     }
 
-    public DocumentModelList getUserSettings(String userName, DocumentType filter) throws ClientException {
+    public DocumentModelList getUserSettings(String userName,
+            DocumentType filter) throws ClientException {
 
-	return getUserSettings(getAdminSession(), userName, filter);
+        return getUserSettings(getAdminSession(), userName, filter);
 
     }
 
-    public DocumentModelList getUserSettings(String userName, String type) throws ClientException {
+    public DocumentModelList getUserSettings(String userName, String type)
+            throws ClientException {
 
-	return getUserSettings(getAdminSession(), userName, type);
+        return getUserSettings(getAdminSession(), userName, type);
 
     }
 
-    protected void initRoot(CoreSession userCoreSession, String userName, DocumentModel userWorkspace) throws ClientException {
+    protected void initRoot(CoreSession userCoreSession, String userName,
+            DocumentModel userWorkspace) throws ClientException {
 
-	DocumentModelList list = userCoreSession.getChildren(userWorkspace.getRef(), UserSettingsType.DOCTYPE);
+        DocumentModelList list = userCoreSession.getChildren(
+                userWorkspace.getRef(), UserSettingsType.DOCTYPE);
 
-	if (list.isEmpty())
-	    root = createUserSettingsRootDocument(userCoreSession, userName, userWorkspace);
-	else
-	    root = list.get(0);
+        if (list.isEmpty())
+            root = createUserSettingsRootDocument(userCoreSession, userName,
+                    userWorkspace);
+        else
+            root = list.get(0);
 
     }
 
-    protected DocumentModel createUserSettingsRootDocument(CoreSession userSession, String userName, DocumentModel userWorkspace)
-	    throws ClientException {
+    protected DocumentModel createUserSettingsRootDocument(
+            CoreSession userSession, String userName,
+            DocumentModel userWorkspace) throws ClientException {
 
-	log.info(String.format("Creating user settings document for user %s in %s", userName, userWorkspace.getPathAsString()));
+        log.info(String.format(
+                "Creating user settings document for user %s in %s", userName,
+                userWorkspace.getPathAsString()));
 
-	String parent = userWorkspace.getPathAsString();
+        String parent = userWorkspace.getPathAsString();
 
-	DocumentModel doc = userSession.createDocumentModel(parent, UserSettingsImplConstants.DOC_PREFIX + userName,
-		"UserSettings");
+        DocumentModel doc = userSession.createDocumentModel(parent,
+                UserSettingsImplConstants.DOC_PREFIX + userName, "UserSettings");
 
-	String title = UserSettingsImplConstants.TITLE;
+        String title = UserSettingsImplConstants.TITLE;
 
-	try {
-	    title = Messages.instance().get(UserSettingsImplConstants.TITLE);
-	} catch (Exception e) {
-	    log.warn(String.format("Unable to get %s message, defaulting.",
-		    UserSettingsImplConstants.TITLE));
-	}
+        try {
+            title = Messages.instance().get(UserSettingsImplConstants.TITLE);
+        } catch (Exception e) {
+            log.warn(String.format("Unable to get %s message, defaulting.",
+                    UserSettingsImplConstants.TITLE));
+        }
 
-	doc.setProperty("dublincore", "title", title);
-	doc.setProperty("usersettings", "user", userName);
+        doc.setProperty("dublincore", "title", title);
+        doc.setProperty("usersettings", "user", userName);
 
-	doc = userSession.createDocument(doc);
-	doc = userSession.saveDocument(doc);
+        doc = userSession.createDocument(doc);
+        doc = userSession.saveDocument(doc);
 
-	userSession.save();
-	
-	return doc;
+        userSession.save();
+
+        return doc;
 
     }
 
-    public DocumentModelList getCurrentUserSettings(CoreSession userSession) throws ClientException {
+    public DocumentModelList getCurrentUserSettings(CoreSession userSession)
+            throws ClientException {
 
-	return getUserSettings(userSession, userSession.getPrincipal().getName());
+        return getUserSettings(userSession,
+                userSession.getPrincipal().getName());
 
     }
 
-    public DocumentModelList getCurrentUserSettings(CoreSession userSession, DocumentType filter) throws ClientException {
+    public DocumentModelList getCurrentUserSettings(CoreSession userSession,
+            DocumentType filter) throws ClientException {
 
-	return getUserSettings(userSession, userSession.getPrincipal().getName(), filter);
+        return getUserSettings(userSession,
+                userSession.getPrincipal().getName(), filter);
 
     }
 
-    public DocumentModelList getCurrentUserSettings(CoreSession userSession, String type) throws ClientException {
+    public DocumentModelList getCurrentUserSettings(CoreSession userSession,
+            String type) throws ClientException {
 
-	return getUserSettings(userSession, userSession.getPrincipal().getName(), type);
+        return getUserSettings(userSession,
+                userSession.getPrincipal().getName(), type);
 
     }
 
-    public Map<String, UserSettingsProvider> getAllRegisteredProviders() throws ClientException {
-	return UserSettingsProviders;
+    public Map<String, UserSettingsProvider> getAllRegisteredProviders()
+            throws ClientException {
+        return UserSettingsProviders;
     }
 
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-usersettings-core/src/test/java/com/nuxeo/ecm/usersettings/core/RepositoryOSGITestCase.java
--- a/nuxeo-platform-usersettings-core/src/test/java/com/nuxeo/ecm/usersettings/core/RepositoryOSGITestCase.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-usersettings-core/src/test/java/com/nuxeo/ecm/usersettings/core/RepositoryOSGITestCase.java	Fri Mar 26 09:05:32 2010 +0100
@@ -55,172 +55,175 @@
     public static final String REPOSITORY_NAME = "demo";
 
     public static final String DOMAIN_NAME = "demo-domain";
-    
+
     protected Repository repository;
 
     private CoreSession coreSession;
 
     protected DocumentModel rootWorkspace = null;
-    
+
     protected DocumentModel domain = null;
 
     protected RepositoryOSGITestCase() {
     }
 
     protected RepositoryOSGITestCase(String name) {
-	super(name);
+        super(name);
     }
 
     protected void undeployBundle(String name) throws BundleException {
-	osgi.getRegistry().getBundle(name).uninstall();
+        osgi.getRegistry().getBundle(name).uninstall();
     }
-    
-    
+
     @Override
     public void setUp() throws Exception {
-	super.setUp();
-	
-	deployBundle("org.nuxeo.ecm.core.schema");
-	deployBundle("org.nuxeo.ecm.core.api");
-	deployBundle("org.nuxeo.ecm.core.event");
-	deployBundle("org.nuxeo.ecm.core");
-	deployBundle("org.nuxeo.ecm.core.jcr");
-	deployBundle("org.nuxeo.ecm.platform.usermanager.api");
-	deployBundle("org.nuxeo.ecm.platform.usermanager");
-	
+        super.setUp();
+
+        deployBundle("org.nuxeo.ecm.core.schema");
+        deployBundle("org.nuxeo.ecm.core.api");
+        deployBundle("org.nuxeo.ecm.core.event");
+        deployBundle("org.nuxeo.ecm.core");
+        deployBundle("org.nuxeo.ecm.core.jcr");
+        deployBundle("org.nuxeo.ecm.platform.usermanager.api");
+        deployBundle("org.nuxeo.ecm.platform.usermanager");
+
     }
 
     @Override
     public void tearDown() throws Exception {
-	
-	Framework.getLocalService(EventService.class).waitForAsyncCompletion();
-	releaseCoreSession(coreSession);
-	coreSession = null;
-	releaseRepository();
 
-	undeployBundle("org.nuxeo.ecm.platform.usermanager");
-	undeployBundle("org.nuxeo.ecm.platform.usermanager.api");
-	undeployBundle("org.nuxeo.ecm.core.jcr");
-	undeployBundle("org.nuxeo.ecm.core");
-	undeployBundle("org.nuxeo.ecm.core.event");
-	undeployBundle("org.nuxeo.ecm.core.api");
-	undeployBundle("org.nuxeo.ecm.core.schema");
-	
-	super.tearDown();
+        Framework.getLocalService(EventService.class).waitForAsyncCompletion();
+        releaseCoreSession(coreSession);
+        coreSession = null;
+        releaseRepository();
+
+        undeployBundle("org.nuxeo.ecm.platform.usermanager");
+        undeployBundle("org.nuxeo.ecm.platform.usermanager.api");
+        undeployBundle("org.nuxeo.ecm.core.jcr");
+        undeployBundle("org.nuxeo.ecm.core");
+        undeployBundle("org.nuxeo.ecm.core.event");
+        undeployBundle("org.nuxeo.ecm.core.api");
+        undeployBundle("org.nuxeo.ecm.core.schema");
+
+        super.tearDown();
     }
 
     protected void initRepository() throws Exception {
-	
-	if (repository == null) {
-	    // the repository should be deployed the last
-	    // after any other bundle that is doctypes
-	    // this is nuxeo-core-jcr-connector-test
-	    repositoryDeploy();
-	    repository = NXCore.getRepositoryService().getRepositoryManager().getRepository(REPOSITORY_NAME);
-	    createRootWorkspace();
-	}
-	
+
+        if (repository == null) {
+            // the repository should be deployed the last
+            // after any other bundle that is doctypes
+            // this is nuxeo-core-jcr-connector-test
+            repositoryDeploy();
+            repository = NXCore.getRepositoryService().getRepositoryManager().getRepository(
+                    REPOSITORY_NAME);
+            createRootWorkspace();
+        }
+
     }
 
     protected void openRepositoryAsUser(String userName) throws Exception {
-	initRepository();
-	coreSession = openCoreSession(userName);
+        initRepository();
+        coreSession = openCoreSession(userName);
     }
 
     protected void closeRepository() throws Exception {
-	releaseCoreSession(coreSession);
-	coreSession = null;
-	releaseRepository();
-	repositoryUndeploy();
+        releaseCoreSession(coreSession);
+        coreSession = null;
+        releaseRepository();
+        repositoryUndeploy();
     }
-    
+
     protected void repositoryDeploy() throws Exception {
-	if (!isRepositoryBundleDeployed) {
-	    deployBundle("org.nuxeo.ecm.core.jcr-connector");
-	    isRepositoryBundleDeployed = true;
-	}
+        if (!isRepositoryBundleDeployed) {
+            deployBundle("org.nuxeo.ecm.core.jcr-connector");
+            isRepositoryBundleDeployed = true;
+        }
     }
 
     protected void repositoryUndeploy() throws Exception {
-	if (isRepositoryBundleDeployed) {
-	    undeployBundle("org.nuxeo.ecm.core.jcr-connector");
-	    isRepositoryBundleDeployed = false;
-	}
+        if (isRepositoryBundleDeployed) {
+            undeployBundle("org.nuxeo.ecm.core.jcr-connector");
+            isRepositoryBundleDeployed = false;
+        }
     }
 
-
     public void openRepository() throws Exception {
-	openRepositoryAsUser("Administrator");
+        openRepositoryAsUser("Administrator");
     }
 
     public void openRepositoryWithSystemPrivileges() throws Exception {
-	openRepositoryAsUser(null);
+        openRepositoryAsUser(null);
     }
 
     public CoreSession getCoreSession() {
-	return coreSession;
+        return coreSession;
     }
 
     protected Repository getRepository() {
-	return repository;
+        return repository;
     }
 
     private void createRootWorkspace() throws ClientException {
 
-	CoreSession adminSession = openCoreSession("Administrator");
-	assertNotNull(adminSession);
-	domain = adminSession.createDocumentModel("/", RepositoryOSGITestCase.DOMAIN_NAME, "Domain");
-	domain = adminSession.createDocument(domain);
-	assertNotNull(domain);
-	domain = adminSession.saveDocument(domain);
-	rootWorkspace = adminSession.createDocumentModel(domain.getPathAsString(), RepositoryOSGITestCase.ROOT_WORKSPACE_NAME, "Workspace");
-	assertNotNull(rootWorkspace);
-	rootWorkspace = adminSession.createDocument(rootWorkspace);
-	rootWorkspace = adminSession.saveDocument(rootWorkspace);
-	adminSession.save();
-	CoreInstance.getInstance().close(adminSession);
-	
+        CoreSession adminSession = openCoreSession("Administrator");
+        assertNotNull(adminSession);
+        domain = adminSession.createDocumentModel("/",
+                RepositoryOSGITestCase.DOMAIN_NAME, "Domain");
+        domain = adminSession.createDocument(domain);
+        assertNotNull(domain);
+        domain = adminSession.saveDocument(domain);
+        rootWorkspace = adminSession.createDocumentModel(
+                domain.getPathAsString(),
+                RepositoryOSGITestCase.ROOT_WORKSPACE_NAME, "Workspace");
+        assertNotNull(rootWorkspace);
+        rootWorkspace = adminSession.createDocument(rootWorkspace);
+        rootWorkspace = adminSession.saveDocument(rootWorkspace);
+        adminSession.save();
+        CoreInstance.getInstance().close(adminSession);
+
     }
 
-    protected CoreSession openCoreSession(String userName) throws ClientException {
+    protected CoreSession openCoreSession(String userName)
+            throws ClientException {
 
-	CoreSession result = null;
-	Map<String, Serializable> ctx = new HashMap<String, Serializable>();
-	ctx.put("username", userName);
-	result = CoreInstance.getInstance().open(REPOSITORY_NAME, ctx);
-	assertNotNull(result);
-	return result;
-	
+        CoreSession result = null;
+        Map<String, Serializable> ctx = new HashMap<String, Serializable>();
+        ctx.put("username", userName);
+        result = CoreInstance.getInstance().open(REPOSITORY_NAME, ctx);
+        assertNotNull(result);
+        return result;
+
     }
 
     public void changeUser(String newUser) throws ClientException {
-	releaseCoreSession(coreSession);
-	coreSession = openCoreSession(newUser);
+        releaseCoreSession(coreSession);
+        coreSession = openCoreSession(newUser);
     }
 
     public void releaseRepository() {
-	if (repository != null) {
-	    repository.shutdown();
-	    repository = null;
-	}
+        if (repository != null) {
+            repository.shutdown();
+            repository = null;
+        }
     }
 
     public void releaseCoreSession(CoreSession session) {
-	if (session != null) {
-	    CoreInstance.getInstance().close(session);
-	}
+        if (session != null) {
+            CoreInstance.getInstance().close(session);
+        }
     }
 
     protected Session getSession() throws DocumentException {
-	return repository.getSession(null);
+        return repository.getSession(null);
     }
 
     protected EventServiceImpl eventService;
 
     protected void waitForEventsDispatched() {
-	if (eventService == null) {
-	    eventService = (EventServiceImpl) Framework.getLocalService(EventService.class);
-	}
-	eventService.waitForAsyncCompletion();
+        if (eventService == null) {
+            eventService = (EventServiceImpl) Framework.getLocalService(EventService.class);
+        }
+        eventService.waitForAsyncCompletion();
     }
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-usersettings-core/src/test/java/com/nuxeo/ecm/usersettings/core/SettingsProvider1.java
--- a/nuxeo-platform-usersettings-core/src/test/java/com/nuxeo/ecm/usersettings/core/SettingsProvider1.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-usersettings-core/src/test/java/com/nuxeo/ecm/usersettings/core/SettingsProvider1.java	Fri Mar 26 09:05:32 2010 +0100
@@ -18,41 +18,42 @@
     private static final long serialVersionUID = -2643607647191744171L;
 
     private static final Log log = LogFactory.getLog(SettingsProvider1.class);
-    
-    public DocumentModelList getUserSettings(DocumentModel userWorkspace, CoreSession coreSession, String userName)
-	    throws ClientException {
-	
-	DocumentModelList list = coreSession.getChildren(userWorkspace.getRef(), TEST_TYPE);
-	
-	if (list.size() == 0) {
-	    
-	    DocumentModel dm = coreSession.createDocumentModel(userWorkspace.getPathAsString(), "testsettings1", TEST_TYPE);	    
-	    
-	    dm.setProperty("testsettings1", "testprop1", TEST_PROPERTY_VALUE);
-	    
-	    DocumentModel doc = coreSession.createDocument(dm);
-	    
-	    coreSession.save();
-	    
-	    list.add(doc);
-	    
-	}
-	
-	return list;
-	
+
+    public DocumentModelList getUserSettings(DocumentModel userWorkspace,
+            CoreSession coreSession, String userName) throws ClientException {
+
+        DocumentModelList list = coreSession.getChildren(
+                userWorkspace.getRef(), TEST_TYPE);
+
+        if (list.size() == 0) {
+
+            DocumentModel dm = coreSession.createDocumentModel(
+                    userWorkspace.getPathAsString(), "testsettings1", TEST_TYPE);
+
+            dm.setProperty("testsettings1", "testprop1", TEST_PROPERTY_VALUE);
+
+            DocumentModel doc = coreSession.createDocument(dm);
+
+            coreSession.save();
+
+            list.add(doc);
+
+        }
+
+        return list;
+
     }
 
     public Boolean isTypeSupported(String type) {
-	
-	return TEST_TYPE.equals(type);
-	
+
+        return TEST_TYPE.equals(type);
+
     }
 
     public Boolean isTypeSupported(DocumentType type) {
-	
-	return isTypeSupported(type.getName());
-	
+
+        return isTypeSupported(type.getName());
+
     }
-    
-    
+
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-usersettings-core/src/test/java/com/nuxeo/ecm/usersettings/core/SettingsProvider2.java
--- a/nuxeo-platform-usersettings-core/src/test/java/com/nuxeo/ecm/usersettings/core/SettingsProvider2.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-usersettings-core/src/test/java/com/nuxeo/ecm/usersettings/core/SettingsProvider2.java	Fri Mar 26 09:05:32 2010 +0100
@@ -18,41 +18,42 @@
     private static final long serialVersionUID = -2643607647191744171L;
 
     private static final Log log = LogFactory.getLog(SettingsProvider2.class);
-    
-    public DocumentModelList getUserSettings(DocumentModel userWorkspace, CoreSession coreSession, String userName)
-	    throws ClientException {
-	
-	DocumentModelList list = coreSession.getChildren(userWorkspace.getRef(), TEST_TYPE);
-	
-	if (list.size() == 0) {
-	    
-	    DocumentModel dm = coreSession.createDocumentModel(userWorkspace.getPathAsString(), "testsettings2", TEST_TYPE);
-	    
-	    dm.setProperty("testsettings2", "testprop2", TEST_PROPERTY_VALUE);
-	    
-	    DocumentModel doc = coreSession.createDocument(dm);
-	    
-	    coreSession.save();
-	    
-	    list.add(doc);
-	    
-	}
-	
-	return list;
-	
+
+    public DocumentModelList getUserSettings(DocumentModel userWorkspace,
+            CoreSession coreSession, String userName) throws ClientException {
+
+        DocumentModelList list = coreSession.getChildren(
+                userWorkspace.getRef(), TEST_TYPE);
+
+        if (list.size() == 0) {
+
+            DocumentModel dm = coreSession.createDocumentModel(
+                    userWorkspace.getPathAsString(), "testsettings2", TEST_TYPE);
+
+            dm.setProperty("testsettings2", "testprop2", TEST_PROPERTY_VALUE);
+
+            DocumentModel doc = coreSession.createDocument(dm);
+
+            coreSession.save();
+
+            list.add(doc);
+
+        }
+
+        return list;
+
     }
 
     public Boolean isTypeSupported(String type) {
-	
-	return TEST_TYPE.equals(type);
-	
+
+        return TEST_TYPE.equals(type);
+
     }
 
     public Boolean isTypeSupported(DocumentType type) {
-	
-	return isTypeSupported(type.getName());
-	
+
+        return isTypeSupported(type.getName());
+
     }
-    
-    
+
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-usersettings-core/src/test/java/com/nuxeo/ecm/usersettings/core/TestUserSettingsCoreAdvanced.java
--- a/nuxeo-platform-usersettings-core/src/test/java/com/nuxeo/ecm/usersettings/core/TestUserSettingsCoreAdvanced.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-usersettings-core/src/test/java/com/nuxeo/ecm/usersettings/core/TestUserSettingsCoreAdvanced.java	Fri Mar 26 09:05:32 2010 +0100
@@ -40,111 +40,110 @@
 
     private UserSettingsService service;
 
-    
     @Override
     public void setUp() throws Exception {
 
-	super.setUp();
+        super.setUp();
 
-	// Bundle to be tested
-	deployBundle("org.nuxeo.ecm.usersettings.types");
-	deployBundle("org.nuxeo.ecm.usersettings.api");
-	deployBundle("org.nuxeo.ecm.usersettings.core");
-	deployBundle("org.nuxeo.ecm.usersettings.core.test");
-	deployBundle("org.nuxeo.ecm.platform.userworkspace.types");
-	deployBundle("org.nuxeo.ecm.platform.userworkspace.api");
-	deployBundle("org.nuxeo.ecm.platform.userworkspace.core");
+        // Bundle to be tested
+        deployBundle("org.nuxeo.ecm.usersettings.types");
+        deployBundle("org.nuxeo.ecm.usersettings.api");
+        deployBundle("org.nuxeo.ecm.usersettings.core");
+        deployBundle("org.nuxeo.ecm.usersettings.core.test");
+        deployBundle("org.nuxeo.ecm.platform.userworkspace.types");
+        deployBundle("org.nuxeo.ecm.platform.userworkspace.api");
+        deployBundle("org.nuxeo.ecm.platform.userworkspace.core");
 
-	// Initialize the test environment
-	openRepositoryAsUser("testuser");
+        // Initialize the test environment
+        openRepositoryAsUser("testuser");
 
-	service = Framework.getLocalService(UserSettingsService.class);
+        service = Framework.getLocalService(UserSettingsService.class);
 
-	checkDeployment();
+        checkDeployment();
 
     }
 
     private void checkDeployment() throws Exception {
-	SchemaManager smgr = Framework.getService(SchemaManager.class);
+        SchemaManager smgr = Framework.getService(SchemaManager.class);
 
-	assertNotNull(smgr);
+        assertNotNull(smgr);
 
-	assertNotNull(smgr.getSchema("testsettings1"));
-	assertNotNull(smgr.getSchema("testsettings2"));
+        assertNotNull(smgr.getSchema("testsettings1"));
+        assertNotNull(smgr.getSchema("testsettings2"));
 
-	assertNotNull(smgr.getDocumentType("TestSettings1"));
-	assertNotNull(smgr.getDocumentType("TestSettings2"));
+        assertNotNull(smgr.getDocumentType("TestSettings1"));
+        assertNotNull(smgr.getDocumentType("TestSettings2"));
     }
 
     @Override
     public void tearDown() throws Exception {
 
-	try {
-	    Framework.getLocalService(EventService.class).waitForAsyncCompletion();
-	} catch (Exception e) {
-	}
+        try {
+            Framework.getLocalService(EventService.class).waitForAsyncCompletion();
+        } catch (Exception e) {
+        }
 
-	closeRepository();
+        closeRepository();
 
-	undeployBundle("org.nuxeo.ecm.platform.userworkspace.core");
-	undeployBundle("org.nuxeo.ecm.platform.userworkspace.api"); 
-	undeployBundle("org.nuxeo.ecm.platform.userworkspace.types");
-	undeployBundle("org.nuxeo.ecm.usersettings.core.test");
-	undeployBundle("org.nuxeo.ecm.usersettings.core");
-	undeployBundle("org.nuxeo.ecm.usersettings.api");
-	undeployBundle("org.nuxeo.ecm.usersettings.types");
+        undeployBundle("org.nuxeo.ecm.platform.userworkspace.core");
+        undeployBundle("org.nuxeo.ecm.platform.userworkspace.api");
+        undeployBundle("org.nuxeo.ecm.platform.userworkspace.types");
+        undeployBundle("org.nuxeo.ecm.usersettings.core.test");
+        undeployBundle("org.nuxeo.ecm.usersettings.core");
+        undeployBundle("org.nuxeo.ecm.usersettings.api");
+        undeployBundle("org.nuxeo.ecm.usersettings.types");
 
-	super.tearDown();
+        super.tearDown();
 
     }
 
     public void testGetAllCurrentUserSettings() throws Exception {
 
-	getAllCurrentUserSettings();
-	getAllCurrentUserSettings();
+        getAllCurrentUserSettings();
+        getAllCurrentUserSettings();
 
     }
 
     private void getAllCurrentUserSettings() throws ClientException {
-	DocumentModelList docs = service.getCurrentUserSettings(getCoreSession());
-	assertEquals(2, docs.size());
-	Map<String, DocumentModel> sets = new HashMap<String, DocumentModel>();
-	Iterator<DocumentModel> it = docs.iterator();
-	while (it.hasNext()) {
-	    DocumentModel doc = it.next();
-	    sets.put(doc.getType(), doc);
-	}
-	assertTrue(sets.containsKey("TestSettings1"));
-	assertTrue(sets.containsKey("TestSettings2"));
-	assertTrue(sets.get("TestSettings1").hasSchema("testsettings1"));
-	assertTrue(sets.get("TestSettings2").hasSchema("testsettings2"));
-	assertTrue(((String) (sets.get("TestSettings1").getProperty("testsettings1", "testprop1")))
-		.equalsIgnoreCase(SettingsProvider1.TEST_PROPERTY_VALUE));
-	assertTrue(((String) (sets.get("TestSettings2").getProperty("testsettings2", "testprop2")))
-		.equalsIgnoreCase(SettingsProvider2.TEST_PROPERTY_VALUE));
+        DocumentModelList docs = service.getCurrentUserSettings(getCoreSession());
+        assertEquals(2, docs.size());
+        Map<String, DocumentModel> sets = new HashMap<String, DocumentModel>();
+        Iterator<DocumentModel> it = docs.iterator();
+        while (it.hasNext()) {
+            DocumentModel doc = it.next();
+            sets.put(doc.getType(), doc);
+        }
+        assertTrue(sets.containsKey("TestSettings1"));
+        assertTrue(sets.containsKey("TestSettings2"));
+        assertTrue(sets.get("TestSettings1").hasSchema("testsettings1"));
+        assertTrue(sets.get("TestSettings2").hasSchema("testsettings2"));
+        assertTrue(((String) (sets.get("TestSettings1").getProperty(
+                "testsettings1", "testprop1"))).equalsIgnoreCase(SettingsProvider1.TEST_PROPERTY_VALUE));
+        assertTrue(((String) (sets.get("TestSettings2").getProperty(
+                "testsettings2", "testprop2"))).equalsIgnoreCase(SettingsProvider2.TEST_PROPERTY_VALUE));
     }
 
     public void testGetAllCurrentUserSettingsFilterType() throws Exception {
 
-	getAllCurrentUserSettingsFilterType();
-	getAllCurrentUserSettingsFilterType();
+        getAllCurrentUserSettingsFilterType();
+        getAllCurrentUserSettingsFilterType();
 
     }
 
     private void getAllCurrentUserSettingsFilterType() throws ClientException {
-	DocumentModelList docs = service.getCurrentUserSettings(getCoreSession(), "TestSettings1");
-	assertEquals(1, docs.size());
-	Map<String, DocumentModel> sets = new HashMap<String, DocumentModel>();
-	Iterator<DocumentModel> it = docs.iterator();
-	while (it.hasNext()) {
-	    DocumentModel doc = it.next();
-	    sets.put(doc.getType(), doc);
-	}
-	assertTrue(sets.containsKey("TestSettings1"));
-	assertTrue(sets.get("TestSettings1").hasSchema("testsettings1"));
-	assertTrue(((String) (sets.get("TestSettings1").getProperty("testsettings1", "testprop1")))
-		.equalsIgnoreCase(SettingsProvider1.TEST_PROPERTY_VALUE));
+        DocumentModelList docs = service.getCurrentUserSettings(
+                getCoreSession(), "TestSettings1");
+        assertEquals(1, docs.size());
+        Map<String, DocumentModel> sets = new HashMap<String, DocumentModel>();
+        Iterator<DocumentModel> it = docs.iterator();
+        while (it.hasNext()) {
+            DocumentModel doc = it.next();
+            sets.put(doc.getType(), doc);
+        }
+        assertTrue(sets.containsKey("TestSettings1"));
+        assertTrue(sets.get("TestSettings1").hasSchema("testsettings1"));
+        assertTrue(((String) (sets.get("TestSettings1").getProperty(
+                "testsettings1", "testprop1"))).equalsIgnoreCase(SettingsProvider1.TEST_PROPERTY_VALUE));
     }
 
-
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-usersettings-core/src/test/java/com/nuxeo/ecm/usersettings/core/TestUserSettingsCoreBasic.java
--- a/nuxeo-platform-usersettings-core/src/test/java/com/nuxeo/ecm/usersettings/core/TestUserSettingsCoreBasic.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-usersettings-core/src/test/java/com/nuxeo/ecm/usersettings/core/TestUserSettingsCoreBasic.java	Fri Mar 26 09:05:32 2010 +0100
@@ -36,49 +36,49 @@
 
     @Override
     public void setUp() throws Exception {
-	
-	super.setUp();
 
-	// Bundle to be tested
-	deployBundle("org.nuxeo.ecm.usersettings.types");
-	deployBundle("org.nuxeo.ecm.usersettings.api");
-	deployBundle("org.nuxeo.ecm.usersettings.core");
+        super.setUp();
 
-	repositoryDeploy();
+        // Bundle to be tested
+        deployBundle("org.nuxeo.ecm.usersettings.types");
+        deployBundle("org.nuxeo.ecm.usersettings.api");
+        deployBundle("org.nuxeo.ecm.usersettings.core");
 
-	// Initialize the test environment
-	openRepository();
-	session = getCoreSession();
-	
+        repositoryDeploy();
+
+        // Initialize the test environment
+        openRepository();
+        session = getCoreSession();
+
     }
 
     @Override
     public void tearDown() throws Exception {
 
-	try {
-	    Framework.getLocalService(EventService.class).waitForAsyncCompletion();
-	} catch (Exception e) {
-	}
+        try {
+            Framework.getLocalService(EventService.class).waitForAsyncCompletion();
+        } catch (Exception e) {
+        }
 
-	closeRepository();
+        closeRepository();
 
-	undeployBundle("org.nuxeo.ecm.usersettings.core");
-	undeployBundle("org.nuxeo.ecm.usersettings.api");
-	undeployBundle("org.nuxeo.ecm.usersettings.types");
+        undeployBundle("org.nuxeo.ecm.usersettings.core");
+        undeployBundle("org.nuxeo.ecm.usersettings.api");
+        undeployBundle("org.nuxeo.ecm.usersettings.types");
 
-	super.tearDown();
+        super.tearDown();
     }
 
     public void testService() throws Exception {
-	UserSettingsService service = Framework.getLocalService(UserSettingsService.class);
-	assertEquals(0, service.getAllRegisteredProviders().size());
+        UserSettingsService service = Framework.getLocalService(UserSettingsService.class);
+        assertEquals(0, service.getAllRegisteredProviders().size());
     }
 
     public void testRegisterProvider() throws Exception {
-	deployBundle("org.nuxeo.ecm.usersettings.core.test");
-	UserSettingsService service = Framework.getLocalService(UserSettingsService.class);
-	assertEquals(2, service.getAllRegisteredProviders().size());
-	undeployBundle("org.nuxeo.ecm.usersettings.core.test");
+        deployBundle("org.nuxeo.ecm.usersettings.core.test");
+        UserSettingsService service = Framework.getLocalService(UserSettingsService.class);
+        assertEquals(2, service.getAllRegisteredProviders().size());
+        undeployBundle("org.nuxeo.ecm.usersettings.core.test");
     }
 
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-usersettings-facade/src/main/java/org/nuxeo/ecm/platform/usersettings/ejb/UserSettingsServiceBean.java
--- a/nuxeo-platform-usersettings-facade/src/main/java/org/nuxeo/ecm/platform/usersettings/ejb/UserSettingsServiceBean.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-usersettings-facade/src/main/java/org/nuxeo/ecm/platform/usersettings/ejb/UserSettingsServiceBean.java	Fri Mar 26 09:05:32 2010 +0100
@@ -48,130 +48,145 @@
 
     @PostConstruct
     public void initialize() {
-	getUserSettingsService();
+        getUserSettingsService();
     }
 
     private UserSettingsService getUserSettingsService() {
-	if (userManager == null) {
-	    userManager = Framework.getLocalService(UserSettingsService.class);
-	}
-	return userManager;
+        if (userManager == null) {
+            userManager = Framework.getLocalService(UserSettingsService.class);
+        }
+        return userManager;
     }
 
     public void cleanup() {
     }
 
-    public Map<String, UserSettingsProvider> getAllRegisteredProviders() throws ClientException {
-	try {
-	    return getUserSettingsService().getAllRegisteredProviders();
-	} catch (Throwable e) {
-	    throw ClientException.wrap(e);
-	}
+    public Map<String, UserSettingsProvider> getAllRegisteredProviders()
+            throws ClientException {
+        try {
+            return getUserSettingsService().getAllRegisteredProviders();
+        } catch (Throwable e) {
+            throw ClientException.wrap(e);
+        }
     }
 
-    public DocumentModelList getCurrentUserSettings(CoreSession coreSession) throws ClientException {
-	try {
-	    return getUserSettingsService().getCurrentUserSettings(coreSession);
-	} catch (Throwable e) {
-	    throw ClientException.wrap(e);
-	}
+    public DocumentModelList getCurrentUserSettings(CoreSession coreSession)
+            throws ClientException {
+        try {
+            return getUserSettingsService().getCurrentUserSettings(coreSession);
+        } catch (Throwable e) {
+            throw ClientException.wrap(e);
+        }
     }
 
-    public DocumentModelList getCurrentUserSettings(CoreSession coreSession, DocumentType filter) throws ClientException {
-	try {
-	    return getUserSettingsService().getCurrentUserSettings(coreSession, filter);
-	} catch (Throwable e) {
-	    throw ClientException.wrap(e);
-	}
+    public DocumentModelList getCurrentUserSettings(CoreSession coreSession,
+            DocumentType filter) throws ClientException {
+        try {
+            return getUserSettingsService().getCurrentUserSettings(coreSession,
+                    filter);
+        } catch (Throwable e) {
+            throw ClientException.wrap(e);
+        }
     }
 
-    public DocumentModelList getCurrentUserSettings(CoreSession coreSession, String type) throws ClientException {
-	try {
-	    return getUserSettingsService().getCurrentUserSettings(coreSession, type);
-	} catch (Throwable e) {
-	    throw ClientException.wrap(e);
-	}
+    public DocumentModelList getCurrentUserSettings(CoreSession coreSession,
+            String type) throws ClientException {
+        try {
+            return getUserSettingsService().getCurrentUserSettings(coreSession,
+                    type);
+        } catch (Throwable e) {
+            throw ClientException.wrap(e);
+        }
     }
 
-    public DocumentModelList getUserSettings(String userName) throws ClientException {
-	try {
-	    return getUserSettingsService().getUserSettings(userName);
-	} catch (Throwable e) {
-	    throw ClientException.wrap(e);
-	}
+    public DocumentModelList getUserSettings(String userName)
+            throws ClientException {
+        try {
+            return getUserSettingsService().getUserSettings(userName);
+        } catch (Throwable e) {
+            throw ClientException.wrap(e);
+        }
     }
 
-    public DocumentModelList getUserSettings(String userName, DocumentType filter) throws ClientException {
-	try {
-	    return getUserSettingsService().getUserSettings(userName, filter);
-	} catch (Throwable e) {
-	    throw ClientException.wrap(e);
-	}
+    public DocumentModelList getUserSettings(String userName,
+            DocumentType filter) throws ClientException {
+        try {
+            return getUserSettingsService().getUserSettings(userName, filter);
+        } catch (Throwable e) {
+            throw ClientException.wrap(e);
+        }
     }
 
-    public DocumentModelList getUserSettings(String userName, String type) throws ClientException {
-	try {
-	    return getUserSettingsService().getUserSettings(userName, type);
-	} catch (Throwable e) {
-	    throw ClientException.wrap(e);
-	}
+    public DocumentModelList getUserSettings(String userName, String type)
+            throws ClientException {
+        try {
+            return getUserSettingsService().getUserSettings(userName, type);
+        } catch (Throwable e) {
+            throw ClientException.wrap(e);
+        }
     }
 
-    public DocumentModelList getUserSettings(CoreSession coreSession, String userName) throws ClientException {
-	try {
-	    return getUserSettingsService().getUserSettings(coreSession, userName);
-	} catch (Throwable e) {
-	    throw ClientException.wrap(e);
-	}
+    public DocumentModelList getUserSettings(CoreSession coreSession,
+            String userName) throws ClientException {
+        try {
+            return getUserSettingsService().getUserSettings(coreSession,
+                    userName);
+        } catch (Throwable e) {
+            throw ClientException.wrap(e);
+        }
     }
 
-    public DocumentModelList getUserSettings(CoreSession coreSession, String userName, DocumentType filter)
-	    throws ClientException {
-	try {
-	    return getUserSettingsService().getUserSettings(coreSession, userName, filter);
-	} catch (Throwable e) {
-	    throw ClientException.wrap(e);
-	}
+    public DocumentModelList getUserSettings(CoreSession coreSession,
+            String userName, DocumentType filter) throws ClientException {
+        try {
+            return getUserSettingsService().getUserSettings(coreSession,
+                    userName, filter);
+        } catch (Throwable e) {
+            throw ClientException.wrap(e);
+        }
     }
 
-    public DocumentModelList getUserSettings(CoreSession coreSession, String userName, String type) throws ClientException {
-	try {
-	    return getUserSettingsService().getUserSettings(coreSession, userName, type);
-	} catch (Throwable e) {
-	    throw ClientException.wrap(e);
-	}
+    public DocumentModelList getUserSettings(CoreSession coreSession,
+            String userName, String type) throws ClientException {
+        try {
+            return getUserSettingsService().getUserSettings(coreSession,
+                    userName, type);
+        } catch (Throwable e) {
+            throw ClientException.wrap(e);
+        }
     }
 
     public void initService() throws Exception {
-	try {
-	    getUserSettingsService().initService();
-	} catch (Throwable e) {
-	    throw ClientException.wrap(e);
-	}
+        try {
+            getUserSettingsService().initService();
+        } catch (Throwable e) {
+            throw ClientException.wrap(e);
+        }
     }
 
-    public void registerProvider(String providerName, UserSettingsProvider provider) throws ClientException {
-	try {
-	    getUserSettingsService().registerProvider(providerName, provider);
-	} catch (Throwable e) {
-	    throw ClientException.wrap(e);
-	}
+    public void registerProvider(String providerName,
+            UserSettingsProvider provider) throws ClientException {
+        try {
+            getUserSettingsService().registerProvider(providerName, provider);
+        } catch (Throwable e) {
+            throw ClientException.wrap(e);
+        }
     }
 
     public void termService() throws Exception {
-	try {
-	    getUserSettingsService().termService();
-	} catch (Throwable e) {
-	    throw ClientException.wrap(e);
-	}
+        try {
+            getUserSettingsService().termService();
+        } catch (Throwable e) {
+            throw ClientException.wrap(e);
+        }
     }
 
     public void unRegisterProvider(String providerName) throws ClientException {
-	try {
-	    getUserSettingsService().unRegisterProvider(providerName);
-	} catch (Throwable e) {
-	    throw ClientException.wrap(e);
-	}
+        try {
+            getUserSettingsService().unRegisterProvider(providerName);
+        } catch (Throwable e) {
+            throw ClientException.wrap(e);
+        }
     }
 
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-usersettings-types/src/main/java/com/nuxeo/ecm/usersettings/types/UserSettingsType.java
--- a/nuxeo-platform-usersettings-types/src/main/java/com/nuxeo/ecm/usersettings/types/UserSettingsType.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-usersettings-types/src/main/java/com/nuxeo/ecm/usersettings/types/UserSettingsType.java	Fri Mar 26 09:05:32 2010 +0100
@@ -1,12 +1,13 @@
-
 package com.nuxeo.ecm.usersettings.types;
 
 public interface UserSettingsType {
 
     public static final String DOCTYPE = "UserSettings";
+
     public static final String SCHEMA = "usersettings";
+
     public static final String SCHEMA_PREFIX = "uset";
-    
+
     public static final String PROP_USER = "user";
 
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-usersettings-types/src/main/java/com/nuxeo/ecm/usersettings/types/UserSettingsWrapper.java
--- a/nuxeo-platform-usersettings-types/src/main/java/com/nuxeo/ecm/usersettings/types/UserSettingsWrapper.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-usersettings-types/src/main/java/com/nuxeo/ecm/usersettings/types/UserSettingsWrapper.java	Fri Mar 26 09:05:32 2010 +0100
@@ -1,26 +1,27 @@
-
 package com.nuxeo.ecm.usersettings.types;
 
 import org.nuxeo.ecm.core.api.ClientException;
 import org.nuxeo.ecm.core.api.DocumentModel;
 
-
 public class UserSettingsWrapper {
 
     private DocumentModel document;
-    
+
     public void setUser(String user) throws ClientException {
-	document.setProperty(UserSettingsType.SCHEMA, UserSettingsType.PROP_USER, user);
+        document.setProperty(UserSettingsType.SCHEMA,
+                UserSettingsType.PROP_USER, user);
     }
 
     public String getUser() throws ClientException {
-	return (String) document.getProperty(UserSettingsType.SCHEMA, UserSettingsType.PROP_USER);
+        return (String) document.getProperty(UserSettingsType.SCHEMA,
+                UserSettingsType.PROP_USER);
     }
 
     public UserSettingsWrapper(DocumentModel document) throws ClientException {
-	if (document == null) throw new ClientException("Forbidden to instanciate a wrapper with null document");
-	this.document = document;
+        if (document == null)
+            throw new ClientException(
+                    "Forbidden to instanciate a wrapper with null document");
+        this.document = document;
     }
-    
-    
+
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-usersettings-types/src/test/java/com/nuxeo/ecm/usersettings/types/RepositoryOSGITestCase.java
--- a/nuxeo-platform-usersettings-types/src/test/java/com/nuxeo/ecm/usersettings/types/RepositoryOSGITestCase.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-usersettings-types/src/test/java/com/nuxeo/ecm/usersettings/types/RepositoryOSGITestCase.java	Fri Mar 26 09:05:32 2010 +0100
@@ -38,7 +38,7 @@
 
 /**
  * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a>
- *
+ * 
  */
 public class RepositoryOSGITestCase extends NXRuntimeTestCase {
 
@@ -49,7 +49,7 @@
     protected Repository repository;
 
     protected CoreSession coreSession;
-    
+
     protected DocumentModel rootWorkspace = null;
 
     protected RepositoryOSGITestCase() {
@@ -108,16 +108,17 @@
         return repository;
     }
 
-    
     protected DocumentModel getRootWorkspace() throws ClientException {
-	if (rootWorkspace == null) createRootWorkspace();
-	return rootWorkspace;
+        if (rootWorkspace == null)
+            createRootWorkspace();
+        return rootWorkspace;
     }
-    
+
     private void createRootWorkspace() throws ClientException {
-	rootWorkspace = coreSession.createDocumentModel("/", RepositoryOSGITestCase.ROOT_WORKSPACE_NAME, "Workspace");
-	assertNotNull(rootWorkspace);
-	rootWorkspace=coreSession.createDocument(rootWorkspace);
+        rootWorkspace = coreSession.createDocumentModel("/",
+                RepositoryOSGITestCase.ROOT_WORKSPACE_NAME, "Workspace");
+        assertNotNull(rootWorkspace);
+        rootWorkspace = coreSession.createDocument(rootWorkspace);
     }
 
     protected void openCoreSession(String userName) throws ClientException {
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-usersettings-types/src/test/java/com/nuxeo/ecm/usersettings/types/TestUserSettings.java
--- a/nuxeo-platform-usersettings-types/src/test/java/com/nuxeo/ecm/usersettings/types/TestUserSettings.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-usersettings-types/src/test/java/com/nuxeo/ecm/usersettings/types/TestUserSettings.java	Fri Mar 26 09:05:32 2010 +0100
@@ -19,31 +19,29 @@
 
 package com.nuxeo.ecm.usersettings.types;
 
-
 import org.nuxeo.ecm.core.api.ClientException;
 import org.nuxeo.ecm.core.api.CoreSession;
 import org.nuxeo.ecm.core.api.DocumentModel;
 import org.nuxeo.ecm.core.api.IdRef;
 
-
-
 /**
  * @author <a href="mailto:christophe.capon@vilogia.fr">Christophe Capon</a>
  */
 public class TestUserSettings extends RepositoryOSGITestCase {
 
-    
     private static final String TEST_USERNAME1 = "testusername";
+
     private static final String TEST_USERNAME2 = "testusername2";
+
     private CoreSession session;
-    private DocumentModel root;        
 
-    
-   @Override
+    private DocumentModel root;
+
+    @Override
     public void setUp() throws Exception {
-       
+
         super.setUp();
-       
+
         // Bundle to be tested
         deployBundle("org.nuxeo.ecm.usersettings.types");
 
@@ -58,13 +56,13 @@
         super.tearDown();
     }
 
-  
     public void testCreateUserSettingsDocument() throws Exception {
         DocumentModel doc = createUserSettingsDoc();
-        Object o = doc.getProperty(UserSettingsType.SCHEMA, UserSettingsType.PROP_USER);
+        Object o = doc.getProperty(UserSettingsType.SCHEMA,
+                UserSettingsType.PROP_USER);
         assertNotNull(o);
         assertTrue(o instanceof String);
-        assertEquals(TestUserSettings.TEST_USERNAME1, (String)o);
+        assertEquals(TestUserSettings.TEST_USERNAME1, (String) o);
         session.removeDocument(new IdRef(doc.getId()));
     }
 
@@ -74,20 +72,19 @@
         assertEquals(TestUserSettings.TEST_USERNAME1, w.getUser());
         w.setUser(TestUserSettings.TEST_USERNAME2);
         session.saveDocument(doc);
-        assertEquals(TestUserSettings.TEST_USERNAME2, w.getUser());        
+        assertEquals(TestUserSettings.TEST_USERNAME2, w.getUser());
         session.removeDocument(new IdRef(doc.getId()));
     }
 
     private DocumentModel createUserSettingsDoc() throws ClientException {
-	DocumentModel testDoc = session.createDocumentModel(root.getPathAsString(), "UserSettingsInstance", "UserSettings");
+        DocumentModel testDoc = session.createDocumentModel(
+                root.getPathAsString(), "UserSettingsInstance", "UserSettings");
         assertNotNull(testDoc);
-        testDoc.setProperty(UserSettingsType.SCHEMA, UserSettingsType.PROP_USER, TestUserSettings.TEST_USERNAME1);
+        testDoc.setProperty(UserSettingsType.SCHEMA,
+                UserSettingsType.PROP_USER, TestUserSettings.TEST_USERNAME1);
         testDoc = session.createDocument(testDoc);
         session.saveDocument(testDoc);
-	return testDoc;
+        return testDoc;
     }
-    
-    
 
- 
 }
diff -r e279cd5bf8c7 -r c1cc5ea70ee2 nuxeo-platform-usersettings-web/src/main/java/org/nuxeo/ecm/usersettings/web/impl/UserSettingsManagerActionsBean.java
--- a/nuxeo-platform-usersettings-web/src/main/java/org/nuxeo/ecm/usersettings/web/impl/UserSettingsManagerActionsBean.java	Fri Mar 26 08:07:51 2010 +0100
+++ b/nuxeo-platform-usersettings-web/src/main/java/org/nuxeo/ecm/usersettings/web/impl/UserSettingsManagerActionsBean.java	Fri Mar 26 09:05:32 2010 +0100
@@ -49,7 +49,8 @@
  */
 @Name("userSettingsActions")
 @Scope(CONVERSATION)
-public class UserSettingsManagerActionsBean implements UserSettingsManagerActions {
+public class UserSettingsManagerActionsBean implements
+        UserSettingsManagerActions {
 
     private static final long serialVersionUID = 1828592026739219850L;
 
@@ -75,96 +76,100 @@
     private DocumentModel previousDocument = null;
 
     public void initialize() {
-	log.debug("Initializing user preferences manager actions bean");
-	try {
-	    initialized = true;
-	} catch (Exception e) {
-	    log.error("There was an error while trying to get UserWorkspaceService", e);
-	}
+        log.debug("Initializing user preferences manager actions bean");
+        try {
+            initialized = true;
+        } catch (Exception e) {
+            log.error(
+                    "There was an error while trying to get UserWorkspaceService",
+                    e);
+        }
     }
 
     @Destroy
     @Remove
     public void destroy() {
-	userPreferencesService = null;
-	log.debug("Removing user workspace actions bean");
+        userPreferencesService = null;
+        log.debug("Removing user workspace actions bean");
     }
 
     private UserSettingsService getUserSettingsService() {
-	if (userPreferencesService != null) {
-	    return userPreferencesService;
-	}
-	try {
-	    userPreferencesService = Framework.getService(UserSettingsService.class);
-	    return userPreferencesService;
-	} catch (Exception e) {
-	    return null;
-	}
+        if (userPreferencesService != null) {
+            return userPreferencesService;
+        }
+        try {
+            userPreferencesService = Framework.getService(UserSettingsService.class);
+            return userPreferencesService;
+        } catch (Exception e) {
+            return null;
+        }
     }
 
     public boolean isInitialized() {
-	return initialized;
+        return initialized;
     }
 
     public void setInitialized(boolean initialized) {
-	this.initialized = initialized;
+        this.initialized = initialized;
     }
 
     public DocumentModel getCurrentUserSettings() throws Exception {
 
-	return getUserSettingsService().getCurrentUserSettings(documentManager, "UserSettings").get(0);
+        return getUserSettingsService().getCurrentUserSettings(documentManager,
+                "UserSettings").get(0);
 
     }
 
     public void populateCurrentUserSettings() throws Exception {
 
-	getUserSettingsService().getCurrentUserSettings(documentManager);
+        getUserSettingsService().getCurrentUserSettings(documentManager);
 
     }
 
     public String navigateToCurrentUserSettings() throws Exception {
 
-	if (!initialized) {
-	    initialize();
-	}
-	String returnView = DOCUMENT_VIEW;
+        if (!initialized) {
+            initialize();
+        }
+        String returnView = DOCUMENT_VIEW;
 
-	backupContext();
+        backupContext();
 
-	populateCurrentUserSettings();
-	
-	DocumentModel currentUserPreferences = getCurrentUserSettings();
+        populateCurrentUserSettings();
 
-	navigationContext.setCurrentDocument(currentUserPreferences);
+        DocumentModel currentUserPreferences = getCurrentUserSettings();
 
-	return returnView;
+        navigationContext.setCurrentDocument(currentUserPreferences);
+
+        return returnView;
     }
 
     private void backupContext() {
 
-	if (previousDocument == null
-		|| !previousDocument.getPathAsString().equals(navigationContext.getCurrentDocument().getPathAsString())) {
-	    previousDocument = navigationContext.getCurrentDocument();
-	}
+        if (previousDocument == null
+                || !previousDocument.getPathAsString().equals(
+                        navigationContext.getCurrentDocument().getPathAsString())) {
+            previousDocument = navigationContext.getCurrentDocument();
+        }
 
     }
 
     public String update(DocumentActions docActions) throws ClientException {
 
-	docActions.updateDocument();
+        docActions.updateDocument();
 
-	restoreContext();
+        restoreContext();
 
-	return DOCUMENT_VIEW;
+        return DOCUMENT_VIEW;
 
     }
 
     private void restoreContext() {
-	try {
-	    navigationContext.setCurrentDocument(previousDocument);
-	} catch (ClientException e) {
-	    // TODO Auto-generated catch block
-	}
+        try {
+            navigationContext.setCurrentDocument(previousDocument);
+        } catch (ClientException e) {
+            // TODO Auto-generated catch block
+        }
     }
 
 }
# HG changeset patch
# User Christophe Capon <christophe.capon@vilogia.fr>
# Date 1269594415 -3600
# Branch 5.3.0
# Node ID c4d1538258eb1bae4f1c3c1b4f931d7bafad568b
# Parent  c1cc5ea70ee2d80fd7bf4677f047994eea0e1ff1
More code cleanup

diff -r c1cc5ea70ee2 -r c4d1538258eb nuxeo-platform-alert-api/src/main/java/org/nuxeo/ecm/alert/AlertManagementService.java
--- a/nuxeo-platform-alert-api/src/main/java/org/nuxeo/ecm/alert/AlertManagementService.java	Fri Mar 26 09:05:32 2010 +0100
+++ b/nuxeo-platform-alert-api/src/main/java/org/nuxeo/ecm/alert/AlertManagementService.java	Fri Mar 26 10:06:55 2010 +0100
@@ -20,7 +20,6 @@
 package org.nuxeo.ecm.alert;
 
 import java.io.Serializable;
-import java.util.List;
 import java.util.Map;
 
 import org.nuxeo.ecm.core.api.ClientException;
diff -r c1cc5ea70ee2 -r c4d1538258eb nuxeo-platform-alert-core/src/main/java/org/nuxeo/ecm/alert/core/AlertManagementServiceImpl.java
--- a/nuxeo-platform-alert-core/src/main/java/org/nuxeo/ecm/alert/core/AlertManagementServiceImpl.java	Fri Mar 26 09:05:32 2010 +0100
+++ b/nuxeo-platform-alert-core/src/main/java/org/nuxeo/ecm/alert/core/AlertManagementServiceImpl.java	Fri Mar 26 10:06:55 2010 +0100
@@ -68,11 +68,11 @@
 import org.nuxeo.runtime.api.Framework;
 
 /**
- * 
+ *
  * Default implementation of the {@link UserPreferencesService}
- * 
+ *
  * @author <a href="mailto:christophe.capon@vilogia.fr">Christophe Capon</a>
- * 
+ *
  */
 
 public class AlertManagementServiceImpl implements AlertManagementService,
@@ -103,8 +103,9 @@
     private static UserSettingsService getUserSettingsService()
             throws Exception {
 
-        if (userSettingsService == null)
-            userSettingsService = (UserSettingsService) Framework.getService(UserSettingsService.class);
+        if (userSettingsService == null) {
+            userSettingsService = Framework.getService(UserSettingsService.class);
+        }
 
         return userSettingsService;
     }
@@ -145,16 +146,21 @@
 
     private CoreSession init(AlertContext ctx) throws Exception {
 
-        if (rs == null)
+        if (rs == null) {
             rs = Framework.getService(RenderingService.class);
-        if (helper == null)
+        }
+        if (helper == null) {
             helper = new EmailHelperImpl();
-        if (hrc1 == null)
+        }
+        if (hrc1 == null) {
             hrc1 = new HtmlHeader1RenderingContext();
-        if (hrc2 == null)
+        }
+        if (hrc2 == null) {
             hrc2 = new HtmlHeader2RenderingContext();
-        if (frc == null)
+        }
+        if (frc == null) {
             frc = new HtmlFooterRenderingContext();
+        }
 
         CoreSession coreSession = getCoreSession();
 
@@ -180,16 +186,18 @@
 
                 Entry<String, UserAlerts> alert = alertIter.next();
 
-                if (!allAlerts.containsKey(alert.getKey()))
+                if (!allAlerts.containsKey(alert.getKey())) {
                     allAlerts.put(alert.getKey(),
                             new UserAlerts(alert.getKey()));
+                }
 
                 UserAlerts userAlerts = allAlerts.get(alert.getKey());
 
                 Iterator<Alert> alIter = alert.getValue().getAlerts().iterator();
 
-                while (alIter.hasNext())
+                while (alIter.hasNext()) {
                     userAlerts.getAlerts().add(alIter.next());
+                }
 
             }
 
@@ -207,8 +215,9 @@
 
         while (iter.hasNext()) {
             List<String> tpl = iter.next().getValue().getTemplateList();
-            for (String t : tpl)
+            for (String t : tpl) {
                 rs.registerEngine(new AlertRenderingEngine(t));
+            }
         }
 
     }
@@ -219,8 +228,9 @@
 
         while (iter.hasNext()) {
             List<String> tpl = iter.next().getValue().getTemplateList();
-            for (String t : tpl)
+            for (String t : tpl) {
                 rs.unregisterEngine(t);
+            }
         }
 
         rs.unregisterEngine("alertHeader2");
@@ -504,9 +514,9 @@
 
     public EmailHelper setEmailHelper(EmailHelper emailHelper) {
 
-        EmailHelper old = this.helper;
+        EmailHelper old = helper;
 
-        this.helper = emailHelper;
+        helper = emailHelper;
 
         return old;
 
