use of com.emc.vipr.model.catalog.OrderJobInfo in project coprhd-controller by CoprHD.
the class RecentOrdersDataTable method getDeleteJobStatus.
public String getDeleteJobStatus() {
OrderJobInfo info = OrderUtils.queryOrderJob(JOB_TYPE_DELETE);
// if the job is done or no job, return null
String status = null;
if (info != null && !info.isNoJobOrJobDone()) {
status = MessagesUtils.get("orders.delete.status", new Date(info.getStartTime()), new Date(info.getEndTime()), info.getCompleted(), info.getTotal(), info.getFailed());
if (info.getTotal() >= OrderDataTable.ORDER_MAX_DELETE_PER_GC) {
status = String.format("%s %s", status, MessagesUtils.get("orders.delete.all.threshold", OrderDataTable.ORDER_MAX_DELETE_PER_GC));
}
}
Logger.info("getDeleteJobStatus: {}", status);
return status;
}
use of com.emc.vipr.model.catalog.OrderJobInfo in project coprhd-controller by CoprHD.
the class OrderService method getJobStatus.
/**
* @brief Query status of deleting/downloading orders
* @param typeStr the type of the job which can be 'DELETE' or 'DOWNLOAD'
* @return job status
*/
@GET
@Path("/job-status")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@CheckPermission(roles = { Role.TENANT_ADMIN })
public OrderJobInfo getJobStatus(@DefaultValue("DELETE_ORDER") @QueryParam(SearchConstants.JOB_TYPE) String typeStr) {
OrderServiceJob.JobType type;
try {
type = OrderServiceJob.JobType.valueOf(typeStr);
} catch (Exception e) {
log.error("Failed to get job type e=", e);
throw APIException.badRequests.invalidParameterWithCause(SearchConstants.JOB_TYPE, typeStr, e);
}
OrderJobStatus status = queryJobInfo(type);
return status != null ? status.toOrderJobInfo() : new OrderJobInfo();
}
use of com.emc.vipr.model.catalog.OrderJobInfo in project coprhd-controller by CoprHD.
the class OrderJobStatus method toOrderJobInfo.
@JsonIgnore
public OrderJobInfo toOrderJobInfo() {
OrderJobInfo info = new OrderJobInfo();
info.setTotal(total);
info.setStartTime(startTime);
info.setEndTime(endTime);
info.setCompleted(getCompletedNumber());
info.setFailed(getFailed());
info.setTimeUsedPerOrder(timeUsedPerOrder);
info.setTids(Collections.unmodifiableList(tids));
return info;
}
use of com.emc.vipr.model.catalog.OrderJobInfo in project coprhd-controller by CoprHD.
the class RecentOrdersDataTable method getDownloadJobStatus.
public String getDownloadJobStatus() {
OrderJobInfo info = OrderUtils.queryOrderJob(JOB_TYPE_DOWNLOAD);
// if the job is done or no job, return null
String status = null;
if (info != null && !info.isNoJobOrJobDone()) {
if (info.getStartTime() == 0) {
status = MessagesUtils.get("orders.download.status.notime", info.getCompleted(), info.getTotal(), info.getFailed());
} else {
status = MessagesUtils.get("orders.download.status", new Date(info.getStartTime()), new Date(info.getEndTime()), info.getCompleted(), info.getTotal(), info.getFailed());
}
}
Logger.info("getDownloadJobStatus: {}", status);
return status;
}
Aggregations