public Calendar getCreationDate() { return (Calendar) this.get(TaskConstants.TASK_COMMENT_CREATION_DATE_KEY); }
public TaskComment(Map<String, Serializable> taskCommentMap) { super(); this.putAll(taskCommentMap); }
for (TaskComment comment : item.getComments()) { jg.writeStartObject(); jg.writeStringField("author", comment.getAuthor()); jg.writeStringField("text", comment.getText()); jg.writeStringField("date", DateParser.formatW3CDateTime(comment.getCreationDate().getTime())); jg.writeEndObject();
protected void mappCommentsFromTaskToStep(CoreSession session, DocumentModel docStep) throws ClientException { List<String> comments = new ArrayList<String>(); RoutingTask task = getRoutingTask(context); if (task == null) { log.error("No task found on the operation context"); return; } List<TaskComment> taskComments = task.getComments(); for (TaskComment taskComment : taskComments) { StringBuilder commentBuilder = new StringBuilder(); commentBuilder.append(taskComment.getAuthor()); commentBuilder.append(" : "); commentBuilder.append(taskComment.getText()); comments.add(commentBuilder.toString()); } if (docStep.hasFacet(RoutingTaskConstants.TASK_STEP_FACET_NAME)) { docStep.setPropertyValue( RoutingTaskConstants.TASK_STEP_COMMENTS_PROPERTY_NAME, (Serializable) comments); session.saveDocument(docStep); } } }
public DashBoardItemImpl(Task task, DocumentModel document, Locale locale) { this.task = task; this.document = document; this.locale = locale; id = task.getId(); name = task.getName(); description = task.getDescription(); dueDate = task.getDueDate(); startDate = task.getCreated(); directive = task.getDirective(); List<TaskComment> comments = task.getComments(); if (comments != null && !comments.isEmpty()) { comment = comments.get(comments.size() - 1).getText(); } else { comment = null; } if (dueDate != null) { Date today = new Date(); expired = dueDate.before(today); } else { expired = false; } }
@Override public List<TaskComment> getComments() { List<Map<String, Serializable>> taskCommentsProperty = getPropertyValue( TaskConstants.TASK_COMMENTS_PROPERTY_NAME); List<TaskComment> taskComments = new ArrayList<>(taskCommentsProperty.size()); for (Map<String, Serializable> taskCommentMap : taskCommentsProperty) { taskComments.add(new TaskComment(taskCommentMap)); } return taskComments; }
protected void finishTask(CoreSession session, GraphRoute graph, GraphNode node, Task task, boolean delete, String status) throws DocumentRouteException { DocumentRoutingService routing = Framework.getService(DocumentRoutingService.class); DocumentModelList docs = graph.getAttachedDocumentModels(); routing.removePermissionsForTaskActors(session, docs, task); // delete task if (delete) { session.removeDocument(new IdRef(task.getId())); } // get the last comment on the task, if there are several: // task might have been previously reassigned or delegated List<TaskComment> comments = task.getComments(); String comment = comments.size() > 0 ? comments.get(comments.size() - 1).getText() : ""; // actor NuxeoPrincipal principal = session.getPrincipal(); String actor = principal.getActingUser(); node.updateTaskInfo(task.getId(), true, status, actor, comment); }
@Override public void addComment(String author, String text) { List<Map<String, Serializable>> existingTasks = getPropertyValue(TaskConstants.TASK_COMMENTS_PROPERTY_NAME); if (existingTasks == null) { existingTasks = new ArrayList<>(); } existingTasks.add(new TaskComment(author, text)); setPropertyValue(TaskConstants.TASK_COMMENTS_PROPERTY_NAME, existingTasks); }
public String getText() { return (String) this.get(TaskConstants.TASK_COMMENT_TEXT_KEY); }
public String getAuthor() { return (String) this.get(TaskConstants.TASK_COMMENT_AUTHOR_KEY); }