From: <tk...@hy...> - 2007-11-26 23:45:59
|
Author: tkeeney Date: 2007-11-26 15:45:54 -0800 (Mon, 26 Nov 2007) New Revision: 6923 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=6923 Modified: trunk/src/org/hyperic/hq/galerts/server/session/GalertManagerEJBImpl.java Log: Added operation required for the group alert stress testing script: getTriggersById() Modified: trunk/src/org/hyperic/hq/galerts/server/session/GalertManagerEJBImpl.java =================================================================== --- trunk/src/org/hyperic/hq/galerts/server/session/GalertManagerEJBImpl.java 2007-11-26 23:20:26 UTC (rev 6922) +++ trunk/src/org/hyperic/hq/galerts/server/session/GalertManagerEJBImpl.java 2007-11-26 23:45:54 UTC (rev 6923) @@ -64,6 +64,7 @@ import org.hyperic.hq.events.EventConstants; import org.hyperic.hq.events.server.session.Action; import org.hyperic.hq.galerts.processor.GalertProcessor; +import org.hyperic.hq.galerts.processor.Gtrigger; import org.hyperic.hq.galerts.server.session.GalertAuxLog; import org.hyperic.hq.galerts.server.session.ExecutionStrategyInfo; import org.hyperic.hq.galerts.server.session.ExecutionStrategyType; @@ -247,6 +248,35 @@ } /** + * Retrieve the Gtriggers for a partition in the given galert def. + * + * @param id The galert def id. + * @param partition The partition. + * @return The list of Gtriggers. + * @ejb:interface-method + */ + public List getTriggersById(Integer id, GalertDefPartition partition) { + List triggers = new ArrayList(); + + GalertDef def = findById(id); + + ExecutionStrategyInfo strategy = def.getStrategy(partition); + + if (strategy != null) { + List triggerInfos = strategy.getTriggers(); + + for (Iterator it = triggerInfos.iterator(); it.hasNext();) { + GtriggerInfo triggerInfo = (GtriggerInfo) it.next(); + Gtrigger trigger = triggerInfo.getTrigger(); + trigger.setGroup(def.getGroup()); + triggers.add(trigger); + } + } + + return triggers; + } + + /** * Save the alert log and associated auxillary log information to the * DB. * |