Package com.cloud.utils.db

Examples of com.cloud.utils.db.UpdateBuilder


            sc.setParameters("ping", oldPingTime);
            sc.setParameters("msid", host.getManagementServerId());
        }

        long newUpdateCount = host.incrUpdated();
        UpdateBuilder ub = getUpdateBuilder(host);
        ub.set(host, _statusAttr, newStatus);
        if (newStatus.updateManagementServer()) {
            if (newStatus.lostConnection()) {
                ub.set(host, _msIdAttr, null);
            } else {
                ub.set(host, _msIdAttr, host.getManagementServerId());
            }
            if (event.equals(Event.Ping) || event.equals(Event.AgentConnected)) {
                ub.set(host, _pingTimeAttr, System.currentTimeMillis() >> 10);
            }
        }
        if (event.equals(Event.ManagementServerDown)) {
            ub.set(host, _pingTimeAttr, ((System.currentTimeMillis() >> 10) - (10 * 60)));
        }
        int result = update(ub, sc, null);
        assert result <= 1 : "How can this update " + result + " rows? ";

        if (result == 0) {
View Full Code Here


        SearchCriteria<HostVO> sc = sb.create();

        sc.setParameters("resource_state", oldState);
        sc.setParameters("id", host.getId());

        UpdateBuilder ub = getUpdateBuilder(host);
        ub.set(host, _resourceStateAttr, newState);
        int result = update(ub, sc, null);
        assert result <= 1 : "How can this update " + result + " rows? ";

        if (state_logger.isDebugEnabled() && result == 0) {
            HostVO ho = findById(host.getId());
View Full Code Here

        sc.setParameters("state", currentState);
        sc.setParameters("updatedCount", vo.getUpdatedCount());

        vo.incrUpdatedCount();

        UpdateBuilder builder = getUpdateBuilder(vo);
        builder.set(vo, "state", nextState);
        builder.set(vo, "updated", new Date());

        int rows = update(vo, sc);
        if (rows == 0 && s_logger.isDebugEnabled()) {
            ObjectInDataStoreVO dbVol = findByIdIncludingRemoved(vo.getId());
            if (dbVol != null) {
View Full Code Here

        sc.setParameters("state", currentState);
        sc.setParameters("updatedCount", volHost.getUpdatedCount());

        volHost.incrUpdatedCount();

        UpdateBuilder builder = getUpdateBuilder(vo);
        builder.set(vo, "state", nextState);
        builder.set(vo, "updated", new Date());

        int rows = update((VolumeHostVO)vo, sc);
        if (rows == 0 && s_logger.isDebugEnabled()) {
            VolumeHostVO dbVol = findByIdIncludingRemoved(volHost.getId());
            if (dbVol != null) {
View Full Code Here

        txn.start();
        SecondaryStorageVmVO proxy = createForUpdate();
        proxy.setPublicIpAddress(null);
        proxy.setPrivateIpAddress(null);
       
        UpdateBuilder ub = getUpdateBuilder(proxy);
        ub.set(proxy, "state", State.Destroyed);
        ub.set(proxy, "privateIpAddress", null);
        update(id, ub, proxy);
       
        boolean result = super.remove(id);
        txn.commit();
        return result;
View Full Code Here

    public boolean remove(Long id) {
        Transaction txn = Transaction.currentTxn();
        txn.start();
        DomainRouterVO router = createForUpdate();
        router.setPublicIpAddress(null);
        UpdateBuilder ub = getUpdateBuilder(router);
        ub.set(router, "state", State.Destroyed);
        update(id, ub, router);

        boolean result = super.remove(id);
        txn.commit();
        return result;
View Full Code Here

      sc.setParameters("states", oldState);
      sc.setParameters("host", vmi.getHostId());
      sc.setParameters("update", vmi.getUpdated());

      vmi.incrUpdated();
      UpdateBuilder ub = getUpdateBuilder(vmi);
     
      ub.set(vmi, "state", newState);
      ub.set(vmi, "hostId", newHostId);
      ub.set(vmi, "podIdToDeployIn", vmi.getPodIdToDeployIn());
      ub.set(vmi, _updateTimeAttr, new Date());

      int result = update(vmi, sc);
      if (result == 0 && s_logger.isDebugEnabled()) {

        VMInstanceVO vo = findByIdIncludingRemoved(vm.getId());
View Full Code Here

        txn.start();
        ConsoleProxyVO proxy = createForUpdate();
        proxy.setPublicIpAddress(null);
        proxy.setPrivateIpAddress(null);
       
        UpdateBuilder ub = getUpdateBuilder(proxy);
        ub.set(proxy, "state", State.Destroyed);
        ub.set(proxy, "privateIpAddress", null);
        update(id, ub, proxy);
       
        boolean result = super.remove(id);
        txn.commit();
        return result;
View Full Code Here

        record.setJoinStatus(joinStatus);
        record.setJoinResult(joinResult);
        record.setCompleteMsid(completeMsid);
        record.setLastUpdated(DateUtil.currentGMTTime());
       
        UpdateBuilder ub = getUpdateBuilder(record);
       
        SearchCriteria<AsyncJobJoinMapVO> sc = CompleteJoinSearch.create();
        sc.setParameters("joinJobId", joinJobId);
        update(ub, sc, null);
  }
View Full Code Here

        sc.setParameters("state", currentState);
        sc.setParameters("updatedCount", templateHost.getUpdatedCount());

        templateHost.incrUpdatedCount();

        UpdateBuilder builder = getUpdateBuilder(vo);
        builder.set(vo, "state", nextState);
        builder.set(vo, "updated", new Date());

        int rows = update((VMTemplateHostVO) vo, sc);
        if (rows == 0 && s_logger.isDebugEnabled()) {
            VMTemplateHostVO dbVol = findByIdIncludingRemoved(templateHost.getId());
            if (dbVol != null) {
View Full Code Here

TOP

Related Classes of com.cloud.utils.db.UpdateBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.