| | |
| | | try |
| | | { |
| | | this.taskState = taskState; |
| | | Attribute attr = Attributes.create(ATTR_TASK_STATE, taskState.toString()); |
| | | taskEntry.putAttribute(attr.getAttributeType(), newArrayList(attr)); |
| | | putAttribute(ATTR_TASK_STATE, taskState.toString()); |
| | | } |
| | | finally |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | private void putAttribute(String attrName, String attrValue) |
| | | { |
| | | Attribute attr = Attributes.create(attrName, attrValue); |
| | | taskEntry.putAttribute(attr.getAttributeDescription().getAttributeType(), newArrayList(attr)); |
| | | } |
| | | |
| | | /** |
| | | * Sets a state for this task that is the result of a call to |
| | | * {@link #interruptTask(TaskState, LocalizableMessage)}. |
| | |
| | | { |
| | | this.actualStartTime = actualStartTime; |
| | | Date d = new Date(actualStartTime); |
| | | String startTimeStr = StaticUtils.formatDateTimeString(d); |
| | | Attribute attr = Attributes.create(ATTR_TASK_ACTUAL_START_TIME, startTimeStr); |
| | | taskEntry.putAttribute(attr.getAttributeType(), newArrayList(attr)); |
| | | putAttribute(ATTR_TASK_ACTUAL_START_TIME, StaticUtils.formatDateTimeString(d)); |
| | | } |
| | | finally |
| | | { |
| | |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT_GMT_TIME); |
| | | dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); |
| | | Date d = new Date(completionTime); |
| | | Attribute attr = Attributes.create(ATTR_TASK_COMPLETION_TIME, dateFormat.format(d)); |
| | | taskEntry.putAttribute(attr.getAttributeType(), newArrayList(attr)); |
| | | putAttribute(ATTR_TASK_COMPLETION_TIME, dateFormat.format(d)); |
| | | } |
| | | finally |
| | | { |