Merge "Omaha #5488: Fix deleted subscription notifications" into omaha_16.2.2

Former-commit-id: 50409efd2e9e0bb12efea84a8edac474d65d4b53
This commit is contained in:
Richard Peter 2016-04-06 16:58:11 -05:00 committed by Gerrit Code Review
commit 12873364a5
2 changed files with 28 additions and 9 deletions

View file

@ -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
*
* <pre>
*
@ -38,6 +39,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
* 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.
* Apr 05, 2016 5488 tjensen Added DynamicSerializeElement to removedObject
*
* </pre>
*
@ -49,6 +51,7 @@ public class RemoveRegistryEvent extends RegistryEvent {
private static final long serialVersionUID = -5854149256576746509L;
@DynamicSerializeElement
private RegistryObjectType removedObject;
public RemoveRegistryEvent() {

View file

@ -113,8 +113,9 @@ import com.raytheon.uf.edex.registry.events.DeleteSlotEvent;
* 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
*
*
* </pre>
@ -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);
}