agave-metadata/metadata-core/src/main/java/org/iplantc/service/metadata/events/MetadataEventProcessor.java
/**
	 * Generates notification events for content-related changes to a 
	 * {@link MetadataItem}. This could be a CRUD operation or a change
	 * to the credentials.
	 * 
	 * @param metadata the metadata item on which the even is triggered
	 * @param eventType the event being triggered
	 * @param createdBy the user who caused this event
	 * @return the {@link MetadataItem} updated with the association to the {@link MetadataItem}
	 */
Generates notification events for content-related changes to a
MetadataItem. This could be a CRUD operation or a change
to the credentials.

@param metadata the metadata item on which the even is triggered
@param eventType the event being triggered
@param createdBy the user who caused this event
@return the  MetadataItem updated with the association to the  MetadataItem
Generates notification events for content - related changes to a MetadataItem . This could be a CRUD operation or a change to the credentials . @param metadata the metadata item on which the even is triggered @param eventType the event being triggered @param createdBy the user who caused this event @return the MetadataItem updated with the association to the MetadataItem
public MetadataItem processContentEvent(MetadataItem metadata, MetadataEventType eventType, String createdBy) {
		try {
			if (metadata == null) {
				throw new EntityEventProcessingException("Valid metadata must be provided to process event.");
			}
			if (eventType == null) {
				throw new EntityEventProcessingException("Valid metadata event type must be provided to process event.");
			}
			if (StringUtils.isEmpty(createdBy)) {
				throw new EntityEventProcessingException("Valid metadata creator username must be provided to process event.");
			}
			String sJson = null;
			try {
				ObjectNode json = getMapper().createObjectNode();
			    json.set("metadata", getMapper().readTree(getMapper().writeValueAsString(metadata)));
			    sJson = json.toString();
			} catch (Throwable e) {
			    log.error(String.format("Failed to serialize metadata "
			            + "%s to json for %s event notification", 
			            metadata.getUuid(), eventType.name()), e);
			}
			processNotification(metadata.getUuid(), eventType.name(), createdBy, sJson);
			for (String associatedUuid: metadata.getAssociations().getRawUuid()) {
				processNotification(associatedUuid, "METADATA_" + eventType.name(), createdBy, sJson);
			}
		}
		catch (EntityEventProcessingException e) {
			log.error(e.getMessage());
		}
		return metadata;
	}
public MetadataItem processContentEvent ( MetadataItem metadata , MetadataEventType eventType , String createdBy ) { try { if ( metadata == null ) { throw new EntityEventProcessingException ( "Valid metadata must be provided to process event." ) ; } if ( eventType == null ) { throw new EntityEventProcessingException ( "Valid metadata event type must be provided to process event." ) ; } if ( StringUtils . isEmpty ( createdBy ) ) { throw new EntityEventProcessingException ( "Valid metadata creator username must be provided to process event." ) ; } String sJson = null ; try { ObjectNode json = getMapper ( ) . createObjectNode ( ) ; json . set ( "metadata" , getMapper ( ) . readTree ( getMapper ( ) . writeValueAsString ( metadata ) ) ) ; sJson = json . toString ( ) ; } catch ( Throwable e ) { log . error ( String . format ( "Failed to serialize metadata " + "%s to json for %s event notification" , metadata . getUuid ( ) , eventType . name ( ) ) , e ) ; } processNotification ( metadata . getUuid ( ) , eventType . name ( ) , createdBy , sJson ) ; for ( String associatedUuid : metadata . getAssociations ( ) . getRawUuid ( ) ) { processNotification ( associatedUuid , "METADATA_" + eventType . name ( ) , createdBy , sJson ) ; } } catch ( EntityEventProcessingException e ) { log . error ( e . getMessage ( ) ) ; } return metadata ; }
Generates notification events for content-related changes to a
 {@link MetadataItem}.
Generates notification events for content - related changes to a { @link MetadataItem } .
// fire event on monitor // We fire delegated monitor chec events on the system being monitored.