本文整理汇总了Java中org.activiti.engine.history.HistoricActivityInstanceQuery类的典型用法代码示例。如果您正苦于以下问题:Java HistoricActivityInstanceQuery类的具体用法?Java HistoricActivityInstanceQuery怎么用?Java HistoricActivityInstanceQuery使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HistoricActivityInstanceQuery类属于org.activiti.engine.history包,在下文中一共展示了HistoricActivityInstanceQuery类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testGetHistoricActivityInstancesByProcessInstanceId
import org.activiti.engine.history.HistoricActivityInstanceQuery; //导入依赖的package包/类
@Test
public void testGetHistoricActivityInstancesByProcessInstanceId()
{
String processInstanceId = "processInstanceId";
HistoricActivityInstanceQuery historicActivityInstanceQuery = mock(HistoricActivityInstanceQuery.class);
when(activitiHistoryService.createHistoricActivityInstanceQuery()).thenReturn(historicActivityInstanceQuery);
when(historicActivityInstanceQuery.processInstanceId(processInstanceId)).thenReturn(historicActivityInstanceQuery);
when(historicActivityInstanceQuery.orderByHistoricActivityInstanceStartTime()).thenReturn(historicActivityInstanceQuery);
when(historicActivityInstanceQuery.asc()).thenReturn(historicActivityInstanceQuery);
when(historicActivityInstanceQuery.orderByHistoricActivityInstanceEndTime()).thenReturn(historicActivityInstanceQuery);
when(historicActivityInstanceQuery.asc()).thenReturn(historicActivityInstanceQuery);
List<HistoricActivityInstance> expectedHistoricActivityInstances = new ArrayList<>();
when(historicActivityInstanceQuery.list()).thenReturn(expectedHistoricActivityInstances);
List<HistoricActivityInstance> actualHistoricActivityInstances = activitiService.getHistoricActivityInstancesByProcessInstanceId(processInstanceId);
assertSame(expectedHistoricActivityInstances, actualHistoricActivityInstances);
InOrder inOrder = inOrder(historicActivityInstanceQuery);
inOrder.verify(historicActivityInstanceQuery).processInstanceId(processInstanceId);
inOrder.verify(historicActivityInstanceQuery).orderByHistoricActivityInstanceStartTime();
inOrder.verify(historicActivityInstanceQuery).asc();
inOrder.verify(historicActivityInstanceQuery).orderByHistoricActivityInstanceEndTime();
inOrder.verify(historicActivityInstanceQuery).asc();
inOrder.verify(historicActivityInstanceQuery).list();
inOrder.verifyNoMoreInteractions();
}
示例2: createHistoricActivityInstanceQuery
import org.activiti.engine.history.HistoricActivityInstanceQuery; //导入依赖的package包/类
@Override
public HistoricActivityInstanceQuery createHistoricActivityInstanceQuery() {
return new HistoricActivityInstanceQueryImpl(commandExecutor);
}
示例3: getActivities
import org.activiti.engine.history.HistoricActivityInstanceQuery; //导入依赖的package包/类
@Override
public CollectionWithPagingInfo<Activity> getActivities(String processId, Parameters parameters)
{
Paging paging = parameters.getPaging();
String status = parameters.getParameter("status");
validateIfUserAllowedToWorkWithProcess(processId);
HistoricActivityInstanceQuery query = activitiProcessEngine
.getHistoryService()
.createHistoricActivityInstanceQuery();
if (STATUS_ACTIVE.equals(status)) query.unfinished();
else if (STATUS_COMPLETED.equals(status)) query.finished();
query.processInstanceId(processId);
query.orderByExecutionId().asc();
List<HistoricActivityInstance> activities = query.listPage(paging.getSkipCount(), paging.getMaxItems());
List<Activity> page = new ArrayList<Activity>(activities.size());
for (HistoricActivityInstance activityInstance: activities)
{
Activity activity = new Activity(activityInstance);
page.add(activity);
}
return CollectionWithPagingInfo.asPaged(paging, page, false, page.size());
}
示例4: createHistoricActivityInstanceQuery
import org.activiti.engine.history.HistoricActivityInstanceQuery; //导入依赖的package包/类
/** Creates a new programmatic query to search for {@link HistoricActivityInstance}s. */
HistoricActivityInstanceQuery createHistoricActivityInstanceQuery();
示例5: orderByActivityId
import org.activiti.engine.history.HistoricActivityInstanceQuery; //导入依赖的package包/类
@Override
public HistoricActivityInstanceQuery orderByActivityId() {
orderBy(HistoricActivityInstanceQueryProperty.ACTIVITY_ID);
return this;
}
示例6: createHistoricActivityInstanceQuery
import org.activiti.engine.history.HistoricActivityInstanceQuery; //导入依赖的package包/类
public HistoricActivityInstanceQuery createHistoricActivityInstanceQuery() {
return new HistoricActivityInstanceQueryImpl(commandExecutor);
}
示例7: orderByActivityId
import org.activiti.engine.history.HistoricActivityInstanceQuery; //导入依赖的package包/类
public HistoricActivityInstanceQuery orderByActivityId() {
orderBy(HistoricActivityInstanceQueryProperty.ACTIVITY_ID);
return this;
}
示例8: publishServiceTaskEvent
import org.activiti.engine.history.HistoricActivityInstanceQuery; //导入依赖的package包/类
/**
* @param activityInstanceQuery
*/
public void publishServiceTaskEvent(HistoricActivityInstanceQuery activityInstanceQuery) {
if (log.isDebugEnabled()) {
log.debug("Start to Publish BPMN service task instance event... ");
}
List<HistoricActivityInstance> historicActivityInstances = activityInstanceQuery.list();
for (HistoricActivityInstance instance : historicActivityInstances) {
if (instance.getActivityType().equals(AnalyticsPublisherConstants.SERVICE_TASK)) {
Object[] payload = new Object[]{
//Service task definition Id
instance.getActivityId(),
//task instance Id
instance.getId(),
//process definition id
instance.getProcessDefinitionId(),
//process instance Id
instance.getProcessInstanceId(),
//task created time
instance.getStartTime().toString(),
//task started time
instance.getStartTime().toString(),
//task end time
instance.getEndTime().toString(),
//task duration
instance.getDurationInMillis(),
//task assignee - NA as this is a service task
"NA"
};
if (dataPublisher != null) {
dataPublisher.tryPublish(getServiceTaskInstanceStreamId(), getMeta(), null, payload);
if (log.isDebugEnabled()) {
log.debug("Published BPMN service task instance event... Service task definition Id:" + instance
.getActivityId() + ", task instance Id:" + instance.getId() + ", process definition "
+ "id:" + instance.getProcessDefinitionId() + ", process instance Id:" + instance
.getProcessInstanceId());
}
} else {
log.error("Data publisher is not registered. Events will not be published.");
}
}
}
}
示例9: getQueryResponse
import org.activiti.engine.history.HistoricActivityInstanceQuery; //导入依赖的package包/类
protected DataResponse getQueryResponse(HistoricActivityInstanceQueryRequest queryRequest, Map<String,String>
allRequestParams, UriInfo uriInfo) {
HistoryService historyService = BPMNOSGIService.getHistoryService();
HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery();
// Populate query based on request
if (queryRequest.getActivityId() != null) {
query.activityId(queryRequest.getActivityId());
}
if (queryRequest.getActivityInstanceId() != null) {
query.activityInstanceId(queryRequest.getActivityInstanceId());
}
if (queryRequest.getActivityName() != null) {
query.activityName(queryRequest.getActivityName());
}
if (queryRequest.getActivityType() != null) {
query.activityType(queryRequest.getActivityType());
}
if (queryRequest.getExecutionId() != null) {
query.executionId(queryRequest.getExecutionId());
}
if (queryRequest.getFinished() != null) {
Boolean finished = queryRequest.getFinished();
if (finished) {
query.finished();
} else {
query.unfinished();
}
}
if (queryRequest.getTaskAssignee() != null) {
query.taskAssignee(queryRequest.getTaskAssignee());
}
if (queryRequest.getProcessInstanceId() != null) {
query.processInstanceId(queryRequest.getProcessInstanceId());
}
if (queryRequest.getProcessDefinitionId() != null) {
query.processDefinitionId(queryRequest.getProcessDefinitionId());
}
if(queryRequest.getTenantId() != null) {
query.activityTenantId(queryRequest.getTenantId());
}
if(queryRequest.getTenantIdLike() != null) {
query.activityTenantIdLike(queryRequest.getTenantIdLike());
}
if(Boolean.TRUE.equals(queryRequest.getWithoutTenantId())) {
query.activityWithoutTenantId();
}
return new HistoricActivityInstancePaginateList(new RestResponseFactory(), uriInfo).paginateList(
allRequestParams, queryRequest, query, "startTime", allowedSortProperties);
}
示例10: getQueryResponse
import org.activiti.engine.history.HistoricActivityInstanceQuery; //导入依赖的package包/类
protected DataResponse getQueryResponse(HistoricActivityInstanceQueryRequest queryRequest, Map<String,String>
allRequestParams) {
HistoryService historyService = BPMNOSGIService.getHistoryService();
HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery();
// Populate query based on request
if (queryRequest.getActivityId() != null) {
query.activityId(queryRequest.getActivityId());
}
if (queryRequest.getActivityInstanceId() != null) {
query.activityInstanceId(queryRequest.getActivityInstanceId());
}
if (queryRequest.getActivityName() != null) {
query.activityName(queryRequest.getActivityName());
}
if (queryRequest.getActivityType() != null) {
query.activityType(queryRequest.getActivityType());
}
if (queryRequest.getExecutionId() != null) {
query.executionId(queryRequest.getExecutionId());
}
if (queryRequest.getFinished() != null) {
Boolean finished = queryRequest.getFinished();
if (finished) {
query.finished();
} else {
query.unfinished();
}
}
if (queryRequest.getTaskAssignee() != null) {
query.taskAssignee(queryRequest.getTaskAssignee());
}
if (queryRequest.getProcessInstanceId() != null) {
query.processInstanceId(queryRequest.getProcessInstanceId());
}
if (queryRequest.getProcessDefinitionId() != null) {
query.processDefinitionId(queryRequest.getProcessDefinitionId());
}
if(queryRequest.getTenantId() != null) {
query.activityTenantId(queryRequest.getTenantId());
}
if(queryRequest.getTenantIdLike() != null) {
query.activityTenantIdLike(queryRequest.getTenantIdLike());
}
if(Boolean.TRUE.equals(queryRequest.getWithoutTenantId())) {
query.activityWithoutTenantId();
}
RestResponseFactory restResponseFactory = new RestResponseFactory();
return new HistoricActivityInstancePaginateList(restResponseFactory, uriInfo).paginateList(
allRequestParams, queryRequest, query, "startTime", allowedSortProperties);
}