本文整理汇总了Java中com.vmware.vim25.TaskInfo.getDescription方法的典型用法代码示例。如果您正苦于以下问题:Java TaskInfo.getDescription方法的具体用法?Java TaskInfo.getDescription怎么用?Java TaskInfo.getDescription使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vmware.vim25.TaskInfo
的用法示例。
在下文中一共展示了TaskInfo.getDescription方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: logTaskInfo
import com.vmware.vim25.TaskInfo; //导入方法依赖的package包/类
private void logTaskInfo(TaskInfo info) {
if (info == null) {
logger.debug("Deleted task info key");
return;
}
TaskInfoState state = info.getState();
Integer progress = info.getProgress();
if (state == TaskInfoState.SUCCESS) {
progress = Integer.valueOf(100);
} else if (progress == null) {
progress = Integer.valueOf(0);
}
LocalizableMessage desc = info.getDescription();
String description = desc != null ? desc.getMessage() : "";
XMLGregorianCalendar queueT = info.getQueueTime();
String queueTime = queueT != null
? queueT.toGregorianCalendar().getTime().toString() : "";
XMLGregorianCalendar startT = info.getStartTime();
String startTime = startT != null
? startT.toGregorianCalendar().getTime().toString() : "";
XMLGregorianCalendar completeT = info.getCompleteTime();
String completeTime = completeT != null
? completeT.toGregorianCalendar().getTime().toString() : "";
logger.debug("Save task info key: " + info.getKey() + " name: "
+ info.getName() + " target: " + info.getEntityName()
+ " state: " + state.name() + " progress: " + progress
+ "% description: " + description + " queue-time: " + queueTime
+ " start-time: " + startTime + " complete-time: "
+ completeTime);
}
示例2: logTaskInfo
import com.vmware.vim25.TaskInfo; //导入方法依赖的package包/类
private void logTaskInfo(TaskInfo info) {
String key = info.getKey();
String name = info.getName();
String target = info.getEntityName();
TaskInfoState state = info.getState();
Integer progress = info.getProgress();
if (state == TaskInfoState.SUCCESS) {
progress = Integer.valueOf(100);
} else if (progress == null) {
progress = Integer.valueOf(0);
}
LocalizableMessage desc = info.getDescription();
String description = desc != null ? desc.getMessage() : "";
TaskReason reason = info.getReason();
String initiatedBy = "";
if (reason != null) {
if (reason instanceof TaskReasonUser) {
initiatedBy = ((TaskReasonUser) reason).getUserName();
} else if (reason instanceof TaskReasonSystem) {
initiatedBy = "System";
} else if (reason instanceof TaskReasonSchedule) {
initiatedBy = ((TaskReasonSchedule) reason).getName();
} else if (reason instanceof TaskReasonAlarm) {
initiatedBy = ((TaskReasonAlarm) reason).getAlarmName();
}
}
XMLGregorianCalendar queueT = info.getQueueTime();
String queueTime = queueT != null
? queueT.toGregorianCalendar().getTime().toString() : "";
XMLGregorianCalendar startT = info.getStartTime();
String startTime = startT != null
? startT.toGregorianCalendar().getTime().toString() : "";
XMLGregorianCalendar completeT = info.getCompleteTime();
String completeTime = completeT != null
? completeT.toGregorianCalendar().getTime().toString() : "";
logger.debug(key + " name: " + name + " target: " + target + " state: "
+ state + " progress: " + progress + "% description: "
+ description + " initiated: " + initiatedBy + " queue-time: "
+ queueTime + " start-time: " + startTime + " complete-time: "
+ completeTime);
}