本文整理汇总了Java中org.activiti.engine.task.Event类的典型用法代码示例。如果您正苦于以下问题:Java Event类的具体用法?Java Event怎么用?Java Event使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Event类属于org.activiti.engine.task包,在下文中一共展示了Event类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
}
开发者ID:flowable,项目名称:flowable-engine,代码行数:20,代码来源:DefaultHistoryManager.java
示例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;
}
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:25,代码来源:AddCommentCmd.java
示例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;
}
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:27,代码来源:DeleteAttachmentCmd.java
示例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);
}
}
开发者ID:springvelocity,项目名称:xbpm5,代码行数:23,代码来源:HistoryManager.java
示例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);
}
}
开发者ID:springvelocity,项目名称:xbpm5,代码行数:23,代码来源:TaskServiceTest.java
示例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);
}
}
开发者ID:flowable,项目名称:flowable-engine,代码行数:28,代码来源:DefaultHistoryManager.java
示例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);
}
}
开发者ID:flowable,项目名称:flowable-engine,代码行数:28,代码来源:DefaultHistoryManager.java
示例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;
}
}
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:13,代码来源:TaskEventTextResolver.java
示例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;
}
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:39,代码来源:AddIdentityLinkCmd.java
示例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;
}
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:36,代码来源:CreateAttachmentCmd.java
示例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;
}
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:37,代码来源:DeleteIdentityLinkCmd.java
示例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);
}
}
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:38,代码来源:TaskServiceTest.java
示例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);
}
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:9,代码来源:TaskIdentityLinksTest.java
示例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);
}
}
开发者ID:springvelocity,项目名称:xbpm5,代码行数:31,代码来源:HistoryManager.java
示例15: getTaskEvents
import org.activiti.engine.task.Event; //导入依赖的package包/类
/** The all events related to the given task. */
List<Event> getTaskEvents(String taskId);
开发者ID:flowable,项目名称:flowable-engine,代码行数:3,代码来源:TaskService.java
示例16: getEvent
import org.activiti.engine.task.Event; //导入依赖的package包/类
/** Returns an individual event with the given id. Returns null if no event exists with the given id. */
Event getEvent(String eventId);
开发者ID:flowable,项目名称:flowable-engine,代码行数:3,代码来源:TaskService.java
示例17: getEvent
import org.activiti.engine.task.Event; //导入依赖的package包/类
@Override
public Event getEvent(String eventId) {
return commandExecutor.execute(new GetTaskEventCmd(eventId));
}
开发者ID:flowable,项目名称:flowable-engine,代码行数:5,代码来源:TaskServiceImpl.java
示例18: getTaskEvents
import org.activiti.engine.task.Event; //导入依赖的package包/类
@Override
public List<Event> getTaskEvents(String taskId) {
return commandExecutor.execute(new GetTaskEventsCmd(taskId));
}
开发者ID:flowable,项目名称:flowable-engine,代码行数:5,代码来源:TaskServiceImpl.java
示例19: findEventsByTaskId
import org.activiti.engine.task.Event; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public List<Event> findEventsByTaskId(String taskId) {
checkHistoryEnabled();
return getDbSqlSession().selectList("selectEventsByTaskId", taskId);
}
开发者ID:flowable,项目名称:flowable-engine,代码行数:6,代码来源:CommentEntityManager.java
示例20: findEventsByProcessInstanceId
import org.activiti.engine.task.Event; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public List<Event> findEventsByProcessInstanceId(String processInstanceId) {
checkHistoryEnabled();
return getDbSqlSession().selectList("selectEventsByProcessInstanceId", processInstanceId);
}
开发者ID:flowable,项目名称:flowable-engine,代码行数:6,代码来源:CommentEntityManager.java
注:本文中的org.activiti.engine.task.Event类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论