本文整理汇总了Java中org.activiti.engine.query.Query类的典型用法代码示例。如果您正苦于以下问题:Java Query类的具体用法?Java Query怎么用?Java Query使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Query类属于org.activiti.engine.query包,在下文中一共展示了Query类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: applySortSpec
import org.activiti.engine.query.Query; //导入依赖的package包/类
private static void applySortSpec(Query activitiQuery, QuerySpec querySpec)
throws InvocationTargetException, IllegalAccessException, NoSuchMethodException {
for (SortSpec orderSpec : querySpec.getSort()) {
List<String> attributePath = orderSpec.getAttributePath();
PreconditionUtil.assertTrue("nested attribute paths not supported", attributePath.size() == 1);
String attributeName = attributePath.get(0);
String orderbyMethodName = "orderBy" + firstToUpper(addTypePrefix(querySpec.getResourceClass(), attributeName));
Method method = activitiQuery.getClass().getMethod(orderbyMethodName);
method.invoke(activitiQuery);
if (orderSpec.getDirection() == Direction.DESC) {
activitiQuery.desc();
}
else {
activitiQuery.asc();
}
}
}
开发者ID:crnk-project,项目名称:crnk-framework,代码行数:20,代码来源:ActivitiQuerySpecMapper.java
示例2: applyFilterSpec
import org.activiti.engine.query.Query; //导入依赖的package包/类
private static void applyFilterSpec(Query activitiQuery, QuerySpec querySpec, List<FilterSpec> baseFilters)
throws InvocationTargetException, IllegalAccessException, NoSuchMethodException {
List<FilterSpec> filters = new ArrayList<>();
filters.addAll(baseFilters);
filters.addAll(querySpec.getFilters());
for (FilterSpec filterSpec : filters) {
List<String> attributePath = filterSpec.getAttributePath();
PreconditionUtil.assertTrue("nested attribute paths not supported", attributePath.size() == 1);
String attrName = attributePath.get(0);
FilterOperator op = filterSpec.getOperator();
Class valueClass = filterSpec.getValue().getClass();
String attributeName = mapAttributeName(attrName, querySpec.getResourceClass(), op, valueClass);
Object value = filterSpec.getValue();
Method method = getMethod(activitiQuery.getClass(), attributeName);
if (method.getParameterCount() == 0) {
PreconditionUtil.assertEquals("only filtering by true supported for boolean values", Boolean.TRUE, value);
method.invoke(activitiQuery);
}
else {
method.invoke(activitiQuery, unmapValue(value));
}
}
}
开发者ID:crnk-project,项目名称:crnk-framework,代码行数:28,代码来源:ActivitiQuerySpecMapper.java
示例3: getMethod
import org.activiti.engine.query.Query; //导入依赖的package包/类
private static Method getMethod(Class<? extends Query> clazz, String methodName) {
for (Method method : clazz.getMethods()) {
if (methodName.equals(method.getName())) {
return method;
}
}
throw new BadRequestException("parameter '" + methodName + "' not found");
}
开发者ID:crnk-project,项目名称:crnk-framework,代码行数:9,代码来源:ActivitiQuerySpecMapper.java
示例4: createQuery
import org.activiti.engine.query.Query; //导入依赖的package包/类
@Override
protected Query<ProcessInstanceQuery, ProcessInstance> createQuery() {
return runtimeService.createProcessInstanceQuery().includeProcessVariables();
}
开发者ID:crnk-project,项目名称:crnk-framework,代码行数:5,代码来源:ProcessInstanceResourceRepository.java
示例5: findAll
import org.activiti.engine.query.Query; //导入依赖的package包/类
@Override
public ResourceList<T> findAll(QuerySpec querySpec) {
Query activitiQuery = createQuery();
List list = ActivitiQuerySpecMapper.find(activitiQuery, querySpec, baseFilters);
return mapToResources(list);
}
开发者ID:crnk-project,项目名称:crnk-framework,代码行数:7,代码来源:ActivitiRepositoryBase.java
示例6: paginateList
import org.activiti.engine.query.Query; //导入依赖的package包/类
/**
* uses the pagination parameters form the request and makes sure to order the result and set all pagination
* attributes for the response to render
*
* @param req The request containing the pagination parameters
* @param query The query to get the paged list from
* @param listName The name model attribute name to use for the result list
* @param model The model to put the list and the pagination attributes in
* @param defaultSort THe default sort column (the rest attribute) that later will be mapped to an internal engine name
*/
@SuppressWarnings("rawtypes")
public DataResponse paginateList(Form form, Query query,
String defaultSort, Map<String, QueryProperty> properties) {
// Collect parameters
int start = RequestUtil.getInteger(form, "start", 0);
int size = RequestUtil.getInteger(form, "size", 10);
String sort = form.getValues("sort");
if(sort == null) {
sort = defaultSort;
}
String order = form.getValues("order");
if(order == null) {
order = "asc";
}
// Sort order
if (sort != null && properties.size() > 0) {
QueryProperty qp = properties.get(sort);
if (qp == null) {
throw new ActivitiException("Value for param 'sort' is not valid, '" + sort + "' is not a valid property");
}
((AbstractQuery) query).orderBy(qp);
if (order.equals("asc")) {
query.asc();
}
else if (order.equals("desc")) {
query.desc();
}
else {
throw new ActivitiException("Value for param 'order' is not valid : '" + order + "', must be 'asc' or 'desc'");
}
}
// Get result and set pagination parameters
List list = processList(query.listPage(start, size));
DataResponse response = new DataResponse();
response.setStart(start);
response.setSize(list.size());
response.setSort(sort);
response.setOrder(order);
response.setTotal(query.count());
response.setData(list);
return response;
}
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:56,代码来源:AbstractPaginateList.java
示例7: paginateList
import org.activiti.engine.query.Query; //导入依赖的package包/类
public DataResponse paginateList(Map<String, String> requestParams, PaginateRequest paginateRequest, Query query,
String defaultSort, Map<String, QueryProperty> properties) {
if (paginateRequest == null) {
paginateRequest = new PaginateRequest();
}
// In case pagination request is incomplete, fill with values found in URL if possible
if (paginateRequest.getStart() == null) {
paginateRequest.setStart(RequestUtil.getInteger(requestParams, "start", 0));
}
if (paginateRequest.getSize() == null) {
paginateRequest.setSize(RequestUtil.getInteger(requestParams, "size", 10));
}
if (paginateRequest.getOrder() == null) {
paginateRequest.setOrder(requestParams.get("order"));
}
if (paginateRequest.getSort() == null) {
paginateRequest.setSort(requestParams.get("sort"));
}
// Use defaults for paging, if not set in the PaginationRequest, nor in the URL
Integer start = paginateRequest.getStart();
if(start == null || start < 0) {
start = 0;
}
Integer size = paginateRequest.getSize();
if(size == null || size < 0) {
size = 10;
}
String sort = paginateRequest.getSort();
if(sort == null) {
sort = defaultSort;//id
}
String order = paginateRequest.getOrder();
if(order == null) {
order = "asc";
}
// Sort order
if (sort != null && !properties.isEmpty()) {
QueryProperty qp = properties.get(sort);
if (qp == null) {
throw new ActivitiIllegalArgumentException("Value for param 'sort' is not valid, '" + sort + "' is not a valid property");
}
((AbstractQuery) query).orderBy(qp);
if (order.equals("asc")) {
query.asc();
}
else if (order.equals("desc")) {
query.desc();
}
else {
throw new ActivitiIllegalArgumentException("Value for param 'order' is not valid : '" + order + "', must be 'asc' or 'desc'");
}
}
// Get result and set pagination parameters
List list = processList(query.listPage(start, size));
DataResponse response = new DataResponse();
response.setStart(start);
response.setSize(list.size());
response.setSort(sort);
response.setOrder(order);
response.setTotal(query.count());
response.setData(list);
return response;
}
开发者ID:wso2,项目名称:carbon-business-process,代码行数:74,代码来源:AbstractPaginateList.java
示例8: createQuery
import org.activiti.engine.query.Query; //导入依赖的package包/类
protected abstract Query createQuery();
开发者ID:crnk-project,项目名称:crnk-framework,代码行数:2,代码来源:ActivitiRepositoryBase.java
注:本文中的org.activiti.engine.query.Query类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论