mooli tayer has uploaded a new change for review. Change subject: tools: Rename EventNotificationMethods to EventNotificationMethod. ......................................................................
tools: Rename EventNotificationMethods to EventNotificationMethod. Change-Id: Icb24075599969e4f8ee987851a91032f22190ee9 Signed-off-by: Mooli Tayer <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddEventSubscriptionCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/EventSubscriptionCommandBase.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveEventSubscriptionCommand.java A backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/EventNotificationMethod.java D backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/EventNotificationMethods.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/EventAuditLogSubscriber.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/event_subscriber.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/event_subscriber_id.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/EventDAODbFacadeImpl.java M backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/EventDAOTest.java M backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/NotificationService.java M backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/utils/NotificationMethodsMapper.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/users/UserEventNotifierListModel.java 13 files changed, 47 insertions(+), 47 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/48/23048/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddEventSubscriptionCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddEventSubscriptionCommand.java index 5496967..ba9f714 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddEventSubscriptionCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddEventSubscriptionCommand.java @@ -3,7 +3,7 @@ import java.util.List; import org.apache.commons.lang.StringUtils; -import org.ovirt.engine.core.common.EventNotificationMethods; +import org.ovirt.engine.core.common.EventNotificationMethod; import org.ovirt.engine.core.common.action.EventSubscriptionParametesBase; import org.ovirt.engine.core.common.businessentities.DbUser; import org.ovirt.engine.core.common.businessentities.EventMap; @@ -26,7 +26,7 @@ // method and address Guid subscriberId = getParameters().getEventSubscriber().getsubscriber_id(); String eventName = getParameters().getEventSubscriber().getevent_up_name(); - EventNotificationMethods eventNotificationMethod = + EventNotificationMethod eventNotificationMethod = getParameters().getEventSubscriber().getevent_notification_method(); List<event_subscriber> subscriptions = DbFacade.getInstance() .getEventDao().getAllForSubscriber(subscriberId); @@ -87,7 +87,7 @@ * @return <c>true</c> if [is already subscribed] [the specified subscriptions]; otherwise, <c>false</c>. */ private static boolean IsAlreadySubscribed(Iterable<event_subscriber> subscriptions, Guid subscriberId, - String eventName, EventNotificationMethods eventNotificationMethod) { + String eventName, EventNotificationMethod eventNotificationMethod) { boolean retval = false; for (event_subscriber eventSubscriber : subscriptions) { if (subscriberId.equals(eventSubscriber.getsubscriber_id()) diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/EventSubscriptionCommandBase.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/EventSubscriptionCommandBase.java index 053506e..1e6b6c5 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/EventSubscriptionCommandBase.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/EventSubscriptionCommandBase.java @@ -6,7 +6,7 @@ import org.apache.commons.lang.StringUtils; import org.ovirt.engine.core.bll.utils.PermissionSubject; -import org.ovirt.engine.core.common.EventNotificationMethods; +import org.ovirt.engine.core.common.EventNotificationMethod; import org.ovirt.engine.core.common.VdcObjectType; import org.ovirt.engine.core.common.action.EventSubscriptionParametesBase; import org.ovirt.engine.core.common.businessentities.ActionGroup; @@ -46,10 +46,10 @@ * The user. * @return */ - protected boolean ValidateNotificationMethod(EventNotificationMethods eventNotificationMethod, + protected boolean ValidateNotificationMethod(EventNotificationMethod eventNotificationMethod, event_subscriber event_subscriber, DbUser user) { boolean retValue = true; - EventNotificationMethods notificationMethod = eventNotificationMethod; + EventNotificationMethod notificationMethod = eventNotificationMethod; switch (notificationMethod) { case EMAIL: @@ -72,19 +72,19 @@ /** * Validates the notification method and tag. * - * @param eventNotificationMethods - * The eventNotificationMethods. + * @param eventNotificationMethod + * The eventNotificationMethod. * @param event_subscriber * The event_subscriber. * @param user * The user. * @return */ - protected boolean ValidateAdd(EventNotificationMethods eventNotificationMethods, + protected boolean ValidateAdd(EventNotificationMethod eventNotificationMethod, event_subscriber event_subscriber, DbUser user) { String tagName = event_subscriber.gettag_name(); // validate notification method - boolean retValue = ValidateNotificationMethod(eventNotificationMethods, event_subscriber, user); + boolean retValue = ValidateNotificationMethod(eventNotificationMethod, event_subscriber, user); // validate tag name if exists if (retValue && StringUtils.isNotEmpty(tagName)) { @@ -93,7 +93,7 @@ return retValue; } - protected boolean ValidateRemove(EventNotificationMethods eventNotificationMethods, + protected boolean ValidateRemove(EventNotificationMethod eventNotificationMethod, event_subscriber event_subscriber, DbUser user) { boolean retValue = false; // check if user is subscribed to the event @@ -108,7 +108,7 @@ } else { String tagName = event_subscriber.gettag_name(); // validate notification method - retValue = ValidateNotificationMethod(eventNotificationMethods, event_subscriber, user); + retValue = ValidateNotificationMethod(eventNotificationMethod, event_subscriber, user); // validate tag name if exists if (retValue && StringUtils.isNotEmpty(tagName)) { diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveEventSubscriptionCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveEventSubscriptionCommand.java index c8247df..f5e7750 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveEventSubscriptionCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveEventSubscriptionCommand.java @@ -2,7 +2,7 @@ import java.util.List; -import org.ovirt.engine.core.common.EventNotificationMethods; +import org.ovirt.engine.core.common.EventNotificationMethod; import org.ovirt.engine.core.common.action.EventSubscriptionParametesBase; import org.ovirt.engine.core.common.businessentities.DbUser; import org.ovirt.engine.core.common.businessentities.EventMap; @@ -19,7 +19,7 @@ protected boolean canDoAction() { boolean retValue; // get notification method - EventNotificationMethods event_notification_method = getParameters().getEventSubscriber().getevent_notification_method(); + EventNotificationMethod event_notification_method = getParameters().getEventSubscriber().getevent_notification_method(); if (event_notification_method != null) { // validate event List<EventMap> event_map = DbFacade.getInstance().getEventDao().getEventMapByName( diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/EventNotificationMethod.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/EventNotificationMethod.java new file mode 100644 index 0000000..49a9321 --- /dev/null +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/EventNotificationMethod.java @@ -0,0 +1,5 @@ +package org.ovirt.engine.core.common; + +public enum EventNotificationMethod { + EMAIL +} diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/EventNotificationMethods.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/EventNotificationMethods.java deleted file mode 100644 index 6286903..0000000 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/EventNotificationMethods.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.ovirt.engine.core.common; - -public enum EventNotificationMethods { - EMAIL -} diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/EventAuditLogSubscriber.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/EventAuditLogSubscriber.java index 6ac973a..4f554ea 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/EventAuditLogSubscriber.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/EventAuditLogSubscriber.java @@ -3,7 +3,7 @@ import java.io.Serializable; import java.util.Date; -import org.ovirt.engine.core.common.EventNotificationMethods; +import org.ovirt.engine.core.common.EventNotificationMethod; import org.ovirt.engine.core.compat.Guid; public class EventAuditLogSubscriber implements Serializable { @@ -46,13 +46,13 @@ this.event_up_nameField = value; } - private EventNotificationMethods eventNotificationMethod; + private EventNotificationMethod eventNotificationMethod; - public EventNotificationMethods getEventNotificationMethod() { + public EventNotificationMethod getEventNotificationMethod() { return this.eventNotificationMethod; } - public void setEventNotificationMethod(EventNotificationMethods eventNotificationMethod) { + public void setEventNotificationMethod(EventNotificationMethod eventNotificationMethod) { this.eventNotificationMethod = eventNotificationMethod; } diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/event_subscriber.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/event_subscriber.java index 1d15cc7..093cff7 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/event_subscriber.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/event_subscriber.java @@ -3,7 +3,7 @@ import java.io.Serializable; import org.hibernate.validator.constraints.Email; -import org.ovirt.engine.core.common.EventNotificationMethods; +import org.ovirt.engine.core.common.EventNotificationMethod; import org.ovirt.engine.core.common.utils.ObjectUtils; import org.ovirt.engine.core.compat.Guid; import org.ovirt.engine.core.compat.StringFormat; @@ -48,7 +48,7 @@ && ObjectUtils.objectsEqual(id.tagName, other.id.tagName)); } - public event_subscriber(String event_up_name, EventNotificationMethods eventNotificationMethod, + public event_subscriber(String event_up_name, EventNotificationMethod eventNotificationMethod, Guid subscriber_id, String tagName) { this(); this.id.eventUpName = event_up_name; @@ -58,7 +58,7 @@ this.id.tagName = tagName; } - public event_subscriber(String event_up_name, EventNotificationMethods eventNotificationMethod, String method_address, Guid subscriber_id, + public event_subscriber(String event_up_name, EventNotificationMethod eventNotificationMethod, String method_address, Guid subscriber_id, String tagName) { this (event_up_name, eventNotificationMethod, subscriber_id, tagName); this.methodAddress = method_address; @@ -72,11 +72,11 @@ this.id.eventUpName = value; } - public EventNotificationMethods getevent_notification_method() { + public EventNotificationMethod getevent_notification_method() { return this.id.eventNotificationMethod; } - public void setevent_notification_method(EventNotificationMethods eventNotificationMethod) { + public void setevent_notification_method(EventNotificationMethod eventNotificationMethod) { this.id.eventNotificationMethod = eventNotificationMethod; } diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/event_subscriber_id.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/event_subscriber_id.java index aaa047f..097d485 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/event_subscriber_id.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/event_subscriber_id.java @@ -2,7 +2,7 @@ import java.io.Serializable; -import org.ovirt.engine.core.common.EventNotificationMethods; +import org.ovirt.engine.core.common.EventNotificationMethod; import org.ovirt.engine.core.common.utils.ObjectUtils; import org.ovirt.engine.core.compat.Guid; @@ -11,7 +11,7 @@ Guid subscriberId; String eventUpName; - EventNotificationMethods eventNotificationMethod; + EventNotificationMethod eventNotificationMethod; String tagName; @Override diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/EventDAODbFacadeImpl.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/EventDAODbFacadeImpl.java index b5aa634..141da5f 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/EventDAODbFacadeImpl.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/EventDAODbFacadeImpl.java @@ -4,7 +4,7 @@ import java.sql.SQLException; import java.util.List; -import org.ovirt.engine.core.common.EventNotificationMethods; +import org.ovirt.engine.core.common.EventNotificationMethod; import org.ovirt.engine.core.common.businessentities.EventMap; import org.ovirt.engine.core.common.businessentities.event_subscriber; import org.ovirt.engine.core.compat.Guid; @@ -25,7 +25,7 @@ throws SQLException { event_subscriber entity = new event_subscriber(); entity.setevent_up_name(rs.getString("event_up_name")); - entity.setevent_notification_method(EventNotificationMethods.valueOf(rs.getString("notification_method"))); + entity.setevent_notification_method(EventNotificationMethod.valueOf(rs.getString("notification_method"))); entity.setmethod_address(rs.getString("method_address")); entity.setsubscriber_id(getGuidDefaultEmpty(rs, "subscriber_id")); entity.settag_name(rs.getString("tag_name")); diff --git a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/EventDAOTest.java b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/EventDAOTest.java index 398ae49..252124d 100644 --- a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/EventDAOTest.java +++ b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/EventDAOTest.java @@ -9,7 +9,7 @@ import java.util.List; import org.junit.Test; -import org.ovirt.engine.core.common.EventNotificationMethods; +import org.ovirt.engine.core.common.EventNotificationMethod; import org.ovirt.engine.core.common.businessentities.EventMap; import org.ovirt.engine.core.common.businessentities.event_notification_hist; import org.ovirt.engine.core.common.businessentities.event_subscriber; @@ -32,7 +32,7 @@ newSubscriber = new Guid("9bf7c640-b620-456f-a550-0348f366544b"); newSubscription = new event_subscriber(); newSubscription.setsubscriber_id(newSubscriber); - newSubscription.setevent_notification_method(EventNotificationMethods.EMAIL); + newSubscription.setevent_notification_method(EventNotificationMethod.EMAIL); newSubscription.setevent_up_name("TestRun"); newSubscription.settag_name("farkle"); diff --git a/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/NotificationService.java b/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/NotificationService.java index aa1b5c0..ee14ae0 100644 --- a/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/NotificationService.java +++ b/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/NotificationService.java @@ -20,7 +20,7 @@ import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; import org.ovirt.engine.core.common.AuditLogSeverity; -import org.ovirt.engine.core.common.EventNotificationMethods; +import org.ovirt.engine.core.common.EventNotificationMethod; import org.ovirt.engine.core.common.businessentities.DbUser; import org.ovirt.engine.core.common.businessentities.EventAuditLogSubscriber; import org.ovirt.engine.core.common.businessentities.event_notification_hist; @@ -79,7 +79,7 @@ failedQueriesNotificationThreshold = 1; } notificationMethodsMapper = new NotificationMethodsMapper(prop); - failedQueriesEventSender = notificationMethodsMapper.getEventSender(EventNotificationMethods.EMAIL); + failedQueriesEventSender = notificationMethodsMapper.getEventSender(EventNotificationMethod.EMAIL); } private int getNonNegativeIntegerProperty(final String name) throws NotificationServiceException { @@ -351,7 +351,7 @@ eals.setevent_type(rs.getInt("event_type")); eals.setsubscriber_id(Guid.createGuidFromStringDefaultEmpty(rs.getString("subscriber_id"))); eals.setevent_up_name(rs.getString("event_up_name")); - eals.setEventNotificationMethod(EventNotificationMethods.valueOf(rs.getString("notification_method"))); + eals.setEventNotificationMethod(EventNotificationMethod.valueOf(rs.getString("notification_method"))); eals.setmethod_address(rs.getString("method_address")); eals.settag_name(rs.getString("tag_name")); eals.setaudit_log_id(rs.getLong("audit_log_id")); @@ -383,7 +383,7 @@ EventAuditLogSubscriber eals = new EventAuditLogSubscriber(); eals.setevent_type(MessageHelper.MessageType.alertMessage.getEventType()); eals.setevent_up_name("DATABASE_UNREACHABLE"); - eals.setEventNotificationMethod(EventNotificationMethods.EMAIL); + eals.setEventNotificationMethod(EventNotificationMethod.EMAIL); eals.setmethod_address(StringUtils.strip(email)); eals.setmessage("Failed to query for notifications. Database Connection refused."); eals.setseverity(AuditLogSeverity.ERROR.getValue()); diff --git a/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/utils/NotificationMethodsMapper.java b/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/utils/NotificationMethodsMapper.java index 1dcb8d6..26ce6a7 100644 --- a/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/utils/NotificationMethodsMapper.java +++ b/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/utils/NotificationMethodsMapper.java @@ -1,6 +1,6 @@ package org.ovirt.engine.core.notifier.utils; -import org.ovirt.engine.core.common.EventNotificationMethods; +import org.ovirt.engine.core.common.EventNotificationMethod; import org.ovirt.engine.core.notifier.utils.sender.EventSender; import org.ovirt.engine.core.notifier.utils.sender.mail.EventSenderMailImpl; @@ -9,13 +9,13 @@ public class NotificationMethodsMapper { - private Map<EventNotificationMethods, EventSender> eventSenders = new HashMap<>(); + private Map<EventNotificationMethod, EventSender> eventSenders = new HashMap<>(); public NotificationMethodsMapper(NotificationProperties prop) { - eventSenders.put(EventNotificationMethods.EMAIL, new EventSenderMailImpl(prop)); + eventSenders.put(EventNotificationMethod.EMAIL, new EventSenderMailImpl(prop)); } - public EventSender getEventSender(EventNotificationMethods method) { + public EventSender getEventSender(EventNotificationMethod method) { return eventSenders.get(method); } diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/users/UserEventNotifierListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/users/UserEventNotifierListModel.java index 801aa9b..a99ef0d 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/users/UserEventNotifierListModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/users/UserEventNotifierListModel.java @@ -7,7 +7,7 @@ import org.ovirt.engine.core.common.AuditLogType; import org.ovirt.engine.core.common.EventNotificationEntity; -import org.ovirt.engine.core.common.EventNotificationMethods; +import org.ovirt.engine.core.common.EventNotificationMethod; import org.ovirt.engine.core.common.action.EventSubscriptionParametesBase; import org.ovirt.engine.core.common.action.VdcActionParametersBase; import org.ovirt.engine.core.common.action.VdcActionType; @@ -254,14 +254,14 @@ for (event_subscriber a : existing) { toRemoveList.add(new EventSubscriptionParametesBase(new event_subscriber(a.getevent_up_name(), - EventNotificationMethods.EMAIL, + EventNotificationMethod.EMAIL, a.getmethod_address(), a.getsubscriber_id(), ""), "")); //$NON-NLS-1$ //$NON-NLS-2$ } for (SelectionTreeNodeModel a : selected) { toAddList.add(new EventSubscriptionParametesBase(new event_subscriber(a.getTitle(), - EventNotificationMethods.EMAIL, + EventNotificationMethod.EMAIL, (String) model.getEmail().getEntity(), getEntity().getId(), ""), "")); //$NON-NLS-1$ //$NON-NLS-2$ } @@ -271,7 +271,7 @@ for (SelectionTreeNodeModel a : added) { toAddList.add(new EventSubscriptionParametesBase(new event_subscriber(a.getTitle(), - EventNotificationMethods.EMAIL, + EventNotificationMethod.EMAIL, (String) model.getEmail().getEntity(), getEntity().getId(), ""), "")); //$NON-NLS-1$ //$NON-NLS-2$ } @@ -279,7 +279,7 @@ for (event_subscriber a : removed) { toRemoveList.add(new EventSubscriptionParametesBase(new event_subscriber(a.getevent_up_name(), - EventNotificationMethods.EMAIL, + EventNotificationMethod.EMAIL, a.getmethod_address(), a.getsubscriber_id(), ""), "")); //$NON-NLS-1$ //$NON-NLS-2$ } -- To view, visit http://gerrit.ovirt.org/23048 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Icb24075599969e4f8ee987851a91032f22190ee9 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: mooli tayer <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
