From e4765fb32b7c27e6608c3fd8873a014acedaad0d Mon Sep 17 00:00:00 2001 From: alena Date: Fri, 18 Feb 2011 17:06:43 -0800 Subject: [PATCH] bug 6969: return jobId/jobStatus for IpAddress and SecurityGroup as ids for these objects were introduced in 2.2.x --- .../commands/AssignToLoadBalancerRuleCmd.java | 2 + .../api/commands/AssociateIPAddrCmd.java | 8 ++++ .../AuthorizeSecurityGroupIngressCmd.java | 11 ++++++ .../api/commands/CancelMaintenanceCmd.java | 2 + .../CancelPrimaryStorageMaintenanceCmd.java | 2 + .../api/commands/DisassociateIPAddrCmd.java | 13 +++++++ .../commands/ListPublicIpAddressesCmd.java | 5 +++ .../api/commands/ListSecurityGroupsCmd.java | 6 +++ .../cloud/api/commands/ListVolumesCmd.java | 2 +- .../commands/PrepareForMaintenanceCmd.java | 2 + ...reparePrimaryStorageForMaintenanceCmd.java | 2 + .../RevokeSecurityGroupIngressCmd.java | 11 ++++++ .../com/cloud/api/response/HostResponse.java | 39 +++++++++++-------- .../cloud/api/response/IPAddressResponse.java | 31 +++++++++++++++ .../api/response/SecurityGroupResponse.java | 32 +++++++++++++++ .../api/response/StoragePoolResponse.java | 37 ++++++++++-------- .../cloud/api/response/VolumeResponse.java | 37 ++++++++++-------- api/src/com/cloud/async/AsyncJob.java | 4 +- server/src/com/cloud/api/ApiServer.java | 10 ++++- .../src/com/cloud/async/AsyncJobManager.java | 2 +- .../com/cloud/async/AsyncJobManagerImpl.java | 2 +- .../src/com/cloud/async/dao/AsyncJobDao.java | 2 +- .../com/cloud/async/dao/AsyncJobDaoImpl.java | 7 +++- 23 files changed, 212 insertions(+), 57 deletions(-) diff --git a/api/src/com/cloud/api/commands/AssignToLoadBalancerRuleCmd.java b/api/src/com/cloud/api/commands/AssignToLoadBalancerRuleCmd.java index de547070efd..69963bc9249 100644 --- a/api/src/com/cloud/api/commands/AssignToLoadBalancerRuleCmd.java +++ b/api/src/com/cloud/api/commands/AssignToLoadBalancerRuleCmd.java @@ -102,10 +102,12 @@ public class AssignToLoadBalancerRuleCmd extends BaseAsyncCmd { } } + @Override public String getSyncObjType() { return BaseAsyncCmd.networkSyncObject; } + @Override public Long getSyncObjId() { return _lbService.findById(id).getNetworkId(); } diff --git a/api/src/com/cloud/api/commands/AssociateIPAddrCmd.java b/api/src/com/cloud/api/commands/AssociateIPAddrCmd.java index f7dc07acf3e..5894e2aaf76 100644 --- a/api/src/com/cloud/api/commands/AssociateIPAddrCmd.java +++ b/api/src/com/cloud/api/commands/AssociateIPAddrCmd.java @@ -29,6 +29,7 @@ import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.api.response.IPAddressResponse; +import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InsufficientAddressCapacityException; @@ -161,11 +162,18 @@ public class AssociateIPAddrCmd extends BaseAsyncCreateCmd { } + @Override public String getSyncObjType() { return BaseAsyncCmd.networkSyncObject; } + @Override public Long getSyncObjId() { return getNetworkId(); + } + + @Override + public AsyncJob.Type getInstanceType() { + return AsyncJob.Type.IpAddress; } } diff --git a/api/src/com/cloud/api/commands/AuthorizeSecurityGroupIngressCmd.java b/api/src/com/cloud/api/commands/AuthorizeSecurityGroupIngressCmd.java index fa155b3bbba..ae5bc963fb3 100644 --- a/api/src/com/cloud/api/commands/AuthorizeSecurityGroupIngressCmd.java +++ b/api/src/com/cloud/api/commands/AuthorizeSecurityGroupIngressCmd.java @@ -34,6 +34,7 @@ import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.api.response.IngressRuleResponse; import com.cloud.api.response.SecurityGroupResponse; +import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.network.security.IngressRule; import com.cloud.user.Account; @@ -206,4 +207,14 @@ public class AuthorizeSecurityGroupIngressCmd extends BaseAsyncCmd { } } + + @Override + public AsyncJob.Type getInstanceType() { + return AsyncJob.Type.SecurityGroup; + } + + @Override + public Long getInstanceId() { + return getSecurityGroupId(); + } } diff --git a/api/src/com/cloud/api/commands/CancelMaintenanceCmd.java b/api/src/com/cloud/api/commands/CancelMaintenanceCmd.java index 58f4cbb6c33..7bf93326d70 100644 --- a/api/src/com/cloud/api/commands/CancelMaintenanceCmd.java +++ b/api/src/com/cloud/api/commands/CancelMaintenanceCmd.java @@ -89,10 +89,12 @@ public class CancelMaintenanceCmd extends BaseAsyncCmd { return "canceling maintenance for host: " + getId(); } + @Override public AsyncJob.Type getInstanceType() { return AsyncJob.Type.Host; } + @Override public Long getInstanceId() { return getId(); } diff --git a/api/src/com/cloud/api/commands/CancelPrimaryStorageMaintenanceCmd.java b/api/src/com/cloud/api/commands/CancelPrimaryStorageMaintenanceCmd.java index 8fec8e46302..44d312c3df1 100644 --- a/api/src/com/cloud/api/commands/CancelPrimaryStorageMaintenanceCmd.java +++ b/api/src/com/cloud/api/commands/CancelPrimaryStorageMaintenanceCmd.java @@ -70,10 +70,12 @@ public class CancelPrimaryStorageMaintenanceCmd extends BaseAsyncCmd { return "primarystorage"; } + @Override public AsyncJob.Type getInstanceType() { return AsyncJob.Type.StoragePool; } + @Override public Long getInstanceId() { return getId(); } diff --git a/api/src/com/cloud/api/commands/DisassociateIPAddrCmd.java b/api/src/com/cloud/api/commands/DisassociateIPAddrCmd.java index d895cbd6663..9008d0fd506 100644 --- a/api/src/com/cloud/api/commands/DisassociateIPAddrCmd.java +++ b/api/src/com/cloud/api/commands/DisassociateIPAddrCmd.java @@ -26,6 +26,7 @@ import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.api.response.SuccessResponse; +import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; import com.cloud.network.IpAddress; @@ -96,10 +97,12 @@ public class DisassociateIPAddrCmd extends BaseAsyncCmd { return ownerId; } + @Override public String getSyncObjType() { return BaseAsyncCmd.networkSyncObject; } + @Override public Long getSyncObjId() { IpAddress ip = getIpAddress(id); return ip.getAssociatedWithNetworkId(); @@ -114,4 +117,14 @@ public class DisassociateIPAddrCmd extends BaseAsyncCmd { return ip; } } + + @Override + public AsyncJob.Type getInstanceType() { + return AsyncJob.Type.IpAddress; + } + + @Override + public Long getInstanceId() { + return getIpAddressId(); + } } diff --git a/api/src/com/cloud/api/commands/ListPublicIpAddressesCmd.java b/api/src/com/cloud/api/commands/ListPublicIpAddressesCmd.java index ed96303a08a..7aed38a8ce6 100644 --- a/api/src/com/cloud/api/commands/ListPublicIpAddressesCmd.java +++ b/api/src/com/cloud/api/commands/ListPublicIpAddressesCmd.java @@ -29,6 +29,7 @@ import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.response.IPAddressResponse; import com.cloud.api.response.ListResponse; +import com.cloud.async.AsyncJob; import com.cloud.network.IpAddress; @Implementation(description="Lists all public ip addresses", responseObject=IPAddressResponse.class) @@ -123,5 +124,9 @@ public class ListPublicIpAddressesCmd extends BaseListCmd { response.setResponses(ipAddrResponses); response.setResponseName(getCommandName()); this.setResponseObject(response); + } + + public AsyncJob.Type getInstanceType() { + return AsyncJob.Type.IpAddress; } } diff --git a/api/src/com/cloud/api/commands/ListSecurityGroupsCmd.java b/api/src/com/cloud/api/commands/ListSecurityGroupsCmd.java index 082d7c87eb1..1d424226586 100644 --- a/api/src/com/cloud/api/commands/ListSecurityGroupsCmd.java +++ b/api/src/com/cloud/api/commands/ListSecurityGroupsCmd.java @@ -27,6 +27,7 @@ import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.response.ListResponse; import com.cloud.api.response.SecurityGroupResponse; +import com.cloud.async.AsyncJob; import com.cloud.network.security.SecurityGroupRules; @Implementation(description="Lists security groups", responseObject=SecurityGroupResponse.class) @@ -95,4 +96,9 @@ public class ListSecurityGroupsCmd extends BaseListCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } + + @Override + public AsyncJob.Type getInstanceType() { + return AsyncJob.Type.SecurityGroup; + } } diff --git a/api/src/com/cloud/api/commands/ListVolumesCmd.java b/api/src/com/cloud/api/commands/ListVolumesCmd.java index ee4282e2d2f..fbd6bd9a6ee 100755 --- a/api/src/com/cloud/api/commands/ListVolumesCmd.java +++ b/api/src/com/cloud/api/commands/ListVolumesCmd.java @@ -26,7 +26,6 @@ import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; import com.cloud.api.Implementation; import com.cloud.api.Parameter; -import com.cloud.api.BaseCmd.CommandType; import com.cloud.api.response.ListResponse; import com.cloud.api.response.VolumeResponse; import com.cloud.async.AsyncJob; @@ -125,6 +124,7 @@ public class ListVolumesCmd extends BaseListCmd { return s_name; } + @Override public AsyncJob.Type getInstanceType() { return AsyncJob.Type.Volume; } diff --git a/api/src/com/cloud/api/commands/PrepareForMaintenanceCmd.java b/api/src/com/cloud/api/commands/PrepareForMaintenanceCmd.java index a911bd0ae85..ab4bfaf0515 100644 --- a/api/src/com/cloud/api/commands/PrepareForMaintenanceCmd.java +++ b/api/src/com/cloud/api/commands/PrepareForMaintenanceCmd.java @@ -86,10 +86,12 @@ public class PrepareForMaintenanceCmd extends BaseAsyncCmd { return "preparing host: " + getId() + " for maintenance"; } + @Override public AsyncJob.Type getInstanceType() { return AsyncJob.Type.Host; } + @Override public Long getInstanceId() { return getId(); } diff --git a/api/src/com/cloud/api/commands/PreparePrimaryStorageForMaintenanceCmd.java b/api/src/com/cloud/api/commands/PreparePrimaryStorageForMaintenanceCmd.java index 2ca32146341..354a8bb0aee 100644 --- a/api/src/com/cloud/api/commands/PreparePrimaryStorageForMaintenanceCmd.java +++ b/api/src/com/cloud/api/commands/PreparePrimaryStorageForMaintenanceCmd.java @@ -67,10 +67,12 @@ public class PreparePrimaryStorageForMaintenanceCmd extends BaseAsyncCmd { return "primarystorage"; } + @Override public AsyncJob.Type getInstanceType() { return AsyncJob.Type.StoragePool; } + @Override public Long getInstanceId() { return getId(); } diff --git a/api/src/com/cloud/api/commands/RevokeSecurityGroupIngressCmd.java b/api/src/com/cloud/api/commands/RevokeSecurityGroupIngressCmd.java index ba2d710770e..be91763de43 100644 --- a/api/src/com/cloud/api/commands/RevokeSecurityGroupIngressCmd.java +++ b/api/src/com/cloud/api/commands/RevokeSecurityGroupIngressCmd.java @@ -9,6 +9,7 @@ import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.api.response.SuccessResponse; +import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.user.Account; import com.cloud.user.UserContext; @@ -100,4 +101,14 @@ public class RevokeSecurityGroupIngressCmd extends BaseAsyncCmd { throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to revoke security group ingress rule"); } } + + @Override + public AsyncJob.Type getInstanceType() { + return AsyncJob.Type.SecurityGroup; + } + + @Override + public Long getInstanceId() { + return getId(); + } } diff --git a/api/src/com/cloud/api/response/HostResponse.java b/api/src/com/cloud/api/response/HostResponse.java index 7fb9e270a73..40982383e49 100755 --- a/api/src/com/cloud/api/response/HostResponse.java +++ b/api/src/com/cloud/api/response/HostResponse.java @@ -141,8 +141,29 @@ public class HostResponse extends BaseResponse { @SerializedName("jobstatus") @Param(description="shows the current pending asynchronous job status") private Integer jobStatus; + @Override public Long getObjectId() { - return getId(); + return getId(); + } + + @Override + public Long getJobId() { + return jobId; + } + + @Override + public void setJobId(Long jobId) { + this.jobId = jobId; + } + + @Override + public Integer getJobStatus() { + return jobStatus; + } + + @Override + public void setJobStatus(Integer jobStatus) { + this.jobStatus = jobStatus; } public Long getId() { @@ -432,20 +453,4 @@ public class HostResponse extends BaseResponse { public void setEvents(String events) { this.events = events; } - - public Long getJobId() { - return jobId; - } - - public void setJobId(Long jobId) { - this.jobId = jobId; - } - - public Integer getJobStatus() { - return jobStatus; - } - - public void setJobStatus(Integer jobStatus) { - this.jobStatus = jobStatus; - } } diff --git a/api/src/com/cloud/api/response/IPAddressResponse.java b/api/src/com/cloud/api/response/IPAddressResponse.java index af4fb6699be..83908005541 100644 --- a/api/src/com/cloud/api/response/IPAddressResponse.java +++ b/api/src/com/cloud/api/response/IPAddressResponse.java @@ -81,6 +81,12 @@ public class IPAddressResponse extends BaseResponse { @SerializedName(ApiConstants.STATE) @Param(description="State of the ip address. Can be: Allocatin, Allocated and Releasing") private String state; + @SerializedName(ApiConstants.JOB_ID) @Param(description="shows the current pending asynchronous job ID. This tag is not returned if no current pending jobs are acting on the volume") + private Long jobId; + + @SerializedName("jobstatus") @Param(description="shows the current pending asynchronous job status") + private Integer jobStatus; + public String getIpAddress() { return ipAddress; } @@ -232,4 +238,29 @@ public class IPAddressResponse extends BaseResponse { public void setState(String state) { this.state = state; } + + @Override + public Long getObjectId() { + return getId(); + } + + @Override + public Long getJobId() { + return jobId; + } + + @Override + public void setJobId(Long jobId) { + this.jobId = jobId; + } + + @Override + public Integer getJobStatus() { + return jobStatus; + } + + @Override + public void setJobStatus(Integer jobStatus) { + this.jobStatus = jobStatus; + } } diff --git a/api/src/com/cloud/api/response/SecurityGroupResponse.java b/api/src/com/cloud/api/response/SecurityGroupResponse.java index 705ac8addec..4e8f54828b3 100644 --- a/api/src/com/cloud/api/response/SecurityGroupResponse.java +++ b/api/src/com/cloud/api/response/SecurityGroupResponse.java @@ -19,6 +19,7 @@ package com.cloud.api.response; import java.util.List; +import com.cloud.api.ApiConstants; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; @@ -40,6 +41,12 @@ public class SecurityGroupResponse extends BaseResponse { @SerializedName("domain") @Param(description="the domain name of the security group") private String domainName; + + @SerializedName(ApiConstants.JOB_ID) @Param(description="shows the current pending asynchronous job ID. This tag is not returned if no current pending jobs are acting on the volume") + private Long jobId; + + @SerializedName("jobstatus") @Param(description="shows the current pending asynchronous job status") + private Integer jobStatus; @SerializedName("ingressrule") @Param(description="the list of ingress rules associated with the security group", responseObject = IngressRuleResponse.class) private List ingressRules; @@ -99,4 +106,29 @@ public class SecurityGroupResponse extends BaseResponse { public void setIngressRules(List ingressRules) { this.ingressRules = ingressRules; } + + @Override + public Long getObjectId() { + return getId(); + } + + @Override + public Long getJobId() { + return jobId; + } + + @Override + public void setJobId(Long jobId) { + this.jobId = jobId; + } + + @Override + public Integer getJobStatus() { + return jobStatus; + } + + @Override + public void setJobStatus(Integer jobStatus) { + this.jobStatus = jobStatus; + } } diff --git a/api/src/com/cloud/api/response/StoragePoolResponse.java b/api/src/com/cloud/api/response/StoragePoolResponse.java index d0047265b78..abfaf8db9d0 100644 --- a/api/src/com/cloud/api/response/StoragePoolResponse.java +++ b/api/src/com/cloud/api/response/StoragePoolResponse.java @@ -20,7 +20,6 @@ package com.cloud.api.response; import java.util.Date; import com.cloud.api.ApiConstants; -import com.cloud.host.Status; import com.cloud.serializer.Param; import com.cloud.storage.StoragePoolStatus; import com.google.gson.annotations.SerializedName; @@ -80,9 +79,30 @@ public class StoragePoolResponse extends BaseResponse { @SerializedName("jobstatus") @Param(description="shows the current pending asynchronous job status") private Integer jobStatus; + @Override public Long getObjectId() { return getId(); } + + @Override + public Long getJobId() { + return jobId; + } + + @Override + public void setJobId(Long jobId) { + this.jobId = jobId; + } + + @Override + public Integer getJobStatus() { + return jobStatus; + } + + @Override + public void setJobStatus(Integer jobStatus) { + this.jobStatus = jobStatus; + } public Long getId() { return id; @@ -212,19 +232,4 @@ public class StoragePoolResponse extends BaseResponse { this.state = state; } - public Integer getJobStatus() { - return jobStatus; - } - - public void setJobStatus(Integer jobStatus) { - this.jobStatus = jobStatus; - } - - public Long getJobId() { - return jobId; - } - - public void setJobId(Long jobId) { - this.jobId = jobId; - } } diff --git a/api/src/com/cloud/api/response/VolumeResponse.java b/api/src/com/cloud/api/response/VolumeResponse.java index 144418deb9a..c760c594bf5 100755 --- a/api/src/com/cloud/api/response/VolumeResponse.java +++ b/api/src/com/cloud/api/response/VolumeResponse.java @@ -123,9 +123,30 @@ public class VolumeResponse extends BaseResponse { @SerializedName("isextractable") @Param(description="true if the volume is extractable, false otherwise") private Boolean extractable; + @Override public Long getObjectId() { return getId(); } + + @Override + public Long getJobId() { + return jobId; + } + + @Override + public void setJobId(Long jobId) { + this.jobId = jobId; + } + + @Override + public Integer getJobStatus() { + return jobStatus; + } + + @Override + public void setJobStatus(Integer jobStatus) { + this.jobStatus = jobStatus; + } public Boolean getDestroyed() { return destroyed; @@ -143,22 +164,6 @@ public class VolumeResponse extends BaseResponse { this.id = id; } - public Long getJobId() { - return jobId; - } - - public void setJobId(Long jobId) { - this.jobId = jobId; - } - - public Integer getJobStatus() { - return jobStatus; - } - - public void setJobStatus(Integer jobStatus) { - this.jobStatus = jobStatus; - } - public String getName() { return name; } diff --git a/api/src/com/cloud/async/AsyncJob.java b/api/src/com/cloud/async/AsyncJob.java index 2bbfc597db5..6334bfe9ba5 100644 --- a/api/src/com/cloud/async/AsyncJob.java +++ b/api/src/com/cloud/async/AsyncJob.java @@ -31,7 +31,9 @@ public interface AsyncJob { Iso, SystemVm, Host, - StoragePool + StoragePool, + IpAddress, + SecurityGroup, } Long getId(); diff --git a/server/src/com/cloud/api/ApiServer.java b/server/src/com/cloud/api/ApiServer.java index d37473eb885..18bb84c7ccd 100755 --- a/server/src/com/cloud/api/ApiServer.java +++ b/server/src/com/cloud/api/ApiServer.java @@ -445,7 +445,15 @@ public class ApiServer implements HttpRequestHandler { private void buildAsyncListResponse(BaseListCmd command, Account account) { List responses = ((ListResponse)command.getResponseObject()).getResponses(); if (responses != null && responses.size() > 0) { - List jobs = _asyncMgr.findInstancePendingAsyncJobs(command.getInstanceType(), account.getId()); + List jobs = null; + + //list all jobs for ROOT admin + if (account.getType() == Account.ACCOUNT_TYPE_ADMIN) { + jobs = _asyncMgr.findInstancePendingAsyncJobs(command.getInstanceType(), null); + } else { + jobs = _asyncMgr.findInstancePendingAsyncJobs(command.getInstanceType(), account.getId()); + } + if (jobs.size() == 0) { return; } diff --git a/server/src/com/cloud/async/AsyncJobManager.java b/server/src/com/cloud/async/AsyncJobManager.java index 44f15b7eca5..6a1c293a4ba 100644 --- a/server/src/com/cloud/async/AsyncJobManager.java +++ b/server/src/com/cloud/async/AsyncJobManager.java @@ -31,7 +31,7 @@ public interface AsyncJobManager extends Manager { public AsyncJobVO getAsyncJob(long jobId); public AsyncJobVO findInstancePendingAsyncJob(String instanceType, long instanceId); - public List findInstancePendingAsyncJobs(AsyncJob.Type instanceType, long accountId); + public List findInstancePendingAsyncJobs(AsyncJob.Type instanceType, Long accountId); public long submitAsyncJob(AsyncJobVO job); public long submitAsyncJob(AsyncJobVO job, boolean scheduleJobExecutionInContext); diff --git a/server/src/com/cloud/async/AsyncJobManagerImpl.java b/server/src/com/cloud/async/AsyncJobManagerImpl.java index 1ad9e405daa..713b520fbca 100644 --- a/server/src/com/cloud/async/AsyncJobManagerImpl.java +++ b/server/src/com/cloud/async/AsyncJobManagerImpl.java @@ -106,7 +106,7 @@ public class AsyncJobManagerImpl implements AsyncJobManager, ClusterManagerListe } @Override - public List findInstancePendingAsyncJobs(AsyncJob.Type instanceType, long accountId) { + public List findInstancePendingAsyncJobs(AsyncJob.Type instanceType, Long accountId) { return _jobDao.findInstancePendingAsyncJobs(instanceType, accountId); } diff --git a/server/src/com/cloud/async/dao/AsyncJobDao.java b/server/src/com/cloud/async/dao/AsyncJobDao.java index 69b171812f9..9c243fb777b 100644 --- a/server/src/com/cloud/async/dao/AsyncJobDao.java +++ b/server/src/com/cloud/async/dao/AsyncJobDao.java @@ -27,7 +27,7 @@ import com.cloud.utils.db.GenericDao; public interface AsyncJobDao extends GenericDao { AsyncJobVO findInstancePendingAsyncJob(String instanceType, long instanceId); - List findInstancePendingAsyncJobs(AsyncJob.Type instanceType, long accountId); + List findInstancePendingAsyncJobs(AsyncJob.Type instanceType, Long accountId); List getExpiredJobs(Date cutTime, int limit); void resetJobProcess(long msid); } diff --git a/server/src/com/cloud/async/dao/AsyncJobDaoImpl.java b/server/src/com/cloud/async/dao/AsyncJobDaoImpl.java index e6980ae091e..c97267b708a 100644 --- a/server/src/com/cloud/async/dao/AsyncJobDaoImpl.java +++ b/server/src/com/cloud/async/dao/AsyncJobDaoImpl.java @@ -87,10 +87,13 @@ public class AsyncJobDaoImpl extends GenericDaoBase implements return null; } - public List findInstancePendingAsyncJobs(AsyncJob.Type instanceType, long accountId) { + public List findInstancePendingAsyncJobs(AsyncJob.Type instanceType, Long accountId) { SearchCriteria sc = pendingAsyncJobsSearch.create(); sc.setParameters("instanceType", instanceType); - sc.setParameters("accountId", accountId); + + if (accountId != null) { + sc.setParameters("accountId", accountId); + } sc.setParameters("status", AsyncJobResult.STATUS_IN_PROGRESS); return listBy(sc);