本文整理汇总了Java中org.onosproject.net.group.GroupService.getGroups方法的典型用法代码示例。如果您正苦于以下问题:Java GroupService.getGroups方法的具体用法?Java GroupService.getGroups怎么用?Java GroupService.getGroups使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.onosproject.net.group.GroupService
的用法示例。
在下文中一共展示了GroupService.getGroups方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: populateTable
import org.onosproject.net.group.GroupService; //导入方法依赖的package包/类
@Override
protected void populateTable(TableModel tm, ObjectNode payload) {
String uri = string(payload, "devId");
if (!Strings.isNullOrEmpty(uri)) {
DeviceId deviceId = DeviceId.deviceId(uri);
GroupService gs = get(GroupService.class);
for (Group group : gs.getGroups(deviceId)) {
populateRow(tm.addRow(), group);
}
}
}
示例2: getSortedGroups
import org.onosproject.net.group.GroupService; //导入方法依赖的package包/类
/**
* Returns the list of devices sorted using the device ID URIs.
*
* @param deviceService device service
* @param groupService group service
* @return sorted device list
*/
protected SortedMap<Device, List<Group>>
getSortedGroups(DeviceService deviceService,
GroupService groupService) {
SortedMap<Device, List<Group>> sortedGroups =
new TreeMap<>(Comparators.ELEMENT_COMPARATOR);
List<Group> groups;
GroupState s = null;
if (state != null && !state.equals("any")) {
s = GroupState.valueOf(state.toUpperCase());
}
Iterable<Device> devices = (uri == null) ? deviceService.getDevices() :
Collections.singletonList(deviceService.getDevice(DeviceId.deviceId(uri)));
for (Device d : devices) {
if (s == null) {
groups = newArrayList(groupService.getGroups(d.id()));
} else {
groups = newArrayList();
for (Group g : groupService.getGroups(d.id())) {
if (g.state().equals(s)) {
groups.add(g);
}
}
}
groups.sort(Comparators.GROUP_COMPARATOR);
sortedGroups.put(d, groups);
}
return sortedGroups;
}
示例3: getSortedGroups
import org.onosproject.net.group.GroupService; //导入方法依赖的package包/类
/**
* Returns the list of devices sorted using the device ID URIs.
*
* @param deviceService device service
* @param groupService group service
* @return sorted device list
*/
protected SortedMap<Device, List<Group>>
getSortedGroups(DeviceService deviceService,
GroupService groupService) {
SortedMap<Device, List<Group>> sortedGroups =
new TreeMap<>(Comparators.ELEMENT_COMPARATOR);
List<Group> groups;
GroupState s = null;
if (state != null && !"any".equals(state)) {
s = GroupState.valueOf(state.toUpperCase());
}
Iterable<Device> devices = deviceService.getDevices();
if (uri != null) {
Device dev = deviceService.getDevice(DeviceId.deviceId(uri));
if (dev != null) {
devices = Collections.singletonList(dev);
}
}
for (Device d : devices) {
if (s == null) {
groups = newArrayList(groupService.getGroups(d.id()));
} else {
groups = newArrayList();
for (Group g : groupService.getGroups(d.id())) {
if (g.state().equals(s)) {
groups.add(g);
}
}
}
groups.sort(Comparators.GROUP_COMPARATOR);
sortedGroups.put(d, groups);
}
if (type != null && !"any".equals(type)) {
for (Device device : sortedGroups.keySet()) {
sortedGroups.put(device, sortedGroups.get(device).stream()
.filter(group -> GroupDescription.Type.valueOf(type.toUpperCase()).equals(group.type()))
.collect(Collectors.toList()));
}
}
return sortedGroups;
}
示例4: getGroups
import org.onosproject.net.group.GroupService; //导入方法依赖的package包/类
@Override
public List<Group> getGroups(NetworkId networkId, DeviceId deviceId) {
GroupService groupService = virtualNetService.get(networkId, GroupService.class);
Iterable<Group> entries = groupService.getGroups(deviceId);
return Lists.newArrayList(entries);
}