| | |
| | | private LinkedList<String> getAttributeValues(String attributeName) |
| | | throws InitializationException |
| | | { |
| | | LinkedList<String> valueStrings = new LinkedList<String>(); |
| | | LinkedList<String> valueStrings = new LinkedList<>(); |
| | | |
| | | List<Attribute> attrList = |
| | | taskEntry.getAttribute(attributeName.toLowerCase()); |
| | | if ((attrList == null) || attrList.isEmpty()) |
| | | List<Attribute> attrList = taskEntry.getAttribute(attributeName.toLowerCase()); |
| | | if (attrList == null || attrList.isEmpty()) |
| | | { |
| | | return valueStrings; |
| | | } |
| | | |
| | | if (attrList.size() > 1) |
| | | { |
| | | throw new InitializationException(ERR_TASK_MULTIPLE_ATTRS_FOR_TYPE.get(attributeName, taskEntry.getName())); |
| | |
| | | try |
| | | { |
| | | this.taskState = taskState; |
| | | Attribute attr = Attributes.create(ATTR_TASK_STATE, |
| | | taskState.toString()); |
| | | ArrayList<Attribute> attrList = new ArrayList<Attribute>(1); |
| | | Attribute attr = Attributes.create(ATTR_TASK_STATE, taskState.toString()); |
| | | ArrayList<Attribute> attrList = new ArrayList<>(1); |
| | | attrList.add(attr); |
| | | taskEntry.putAttribute(attr.getAttributeType(), attrList); |
| | | } |
| | |
| | | |
| | | /** |
| | | * Sets a state for this task that is the result of a call to |
| | | * {@link #interruptTask(TaskState, org.opends.messages.LocalizableMessage)}. |
| | | * {@link #interruptTask(TaskState, LocalizableMessage)}. |
| | | * It may take this task some time to actually cancel to that |
| | | * actual state may differ until quiescence. |
| | | * |
| | |
| | | |
| | | /** |
| | | * Gets the interrupt state for this task that was set as a |
| | | * result of a call to {@link #interruptTask(TaskState, |
| | | * org.opends.messages.LocalizableMessage)}. |
| | | * result of a call to {@link #interruptTask(TaskState, LocalizableMessage)}. |
| | | * |
| | | * @return interrupt state for this task |
| | | */ |
| | |
| | | /** |
| | | * Returns a state for this task after processing has completed. |
| | | * If the task was interrupted with a call to |
| | | * {@link #interruptTask(TaskState, org.opends.messages.LocalizableMessage)} |
| | | * then that method's interruptState is returned here. Otherwse |
| | | * {@link #interruptTask(TaskState, LocalizableMessage)} |
| | | * then that method's interruptState is returned here. Otherwise |
| | | * this method returns TaskState.COMPLETED_SUCCESSFULLY. It is |
| | | * assumed that if there were errors during task processing that |
| | | * task state will have been derived in some other way. |
| | |
| | | { |
| | | Entry taskEntry = getTaskEntry(); |
| | | |
| | | ArrayList<Modification> modifications = new ArrayList<Modification>(); |
| | | ArrayList<Modification> modifications = new ArrayList<>(); |
| | | modifications.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(name, value))); |
| | | |
| | |
| | | String startTimeStr = StaticUtils.formatDateTimeString(d); |
| | | Attribute attr = Attributes.create(ATTR_TASK_ACTUAL_START_TIME, |
| | | startTimeStr); |
| | | ArrayList<Attribute> attrList = new ArrayList<Attribute>(1); |
| | | ArrayList<Attribute> attrList = new ArrayList<>(1); |
| | | attrList.add(attr); |
| | | taskEntry.putAttribute(attr.getAttributeType(), attrList); |
| | | } |
| | |
| | | Date d = new Date(completionTime); |
| | | Attribute attr = Attributes.create(ATTR_TASK_COMPLETION_TIME, |
| | | dateFormat.format(d)); |
| | | ArrayList<Attribute> attrList = new ArrayList<Attribute>(1); |
| | | ArrayList<Attribute> attrList = new ArrayList<>(1); |
| | | attrList.add(attr); |
| | | taskEntry.putAttribute(attr.getAttributeType(), attrList); |
| | | } |
| | |
| | | */ |
| | | public final List<LocalizableMessage> getLogMessages() |
| | | { |
| | | List<LocalizableMessage> msgList = new ArrayList<LocalizableMessage>(); |
| | | List<LocalizableMessage> msgList = new ArrayList<>(); |
| | | for(String logString : logMessages) { |
| | | // TODO: a better job or recreating the message |
| | | msgList.add(LocalizableMessage.raw(logString)); |
| | |
| | | ByteString value = ByteString.valueOf(messageString); |
| | | if (attrList == null) |
| | | { |
| | | attrList = new ArrayList<Attribute>(); |
| | | attrList = new ArrayList<>(); |
| | | attrList.add(Attributes.create(type, value)); |
| | | taskEntry.putAttribute(type, attrList); |
| | | } |
| | |
| | | { |
| | | if (DirectoryServer.mailServerConfigured()) |
| | | { |
| | | LinkedHashSet<String> recipients = new LinkedHashSet<String>(notifyOnCompletion); |
| | | LinkedHashSet<String> recipients = new LinkedHashSet<>(notifyOnCompletion); |
| | | if (! TaskState.isSuccessful(taskState)) |
| | | { |
| | | recipients.addAll(notifyOnError); |