mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Coding standards and consistency sweep across new services code in repository project.
Covers spacing, trailing {, @since tags, tabs and copyright headers. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@30211 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
@@ -36,6 +36,7 @@ import org.springframework.extensions.surf.util.I18NUtil;
|
||||
* Notification service implementation.
|
||||
*
|
||||
* @author Roy Wetherall
|
||||
* @since 4.0
|
||||
*/
|
||||
public class NotificationServiceImpl implements NotificationService
|
||||
{
|
||||
@@ -49,58 +50,58 @@ public class NotificationServiceImpl implements NotificationService
|
||||
/** Map of registered notification providers */
|
||||
private Map<String, NotificationProvider> providers = new HashMap<String, NotificationProvider>(3);
|
||||
|
||||
/**
|
||||
* @see org.alfresco.service.cmr.notification.NotificationService#register(org.alfresco.service.cmr.notification.NotificationProvider)
|
||||
*/
|
||||
@Override
|
||||
public void register(NotificationProvider notificationProvider)
|
||||
{
|
||||
// Check mandatory params
|
||||
ParameterCheck.mandatory("notificationProvider", notificationProvider);
|
||||
|
||||
// Add the notification provider to the map
|
||||
providers.put(notificationProvider.getName(), notificationProvider);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.service.cmr.notification.NotificationService#exists(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public boolean exists(String notificationProvider)
|
||||
{
|
||||
// Check the mandatory params
|
||||
ParameterCheck.mandatory("notificationProvider", notificationProvider);
|
||||
|
||||
return providers.containsKey(notificationProvider);
|
||||
}
|
||||
/**
|
||||
* @see org.alfresco.service.cmr.notification.NotificationService#register(org.alfresco.service.cmr.notification.NotificationProvider)
|
||||
*/
|
||||
@Override
|
||||
public void register(NotificationProvider notificationProvider)
|
||||
{
|
||||
// Check mandatory params
|
||||
ParameterCheck.mandatory("notificationProvider", notificationProvider);
|
||||
|
||||
// Add the notification provider to the map
|
||||
providers.put(notificationProvider.getName(), notificationProvider);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.service.cmr.notification.NotificationService#getNotificationProviders()
|
||||
*/
|
||||
@Override
|
||||
public List<String> getNotificationProviders()
|
||||
{
|
||||
return new ArrayList<String>(providers.keySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.service.cmr.notification.NotificationService#sendNotification(java.lang.String, org.alfresco.service.cmr.notification.NotificationContext)
|
||||
*/
|
||||
@Override
|
||||
public void sendNotification(String notificationProvider, NotificationContext notificationContext)
|
||||
{
|
||||
// Check the mandatory params
|
||||
ParameterCheck.mandatory("notificationProvider", notificationProvider);
|
||||
ParameterCheck.mandatory("notificationContext", notificationContext);
|
||||
|
||||
// Check that the notificaiton provider exists
|
||||
if (exists(notificationProvider) == false)
|
||||
{
|
||||
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NP_DOES_NOT_EXIST, notificationProvider));
|
||||
}
|
||||
|
||||
// Get the notification provider and send notification
|
||||
NotificationProvider provider = providers.get(notificationProvider);
|
||||
provider.sendNotification(notificationContext);
|
||||
}
|
||||
/**
|
||||
* @see org.alfresco.service.cmr.notification.NotificationService#exists(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public boolean exists(String notificationProvider)
|
||||
{
|
||||
// Check the mandatory params
|
||||
ParameterCheck.mandatory("notificationProvider", notificationProvider);
|
||||
|
||||
return providers.containsKey(notificationProvider);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.service.cmr.notification.NotificationService#getNotificationProviders()
|
||||
*/
|
||||
@Override
|
||||
public List<String> getNotificationProviders()
|
||||
{
|
||||
return new ArrayList<String>(providers.keySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.service.cmr.notification.NotificationService#sendNotification(java.lang.String, org.alfresco.service.cmr.notification.NotificationContext)
|
||||
*/
|
||||
@Override
|
||||
public void sendNotification(String notificationProvider, NotificationContext notificationContext)
|
||||
{
|
||||
// Check the mandatory params
|
||||
ParameterCheck.mandatory("notificationProvider", notificationProvider);
|
||||
ParameterCheck.mandatory("notificationContext", notificationContext);
|
||||
|
||||
// Check that the notificaiton provider exists
|
||||
if (exists(notificationProvider) == false)
|
||||
{
|
||||
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NP_DOES_NOT_EXIST, notificationProvider));
|
||||
}
|
||||
|
||||
// Get the notification provider and send notification
|
||||
NotificationProvider provider = providers.get(notificationProvider);
|
||||
provider.sendNotification(notificationContext);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user