001/* 002 * (C) Copyright 2006-2012 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, Antoine Taillefer 018 * 019 */ 020 021package org.nuxeo.ecm.platform.task; 022 023import java.io.Serializable; 024import java.util.Date; 025import java.util.List; 026import java.util.Map; 027 028import org.nuxeo.ecm.core.api.CoreSession; 029import org.nuxeo.ecm.core.api.DocumentModel; 030 031/** 032 * @since 5.5 033 */ 034public interface Task extends Serializable { 035 036 /** 037 * @since 5.6 038 */ 039 String TASK_PROVIDER_KEY = "taskProviderId"; 040 041 DocumentModel getDocument(); 042 043 String getId(); 044 045 /** 046 * @deprecated 047 * @since 5.8, getTargetDocumentsIds() should be used instead 048 */ 049 String getTargetDocumentId(); 050 051 List<String> getActors(); 052 053 String getInitiator(); 054 055 String getName(); 056 057 /** 058 * @since 5.6 059 */ 060 String getType(); 061 062 /** 063 * @since 5.6 064 */ 065 String getProcessId(); 066 067 /** 068 * @since 7.4 069 */ 070 String getProcessName(); 071 072 String getDescription(); 073 074 String getDirective(); 075 076 List<TaskComment> getComments(); 077 078 String getVariable(String key); 079 080 Date getDueDate(); 081 082 Date getCreated(); 083 084 Boolean isCancelled(); 085 086 Boolean isOpened(); 087 088 Boolean hasEnded(); 089 090 Boolean isAccepted(); 091 092 Map<String, String> getVariables(); 093 094 void setActors(List<String> actors); 095 096 void setInitiator(String initiator); 097 098 /** 099 * @deprecated 100 * @since 5.8, setTargetDocumentsIds(List<String> ids) should be used instead 101 */ 102 void setTargetDocumentId(String targetDocumentId); 103 104 void setName(String name); 105 106 /** 107 * @since 5.6 108 */ 109 void setType(String type); 110 111 /** 112 * @since 5.6 113 */ 114 void setProcessId(String processId); 115 116 /** 117 * @since 7.4 118 */ 119 void setProcessName(String processName); 120 121 void setDescription(String description); 122 123 void setDirective(String directive); 124 125 void setVariable(String key, String value); 126 127 void setDueDate(Date dueDate); 128 129 void setCreated(Date created); 130 131 void setAccepted(Boolean accepted); 132 133 void setVariables(Map<String, String> variables); 134 135 void addComment(String author, String text); 136 137 void cancel(CoreSession coreSession); 138 139 void end(CoreSession coreSession); 140 141 enum TaskVariableName { 142 needi18n, taskType 143 }; 144 145 /** 146 * @since 5.8 147 */ 148 List<String> getDelegatedActors(); 149 150 /** 151 * @since 5.8 152 */ 153 void setDelegatedActors(List<String> delegatedActors); 154 155 /** 156 * @since 5.8 157 */ 158 List<String> getTargetDocumentsIds(); 159 160 /** 161 * The first id on the list is also set as 'targetDocumentId' 162 * 163 * @since 5.8 164 */ 165 void setTargetDocumentsIds(List<String> ids); 166}