Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public interface InternalBackupServiceJobDao extends GenericDao<InternalBackupSe

List<InternalBackupServiceJobVO> listExecutingJobsByHostsAndStartTimeBeforeAndTypeIn(Object[] hostIds, Date date, InternalBackupServiceJobType... jobTypes);

Pair<List<InternalBackupServiceJobVO>, Integer> searchAndCountForListApi(Long id, Long backupId, Long hostId, Long zoneId, InternalBackupServiceJobType type, boolean executing,
Pair<List<InternalBackupServiceJobVO>, Integer> searchAndCountForListApi(Long id, Long backupId, Long hostId, Long zoneId, String type, boolean executing,
boolean scheduled, Long startIndex, Long pageSize);

void update(InternalBackupServiceJobVO job);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public List<InternalBackupServiceJobVO> listExecutingJobsByHostsAndStartTimeBefo
}

@Override
public Pair<List<InternalBackupServiceJobVO>, Integer> searchAndCountForListApi(Long id, Long backupId, Long hostId, Long zoneId, InternalBackupServiceJobType type, boolean executing,
public Pair<List<InternalBackupServiceJobVO>, Integer> searchAndCountForListApi(Long id, Long backupId, Long hostId, Long zoneId, String type, boolean executing,
boolean scheduled, Long startIndex, Long pageSize) {
SearchBuilder<InternalBackupServiceJobVO> sb = createSearchBuilder();

Expand All @@ -122,7 +122,7 @@ public Pair<List<InternalBackupServiceJobVO>, Integer> searchAndCountForListApi(
sc.setParametersIfNotNull(HOST_ID, hostId);
sc.setParametersIfNotNull(ZONE_ID, zoneId);
if (type != null) {
sc.setParameters(TYPE, type);
sc.setParameters(TYPE, InternalBackupServiceJobType.valueOf(type));
}

Filter filter = new Filter(InternalBackupServiceJobVO.class, "created", false, startIndex, pageSize);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@
import org.apache.cloudstack.api.response.VirtualMachineResponse;
import org.apache.cloudstack.api.response.VolumeResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.cloudstack.backup.InternalBackupServiceJobType;
import org.apache.cloudstack.backup.InternalBackupServiceJobVO;
import org.apache.cloudstack.backup.BackupOfferingVO;
import org.apache.cloudstack.backup.BackupVO;
Expand Down Expand Up @@ -6379,7 +6378,7 @@ private List<BucketVO> searchForBucketsInternal(ListBucketsCmd cmd) {
public ListResponse<BackupServiceJobResponse> listBackupServiceJobs(ListBackupServiceJobsCmd cmd) {
ListResponse<BackupServiceJobResponse> responses = new ListResponse<>();
Pair<List<InternalBackupServiceJobVO>, Integer> result = listBackupServiceJobsInternal(cmd);
List<BackupServiceJobResponse> compressionJobResponses = new ArrayList<>();
List<BackupServiceJobResponse> backupServiceJobResponses = new ArrayList<>();

for (InternalBackupServiceJobVO jobVO : result.first()) {
BackupVO backup = backupDao.findByIdIncludingRemoved(jobVO.getBackupId());
Expand All @@ -6391,16 +6390,16 @@ public ListResponse<BackupServiceJobResponse> listBackupServiceJobs(ListBackupSe
if (jobVO.getHostId() != null) {
response.setHostId(hostDao.findByIdIncludingRemoved(jobVO.getHostId()).getUuid());
}
compressionJobResponses.add(response);
backupServiceJobResponses.add(response);
}

responses.setResponses(compressionJobResponses, result.second());
responses.setResponses(backupServiceJobResponses, result.second());
return responses;
}

private Pair<List<InternalBackupServiceJobVO>, Integer> listBackupServiceJobsInternal(ListBackupServiceJobsCmd cmd) {
return internalBackupServiceJobDao.searchAndCountForListApi(cmd.getId(), cmd.getBackupId(), cmd.getHostId(), cmd.getZoneId(),
InternalBackupServiceJobType.valueOf(cmd.getType()), cmd.getExecuting(), cmd.getScheduled(), cmd.getStartIndex(), cmd.getPageSizeVal());
cmd.getType(), cmd.getExecuting(), cmd.getScheduled(), cmd.getStartIndex(), cmd.getPageSizeVal());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note that is we propagate the enum to the parameter we can use the CSoC work by @dheeraj12347 for code completion/ parameter validation. (Last bit yet to be designed and worked on)

}

@Override
Expand Down
Loading