From 173b91c59ae800ae7013d61bd0d62cf78e92120b Mon Sep 17 00:00:00 2001 From: Tim Jensen Date: Tue, 5 Apr 2016 16:24:21 -0500 Subject: [PATCH] Omaha #5488 - Fix deleted subscription notifications (cherry picked from d10dc5444df4c1d016d1a0a597dea67d89720e17 [formerly 1ea33b16eabaf4cef0155a3389a70c0b9e31464a]) Change-Id: I3d7dec1153f163d085bcbfd8208b2c0a850a0b14 Former-commit-id: 87bc96e88a476323c9cd1bb92162e41facbb333e --- .../registry/event/RemoveRegistryEvent.java | 7 +++-- .../lifecycle/LifecycleManagerImpl.java | 30 ++++++++++++++----- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/edexOsgi/com.raytheon.uf.common.registry.event/src/com/raytheon/uf/common/registry/event/RemoveRegistryEvent.java b/edexOsgi/com.raytheon.uf.common.registry.event/src/com/raytheon/uf/common/registry/event/RemoveRegistryEvent.java index c796161058..6e86c09221 100644 --- a/edexOsgi/com.raytheon.uf.common.registry.event/src/com/raytheon/uf/common/registry/event/RemoveRegistryEvent.java +++ b/edexOsgi/com.raytheon.uf.common.registry.event/src/com/raytheon/uf/common/registry/event/RemoveRegistryEvent.java @@ -23,10 +23,11 @@ package com.raytheon.uf.common.registry.event; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; +import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; /** * - * TODO Add Description + * Registry Event for removing objects * *
  * 
@@ -37,7 +38,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
  * Mar 16, 2012            jsanchez     Initial creation
  * Nov 08, 2013 2506       bgonzale     Added constructors.  Added object deleted field.
  *                                      Added RegistryObjectType field.
- * Mar 31, 2014 2889      dhladky      Added username for notification center tracking.
+ * Mar 31, 2014 2889       dhladky      Added username for notification center tracking.
+ * Apr 05, 2016 5488       tjensen      Added DynamicSerializeElement to removedObject
  * 
  * 
* @@ -49,6 +51,7 @@ public class RemoveRegistryEvent extends RegistryEvent { private static final long serialVersionUID = -5854149256576746509L; + @DynamicSerializeElement private RegistryObjectType removedObject; public RemoveRegistryEvent() { diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/lifecycle/LifecycleManagerImpl.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/lifecycle/LifecycleManagerImpl.java index ea635944de..6272be122a 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/lifecycle/LifecycleManagerImpl.java +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/lifecycle/LifecycleManagerImpl.java @@ -95,8 +95,8 @@ import com.raytheon.uf.edex.registry.events.DeleteSlotEvent; * * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * Jan 18, 2012 bphillip Initial creation - * Sep 14, 2012 1169 djohnson Throw exception when object exists during create only mode. + * Jan 18, 2012 bphillip Initial creation + * Sep 14, 2012 1169 djohnson Throw exception when object exists during create only mode. * 3/18/2013 1802 bphillip Modified to use transaction boundaries and spring injection * 4/9/2013 1802 bphillip Changed how auditable events are handled * Apr 18, 2013 1693 djohnson Changes to conform to Ebxml 4.0 SubmitObjects protocol. @@ -109,12 +109,13 @@ import com.raytheon.uf.edex.registry.events.DeleteSlotEvent; * Separate update from create notifications. * 12/2/2013 1829 bphillip Auditable events are not genereted via messages on the event bus * 01/21/2014 2613 bphillip Removed verbose log message from removeObjects - * 2/19/2014 2769 bphillip Added current time to audit trail events + * 2/19/2014 2769 bphillip Added current time to audit trail events * Mar 31, 2014 2889 dhladky Added username for notification center tracking. * 4/11/2014 3011 bphillip Modified merge behavior * 4/17/2014 3011 bphillip Delete slot events now contain strings - * June 25, 2014 2760 dhladky Added external delivery of registry events + * Jun 25, 2014 2760 dhladky Added external delivery of registry events * May 14, 2015 4493 dhladky Better integrated external delivery of registry events. + * Apr 05, 2016 5488 tjensen Fixed serialization issue in removeObjects * * * @@ -297,8 +298,22 @@ public class LifecycleManagerImpl implements LifecycleManager { // Don't send notifications for Association types if (objectType != null && !objectType.equals(RegistryObjectTypes.ASSOCIATION)) { + + /* + * Clone the object before publishing it to the Event Bus. This + * resolves an issue with serialization due to the + * InternationalStringType data of the obj having odd + * classnames. + */ + RegistryObjectType objClone = new RegistryObjectType( + obj.getId(), obj.getLid(), obj.getObjectType(), + obj.getOwner(), obj.getStatus(), obj.getName() + .toString(), obj.getDescription().toString()); + objClone.setSlot(obj.getSlot()); + objClone.setVersionInfo(obj.getVersionInfo()); RemoveRegistryEvent event = new RemoveRegistryEvent( - request.getUsername(), obj.getId(), obj); + request.getUsername(), obj.getId(), objClone); + event.setAction(Action.DELETE); event.setLid(obj.getLid()); event.setObjectType(objectType); @@ -762,7 +777,8 @@ public class LifecycleManagerImpl implements LifecycleManager { private void mergeObjects(RegistryObjectType newObject, RegistryObjectType existingObject) { - DeleteSlotEvent deleteSlotEvent = new DeleteSlotEvent(existingObject.getSlot()); + DeleteSlotEvent deleteSlotEvent = new DeleteSlotEvent( + existingObject.getSlot()); registryObjectDao.merge(newObject, existingObject); EventBus.publish(deleteSlotEvent); } @@ -860,5 +876,5 @@ public class LifecycleManagerImpl implements LifecycleManager { public void setXpathProcessor(RegistryXPathProcessor xpathProcessor) { this.xpathProcessor = xpathProcessor; } - + }