list recurring snapshot if volumeId and interval are specified

This commit is contained in:
anthony 2011-02-09 13:57:00 -08:00
parent ce4922cb76
commit a83f7b5344
1 changed files with 4 additions and 1 deletions

View File

@ -840,6 +840,7 @@ public class SnapshotManagerImpl implements SnapshotManager, SnapshotService, Ma
Object id = cmd.getId();
Object keyword = cmd.getKeyword();
Object snapshotTypeStr = cmd.getSnapshotType();
Object intervalTypeStr = cmd.getIntervalType();
Filter searchFilter = new Filter(SnapshotVO.class, "created", false, cmd.getStartIndex(), cmd.getPageSizeVal());
SearchBuilder<SnapshotVO> sb = _snapshotDao.createSearchBuilder();
@ -906,10 +907,12 @@ public class SnapshotManagerImpl implements SnapshotManager, SnapshotService, Ma
throw new InvalidParameterValueException("Unsupported snapshot type " + snapshotTypeStr);
}
sc.setParameters("snapshotTypeEQ", snapshotType.ordinal());
} else if (intervalTypeStr != null && volumeId != null) {
sc.setParameters("snapshotTypeEQ", Snapshot.Type.RECURRING.ordinal());
} else {
// Show only MANUAL and RECURRING snapshot types
sc.setParameters("snapshotTypeNEQ", Snapshot.Type.TEMPLATE.ordinal());
}
}
return _snapshotDao.search(sc, searchFilter);
}