use of org.camunda.bpm.engine.impl.QueryPropertyImpl in project camunda-bpm-platform by camunda.
the class CommentManager method findEventsByTaskId.
@SuppressWarnings("unchecked")
public List<Event> findEventsByTaskId(String taskId) {
checkHistoryEnabled();
ListQueryParameterObject query = new ListQueryParameterObject();
query.setParameter(taskId);
query.getOrderingProperties().add(new QueryOrderingProperty(new QueryPropertyImpl("TIME_"), Direction.DESCENDING));
return getDbEntityManager().selectList("selectEventsByTaskId", query);
}
use of org.camunda.bpm.engine.impl.QueryPropertyImpl in project camunda-bpm-platform by camunda.
the class JsonLegacyQueryOrderingPropertyConverter method fromOrderByString.
public List<QueryOrderingProperty> fromOrderByString(String orderByString) {
List<QueryOrderingProperty> properties = new ArrayList<QueryOrderingProperty>();
String[] orderByClauses = orderByString.split(ORDER_BY_DELIMITER);
for (String orderByClause : orderByClauses) {
orderByClause = orderByClause.trim();
String[] clauseParts = orderByClause.split(" ");
if (clauseParts.length == 0) {
continue;
} else if (clauseParts.length > 2) {
throw new ProcessEngineException("Invalid order by clause: " + orderByClause);
}
String function = null;
String propertyPart = clauseParts[0];
int functionArgumentBegin = propertyPart.indexOf("(");
if (functionArgumentBegin >= 0) {
function = propertyPart.substring(0, functionArgumentBegin);
int functionArgumentEnd = propertyPart.indexOf(")");
propertyPart = propertyPart.substring(functionArgumentBegin + 1, functionArgumentEnd);
}
String[] propertyParts = propertyPart.split("\\.");
String property = null;
if (propertyParts.length == 1) {
property = propertyParts[0];
} else if (propertyParts.length == 2) {
property = propertyParts[1];
} else {
throw new ProcessEngineException("Invalid order by property part: " + clauseParts[0]);
}
QueryProperty queryProperty = new QueryPropertyImpl(property, function);
Direction direction = null;
if (clauseParts.length == 2) {
String directionPart = clauseParts[1];
direction = Direction.findByName(directionPart);
}
QueryOrderingProperty orderingProperty = new QueryOrderingProperty(null, queryProperty);
orderingProperty.setDirection(direction);
properties.add(orderingProperty);
}
return properties;
}
use of org.camunda.bpm.engine.impl.QueryPropertyImpl in project camunda-bpm-platform by camunda.
the class JsonQueryFilteringPropertyConverter method toObject.
public QueryEntityRelationCondition toObject(JSONObject jsonObject) {
// this is limited in that it allows only String values;
// that is sufficient for current use case with task filters
// but could be extended by a data type in the future
Object scalarValue = null;
if (jsonObject.has(SCALAR_VALUE)) {
scalarValue = jsonObject.getString(SCALAR_VALUE);
}
QueryProperty baseProperty = null;
if (jsonObject.has(BASE_PROPERTY)) {
baseProperty = new QueryPropertyImpl(jsonObject.getString(BASE_PROPERTY));
}
QueryProperty comparisonProperty = null;
if (jsonObject.has(COMPARISON_PROPERTY)) {
comparisonProperty = new QueryPropertyImpl(jsonObject.getString(COMPARISON_PROPERTY));
}
return new QueryEntityRelationCondition(baseProperty, comparisonProperty, scalarValue);
}
use of org.camunda.bpm.engine.impl.QueryPropertyImpl in project camunda-bpm-platform by camunda.
the class HistoricBatchManager method findCleanableHistoricBatchesReportByCriteria.
@SuppressWarnings("unchecked")
public List<CleanableHistoricBatchReportResult> findCleanableHistoricBatchesReportByCriteria(CleanableHistoricBatchReportImpl query, Page page, Map<String, Integer> batchOperationsForHistoryCleanup) {
query.setCurrentTimestamp(ClockUtil.getCurrentTime());
query.setParameter(batchOperationsForHistoryCleanup);
query.getOrderingProperties().add(new QueryOrderingProperty(new QueryPropertyImpl("TYPE_"), Direction.ASCENDING));
if (batchOperationsForHistoryCleanup.isEmpty()) {
return getDbEntityManager().selectList("selectOnlyFinishedBatchesReportEntities", query, page);
} else {
return getDbEntityManager().selectList("selectFinishedBatchesReportEntities", query, page);
}
}
use of org.camunda.bpm.engine.impl.QueryPropertyImpl in project camunda-bpm-platform by camunda.
the class HistoricBatchManager method findHistoricBatchIdsForCleanup.
@SuppressWarnings("unchecked")
public List<String> findHistoricBatchIdsForCleanup(Integer batchSize, Map<String, Integer> batchOperationsForHistoryCleanup) {
Map<String, Object> queryParameters = new HashMap<String, Object>();
queryParameters.put("currentTimestamp", ClockUtil.getCurrentTime());
queryParameters.put("map", batchOperationsForHistoryCleanup);
ListQueryParameterObject parameterObject = new ListQueryParameterObject();
parameterObject.setParameter(queryParameters);
parameterObject.getOrderingProperties().add(new QueryOrderingProperty(new QueryPropertyImpl("END_TIME_"), Direction.ASCENDING));
parameterObject.setFirstResult(0);
parameterObject.setMaxResults(batchSize);
return (List<String>) getDbEntityManager().selectList("selectHistoricBatchIdsForCleanup", parameterObject);
}
Aggregations