@Override public Region getRegion(String regionID) throws InternalException, CloudException { if (regionID == null || regionID.isEmpty()) { return null; } SearchFilter filter = new SearchFilter(); FilterCondition equalsUUID = new FilterCondition(); equalsUUID.setCondition(Condition.IS_EQUAL_TO); equalsUUID.setField("resourceUUID"); equalsUUID.getValue().add(regionID); filter.getFilterConditions().add(equalsUUID); QueryLimit limit = new QueryLimit(); limit.setMaxRecords(1); try { ListResult result = userService.listResources(filter, limit, ResourceType.CLUSTER); if (result != null && result.getList() != null && result.getList().size() > 0) { return createRegionFromCluster((Cluster) result.getList().get(0)); } } catch (ExtilityException e) { } return null; }
@Override public Collection<DataCenter> listDataCenters(String regionID) throws InternalException, CloudException { if (regionID == null || regionID.isEmpty()) { return null; } List<DataCenter> dataCenters = new ArrayList<DataCenter>(); SearchFilter filter = new SearchFilter(); FilterCondition fc = new FilterCondition(); fc.setCondition(Condition.IS_EQUAL_TO); fc.setField("clusterUUID"); fc.getValue().add(regionID); filter.getFilterConditions().add(fc); try { List<Object> vdcs = userService.listResources(filter, null, ResourceType.VDC).getList(); for (Object obj : vdcs) { dataCenters.add(createDataCentreFromVDC((Vdc) obj)); } } catch (ExtilityException e) { throw new CloudException(e); } return dataCenters; }