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