use of org.ovirt.engine.core.common.scheduling.ClusterPolicy in project ovirt-engine by oVirt.
the class ClusterPolicyDaoTest method createDummyPolicy.
private void createDummyPolicy() {
dummyPolicy = new ClusterPolicy();
dummyPolicy.setId(Guid.newGuid());
dummyPolicy.setName("Dummy policy");
dummyPolicy.setDescription("Dummy policy description");
dummyPolicy.setLocked(false);
ArrayList<Guid> filters = new ArrayList<>();
filters.add(FixturesTool.POLICY_UNIT_MIGRATION);
dummyPolicy.setFilters(filters);
HashMap<Guid, Integer> filterPositionMap = new HashMap<>();
filterPositionMap.put(FixturesTool.POLICY_UNIT_MIGRATION, 1);
dummyPolicy.setFilterPositionMap(filterPositionMap);
dummyPolicy.setParameterMap(new LinkedHashMap<>());
}
use of org.ovirt.engine.core.common.scheduling.ClusterPolicy in project ovirt-engine by oVirt.
the class ClusterPolicyDaoTest method testGet.
@Test
public void testGet() {
ClusterPolicy result = dao.get(existingPolicy.getId(), Collections.emptyMap());
assertEquals(result, existingPolicy);
}
use of org.ovirt.engine.core.common.scheduling.ClusterPolicy in project ovirt-engine by oVirt.
the class ClusterPolicyDaoImpl method get.
@Override
public ClusterPolicy get(Guid id, @NotNull Map<Guid, PolicyUnitType> internalUnitTypes) {
ClusterPolicy clusterPolicy = super.get(id);
if (clusterPolicy == null) {
return null;
}
List<ClusterPolicyUnit> clusterPolicyUnits = getCallsHandler().executeReadList("GetClusterPolicyUnitsByClusterPolicyId", createClusterPolicyUnitRowMapper(), createIdParameterMapper(id));
Map<Guid, ClusterPolicy> map = new HashMap<>();
map.put(clusterPolicy.getId(), clusterPolicy);
fillClusterPolicy(map, clusterPolicyUnits, Collections.unmodifiableMap(internalUnitTypes));
return clusterPolicy;
}
use of org.ovirt.engine.core.common.scheduling.ClusterPolicy in project ovirt-engine by oVirt.
the class ClusterPolicyDaoImpl method getAll.
@Override
public List<ClusterPolicy> getAll(@NotNull Map<Guid, PolicyUnitType> internalUnitTypes) {
List<ClusterPolicy> clusterPolicies = super.getAll();
Map<Guid, ClusterPolicy> map = new HashMap<>();
for (ClusterPolicy clusterPolicy : clusterPolicies) {
map.put(clusterPolicy.getId(), clusterPolicy);
}
List<ClusterPolicyUnit> clusterPolicyUnits = getCallsHandler().executeReadList("GetAllFromClusterPolicyUnits", createClusterPolicyUnitRowMapper(), getCustomMapSqlParameterSource());
fillClusterPolicy(map, clusterPolicyUnits, Collections.unmodifiableMap(internalUnitTypes));
return clusterPolicies;
}
use of org.ovirt.engine.core.common.scheduling.ClusterPolicy in project ovirt-engine by oVirt.
the class ClusterPolicyListModel method onRemove.
public void onRemove() {
for (Object item : getSelectedItems()) {
ClusterPolicy clusterPolicy = (ClusterPolicy) item;
Frontend.getInstance().runAction(ActionType.RemoveClusterPolicy, new ClusterPolicyCRUDParameters(clusterPolicy.getId(), clusterPolicy));
}
setWindow(null);
// Execute search to keep list updated.
getSearchCommand().execute();
}
Aggregations