001/*
002 * (C) Copyright 2011 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     Nicolas Ulrich
018 */
019
020package org.nuxeo.ecm.platform.task;
021
022import java.io.Serializable;
023import java.util.Calendar;
024import java.util.Date;
025import java.util.HashMap;
026import java.util.Map;
027
028/**
029 * @since 5.5
030 */
031public class TaskComment extends HashMap<String, Serializable> {
032
033    private static final long serialVersionUID = 1L;
034
035    public TaskComment(Map<String, Serializable> taskCommentMap) {
036        super();
037        this.putAll(taskCommentMap);
038    }
039
040    public TaskComment(String author, String text) {
041        super();
042        this.put(TaskConstants.TASK_COMMENT_AUTHOR_KEY, author);
043        this.put(TaskConstants.TASK_COMMENT_TEXT_KEY, text);
044        this.put(TaskConstants.TASK_COMMENT_CREATION_DATE_KEY, Calendar.getInstance());
045    }
046
047    public TaskComment(String author, String text, Date commentDate) {
048        super();
049        this.put(TaskConstants.TASK_COMMENT_AUTHOR_KEY, author);
050        this.put(TaskConstants.TASK_COMMENT_TEXT_KEY, text);
051        this.put(TaskConstants.TASK_COMMENT_CREATION_DATE_KEY, commentDate);
052    }
053
054    public String getAuthor() {
055        return (String) this.get(TaskConstants.TASK_COMMENT_AUTHOR_KEY);
056    }
057
058    public String getText() {
059        return (String) this.get(TaskConstants.TASK_COMMENT_TEXT_KEY);
060    }
061
062    public Calendar getCreationDate() {
063        return (Calendar) this.get(TaskConstants.TASK_COMMENT_CREATION_DATE_KEY);
064    }
065
066}