本文整理了Java中org.zstack.core.db.Q.select
方法的一些代码示例,展示了Q.select
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Q.select
方法的具体详情如下:
包路径:org.zstack.core.db.Q
类名称:Q
方法名:select
暂无
代码示例来源: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
private String getAvailableHostUuidForOperation() {
List<String> hostUuids = Q.New(PrimaryStorageHostRefVO.class).
eq(PrimaryStorageHostRefVO_.primaryStorageUuid, self.getUuid()).select(PrimaryStorageHostRefVO_.hostUuid).listValues();
if (hostUuids == null || hostUuids.size() == 0) {
return null;
}
return hostUuids.get(0);
}
代码示例来源: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 List<String> getNeedRefreshSizeVolumeUuids(){
Set<String> volUuids = new HashSet<>();
for (RefreshVolumeSizeExtensionPoint ext : pluginRgty.getExtensionList(RefreshVolumeSizeExtensionPoint.class)) {
volUuids.addAll(ext.getNeedRefreshVolumeSizeVolume());
}
return volUuids.isEmpty() ? new ArrayList<>() : Q.New(VolumeVO.class).in(VolumeVO_.uuid, volUuids)
.eq(VolumeVO_.state, VolumeState.Enabled)
.eq(VolumeVO_.status, VolumeStatus.Ready)
.select(VolumeVO_.uuid)
.listValues();
}
}
代码示例来源: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
@Transactional
protected List<String> getAvoidHost(VmInstanceSpec spec){
return Q.New(PrimaryStorageHostRefVO.class).select(PrimaryStorageHostRefVO_.hostUuid)
.eq(PrimaryStorageHostRefVO_.primaryStorageUuid, spec.getRequiredPrimaryStorageUuidForRootVolume())
.eq(PrimaryStorageHostRefVO_.status, PrimaryStorageHostStatus.Disconnected)
.listValues();
}
代码示例来源:origin: zstackio/zstack
@Transactional
private List<String> getAvoidHost(VmInstanceSpec spec){
return Q.New(PrimaryStorageHostRefVO.class).select(PrimaryStorageHostRefVO_.hostUuid)
.eq(PrimaryStorageHostRefVO_.primaryStorageUuid, spec.getRequiredPrimaryStorageUuidForRootVolume())
.eq(PrimaryStorageHostRefVO_.status, PrimaryStorageHostStatus.Disconnected)
.listValues();
}
}
代码示例来源: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 static List<String> getIsoUuidByVmUuid(String vmUuid) {
List<String> isoUuids = Q.New(VmCdRomVO.class)
.select(VmCdRomVO_.isoUuid)
.eq(VmCdRomVO_.vmInstanceUuid, vmUuid)
.notNull(VmCdRomVO_.isoUuid)
.listValues();
return isoUuids;
}
代码示例来源: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
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 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(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
@Override
protected void scripts() {
List<String> huuids = Q.New(HostVO.class).select(HostVO_.uuid)
.eq(HostVO_.clusterUuid, clusterUuid)
.listValues();
SQL.New(PrimaryStorageHostRefVO.class)
.eq(PrimaryStorageHostRefVO_.primaryStorageUuid, inventory.getUuid())
.in(PrimaryStorageHostRefVO_.hostUuid, huuids)
.hardDelete();
}
}.execute();
代码示例来源: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
@Override
protected void scripts() {
if (!q(VolumeSnapshotVO.class).eq(VolumeSnapshotVO_.volumeUuid, volumeUuid).isExists()) {
return;
}
List<String> treeUuids = q(VolumeSnapshotVO.class).select(VolumeSnapshotVO_.treeUuid).eq(VolumeSnapshotVO_.volumeUuid, volumeUuid).listValues();
sql(VolumeSnapshotTreeVO.class).in(VolumeSnapshotTreeVO_.uuid, treeUuids).delete();
sql(VolumeSnapshotVO.class).eq(VolumeSnapshotVO_.volumeUuid, volumeUuid).delete();
}
}.execute();
代码示例来源: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()));
}
}
}
内容来源于网络,如有侵权,请联系作者删除!