agave-systems/systems-core/src/main/java/org/iplantc/service/systems/events/RemoteSystemEventProcessor.java
/**
	 * Generates notification events for content-related changes to a 
	 * {@link RemoteSystem}. This could be a CRUD operation or a change
	 * to the credentials.
	 * 
	 * @param system the system being updated
	 * @param eventType the type of event
	 * @param createdBy the owner of the event action
	 * @return the {@link SystemHistoryEvent} updated with the association to the {@link RemoteSystem}
	 */
Generates notification events for content-related changes to a
RemoteSystem. This could be a CRUD operation or a change
to the credentials.

@param system the system being updated
@param eventType the type of event
@param createdBy the owner of the event action
@return the  SystemHistoryEvent updated with the association to the  RemoteSystem
Generates notification events for content - related changes to a RemoteSystem . This could be a CRUD operation or a change to the credentials . @param system the system being updated @param eventType the type of event @param createdBy the owner of the event action @return the SystemHistoryEvent updated with the association to the RemoteSystem
public SystemHistoryEvent processSystemUpdateEvent(RemoteSystem system, SystemEventType eventType, String createdBy) {
		SystemHistoryEvent event = null;
		try {
			if (system == null) {
				throw new EntityEventProcessingException("Valid system must be provided to process event.");
			}
			if (eventType == null) {
				throw new EntityEventProcessingException("Valid system event type must be provided to process event.");
			}
			String json;
			try {
			    json = mapper.createObjectNode()
			    		.set("system", mapper.readTree(system.toJSON()))
			    		.toString();
			} catch (Throwable e) {
			    log.error(String.format("Failed to serialize system "
			            + "%s to json for %s event notification", 
			            system.getUuid(), eventType.name()), e);
			    json = null;
			}
			event = new SystemHistoryEvent(system.getUuid(), eventType, eventType.getDescription(), createdBy);
			getEntityEventDao().persist(event);
			fireNotification(system.getUuid(), event.getStatus(), event.getCreatedBy(), json);
		}
		catch (EntityEventProcessingException e) {
			log.error(e.getMessage());
		}
		catch (EntityEventPersistenceException e) {
			log.error("Failed to persist history event for system " + system.getUuid(), e);
		}
		return event;	
	}
public SystemHistoryEvent processSystemUpdateEvent ( RemoteSystem system , SystemEventType eventType , String createdBy ) { SystemHistoryEvent event = null ; try { if ( system == null ) { throw new EntityEventProcessingException ( "Valid system must be provided to process event." ) ; } if ( eventType == null ) { throw new EntityEventProcessingException ( "Valid system event type must be provided to process event." ) ; } String json ; try { json = mapper . createObjectNode ( ) . set ( "system" , mapper . readTree ( system . toJSON ( ) ) ) . toString ( ) ; } catch ( Throwable e ) { log . error ( String . format ( "Failed to serialize system " + "%s to json for %s event notification" , system . getUuid ( ) , eventType . name ( ) ) , e ) ; json = null ; } event = new SystemHistoryEvent ( system . getUuid ( ) , eventType , eventType . getDescription ( ) , createdBy ) ; getEntityEventDao ( ) . persist ( event ) ; fireNotification ( system . getUuid ( ) , event . getStatus ( ) , event . getCreatedBy ( ) , json ) ; } catch ( EntityEventProcessingException e ) { log . error ( e . getMessage ( ) ) ; } catch ( EntityEventPersistenceException e ) { log . error ( "Failed to persist history event for system " + system . getUuid ( ) , e ) ; } return event ; }
Generates notification events for content-related changes to a
 {@link RemoteSystem}.
Generates notification events for content - related changes to a { @link RemoteSystem } .