use of org.apache.hadoop.hive.metastore.api.WMTrigger in project hive by apache.
the class ObjectStore method getTriggersForResourcePlan.
@Override
public List<WMTrigger> getTriggersForResourcePlan(String resourcePlanName) throws NoSuchObjectException, MetaException {
List<WMTrigger> triggers = new ArrayList();
boolean commited = false;
Query query = null;
try {
openTransaction();
MWMResourcePlan resourcePlan;
try {
resourcePlan = getMWMResourcePlan(resourcePlanName, false);
} catch (InvalidOperationException e) {
// Should not happen, edit check is false.
throw new RuntimeException(e);
}
query = pm.newQuery(MWMTrigger.class, "resourcePlan == rp");
query.declareParameters("MWMResourcePlan rp");
List<MWMTrigger> mTriggers = (List<MWMTrigger>) query.execute(resourcePlan);
pm.retrieveAll(mTriggers);
commited = commitTransaction();
if (mTriggers != null) {
for (MWMTrigger trigger : mTriggers) {
triggers.add(fromMWMTrigger(trigger, resourcePlanName));
}
}
} finally {
rollbackAndCleanup(commited, query);
}
return triggers;
}
Aggregations