use of com.cloud.utils.db.Filter in project cloudstack by apache.
the class HighAvailabilityDaoImpl method take.
@Override
public HaWorkVO take(final long serverId) {
final TransactionLegacy txn = TransactionLegacy.currentTxn();
try {
final SearchCriteria<HaWorkVO> sc = TBASearch.create();
sc.setParameters("time", System.currentTimeMillis() >> 10);
sc.setParameters("step", Step.Done, Step.Cancelled);
final Filter filter = new Filter(HaWorkVO.class, null, true, 0l, 1l);
txn.start();
final List<HaWorkVO> vos = lockRows(sc, filter, true);
if (vos.size() == 0) {
txn.commit();
return null;
}
final HaWorkVO work = vos.get(0);
work.setServerId(serverId);
work.setDateTaken(new Date());
update(work.getId(), work);
txn.commit();
return work;
} catch (final Throwable e) {
throw new CloudRuntimeException("Unable to execute take", e);
}
}
use of com.cloud.utils.db.Filter in project cloudstack by apache.
the class SecurityGroupRulesDaoImpl method listSecurityGroupRules.
@Override
public List<SecurityGroupRulesVO> listSecurityGroupRules(long accountId, String groupName) {
Filter searchFilter = new Filter(SecurityGroupRulesVO.class, "id", true, null, null);
SearchCriteria<SecurityGroupRulesVO> sc = AccountGroupNameSearch.create();
sc.setParameters("accountId", accountId);
sc.setParameters("name", groupName);
return listBy(sc, searchFilter);
}
use of com.cloud.utils.db.Filter in project cloudstack by apache.
the class SecurityGroupRulesDaoImpl method listSecurityRulesByGroupId.
@Override
public List<SecurityGroupRulesVO> listSecurityRulesByGroupId(long groupId) {
Filter searchFilter = new Filter(SecurityGroupRulesVO.class, "id", true, null, null);
SearchCriteria<SecurityGroupRulesVO> sc = GroupSearch.create();
sc.setParameters("groupId", groupId);
return listBy(sc, searchFilter);
}
use of com.cloud.utils.db.Filter in project cloudstack by apache.
the class SecurityGroupRulesDaoImpl method listSecurityGroupRules.
@Override
public List<SecurityGroupRulesVO> listSecurityGroupRules(long accountId) {
Filter searchFilter = new Filter(SecurityGroupRulesVO.class, "id", true, null, null);
SearchCriteria<SecurityGroupRulesVO> sc = AccountSearch.create();
sc.setParameters("accountId", accountId);
return listBy(sc, searchFilter);
}
use of com.cloud.utils.db.Filter in project cloudstack by apache.
the class VolumeDaoImpl method listVolumesAscending.
@Override
public List<NetappVolumeVO> listVolumesAscending(String poolName) {
Filter searchFilter = new Filter(NetappVolumeVO.class, "id", Boolean.TRUE, Long.valueOf(0), Long.valueOf(10000));
SearchCriteria<NetappVolumeVO> sc = NetappListVolumeSearch.create();
sc.setParameters("poolName", poolName);
return listBy(sc, searchFilter);
}
Aggregations