本文整理了Java中org.zstack.core.db.Q.listTuple
方法的一些代码示例,展示了Q.listTuple
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Q.listTuple
方法的具体详情如下:
包路径:org.zstack.core.db.Q
类名称:Q
方法名:listTuple
暂无
代码示例来源:origin: zstackio/zstack
private Map<String, String> getUuidTypeMapByResourceUuids(List<String> resourceUuids) {
List<Tuple> ts = Q.New(AccountResourceRefVO.class)
.select(AccountResourceRefVO_.resourceUuid, AccountResourceRefVO_.resourceType)
.in(AccountResourceRefVO_.resourceUuid, resourceUuids)
.listTuple();
Map<String, String> uuidType = new HashMap<String, String>();
for (Tuple t : ts) {
String resUuid = t.get(0, String.class);
String resType = t.get(1, String.class);
uuidType.put(resUuid, resType);
}
return uuidType;
}
代码示例来源:origin: zstackio/zstack
@Override
public RangeSet getVipUsePortRange(String vipUuid, String protocol, VipUseForList useForList){
RangeSet portRangeList = new RangeSet();
List<RangeSet.Range> portRanges = new ArrayList<RangeSet.Range>();
if (protocol.toUpperCase().equals(PortForwardingProtocolType.UDP.toString()) || protocol.toUpperCase().equals(PortForwardingProtocolType.TCP.toString())) {
List<Tuple> pfPortList = Q.New(PortForwardingRuleVO.class).select(PortForwardingRuleVO_.vipPortStart, PortForwardingRuleVO_.vipPortEnd)
.eq(PortForwardingRuleVO_.vipUuid, vipUuid).eq(PortForwardingRuleVO_.protocolType, PortForwardingProtocolType.valueOf(protocol.toUpperCase())).listTuple();
Iterator<Tuple> it = pfPortList.iterator();
while (it.hasNext()){
Tuple strRange = it.next();
int start = strRange.get(0, Integer.class);
int end = strRange.get(1, Integer.class);
RangeSet.Range range = new RangeSet.Range(start, end);
portRanges.add(range);
}
}
portRangeList.setRanges(portRanges);
return portRangeList;
}
代码示例来源:origin: zstackio/zstack
private void checkIfTheAccountOwnTheResource(APIMessage.FieldParam param) throws IllegalAccessException {
List<String> uuids = getResourceUuids(param);
if (uuids.isEmpty()) {
return;
}
Class resourceType = param.param.resourceType();
List<Tuple> ts = q(AccountResourceRefVO.class).select(AccountResourceRefVO_.accountUuid, AccountResourceRefVO_.resourceUuid)
.in(AccountResourceRefVO_.resourceUuid, uuids)
//.eq(AccountResourceRefVO_.resourceType, acntMgr.getBaseResourceType(resourceType).getSimpleName())
.listTuple();
ts.addAll(
q(SharedResourceVO.class).select(SharedResourceVO_.receiverAccountUuid, SharedResourceVO_.resourceUuid)
.in(SharedResourceVO_.resourceUuid, uuids)
.eq(SharedResourceVO_.permission, SharedResourceVO.PERMISSION_WRITE)
.eq(SharedResourceVO_.receiverAccountUuid, rbacEntity.getApiMessage().getSession().getAccountUuid())
//.eq(SharedResourceVO_.resourceType, acntMgr.getBaseResourceType(resourceType).getSimpleName())
.listTuple()
);
Collection<AccountResourceBundle> bundles = toAccountResourceBundles(uuids, ts);
uuids.forEach(uuid -> {
Optional<AccountResourceBundle> opt = bundles.stream().filter(b -> b.accountUuid.equals(rbacEntity.getApiMessage().getSession().getAccountUuid()) && b.resourceUuid.equals(uuid)).findFirst();
if (!opt.isPresent()) {
throw new OperationFailureException(operr("permission denied, the account[uuid:%s] is not the owner of the resource[uuid:%s, type:%s]",
rbacEntity.getApiMessage().getSession().getAccountUuid(), uuid, resourceType.getSimpleName()));
}
});
}
代码示例来源:origin: zstackio/zstack
private void addCdRomToHistoricalVm() {
if (!VmCdRomGlobalProperty.addCdRomToHistoricalVm) {
return;
}
List<String> vmUuids = getTargetVmUuids();
if (vmUuids.isEmpty()){
return;
}
List<Tuple> vmUuidPlatforms = Q.New(VmInstanceVO.class)
.select(VmInstanceVO_.uuid, VmInstanceVO_.platform)
.in(VmInstanceVO_.uuid, vmUuids)
.listTuple();
for (Tuple vmTuple : vmUuidPlatforms) {
String vmUuid = vmTuple.get(0, String.class);
String vmPlatform = vmTuple.get(1, String.class);
if (vmPlatform != null && ImagePlatform.Windows.toString().equalsIgnoreCase(vmPlatform)) {
addCdRomForWindowsVm(vmUuid);
continue;
}
addCdRomForLinuxAndOthersVm(vmUuid);
}
}
代码示例来源:origin: zstackio/zstack
.eq(GlobalConfigVO_.category, AccountConstant.QUOTA_GLOBAL_CONFIG_CATETORY).listTuple();
代码示例来源:origin: zstackio/zstack
.eq(GlobalConfigVO_.category, AccountConstant.QUOTA_GLOBAL_CONFIG_CATETORY).listTuple();
内容来源于网络,如有侵权,请联系作者删除!