本文整理汇总了Java中org.activiti.engine.task.Event类的典型用法代码示例。如果您正苦于以下问题:Java Event类的具体用法?Java Event怎么用?Java Event使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Event类属于org.activiti.engine.task包,在下文中一共展示了Event类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createAttachmentComment
import org.activiti.engine.task.Event; //导入依赖的package包/类
@Override
public void createAttachmentComment(String taskId, String processInstanceId, String attachmentName, boolean create) {
if (isHistoryEnabled()) {
String userId = Authentication.getAuthenticatedUserId();
CommentEntity comment = new CommentEntity();
comment.setUserId(userId);
comment.setType(CommentEntity.TYPE_EVENT);
comment.setTime(Context.getProcessEngineConfiguration().getClock().getCurrentTime());
comment.setTaskId(taskId);
comment.setProcessInstanceId(processInstanceId);
if (create) {
comment.setAction(Event.ACTION_ADD_ATTACHMENT);
} else {
comment.setAction(Event.ACTION_DELETE_ATTACHMENT);
}
comment.setMessage(attachmentName);
getSession(CommentEntityManager.class).insert(comment);
}
}
示例2: execute
import org.activiti.engine.task.Event; //导入依赖的package包/类
public Object execute(CommandContext commandContext) {
String userId = Authentication.getAuthenticatedUserId();
CommentEntity comment = new CommentEntity();
comment.setUserId(userId);
comment.setType(CommentEntity.TYPE_COMMENT);
comment.setTime(ClockUtil.getCurrentTime());
comment.setTaskId(taskId);
comment.setProcessInstanceId(processInstanceId);
comment.setAction(Event.ACTION_ADD_COMMENT);
String eventMessage = message.replaceAll("\\s+", " ");
if (eventMessage.length()>163) {
eventMessage = eventMessage.substring(0, 160)+"...";
}
comment.setMessage(eventMessage);
comment.setFullMessage(message);
commandContext
.getCommentManager()
.insert(comment);
return null;
}
示例3: execute
import org.activiti.engine.task.Event; //导入依赖的package包/类
public Object execute(CommandContext commandContext) {
AttachmentEntity attachment = commandContext
.getDbSqlSession()
.selectById(AttachmentEntity.class, attachmentId);
commandContext
.getDbSqlSession()
.delete(AttachmentEntity.class, attachmentId);
if (attachment.getTaskId()!=null) {
CommentManager commentManager = commandContext.getCommentManager();
if (commentManager.isHistoryEnabled()) {
String authenticatedUserId = Authentication.getAuthenticatedUserId();
CommentEntity comment = new CommentEntity();
comment.setUserId(authenticatedUserId);
comment.setType(CommentEntity.TYPE_EVENT);
comment.setTime(ClockUtil.getCurrentTime());
comment.setAction(Event.ACTION_DELETE_ATTACHMENT);
comment.setMessage(attachment.getName());
comment.setTaskId(attachment.getTaskId());
commentManager.insert(comment);
}
}
return null;
}
示例4: createAttachmentComment
import org.activiti.engine.task.Event; //导入依赖的package包/类
/**
* Creates a new comment to indicate a new attachment has been created or deleted,
* if history is enabled.
*/
public void createAttachmentComment(String taskId, String processInstanceId, String attachmentName, boolean create) {
if (isHistoryEnabled()) {
String userId = Authentication.getAuthenticatedUserId();
CommentEntity comment = new CommentEntity();
comment.setUserId(userId);
comment.setType(CommentEntity.TYPE_EVENT);
comment.setTime(ClockUtil.getCurrentTime());
comment.setTaskId(taskId);
comment.setProcessInstanceId(processInstanceId);
if(create) {
comment.setAction(Event.ACTION_ADD_ATTACHMENT);
} else {
comment.setAction(Event.ACTION_DELETE_ATTACHMENT);
}
comment.setMessage(attachmentName);
getSession(CommentEntityManager.class).insert(comment);
}
}
示例5: testTaskComments
import org.activiti.engine.task.Event; //导入依赖的package包/类
public void testTaskComments() {
if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.ACTIVITY)) {
Task task = taskService.newTask();
task.setOwner("johndoe");
taskService.saveTask(task);
String taskId = task.getId();
identityService.setAuthenticatedUserId("johndoe");
// Fetch the task again and update
taskService.addComment(taskId, null, "look at this \n isn't this great? slkdjf sldkfjs ldkfjs ldkfjs ldkfj sldkfj sldkfj sldkjg laksfg sdfgsd;flgkj ksajdhf skjdfh ksjdhf skjdhf kalskjgh lskh dfialurhg kajsh dfuieqpgkja rzvkfnjviuqerhogiuvysbegkjz lkhf ais liasduh flaisduh ajiasudh vaisudhv nsfd");
Comment comment = taskService.getTaskComments(taskId).get(0);
assertEquals("johndoe", comment.getUserId());
assertEquals(taskId, comment.getTaskId());
assertNull(comment.getProcessInstanceId());
assertEquals("look at this isn't this great? slkdjf sldkfjs ldkfjs ldkfjs ldkfj sldkfj sldkfj sldkjg laksfg sdfgsd;flgkj ksajdhf skjdfh ksjdhf skjdhf kalskjgh lskh dfialurhg ...", ((Event)comment).getMessage());
assertEquals("look at this \n isn't this great? slkdjf sldkfjs ldkfjs ldkfjs ldkfj sldkfj sldkfj sldkjg laksfg sdfgsd;flgkj ksajdhf skjdfh ksjdhf skjdhf kalskjgh lskh dfialurhg kajsh dfuieqpgkja rzvkfnjviuqerhogiuvysbegkjz lkhf ais liasduh flaisduh ajiasudh vaisudhv nsfd", comment.getFullMessage());
assertNotNull(comment.getTime());
// Finally, delete task
taskService.deleteTask(taskId, true);
}
}
示例6: createIdentityLinkComment
import org.activiti.engine.task.Event; //导入依赖的package包/类
@Override
public void createIdentityLinkComment(String taskId, String userId, String groupId, String type, boolean create, boolean forceNullUserId) {
if (isHistoryEnabled()) {
String authenticatedUserId = Authentication.getAuthenticatedUserId();
CommentEntity comment = new CommentEntity();
comment.setUserId(authenticatedUserId);
comment.setType(CommentEntity.TYPE_EVENT);
comment.setTime(Context.getProcessEngineConfiguration().getClock().getCurrentTime());
comment.setTaskId(taskId);
if (userId != null || forceNullUserId) {
if (create) {
comment.setAction(Event.ACTION_ADD_USER_LINK);
} else {
comment.setAction(Event.ACTION_DELETE_USER_LINK);
}
comment.setMessage(new String[] { userId, type });
} else {
if (create) {
comment.setAction(Event.ACTION_ADD_GROUP_LINK);
} else {
comment.setAction(Event.ACTION_DELETE_GROUP_LINK);
}
comment.setMessage(new String[] { groupId, type });
}
getSession(CommentEntityManager.class).insert(comment);
}
}
示例7: createProcessInstanceIdentityLinkComment
import org.activiti.engine.task.Event; //导入依赖的package包/类
@Override
public void createProcessInstanceIdentityLinkComment(String processInstanceId, String userId, String groupId, String type, boolean create, boolean forceNullUserId) {
if (isHistoryEnabled()) {
String authenticatedUserId = Authentication.getAuthenticatedUserId();
CommentEntity comment = new CommentEntity();
comment.setUserId(authenticatedUserId);
comment.setType(CommentEntity.TYPE_EVENT);
comment.setTime(Context.getProcessEngineConfiguration().getClock().getCurrentTime());
comment.setProcessInstanceId(processInstanceId);
if (userId != null || forceNullUserId) {
if (create) {
comment.setAction(Event.ACTION_ADD_USER_LINK);
} else {
comment.setAction(Event.ACTION_DELETE_USER_LINK);
}
comment.setMessage(new String[] { userId, type });
} else {
if (create) {
comment.setAction(Event.ACTION_ADD_GROUP_LINK);
} else {
comment.setAction(Event.ACTION_DELETE_GROUP_LINK);
}
comment.setMessage(new String[] { groupId, type });
}
getSession(CommentEntityManager.class).insert(comment);
}
}
示例8: getEventMessage
import org.activiti.engine.task.Event; //导入依赖的package包/类
private String getEventMessage(Event event) {
String result = "";
User user = userCache.findUser(event.getUserId());
User involvedUser = userCache.findUser(event.getMessageParts().get(0));
if (TaskInvolvedPeopleComponent.returnDelegationType == "") {
result = user.getFirstName() + " " + user.getLastName() + " executed a " + TaskInvolvedPeopleComponent.lastDelegationType + " on the task " + taskService.createTaskQuery().taskId(event.getTaskId()).singleResult().getName() + ". Assignee is now: " + involvedUser.getFirstName() + " " + involvedUser.getLastName();
return result;
} else {
result = user.getFirstName() + " " + user.getLastName() + " returned a " + TaskInvolvedPeopleComponent.lastDelegationType + " for the task " + taskService.createTaskQuery().taskId(event.getTaskId()).singleResult().getName() + ". Assignee is now: " + involvedUser.getFirstName() + " " + involvedUser.getLastName();
return result;
}
}
示例9: execute
import org.activiti.engine.task.Event; //导入依赖的package包/类
public Void execute(CommandContext commandContext) {
TaskEntity task = Context
.getCommandContext()
.getTaskManager()
.findTaskById(taskId);
if (task == null) {
throw new ActivitiException("Cannot find task with id " + taskId);
}
if (IdentityLinkType.ASSIGNEE.equals(type)) {
task.setAssignee(userId);
} else if (IdentityLinkType.OWNER.equals(type)) {
task.setOwner(userId);
} else {
task.addIdentityLink(userId, groupId, type);
}
CommentManager commentManager = commandContext.getCommentManager();
if (commentManager.isHistoryEnabled()) {
String authenticatedUserId = Authentication.getAuthenticatedUserId();
CommentEntity comment = new CommentEntity();
comment.setUserId(authenticatedUserId);
comment.setType(CommentEntity.TYPE_EVENT);
comment.setTime(ClockUtil.getCurrentTime());
comment.setTaskId(taskId);
if (userId!=null) {
comment.setAction(Event.ACTION_ADD_USER_LINK);
comment.setMessage(new String[]{userId, type});
} else {
comment.setAction(Event.ACTION_ADD_GROUP_LINK);
comment.setMessage(new String[]{groupId, type});
}
commentManager.insert(comment);
}
return null;
}
示例10: execute
import org.activiti.engine.task.Event; //导入依赖的package包/类
public Attachment execute(CommandContext commandContext) {
AttachmentEntity attachment = new AttachmentEntity();
attachment.setName(attachmentName);
attachment.setDescription(attachmentDescription);
attachment.setType(attachmentType);
attachment.setTaskId(taskId);
attachment.setProcessInstanceId(processInstanceId);
attachment.setUrl(url);
DbSqlSession dbSqlSession = commandContext.getDbSqlSession();
dbSqlSession.insert(attachment);
if (content!=null) {
byte[] bytes = IoUtil.readInputStream(content, attachmentName);
ByteArrayEntity byteArray = new ByteArrayEntity(bytes);
dbSqlSession.insert(byteArray);
attachment.setContentId(byteArray.getId());
}
CommentManager commentManager = commandContext.getCommentManager();
if (commentManager.isHistoryEnabled()) {
String userId = Authentication.getAuthenticatedUserId();
CommentEntity comment = new CommentEntity();
comment.setUserId(userId);
comment.setType(CommentEntity.TYPE_EVENT);
comment.setTime(ClockUtil.getCurrentTime());
comment.setTaskId(taskId);
comment.setProcessInstanceId(processInstanceId);
comment.setAction(Event.ACTION_ADD_ATTACHMENT);
comment.setMessage(attachmentName);
commentManager.insert(comment);
}
return attachment;
}
示例11: execute
import org.activiti.engine.task.Event; //导入依赖的package包/类
public Void execute(CommandContext commandContext) {
TaskEntity task = Context
.getCommandContext()
.getTaskManager()
.findTaskById(taskId);
if (task == null) {
throw new ActivitiException("Cannot find task with id " + taskId);
}
if (IdentityLinkType.ASSIGNEE.equals(type)) {
task.setAssignee(null);
} else {
task.deleteIdentityLink(userId, groupId, type);
}
CommentManager commentManager = commandContext.getCommentManager();
if (commentManager.isHistoryEnabled()) {
String authenticatedUserId = Authentication.getAuthenticatedUserId();
CommentEntity comment = new CommentEntity();
comment.setUserId(authenticatedUserId);
comment.setType(CommentEntity.TYPE_EVENT);
comment.setTime(ClockUtil.getCurrentTime());
comment.setTaskId(taskId);
if (userId!=null) {
comment.setAction(Event.ACTION_DELETE_USER_LINK);
comment.setMessage(new String[]{userId, type});
} else {
comment.setAction(Event.ACTION_DELETE_GROUP_LINK);
comment.setMessage(new String[]{groupId, type});
}
commentManager.insert(comment);
}
return null;
}
示例12: testTaskComments
import org.activiti.engine.task.Event; //导入依赖的package包/类
public void testTaskComments() {
int historyLevel = processEngineConfiguration.getHistoryLevel();
if (historyLevel>ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) {
Task task = taskService.newTask();
task.setOwner("johndoe");
taskService.saveTask(task);
String taskId = task.getId();
identityService.setAuthenticatedUserId("johndoe");
// Fetch the task again and update
taskService.addComment(taskId, null, "look at this \n isn't this great? slkdjf sldkfjs ldkfjs ldkfjs ldkfj sldkfj sldkfj sldkjg laksfg sdfgsd;flgkj ksajdhf skjdfh ksjdhf skjdhf kalskjgh lskh dfialurhg kajsh dfuieqpgkja rzvkfnjviuqerhogiuvysbegkjz lkhf ais liasduh flaisduh ajiasudh vaisudhv nsfd");
Comment comment = taskService.getTaskComments(taskId).get(0);
assertEquals("johndoe", comment.getUserId());
assertEquals(taskId, comment.getTaskId());
assertNull(comment.getProcessInstanceId());
assertEquals("look at this isn't this great? slkdjf sldkfjs ldkfjs ldkfjs ldkfj sldkfj sldkfj sldkjg laksfg sdfgsd;flgkj ksajdhf skjdfh ksjdhf skjdhf kalskjgh lskh dfialurhg ...", ((Event)comment).getMessage());
assertEquals("look at this \n isn't this great? slkdjf sldkfjs ldkfjs ldkfjs ldkfj sldkfj sldkfj sldkjg laksfg sdfgsd;flgkj ksajdhf skjdfh ksjdhf skjdhf kalskjgh lskh dfialurhg kajsh dfuieqpgkja rzvkfnjviuqerhogiuvysbegkjz lkhf ais liasduh flaisduh ajiasudh vaisudhv nsfd", comment.getFullMessage());
assertNotNull(comment.getTime());
taskService.addComment(taskId, "pid", "one");
taskService.addComment(taskId, "pid", "two");
Set<String> expectedComments = new HashSet<String>();
expectedComments.add("one");
expectedComments.add("two");
Set<String> comments = new HashSet<String>();
for (Comment cmt: taskService.getProcessInstanceComments("pid")) {
comments.add(cmt.getFullMessage());
}
assertEquals(expectedComments, comments);
// Finally, delete task
taskService.deleteTask(taskId, true);
}
}
示例13: findTaskEvent
import org.activiti.engine.task.Event; //导入依赖的package包/类
private Event findTaskEvent(List<Event> taskEvents, String action) {
for (Event event: taskEvents) {
if (action.equals(event.getAction())) {
return event;
}
}
throw new AssertionFailedError("no task event found with action "+action);
}
示例14: createIdentityLinkComment
import org.activiti.engine.task.Event; //导入依赖的package包/类
/**
* Creates a new comment to indicate a new {@link IdentityLink} has been created or deleted,
* if history is enabled.
*/
public void createIdentityLinkComment(String taskId, String userId, String groupId, String type, boolean create, boolean forceNullUserId) {
if(isHistoryEnabled()) {
String authenticatedUserId = Authentication.getAuthenticatedUserId();
CommentEntity comment = new CommentEntity();
comment.setUserId(authenticatedUserId);
comment.setType(CommentEntity.TYPE_EVENT);
comment.setTime(ClockUtil.getCurrentTime());
comment.setTaskId(taskId);
if (userId!=null || forceNullUserId) {
if(create) {
comment.setAction(Event.ACTION_ADD_USER_LINK);
} else {
comment.setAction(Event.ACTION_DELETE_USER_LINK);
}
comment.setMessage(new String[]{userId, type});
} else {
if(create) {
comment.setAction(Event.ACTION_ADD_GROUP_LINK);
} else {
comment.setAction(Event.ACTION_DELETE_GROUP_LINK);
}
comment.setMessage(new String[]{groupId, type});
}
getSession(CommentEntityManager.class).insert(comment);
}
}
示例15: getTaskEvents
import org.activiti.engine.task.Event; //导入依赖的package包/类
/** The all events related to the given task. */
List<Event> getTaskEvents(String taskId);