agave-tags/tags-core/src/main/java/org/iplantc/service/tags/events/TagEventProcessor.java
/**
	 * Generates notification events for content-related changes to a 
	 * {@link Tag}. This could be a CRUD operation or a change
	 * to the associations.
	 * 
	 * @param tag
	 * @param event
	 * @return the {@link TagEvent} updated with the association to the {@link Tag}
	 */
Generates notification events for content-related changes to a
Tag. This could be a CRUD operation or a change
to the associations.

@param tag
@param event
@return the  TagEvent updated with the association to the  Tag
Generates notification events for content - related changes to a Tag . This could be a CRUD operation or a change to the associations . @param tag @param event @return the TagEvent updated with the association to the Tag
public TagEvent processContentEvent(Tag tag, TagEvent event) 
	throws TagEventProcessingException {
		if (tag == null) {
			throw new TagEventProcessingException("Valid tag must be provided to process event.");
		}
		if (event == null) {
			throw new TagEventProcessingException("Valid tag event must be provided to process event.");
		}
		JsonNode json = null;
		try {
		    json = mapper.createObjectNode().set("tag", tag.toJSON());
		} catch (Throwable e) {
		    log.error(String.format("Failed to serialize tag "
		            + "%s to json for %s event notification", 
		            tag.getUuid(), event.getStatus()), e);
		    json = null;
		}
		try {
			dao.persist(event);
		}
		catch (TagEventPersistenceException e) {
			log.error("Failed to save tag event " + event.getStatus() + " on tag " + tag.getUuid(), e);
		}
		NotificationManager.process(tag.getUuid(), event.getStatus(), event.getCreatedBy(), json.toString());
		TagEventType delegatedEvent = TagEventType.CREATED == TagEventType.valueOf(event.getStatus().toUpperCase()) ? 
				TagEventType.RESOURCE_ADDED : TagEventType.RESOURCE_REMOVED;
		for (TaggedResource tr: tag.getTaggedResources()) {
			fireAssociatedNotification(tr.getUuid(), delegatedEvent, event.getCreatedBy(), json);
		}
		return event;
	}
public TagEvent processContentEvent ( Tag tag , TagEvent event ) throws TagEventProcessingException { if ( tag == null ) { throw new TagEventProcessingException ( "Valid tag must be provided to process event." ) ; } if ( event == null ) { throw new TagEventProcessingException ( "Valid tag event must be provided to process event." ) ; } JsonNode json = null ; try { json = mapper . createObjectNode ( ) . set ( "tag" , tag . toJSON ( ) ) ; } catch ( Throwable e ) { log . error ( String . format ( "Failed to serialize tag " + "%s to json for %s event notification" , tag . getUuid ( ) , event . getStatus ( ) ) , e ) ; json = null ; } try { dao . persist ( event ) ; } catch ( TagEventPersistenceException e ) { log . error ( "Failed to save tag event " + event . getStatus ( ) + " on tag " + tag . getUuid ( ) , e ) ; } NotificationManager . process ( tag . getUuid ( ) , event . getStatus ( ) , event . getCreatedBy ( ) , json . toString ( ) ) ; TagEventType delegatedEvent = TagEventType . CREATED == TagEventType . valueOf ( event . getStatus ( ) . toUpperCase ( ) ) ? TagEventType . RESOURCE_ADDED : TagEventType . RESOURCE_REMOVED ; for ( TaggedResource tr : tag . getTaggedResources ( ) ) { fireAssociatedNotification ( tr . getUuid ( ) , delegatedEvent , event . getCreatedBy ( ) , json ) ; } return event ; }
Generates notification events for content-related changes to a
 {@link Tag}.
Generates notification events for content - related changes to a { @link Tag } .
// We fire delegated tag permission events on associated uuids. We will  // send the entire fire event to the delgation method for simplicity