public void deleteDriftDefinition(Subject subject, EntityContext entityContext, String driftDefName) {
switch (entityContext.getType()) {
case Resource:
authorizeOrFail(subject, entityContext, "Can not delete drifts");
int resourceId = entityContext.getResourceId();
DriftDefinitionCriteria criteria = new DriftDefinitionCriteria();
criteria.addFilterName(driftDefName);
criteria.addFilterResourceIds(resourceId);
criteria.setStrict(true);
criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
PageList<DriftDefinition> results = driftManager.findDriftDefinitionsByCriteria(subject, criteria);
DriftDefinition doomedDriftDef = null;
if (results != null && results.size() == 1) {
doomedDriftDef = results.get(0);