001/*
002 * (C) Copyright 2011 Nuxeo SA (http://nuxeo.com/) and contributors.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 * Contributors:
015 *     Nicolas Ulrich
016 */
017
018package org.nuxeo.ecm.platform.task;
019
020import java.io.Serializable;
021import java.util.Calendar;
022import java.util.Date;
023import java.util.HashMap;
024import java.util.Map;
025
026/**
027 * @since 5.5
028 */
029public class TaskComment extends HashMap<String, Serializable> {
030
031    private static final long serialVersionUID = 1L;
032
033    public TaskComment(Map<String, Serializable> taskCommentMap) {
034        super();
035        this.putAll(taskCommentMap);
036    }
037
038    public TaskComment(String author, String text) {
039        super();
040        this.put(TaskConstants.TASK_COMMENT_AUTHOR_KEY, author);
041        this.put(TaskConstants.TASK_COMMENT_TEXT_KEY, text);
042        this.put(TaskConstants.TASK_COMMENT_CREATION_DATE_KEY, Calendar.getInstance());
043    }
044
045    public TaskComment(String author, String text, Date commentDate) {
046        super();
047        this.put(TaskConstants.TASK_COMMENT_AUTHOR_KEY, author);
048        this.put(TaskConstants.TASK_COMMENT_TEXT_KEY, text);
049        this.put(TaskConstants.TASK_COMMENT_CREATION_DATE_KEY, commentDate);
050    }
051
052    public String getAuthor() {
053        return (String) this.get(TaskConstants.TASK_COMMENT_AUTHOR_KEY);
054    }
055
056    public String getText() {
057        return (String) this.get(TaskConstants.TASK_COMMENT_TEXT_KEY);
058    }
059
060    public Calendar getCreationDate() {
061        return (Calendar) this.get(TaskConstants.TASK_COMMENT_CREATION_DATE_KEY);
062    }
063
064}