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 List<String> getActors(); 046 047 String getInitiator(); 048 049 String getName(); 050 051 /** 052 * @since 5.6 053 */ 054 String getType(); 055 056 /** 057 * @since 5.6 058 */ 059 String getProcessId(); 060 061 /** 062 * @since 7.4 063 */ 064 String getProcessName(); 065 066 String getDescription(); 067 068 String getDirective(); 069 070 List<TaskComment> getComments(); 071 072 String getVariable(String key); 073 074 Date getDueDate(); 075 076 Date getCreated(); 077 078 Boolean isCancelled(); 079 080 Boolean isOpened(); 081 082 Boolean hasEnded(); 083 084 Boolean isAccepted(); 085 086 Map<String, String> getVariables(); 087 088 void setActors(List<String> actors); 089 090 void setInitiator(String initiator); 091 092 void setName(String name); 093 094 /** 095 * @since 5.6 096 */ 097 void setType(String type); 098 099 /** 100 * @since 5.6 101 */ 102 void setProcessId(String processId); 103 104 /** 105 * @since 7.4 106 */ 107 void setProcessName(String processName); 108 109 void setDescription(String description); 110 111 void setDirective(String directive); 112 113 void setVariable(String key, String value); 114 115 void setDueDate(Date dueDate); 116 117 void setCreated(Date created); 118 119 void setAccepted(Boolean accepted); 120 121 void setVariables(Map<String, String> variables); 122 123 void addComment(String author, String text); 124 125 void cancel(CoreSession coreSession); 126 127 void end(CoreSession coreSession); 128 129 enum TaskVariableName { 130 needi18n, taskType 131 }; 132 133 /** 134 * @since 5.8 135 */ 136 List<String> getDelegatedActors(); 137 138 /** 139 * @since 5.8 140 */ 141 void setDelegatedActors(List<String> delegatedActors); 142 143 /** 144 * @since 5.8 145 */ 146 List<String> getTargetDocumentsIds(); 147 148 /** 149 * The first id on the list is also set as 'targetDocumentId' 150 * 151 * @since 5.8 152 */ 153 void setTargetDocumentsIds(List<String> ids); 154}