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 */
016package org.nuxeo.ecm.platform.task.dashboard;
017
018import java.io.Serializable;
019import java.util.Date;
020import java.util.Locale;
021
022import net.sf.json.JSONObject;
023
024import org.nuxeo.ecm.core.api.DocumentModel;
025import org.nuxeo.ecm.core.api.DocumentRef;
026import org.nuxeo.ecm.platform.task.Task;
027
028/**
029 * Item holding information about a Document with a task attached to it.
030 * <p>
031 * Aimed at being used in Dashboard fragments.
032 *
033 * @author <a href="mailto:ja@nuxeo.com">Julien Anguenot</a>
034 * @since 5.5
035 */
036public interface DashBoardItem extends Serializable {
037
038    /**
039     * Returns the identifier of the workflow task instance.
040     *
041     * @return the identifier of the dash board item.
042     */
043    String getId();
044
045    /**
046     * Returns the name of the DashBoardItem.
047     *
048     * @return the name of the DashBoardItem
049     */
050    String getName();
051
052    /**
053     * Returns the document reference on which the item is bound.
054     *
055     * @return a document reference instance
056     */
057    DocumentRef getDocRef();
058
059    /**
060     * Returns the description of the item.
061     *
062     * @return the description of the item
063     */
064    String getDescription();
065
066    /**
067     * Returns the associated item comment.
068     *
069     * @return the associated item comment
070     */
071    String getComment();
072
073    /**
074     * Returns the date when the task has been started.
075     *
076     * @return the date when the task has been started
077     */
078    Date getStartDate();
079
080    /**
081     * Returns the date at which the task needs to be closed.
082     *
083     * @return the date at which the task needs to be closed
084     */
085    Date getDueDate();
086
087    /**
088     * Returns the item associated directive.
089     *
090     * @return the item associated directive
091     */
092    String getDirective();
093
094    /**
095     * Returns the icon path for the doc ref.
096     *
097     * @return the icon path for the doc ref
098     */
099    DocumentModel getDocument();
100
101    /**
102     * Does the user reach the deadline?
103     *
104     * @return the expired flag.
105     */
106    boolean isExpired();
107
108    /**
109     * Returns the underneath task instance
110     */
111    Task getTask();
112
113    /**
114     * Defines the {@link Locale} that will be used to generate translations
115     *
116     * @param locale
117     */
118    void setLocale(Locale locale);
119
120    /**
121     * Get the Translated TaskName (Locale must be set)
122     *
123     * @return
124     */
125    String getI18nTaskName();
126
127    /**
128     * Get the Translated Task Directive (Locale must be set)
129     *
130     * @return
131     */
132    String getI18nDirective();
133
134    /**
135     * Returns JSON representation of the item
136     *
137     * @return
138     */
139    JSONObject asJSON();
140
141    /**
142     * Return the link url to the target Document
143     *
144     * @param includeWorkflowTab
145     * @return
146     */
147    String getDocumentLink(boolean includeWorkflowTab);
148
149}