Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HistoricUserOperationLogService #69

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Prev Previous commit
add sorting into taskQuery
Mohammad Sharifi committed Apr 25, 2021
commit a70241ef5b43361b4e90a9b5247f78f43a2ff722
47 changes: 8 additions & 39 deletions Camunda.Api.Client/UserTask/TaskQuery.cs
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@

namespace Camunda.Api.Client.UserTask
{
public class TaskQuery
public class TaskQuery : QueryParameters
{
/// <summary>
/// Restrict to tasks that belong to process instances with the given business key.
@@ -325,44 +325,15 @@ public class TaskQuery
public bool? WithoutCandidateGroups;

/// <summary>
/// Array of criteria to sort the result by. The position in the array identifies the rank of an ordering, i.e. whether it is primary, secondary, etc.
/// Sort the results lexicographically by a given criterion. Must be used in conjunction with the <see cref="SortOrder"/> parameter.
/// </summary>
public List<SortingInfo<TaskSorting>> Sorting = new List<SortingInfo<TaskSorting>>();

/// <param name="sortBy"></param>
/// <param name="sortOrder"></param>
/// <param name="variable">
/// Mandatory when <paramref name="sortBy" /> is either
/// <see cref="TaskSorting.ProcessVariable"/>, <see cref="TaskSorting.ExecutionVariable"/>, <see cref="TaskSorting.TaskVariable"/>, <see cref="TaskSorting.CaseExecutionVariable"/> or <see cref="TaskSorting.CaseInstanceVariable"/>
/// </param>
public TaskQuery Sort(TaskSorting sortBy, SortOrder sortOrder = SortOrder.Ascending, VariableOrder variable = null)
{
Dictionary<string, object> parameters = null;

TaskSorting[] variableSorting = new[] {
TaskSorting.ProcessVariable,
TaskSorting.ExecutionVariable,
TaskSorting.TaskVariable,
TaskSorting.CaseExecutionVariable,
TaskSorting.CaseInstanceVariable
};

bool isVariableSorting = variableSorting.Contains(sortBy);

if (isVariableSorting ^ variable != null)
throw new ArgumentException("Variable is mandatory when sortBy is either processVariable, executionVariable, taskVariable, caseExecutionVariable or caseInstanceVariable.", nameof(variable));

if (variable != null) {
parameters = new Dictionary<string, object>() {
["variable"] = variable.VariableName,
["type"] = variable.Type.ToString(),
};
}

Sorting.Add(new SortingInfo<TaskSorting>() { SortBy = sortBy, SortOrder = sortOrder, Parameters = parameters });
public TaskSorting SortBy;

/// <summary>
/// Sort the results in a given order. Must be used in conjunction with the <see cref="SortBy"/> parameter.
/// </summary>
public SortOrder SortOrder;

return this;
}
}

public enum TaskSorting
@@ -379,12 +350,10 @@ public enum TaskSorting
Name,
NameCaseInsensitive,
Priority,

ProcessVariable,
ExecutionVariable,
TaskVariable,
CaseExecutionVariable,
CaseInstanceVariable
}

}