本文整理了Java中org.zstack.core.db.Q.findValue
方法的一些代码示例,展示了Q.findValue
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Q.findValue
方法的具体详情如下:
包路径:org.zstack.core.db.Q
类名称:Q
方法名:findValue
暂无
代码示例来源:origin: zstackio/zstack
public static String getMemberKey(){
String ldapServerUuid = Q.New(LdapServerVO.class).select(LdapServerVO_.uuid).findValue();
String type = LdapSystemTags.LDAP_SERVER_TYPE.getTokenByResourceUuid(ldapServerUuid, LdapSystemTags.LDAP_SERVER_TYPE_TOKEN);
if(LdapConstant.WindowsAD.TYPE.equals(type)){
return LdapConstant.WindowsAD.MEMBER_KEY;
}
if(LdapConstant.OpenLdap.TYPE.equals(type)){
return LdapConstant.OpenLdap.MEMBER_KEY;
}
// default WindowsAD
return LdapConstant.WindowsAD.MEMBER_KEY;
}
代码示例来源:origin: zstackio/zstack
public static boolean isLocalStorage(String psUuid){
String psType = Q.New(PrimaryStorageVO.class)
.select(PrimaryStorageVO_.type)
.eq(PrimaryStorageVO_.uuid, psUuid)
.findValue();
return LocalStorageConstants.LOCAL_STORAGE_TYPE.equals(psType);
}
}
代码示例来源:origin: zstackio/zstack
@Override
public String getSyncSignature() {
String vipUuid = Q.New(PortForwardingRuleVO.class).eq(PortForwardingRuleVO_.uuid, msg.getUuid()).select(PortForwardingRuleVO_.vipUuid).findValue();
return String.format("api-delete-portforwardingrule-vip-%s", vipUuid);
}
代码示例来源:origin: zstackio/zstack
public Tracker(String uuid) {
super(TimeUnit.SECONDS, HostGlobalConfig.PING_HOST_INTERVAL.value(Long.class));
this.uuid = uuid;
hypervisorType = Q.New(HostVO.class).select(HostVO_.hypervisorType)
.eq(HostVO_.uuid, uuid).findValue();
if (hypervisorType == null) {
throw new CloudRuntimeException(String.format("host[uuid:%s] is deleted, why you submit a tracker for it???", uuid));
}
__name__ = String.format("host-tracker-%s-hypervisor-%s", uuid, hypervisorType);
}
代码示例来源:origin: zstackio/zstack
private void validate(APICreateL3NetworkMsg msg) {
String type = Q.New(L2NetworkVO.class).select(L2NetworkVO_.type).eq(L2NetworkVO_.uuid, msg.getL2NetworkUuid()).findValue();
if (type.equals(VxlanNetworkPoolConstant.VXLAN_NETWORK_POOL_TYPE)) {
throw new ApiMessageInterceptionException(Platform.err(SysErrors.INVALID_ARGUMENT_ERROR,
String.format("vxlan network pool doesn't support create l3 network")
));
}
}
}
代码示例来源:origin: zstackio/zstack
public static String getLdapUseAsLoginName(){
String ldapServerUuid = Q.New(LdapServerVO.class).select(LdapServerVO_.uuid).findValue();
PatternedSystemTag tag = LdapSystemTags.LDAP_USE_AS_LOGIN_NAME;
if(!tag.hasTag(ldapServerUuid)){
return LdapConstant.LDAP_UID_KEY;
}
return tag.getTokenByResourceUuid(ldapServerUuid, LdapSystemTags.LDAP_USE_AS_LOGIN_NAME_TOKEN);
}
代码示例来源:origin: zstackio/zstack
public SystemTagInventory updateUnique(String resourceUuid, String oldTag, String newTag) {
String tagUuid = Q.New(SystemTagVO.class).eq(SystemTagVO_.resourceUuid, resourceUuid).
eq(SystemTagVO_.resourceType, resourceClass.getSimpleName()).like(SystemTagVO_.tag, oldTag).
select(SystemTagVO_.uuid).findValue();
if (tagUuid == null) {
return null;
}
return tagMgr.updateSystemTag(tagUuid, newTag);
}
代码示例来源:origin: zstackio/zstack
private void validate(APIDeleteCephPrimaryStoragePoolMsg msg) {
msg.setPrimaryStorageUuid(
Q.New(CephPrimaryStoragePoolVO.class).select(CephPrimaryStoragePoolVO_.primaryStorageUuid)
.eq(CephPrimaryStoragePoolVO_.uuid, msg.getUuid()).findValue()
);
}
代码示例来源:origin: zstackio/zstack
private String getVipPeerL3NetworkAttachedVirtualRouter(VipInventory vip) {
for (String l3Uuid : vip.getPeerL3NetworkUuids()) {
String vrUuid = Q.New(VmNicVO.class).select(VmNicVO_.vmInstanceUuid).eq(VmNicVO_.l3NetworkUuid, l3Uuid).eq(VmNicVO_.metaData, GUEST_NIC_MASK).findValue();
if (vrUuid != null) {
return vrUuid;
}
}
return null;
}
代码示例来源:origin: zstackio/zstack
protected String getDestMigrationAddress(String srcHostUuid, String dstHostUuid){
MigrateNetworkExtensionPoint.MigrateInfo migrateIpInfo = null;
for (MigrateNetworkExtensionPoint ext: pluginRgty.getExtensionList(MigrateNetworkExtensionPoint.class)) {
MigrateNetworkExtensionPoint.MigrateInfo r = ext.getMigrationAddressForVM(srcHostUuid, dstHostUuid);
if (r == null) {
continue;
}
migrateIpInfo = r;
}
return migrateIpInfo != null ? migrateIpInfo.dstMigrationAddress :
Q.New(HostVO.class).eq(HostVO_.uuid, dstHostUuid).select(HostVO_.managementIp).findValue();
}
代码示例来源:origin: zstackio/zstack
private void validate(APIUpdateCephPrimaryStoragePoolMsg msg) {
String psUuid = Q.New(CephPrimaryStoragePoolVO.class)
.select(CephPrimaryStoragePoolVO_.primaryStorageUuid)
.eq(CephPrimaryStoragePoolVO_.uuid, msg.getUuid())
.findValue();
msg.setPrimaryStorageUuid(psUuid);
}
代码示例来源:origin: zstackio/zstack
private void validate(APIUpdateLoadBalancerListenerMsg msg) {
String loadBalancerUuid = Q.New(LoadBalancerListenerVO.class).
select(LoadBalancerListenerVO_.loadBalancerUuid).
eq(LoadBalancerListenerVO_.uuid,msg.
getLoadBalancerListenerUuid()).findValue();
msg.setLoadBalancerUuid(loadBalancerUuid);
bus.makeTargetServiceIdByResourceUuid(msg, LoadBalancerConstants.SERVICE_ID, loadBalancerUuid);
}
代码示例来源:origin: zstackio/zstack
private void validate(APIDeleteLongJobMsg msg) {
LongJobState state = Q.New(LongJobVO.class)
.select(LongJobVO_.state)
.eq(LongJobVO_.uuid, msg.getUuid())
.findValue();
if (state != LongJobState.Succeeded && state != LongJobState.Canceled && state != LongJobState.Failed) {
throw new ApiMessageInterceptionException(argerr("delete longjob only when it's succeeded, canceled, or failed"));
}
}
代码示例来源:origin: zstackio/zstack
private void setServiceId(GarbageCollectorMessage msg) {
String mgmtUuid = Q.New(GarbageCollectorVO.class).select(GarbageCollectorVO_.managementNodeUuid)
.eq(GarbageCollectorVO_.uuid, msg.getGCJobUuid()).findValue();
if (mgmtUuid != null) {
bus.makeTargetServiceIdByResourceUuid((Message) msg, GCConstants.SERVICE_ID, mgmtUuid);
} else {
bus.makeLocalServiceId((Message) msg, GCConstants.SERVICE_ID);
}
}
}
代码示例来源:origin: zstackio/zstack
private void validate(APIChangeHostStateMsg msg){
HostStatus hostStatus = Q.New(HostVO.class)
.select(HostVO_.status)
.eq(HostVO_.uuid,msg.getHostUuid())
.findValue();
if (hostStatus != HostStatus.Connected && msg.getStateEvent().equals(HostStateEvent.maintain.toString())){
throw new ApiMessageInterceptionException(operr("can not maintain host[uuid:%s, status:%s]which is not Connected", msg.getHostUuid(), hostStatus));
}
}
}
代码示例来源:origin: zstackio/zstack
private void validate(final APIGetCandidatePrimaryStoragesForCreatingVmMsg msg) {
ImageMediaType mediaType = Q.New(ImageVO.class).eq(ImageVO_.uuid, msg.getImageUuid()).select(ImageVO_.mediaType).findValue();
if (ImageMediaType.ISO == mediaType && msg.getRootDiskOfferingUuid() == null) {
throw new ApiMessageInterceptionException(argerr("rootVolumeOffering is needed when image media type is ISO"));
}
}
代码示例来源:origin: zstackio/zstack
private void validate(APICreateLoadBalancerListenerMsg msg){
String vipUuid = Q.New(LoadBalancerVO.class).eq(LoadBalancerVO_.uuid, msg.getLoadBalancerUuid()).select(LoadBalancerVO_.vipUuid).findValue();
RangeSet.Range cur = new RangeSet.Range(msg.getLoadBalancerPort(), msg.getLoadBalancerPort());
checkVipPortConfliction(vipUuid, msg.getProtocol(), cur);
}
代码示例来源:origin: zstackio/zstack
@Override
public Result getMessageParams(APIMessage message) {
APILogInByAccountMsg msg = (APILogInByAccountMsg) message;
String resourceIdentity = Q.New(AccountVO.class).select(AccountVO_.uuid).eq(AccountVO_.name, msg.getAccountName()).findValue();
Result r = new Result();
r.setCaptchaUuid(msg.getCaptchaUuid());
r.setTargetResourceIdentity(resourceIdentity);
r.setVerifyCode(msg.getVerifyCode());
return r;
}
}
代码示例来源:origin: zstackio/zstack
private void validate(APICreateEipMsg msg) {
String useFor = Q.New(VipVO.class).select(VipVO_.useFor).eq(VipVO_.uuid, msg.getVipUuid()).findValue();
VipUseForList vipUseForList;
if (useFor != null){
vipUseForList = new VipUseForList(useFor);
} else {
vipUseForList = new VipUseForList();
}
if(!vipUseForList.validateNewAdded(EipConstant.EIP_NETWORK_SERVICE_TYPE)){
throw new ApiMessageInterceptionException(operr("the vip[uuid:%s] already has bound to other service[%s]", msg.getVipUuid(), vipUseForList.toString()));
}
}
代码示例来源:origin: zstackio/zstack
private void validate(APIGetEipAttachableVmNicsMsg msg) {
if (msg.getVipUuid() == null && msg.getEipUuid() == null) {
throw new ApiMessageInterceptionException(argerr("either eipUuid or vipUuid must be set"));
}
if (msg.getEipUuid() != null) {
EipState state = Q.New(EipVO.class).select(EipVO_.state).eq(EipVO_.uuid,msg.getEipUuid()).findValue();
if (state != EipState.Enabled) {
throw new ApiMessageInterceptionException(operr("eip[uuid:%s] is not in state of Enabled, cannot get attachable vm nic", msg.getEipUuid()));
}
}
}
内容来源于网络,如有侵权,请联系作者删除!