class FruIdEventsHelperUtil {

    public static List<Event> addFruIDtoMemoryEvents( List<Event> aggregatedEvents, List<MemoryInfo> memoryInfoList )
    {

        List<Event> events = new ArrayList<Event>();
        MemoryInfo memoryInfo = new MemoryInfo();

        try
        {
            for ( int i = 0; i < aggregatedEvents.size(); i++ )
            {
                Event event = aggregatedEvents.get( i );
                Map<EventComponent, String> eventComponentIdentifier = event.getHeader().getComponentIdentifier();
                Map<String, String> eventBody = event.getBody().getData();
                String componentId = eventComponentIdentifier.get( EventComponent.MEMORY );

                for ( int j = 0; j < memoryInfoList.size(); j++ )
                {
                    if ( componentId.contains( memoryInfoList.get( j ).getLocation() ) )
                    {
                        memoryInfo = memoryInfoList.get( j );
                        eventBody.put( "fruID", memoryInfo.getFruId() );
                        break;
                    }
                }
                events.add( event );
            }
            return events;
        }
        catch ( Exception e )
        {
            logger.error( "HMS aggregator error in adding Fru ID to Memory Events", e );
        }

        return null;
    }

}