org.zstack.core.db.Q.orderBy()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(96)

本文整理了Java中org.zstack.core.db.Q.orderBy方法的一些代码示例,展示了Q.orderBy的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Q.orderBy方法的具体详情如下:
包路径:org.zstack.core.db.Q
类名称:Q
方法名:orderBy

Q.orderBy介绍

暂无

代码示例

代码示例来源:origin: zstackio/zstack

@Override
  public void run(FlowTrigger trigger, Map data) {
    StringSimilarity.refreshErrorTemplates();
    eliminateErrors();
    List<ElaborationVO> vos = Q.New(ElaborationVO.class).gte(ElaborationVO_.repeats, 1).eq(ElaborationVO_.matched, false).orderBy(ElaborationVO_.lastOpDate, SimpleQuery.Od.DESC).list();
    if (!vos.isEmpty()) {
      List<String> messages = StringSimilarity.getElaborations().stream().map(ErrorCodeElaboration::getMessage_cn).collect(Collectors.toList());
      for (ElaborationVO vo: vos) {
        if (messages.contains(vo.getErrorInfo())) {
          vo.setMatched(true);
          dbf.updateAndRefresh(vo);
        }
      }
    }
    StringSimilarity.resetCachedErrors();
    trigger.next();
  }
}).done(new FlowDoneHandler(completion) {

代码示例来源:origin: zstackio/zstack

static VmCdRomVO getEmptyCdRom(String vmUuid) {
  VmCdRomVO cdRomVO = Q.New(VmCdRomVO.class)
      .eq(VmCdRomVO_.vmInstanceUuid, vmUuid)
      .isNull(VmCdRomVO_.isoUuid)
      .orderBy(VmCdRomVO_.deviceId, SimpleQuery.Od.ASC)
      .limit(1)
      .find();
  return cdRomVO;
}

代码示例来源:origin: zstackio/zstack

private List<String> getL3NetworkDns(String l3NetworkUuid){
  List<String> dns = Q.New(L3NetworkDnsVO.class).eq(L3NetworkDnsVO_.l3NetworkUuid, l3NetworkUuid)
      .select(L3NetworkDnsVO_.dns).orderBy(L3NetworkDnsVO_.id, SimpleQuery.Od.ASC).listValues();
  if (dns == null) {
    dns = new ArrayList<String>();
  }
  L3NetworkVO l3VO = Q.New(L3NetworkVO.class).eq(L3NetworkVO_.uuid, l3NetworkUuid).find();
  if (FlatNetwordProviderGlobalConfig.ALLOW_DEFAULT_DNS.value(Boolean.class) && l3VO.getIpVersion() == IPv6Constants.IPv4) {
    String dhcpIp = getDHCPServerIP(l3NetworkUuid);
    if (dhcpIp != null) {
      dns.add(dhcpIp);
    }
  }
  return dns;
}

代码示例来源:origin: zstackio/zstack

.orderBy(VmCdRomVO_.deviceId, SimpleQuery.Od.ASC)
    .list();
if (cdRomVOS.size() <= 1) {

代码示例来源:origin: zstackio/zstack

private void replyLastProgress() {
  TaskProgressVO vo = Q.New(TaskProgressVO.class)
      .eq(TaskProgressVO_.apiId, msg.getApiId())
      .orderBy(TaskProgressVO_.time, SimpleQuery.Od.DESC)
      .limit(1)
      .find();
        .eq(TaskProgressVO_.apiId, msg.getApiId())
        .eq(TaskProgressVO_.taskUuid, vo.getParentUuid())
        .orderBy(TaskProgressVO_.time, SimpleQuery.Od.DESC)
        .limit(1)
        .find();

代码示例来源:origin: zstackio/zstack

@Override
public void afterDelIpAddress(String vmNicUUid, String usedIpUuid) {
  VmNicVO nic = Q.New(VmNicVO.class).eq(VmNicVO_.uuid, vmNicUUid).find();
  if (nic.getUsedIpUuid() != null && !nic.getUsedIpUuid().equals(usedIpUuid)) {
    return;
  }
  UsedIpVO temp = null;
  /* if there is ipv4 addresses, we put the first attached ipv4 address to VmNic.ip
   * or we put the first attached ipv6 address to vmNic.Ip */
  List<UsedIpVO> refs = Q.New(UsedIpVO.class).eq(UsedIpVO_.ipVersion, IPv6Constants.IPv4)
      .eq(UsedIpVO_.vmNicUuid, vmNicUUid).orderBy(UsedIpVO_.createDate, SimpleQuery.Od.ASC).list();
  if (refs != null && !refs.isEmpty()) {
    temp = refs.get(0);
  } else {
    refs = Q.New(UsedIpVO.class).eq(UsedIpVO_.ipVersion, IPv6Constants.IPv6)
        .eq(UsedIpVO_.vmNicUuid, vmNicUUid).orderBy(UsedIpVO_.createDate, SimpleQuery.Od.ASC).list();
    if (refs != null && !refs.isEmpty()) {
      temp = refs.get(0);
    }
  }
  if (temp != null) {
    SQL.New(VmNicVO.class).eq(VmNicVO_.uuid, vmNicUUid)
        .set(VmNicVO_.ip, temp.getIp())
        .set(VmNicVO_.netmask, temp.getNetmask())
        .set(VmNicVO_.gateway, temp.getGateway())
        .set(VmNicVO_.usedIpUuid, temp.getUuid())
        .set(VmNicVO_.ipVersion, temp.getIpVersion())
        .set(VmNicVO_.l3NetworkUuid, temp.getL3NetworkUuid()).update();
  }
}

代码示例来源:origin: zstackio/zstack

@Override
public void afterAddIpAddress(String vmNicUUid, String usedIpUuid) {
  /* update UsedIpVO */
  SQL.New(UsedIpVO.class).eq(UsedIpVO_.uuid, usedIpUuid).set(UsedIpVO_.vmNicUuid, vmNicUUid).update();
  VmNicVO nic = Q.New(VmNicVO.class).eq(VmNicVO_.uuid, vmNicUUid).find();
  UsedIpVO temp = null;
  /* if there is ipv4 addresses, we put the first attached ipv4 address to VmNic.ip
   * or we put the first attached ipv6 address to vmNic.Ip */
  List<UsedIpVO> refs = Q.New(UsedIpVO.class).eq(UsedIpVO_.ipVersion, IPv6Constants.IPv4)
      .eq(UsedIpVO_.vmNicUuid, vmNicUUid).orderBy(UsedIpVO_.createDate, SimpleQuery.Od.ASC).list();
  if (refs != null && !refs.isEmpty()) {
    temp = refs.get(0);
  } else {
    refs = Q.New(UsedIpVO.class).eq(UsedIpVO_.ipVersion, IPv6Constants.IPv6)
        .eq(UsedIpVO_.vmNicUuid, vmNicUUid).orderBy(UsedIpVO_.createDate, SimpleQuery.Od.ASC).list();
    if (refs != null && !refs.isEmpty()) {
      temp = refs.get(0);
    }
  }
  if (!temp.getUuid().equals(nic.getUsedIpUuid())) {
    SQL.New(VmNicVO.class).eq(VmNicVO_.uuid, vmNicUUid)
        .set(VmNicVO_.ip, temp.getIp())
        .set(VmNicVO_.netmask, temp.getNetmask())
        .set(VmNicVO_.gateway, temp.getGateway())
        .set(VmNicVO_.usedIpUuid, temp.getUuid())
        .set(VmNicVO_.ipVersion, temp.getIpVersion())
        .set(VmNicVO_.l3NetworkUuid, temp.getL3NetworkUuid()).update();
  }
}

代码示例来源:origin: zstackio/zstack

List<VmCdRomVO> cdRomVOS = q(VmCdRomVO.class)
    .eq(VmCdRomVO_.vmInstanceUuid, self.getUuid())
    .orderBy(VmCdRomVO_.deviceId, SimpleQuery.Od.ASC)
    .list();

代码示例来源:origin: zstackio/zstack

.orderBy(VmCdRomVO_.deviceId, SimpleQuery.Od.ASC)
    .list();
for (VmCdRomVO cdRomVO : cdRomVOS) {

相关文章