Merge "Issue #2354 Fixed replication of deleted objects" into development

Former-commit-id: d89e040f25fb67e1f4bf86a67736287e96e855fd
This commit is contained in:
Richard Peter 2013-09-12 13:31:59 -05:00 committed by Gerrit Code Review
commit f7f6661ca4
6 changed files with 129 additions and 174 deletions

View file

@ -21,8 +21,8 @@
package com.raytheon.uf.edex.registry.ebxml.dao; package com.raytheon.uf.edex.registry.ebxml.dao;
import java.math.BigInteger; import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Collections;
import java.util.List; import java.util.List;
import javax.xml.datatype.XMLGregorianCalendar; import javax.xml.datatype.XMLGregorianCalendar;
@ -35,6 +35,7 @@ import org.springframework.transaction.annotation.Transactional;
import com.raytheon.uf.common.registry.constants.ActionTypes; import com.raytheon.uf.common.registry.constants.ActionTypes;
import com.raytheon.uf.common.time.util.TimeUtil; import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.common.util.CollectionUtil;
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException; import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil; import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
@ -53,6 +54,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
* May 02, 2013 1910 djohnson Broke out registry subscription notification to a service class. * May 02, 2013 1910 djohnson Broke out registry subscription notification to a service class.
* 7/29/2013 2191 bphillip Changed method to get expired events * 7/29/2013 2191 bphillip Changed method to get expired events
* 8/1/2013 1693 bphillip Moved creation of auditable events to the auditable event service class * 8/1/2013 1693 bphillip Moved creation of auditable events to the auditable event service class
* 9/11/2013 2354 bphillip Modified queries to find deleted objects
* *
* </pre> * </pre>
* *
@ -68,11 +70,20 @@ public class AuditableEventTypeDao extends
* Query to find events of interest when sending registry replication * Query to find events of interest when sending registry replication
* notifications * notifications
*/ */
private static final String EVENTS_OF_INTEREST_QUERY = "select event from AuditableEventType as event " private static final String FIND_EVENTS_OF_INTEREST_QUERY = "select event from AuditableEventType as event "
+ "left outer join event.action as action " + "left outer join event.action as action "
+ "left outer join action.affectedObjects as AffectedObjects " + "left outer join action.affectedObjects as AffectedObjects "
+ "left outer join action.affectedObjectRefs as AffectedObjectRefs "
+ "left outer join AffectedObjects.registryObject as RegistryObjects " + "left outer join AffectedObjects.registryObject as RegistryObjects "
+ "where (RegistryObjects.id in (:ids) OR action.eventType = :eventType) and event.timestamp >= :startTime"; + "left outer join AffectedObjectRefs.objectRef as ObjRefs "
+ "where (ObjRefs.id in (:ids) OR RegistryObjects.id in (:ids) OR action.eventType = :eventType) and event.timestamp >= :startTime";
/**
* Query to find deleted events
*/
private static final String FIND_DELETED_EVENTS_OF_INTEREST_QUERY = "select event from AuditableEventType as event "
+ "left outer join event.action as action "
+ "where action.eventType = :eventType and event.timestamp >= :startTime";
/** Optional end time clause */ /** Optional end time clause */
private static final String END_TIME_CLAUSE = " and event.timestamp <= :endTime"; private static final String END_TIME_CLAUSE = " and event.timestamp <= :endTime";
@ -136,24 +147,33 @@ public class AuditableEventTypeDao extends
public List<AuditableEventType> getEventsOfInterest( public List<AuditableEventType> getEventsOfInterest(
XMLGregorianCalendar startTime, XMLGregorianCalendar endTime, XMLGregorianCalendar startTime, XMLGregorianCalendar endTime,
List<ObjectRefType> objectsOfInterest) { List<ObjectRefType> objectsOfInterest) {
if (objectsOfInterest.isEmpty()) { String query = FIND_DELETED_EVENTS_OF_INTEREST_QUERY;
return Collections.emptyList(); List<Object> queryParams = new ArrayList<Object>(4);
} queryParams.add("eventType");
StringBuilder buf = new StringBuilder(); queryParams.add(ActionTypes.delete);
for (ObjectRefType objOfInterest : objectsOfInterest) { queryParams.add("startTime");
buf.append(", '").append(objOfInterest.getId()).append("'"); queryParams.add(startTime);
} if (!CollectionUtil.isNullOrEmpty(objectsOfInterest)) {
String inString = buf.toString().replaceFirst(",", ""); StringBuilder buf = new StringBuilder();
if (endTime == null) { for (int i = 0; i < objectsOfInterest.size(); i++) {
return this.query((EVENTS_OF_INTEREST_QUERY + ORDER_CLAUSE) if (i > 0) {
.replace(IDS, inString), "startTime", startTime, buf.append(", ");
"eventType", ActionTypes.delete); }
} else { buf.append("'").append(objectsOfInterest.get(i).getId())
return this.query( .append("'");
(EVENTS_OF_INTEREST_QUERY + END_TIME_CLAUSE + ORDER_CLAUSE) }
.replace(IDS, inString), "startTime", startTime, query = FIND_EVENTS_OF_INTEREST_QUERY.replaceAll(IDS, buf.toString());
"eventType", ActionTypes.delete, "endTime", endTime);
if (endTime == null) {
query += ORDER_CLAUSE;
} else {
query += END_TIME_CLAUSE + ORDER_CLAUSE;
queryParams.add("endTime");
queryParams.add(endTime);
}
} }
return this.query(query,
queryParams.toArray(new Object[queryParams.size()]));
} }
/** /**

View file

@ -25,12 +25,10 @@ import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ActionType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.AuditableEventType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.AuditableEventType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectRefListType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectRefListType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectRefType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectRefType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectListType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.VersionInfoType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.VersionInfoType;
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryRequestType; import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryRequestType;
import com.raytheon.uf.common.registry.constants.ActionTypes;
import com.raytheon.uf.common.registry.constants.RegistryObjectTypes; import com.raytheon.uf.common.registry.constants.RegistryObjectTypes;
import com.raytheon.uf.common.registry.constants.StatusTypes; import com.raytheon.uf.common.registry.constants.StatusTypes;
import com.raytheon.uf.common.registry.ebxml.RegistryUtil; import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
@ -53,6 +51,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* May 02, 2013 1910 djohnson Extracted subscription notification from the dao. * May 02, 2013 1910 djohnson Extracted subscription notification from the dao.
* 8/1/2013 1692 bphillip Refactored auditable event creation * 8/1/2013 1692 bphillip Refactored auditable event creation
* 9/11/2013 2254 bphillip Cleaned up creation of auditable events
* *
* </pre> * </pre>
* *
@ -90,36 +89,24 @@ public class AuditableEventService {
* Creates auditable events from the given objects * Creates auditable events from the given objects
* *
* @param request * @param request
* The request object which was process that generated the events * The request that generated the changes
* @param objectsCreated * @param actionType
* The objects created during the processing of the request * The action that was taken on the object
* @param objectsUpdated * @param objectsAffected
* The objects updated during the processing of the request * The objects that were affected
* @param objectsVersioned
* The objects versioned during the processing of the request
* @param objectsRemoved
* The objects removed during the processing of the request
* @throws EbxmlRegistryException * @throws EbxmlRegistryException
* If errors occur creating the event * If errors occur while creating the event
*/ */
public void createAuditableEventFromObjects(RegistryRequestType request, public void createAuditableEventFromObjects(RegistryRequestType request,
List<RegistryObjectType> objectsCreated, String actionType, List<RegistryObjectType> objectsAffected)
List<RegistryObjectType> objectsUpdated,
List<RegistryObjectType> objectsVersioned,
List<RegistryObjectType> objectsRemoved)
throws EbxmlRegistryException { throws EbxmlRegistryException {
AuditableEventType event = createEvent(request, if (!CollectionUtil.isNullOrEmpty(objectsAffected)) {
TimeUtil.currentTimeMillis()); AuditableEventType event = createEvent(request,
addRegistryObjectActionToEvent(event, ActionTypes.create, TimeUtil.currentTimeMillis());
objectsCreated); addRegistryObjectActionToEvent(event, actionType, objectsAffected);
addRegistryObjectActionToEvent(event, ActionTypes.update, auditDao.create(event);
objectsUpdated); notifySubscriptionManager();
addRegistryObjectActionToEvent(event, ActionTypes.version, }
objectsVersioned);
addRegistryObjectActionToEvent(event, ActionTypes.delete,
objectsRemoved);
auditDao.create(event);
notifySubscriptionManager();
} }
/** /**
@ -134,49 +121,39 @@ public class AuditableEventService {
*/ */
private void addRegistryObjectActionToEvent(AuditableEventType event, private void addRegistryObjectActionToEvent(AuditableEventType event,
String eventType, List<RegistryObjectType> objs) { String eventType, List<RegistryObjectType> objs) {
if (!CollectionUtil.isNullOrEmpty(objs)) { ActionType action = new ActionType();
ActionType action = new ActionType(); action.setEventType(eventType);
action.setEventType(eventType); ObjectRefListType objList = new ObjectRefListType();
RegistryObjectListType objList = new RegistryObjectListType(); for (RegistryObjectType obj : objs) {
objList.getRegistryObject().addAll(objs); objList.getObjectRef().add(new ObjectRefType(obj.getId()));
action.setAffectedObjects(objList);
event.getAction().add(action);
} }
action.setAffectedObjectRefs(objList);
event.getAction().add(action);
} }
/** /**
* Creates an auditable event from the given object references * Creates an auditable event from the given object references
* *
* @param request * @param request
* The request that is generating the event * The request that generated the changes
* @param objectsCreated * @param actionType
* References to the objects created during the processing of the * The action that was taken on the object
* request * @param objectsAffected
* @param objectsUpdated * The references to the objects that were affected
* References to the objects updated during the processing of the
* request
* @param objectsVersioned
* References to the object versioned during the processing of
* the request
* @param objectsRemoved
* References to the objects removed during the processing of the
* request
* @throws EbxmlRegistryException * @throws EbxmlRegistryException
* If error occur while creating the event * If errors occur while creating the event
*/ */
public void createAuditableEventFromRefs(RegistryRequestType request, public void createAuditableEventFromRefs(RegistryRequestType request,
List<ObjectRefType> objectsCreated, String actionType, List<ObjectRefType> objectsAffected)
List<ObjectRefType> objectsUpdated, throws EbxmlRegistryException {
List<ObjectRefType> objectsVersioned, if (!CollectionUtil.isNullOrEmpty(objectsAffected)) {
List<ObjectRefType> objectsRemoved) throws EbxmlRegistryException { AuditableEventType event = createEvent(request,
AuditableEventType event = createEvent(request, TimeUtil.currentTimeMillis());
TimeUtil.currentTimeMillis()); addObjectRefActionToEvent(event, actionType, objectsAffected);
addObjectRefActionToEvent(event, ActionTypes.create, objectsCreated); auditDao.create(event);
addObjectRefActionToEvent(event, ActionTypes.update, objectsUpdated); notifySubscriptionManager();
addObjectRefActionToEvent(event, ActionTypes.version, objectsVersioned); }
addObjectRefActionToEvent(event, ActionTypes.delete, objectsRemoved);
auditDao.create(event);
notifySubscriptionManager();
} }
/** /**
@ -191,14 +168,12 @@ public class AuditableEventService {
*/ */
private void addObjectRefActionToEvent(AuditableEventType event, private void addObjectRefActionToEvent(AuditableEventType event,
String eventType, List<ObjectRefType> objs) { String eventType, List<ObjectRefType> objs) {
if (!CollectionUtil.isNullOrEmpty(objs)) { ActionType action = new ActionType();
ActionType action = new ActionType(); action.setEventType(eventType);
action.setEventType(eventType); ObjectRefListType objList = new ObjectRefListType();
ObjectRefListType objList = new ObjectRefListType(); objList.getObjectRef().addAll(objs);
objList.getObjectRef().addAll(objs); action.setAffectedObjectRefs(objList);
action.setAffectedObjectRefs(objList); event.getAction().add(action);
event.getAction().add(action);
}
} }
/** /**

View file

@ -52,6 +52,7 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import com.raytheon.uf.common.event.EventBus; import com.raytheon.uf.common.event.EventBus;
import com.raytheon.uf.common.registry.constants.ActionTypes;
import com.raytheon.uf.common.registry.constants.AssociationTypes; import com.raytheon.uf.common.registry.constants.AssociationTypes;
import com.raytheon.uf.common.registry.constants.DeletionScope; import com.raytheon.uf.common.registry.constants.DeletionScope;
import com.raytheon.uf.common.registry.constants.QueryLanguages; import com.raytheon.uf.common.registry.constants.QueryLanguages;
@ -99,6 +100,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.xpath.RegistryXPathProcessor;
* Apr 24, 2013 1910 djohnson Use validation framework to check references. * Apr 24, 2013 1910 djohnson Use validation framework to check references.
* Jun 24, 2013 2106 djohnson Requires a transaction to already be open. * Jun 24, 2013 2106 djohnson Requires a transaction to already be open.
* 8/1/2013 1693 bphillip Added check references and refactored submit objects to conform to EBXML 4.0 spec * 8/1/2013 1693 bphillip Added check references and refactored submit objects to conform to EBXML 4.0 spec
* 9/11/2013 2254 bphillip Cleaned up creation of auditable events
* *
* *
* </pre> * </pre>
@ -270,7 +272,7 @@ public class LifecycleManagerImpl implements LifecycleManager {
+ "]"); + "]");
} }
auditableEventService.createAuditableEventFromObjects(request, auditableEventService.createAuditableEventFromObjects(request,
null, null, null, objectsToRemove); ActionTypes.delete, objectsToRemove);
} catch (EbxmlRegistryException e) { } catch (EbxmlRegistryException e) {
throw EbxmlExceptionUtil.createMsgRegistryException( throw EbxmlExceptionUtil.createMsgRegistryException(
REMOVE_OBJECTS_ERROR_MSG, e); REMOVE_OBJECTS_ERROR_MSG, e);
@ -457,7 +459,9 @@ public class LifecycleManagerImpl implements LifecycleManager {
statusHandler.info("Creating auditable events...."); statusHandler.info("Creating auditable events....");
try { try {
auditableEventService.createAuditableEventFromObjects(request, auditableEventService.createAuditableEventFromObjects(request,
objsCreated, objsUpdated, null, null); ActionTypes.create, objsCreated);
auditableEventService.createAuditableEventFromObjects(request,
ActionTypes.update, objsUpdated);
} catch (EbxmlRegistryException e) { } catch (EbxmlRegistryException e) {
throw EbxmlExceptionUtil.createMsgRegistryException( throw EbxmlExceptionUtil.createMsgRegistryException(
SUBMIT_OBJECTS_ERROR_MSG, e); SUBMIT_OBJECTS_ERROR_MSG, e);
@ -737,7 +741,7 @@ public class LifecycleManagerImpl implements LifecycleManager {
} }
try { try {
auditableEventService.createAuditableEventFromObjects(request, auditableEventService.createAuditableEventFromObjects(request,
null, objectsToUpdate, null, null); ActionTypes.update, objectsToUpdate);
} catch (EbxmlRegistryException e) { } catch (EbxmlRegistryException e) {
throw EbxmlExceptionUtil.createMsgRegistryException( throw EbxmlExceptionUtil.createMsgRegistryException(
UPDATE_OBJECTS_ERROR_MSG, e); UPDATE_OBJECTS_ERROR_MSG, e);

View file

@ -78,6 +78,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
* 3/18/2013 1082 bphillip Initial creation * 3/18/2013 1082 bphillip Initial creation
* 4/9/2013 1802 bphillip Implemented notification handling * 4/9/2013 1802 bphillip Implemented notification handling
* 5/21/2013 2022 bphillip Reworked how notifications are handled * 5/21/2013 2022 bphillip Reworked how notifications are handled
* 9/11/2013 2254 bphillip Cleaned up handling of notifications and removed unneccessary code
* *
* </pre> * </pre>
* *
@ -129,11 +130,12 @@ public class NotificationListenerImpl implements NotificationListener {
// Process the received auditable events and add them to the appropriate // Process the received auditable events and add them to the appropriate
// list based on the action performed // list based on the action performed
RegistryObjectActionList objActionList = new RegistryObjectActionList();
for (AuditableEventType event : events) { for (AuditableEventType event : events) {
List<ActionType> actions = event.getAction(); List<ActionType> actions = event.getAction();
for (ActionType action : actions) { for (ActionType action : actions) {
String eventType = action.getEventType(); String eventType = action.getEventType();
List<String> objectIds = new ArrayList<String>();
// Verify this is a valid event type // Verify this is a valid event type
if (!classificationNodeDao.isValidNode(eventType)) { if (!classificationNodeDao.isValidNode(eventType)) {
@ -145,58 +147,56 @@ public class NotificationListenerImpl implements NotificationListener {
if (action.getAffectedObjectRefs() != null) { if (action.getAffectedObjectRefs() != null) {
for (ObjectRefType ref : action.getAffectedObjectRefs() for (ObjectRefType ref : action.getAffectedObjectRefs()
.getObjectRef()) { .getObjectRef()) {
objActionList.addAction(eventType, ref.getId()); objectIds.add(ref.getId());
} }
} else if (action.getAffectedObjects() != null) { } else if (action.getAffectedObjects() != null) {
for (RegistryObjectType regObj : action for (RegistryObjectType regObj : action
.getAffectedObjects().getRegistryObject()) { .getAffectedObjects().getRegistryObject()) {
objActionList.addAction(eventType, regObj.getId()); objectIds.add(regObj.getId());
} }
} else { } else {
statusHandler.info("Event " + event.getId() statusHandler.info("Event " + event.getId()
+ " contains 0 affected objects "); + " contains 0 affected objects ");
continue;
} }
}
}
for (RegistryObjectAction regObjAction : objActionList.getActionList()) { if (eventType.equals(ActionTypes.create)
String action = regObjAction.getAction(); || eventType.equals(ActionTypes.update)) {
try { try {
if (action.equals(ActionTypes.create) SubmitObjectsRequest submitRequest = createSubmitObjectsRequest(
|| action.equals(ActionTypes.update)) { clientBaseURL, notification.getId(), objectIds,
SubmitObjectsRequest submitRequest = createSubmitObjectsRequest( Mode.CREATE_OR_REPLACE);
clientBaseURL, notification.getId(), lcm.submitObjects(submitRequest);
regObjAction.getObjIds(), Mode.CREATE_OR_REPLACE); } catch (MsgRegistryException e) {
lcm.submitObjects(submitRequest); statusHandler.error(
} else if (action.equals(ActionTypes.delete)) { "Error creating objects in registry!", e);
} catch (EbxmlRegistryException e) {
statusHandler.error(
"Error creating submit objects request!", e);
}
} else if (eventType.equals(ActionTypes.delete)) {
ObjectRefListType refList = new ObjectRefListType(); ObjectRefListType refList = new ObjectRefListType();
for (String id : regObjAction.getObjIds()) { for (String id : objectIds) {
RegistryObjectType object = registryObjectDao RegistryObjectType object = registryObjectDao
.getById(id); .getById(id);
if (object != null) { if (object != null) {
String replicaHome = object refList.getObjectRef().add(new ObjectRefType(id));
.getSlotValue(EbxmlObjectUtil.HOME_SLOT_NAME);
if (clientBaseURL.equals(replicaHome)) {
ObjectRefType ref = new ObjectRefType();
ref.setId(id);
refList.getObjectRef().add(ref);
}
} }
} }
RemoveObjectsRequest request = new RemoveObjectsRequest( RemoveObjectsRequest request = new RemoveObjectsRequest(
"Remove Objects for notification [" "Remove Objects for notification ["
+ notification.getId() + "]", + notification.getId() + "]",
"Notification delete object submission", null, "Notification delete object submission", null,
null, refList, false, false, null, refList, false, true,
DeletionScope.DELETE_ALL); DeletionScope.DELETE_ALL);
lcm.removeObjects(request); try {
lcm.removeObjects(request);
} catch (MsgRegistryException e) {
statusHandler.error(
"Error creating remove objects request!", e);
}
} }
} catch (EbxmlRegistryException e) {
statusHandler
.error("Error getting remote objects to create", e);
} catch (MsgRegistryException e) {
statusHandler.error("Error creating objects in registry!", e);
} }
} }
@ -321,49 +321,4 @@ public class NotificationListenerImpl implements NotificationListener {
this.registryDao = registryDao; this.registryDao = registryDao;
} }
private class RegistryObjectActionList {
List<RegistryObjectAction> actionList = new ArrayList<RegistryObjectAction>();
public void addAction(String action, String objId) {
if (actionList.isEmpty()
|| !actionList.get(actionList.size() - 1).getAction()
.equals(action)) {
RegistryObjectAction newAction = new RegistryObjectAction(
action);
newAction.addObj(objId);
actionList.add(newAction);
} else {
actionList.get(actionList.size() - 1).addObj(objId);
}
}
public List<RegistryObjectAction> getActionList() {
return actionList;
}
}
private class RegistryObjectAction {
private String action;
private List<String> objIds = new ArrayList<String>();
public RegistryObjectAction(String action) {
this.action = action;
}
public void addObj(String obj) {
this.objIds.add(obj);
}
public String getAction() {
return action;
}
public List<String> getObjIds() {
return objIds;
}
}
} }

View file

@ -39,6 +39,7 @@ import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SubscriptionType;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import com.raytheon.uf.common.dataplugin.persist.IPersistableDataObject; import com.raytheon.uf.common.dataplugin.persist.IPersistableDataObject;
import com.raytheon.uf.common.registry.constants.ActionTypes;
import com.raytheon.uf.common.registry.constants.RegistryObjectTypes; import com.raytheon.uf.common.registry.constants.RegistryObjectTypes;
import com.raytheon.uf.common.registry.constants.StatusTypes; import com.raytheon.uf.common.registry.constants.StatusTypes;
import com.raytheon.uf.common.registry.ebxml.RegistryUtil; import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
@ -65,6 +66,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
* 4/15/2013 1905 bphillip Implemented notification to email endpoints * 4/15/2013 1905 bphillip Implemented notification to email endpoints
* Apr 17, 2013 1672 djohnson No longer cares about notification protocol. * Apr 17, 2013 1672 djohnson No longer cares about notification protocol.
* 5/21/2013 2022 bphillip Cleaned up unused method parameters and batching of notifications * 5/21/2013 2022 bphillip Cleaned up unused method parameters and batching of notifications
* 9/11/2013 2354 bphillip Added logic to ensure delete events get included in notifications
* </pre> * </pre>
* *
* @author bphillip * @author bphillip
@ -229,7 +231,7 @@ public class RegistryNotificationManager {
.getAffectedObjectRefs().getObjectRef(); .getAffectedObjectRefs().getObjectRef();
for (ObjectRefType obj : objRefs) { for (ObjectRefType obj : objRefs) {
boolean found = objectInList(objectsOfInterest, obj); boolean found = objectInList(objectsOfInterest, obj);
if (!found) { if (!found && !action.equals(ActionTypes.delete)) {
refsToRemove.add(obj); refsToRemove.add(obj);
} }
} }
@ -239,7 +241,7 @@ public class RegistryNotificationManager {
.getAffectedObjects().getRegistryObject(); .getAffectedObjects().getRegistryObject();
for (RegistryObjectType obj : regObjs) { for (RegistryObjectType obj : regObjs) {
boolean found = objectInList(objectsOfInterest, obj); boolean found = objectInList(objectsOfInterest, obj);
if (!found) { if (!found && !action.equals(ActionTypes.delete)) {
objectsToRemove.add(obj); objectsToRemove.add(obj);
} }
} }

View file

@ -91,6 +91,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
* event. * event.
* 6/4/2013 2022 bphillip Changed slot type of subscription last run time. Longs were being truncated when casting to ints * 6/4/2013 2022 bphillip Changed slot type of subscription last run time. Longs were being truncated when casting to ints
* 9/5/2013 1538 bphillip Changed processing of each subscription to be in their own transaction. Subscriptions are now loaded on startup * 9/5/2013 1538 bphillip Changed processing of each subscription to be in their own transaction. Subscriptions are now loaded on startup
* 9/11/2013 2354 bphillip Added handling of deleted objects
* </pre> * </pre>
* *
* @author bphillip * @author bphillip
@ -457,11 +458,9 @@ public class RegistrySubscriptionManager implements
} }
statusHandler.info("Processing subscription [" + subscriptionName statusHandler.info("Processing subscription [" + subscriptionName
+ "]..."); + "]...");
List<ObjectRefType> objectsOfInterest = getObjectsOfInterest(subscription); notificationManager.sendNotifications(
if (!objectsOfInterest.isEmpty()) { listeners.get(subscriptionName),
notificationManager.sendNotifications( getObjectsOfInterest(subscription));
listeners.get(subscriptionName), objectsOfInterest);
}
updateLastRunTime(subscription, TimeUtil.currentTimeMillis()); updateLastRunTime(subscription, TimeUtil.currentTimeMillis());
} catch (Throwable e) { } catch (Throwable e) {
statusHandler.error( statusHandler.error(