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