From 5625782b34be01e3f1c160ca5fde95c1d319be9a Mon Sep 17 00:00:00 2001 From: Mohammad Sharifi Date: Sat, 16 Jan 2021 17:22:04 +0330 Subject: [PATCH 01/15] Add HistoricUserOperationLogService --- Camunda.Api.Client/CamundaClient.cs | 6 +- .../History/HistoricUserOperationLog.cs | 125 +++++++++++++++++ .../HistoricUserOperationLogAnnotation.cs | 11 ++ .../History/HistoricUserOperationLogQuery.cs | 131 ++++++++++++++++++ .../HistoricUserOperationLogResource.cs | 30 ++++ .../HistoricUserOperationLogService.cs | 24 ++++ Camunda.Api.Client/History/HistoryService.cs | 9 +- .../IHistoricUserOperationLogRestService.cs | 22 +++ 8 files changed, 354 insertions(+), 4 deletions(-) create mode 100644 Camunda.Api.Client/History/HistoricUserOperationLog.cs create mode 100644 Camunda.Api.Client/History/HistoricUserOperationLogAnnotation.cs create mode 100644 Camunda.Api.Client/History/HistoricUserOperationLogQuery.cs create mode 100644 Camunda.Api.Client/History/HistoricUserOperationLogResource.cs create mode 100644 Camunda.Api.Client/History/HistoricUserOperationLogService.cs create mode 100644 Camunda.Api.Client/History/IHistoricUserOperationLogRestService.cs diff --git a/Camunda.Api.Client/CamundaClient.cs b/Camunda.Api.Client/CamundaClient.cs index 6339613..cb79eaa 100644 --- a/Camunda.Api.Client/CamundaClient.cs +++ b/Camunda.Api.Client/CamundaClient.cs @@ -81,7 +81,8 @@ internal class HistoricApi public Lazy VariableInstanceApi; public Lazy UserTaskApi; public Lazy ProcessDefinitionApi; - public Lazy ExternalTaskLogApi; + public Lazy externalTaskLogApi; + public Lazy userOperationLogApi; } static CamundaClient() @@ -234,7 +235,8 @@ private void CreateServices() VariableInstanceApi = CreateService(), UserTaskApi = CreateService(), ProcessDefinitionApi = CreateService(), - ExternalTaskLogApi = CreateService(), + externalTaskLogApi = CreateService(), + userOperationLogApi = CreateService(), }; } diff --git a/Camunda.Api.Client/History/HistoricUserOperationLog.cs b/Camunda.Api.Client/History/HistoricUserOperationLog.cs new file mode 100644 index 0000000..f569809 --- /dev/null +++ b/Camunda.Api.Client/History/HistoricUserOperationLog.cs @@ -0,0 +1,125 @@ +namespace Camunda.Api.Client.History +{ + public class HistoricUserOperationLog + { + /// + /// The unique identifier of this log entry. + /// + public string Id; + + /// + /// The user who performed this operation. + /// + public string UserId; + + /// + /// Timestamp of this operation. + /// + public string Timestamp; + + /// + /// The unique identifier of this operation.A composite operation that changes multiple properties has a common operationId. + /// + public string OperationId; + + /// + /// The type of this operation, e.g., Assign, Claim and so on. + /// + public string OperationType; + + /// + /// The type of the entity on which this operation was executed, e.g., Task or Attachment. + /// + public string EntityType; + + /// + /// The name of the category this operation was associated with, e.g., TaskWorker or Admin. + /// + public string Category; + + /// + /// An arbitrary annotation set by a user for auditing reasons. + /// + public string Annotation; + + /// + /// The property changed by this operation. + /// + public string Property; + + /// + /// The original value of the changed property. + /// + public string OrgValue; + + /// + /// The new value of the changed property. + /// + public string NewValue; + + /// + /// If not null, the operation is restricted to entities in relation to this deployment. + /// + public string DeploymentId; + + /// + /// If not null, the operation is restricted to entities in relation to this process definition. + /// + public string ProcessDefinitionId; + + /// + /// If not null, the operation is restricted to entities in relation to process definitions with this key. + /// + public string ProcessDefinitionKey; + + /// + /// If not null, the operation is restricted to entities in relation to this process instance. + /// + public string ProcessInstanceId; + + /// + /// If not null, the operation is restricted to entities in relation to this execution. + /// + public string ExecutionId; + + /// + /// If not null, the operation is restricted to entities in relation to this case definition. + /// + public string CaseDefinitionId; + + /// + /// If not null, the operation is restricted to entities in relation to this case instance. + /// + public string CaseInstanceId; + + /// + /// If not null, the operation is restricted to entities in relation to this case execution. + /// + public string CaseExecutionId; + + /// + /// If not null, the operation is restricted to entities in relation to this task. + /// + public string TaskId; + + /// + /// If not null, the operation is restricted to entities in relation to this job. + /// + public string JobId; + + /// + /// If not null, the operation is restricted to entities in relation to this job definition. + /// + public string JobDefinitionId; + + /// + /// The time after which the entry should be removed by the History Cleanup job. Default format* yyyy-MM-dd'T'HH:mm:ss.SSSZ. + /// + public string RemovalTime; + + /// + /// The process instance id of the root process instance that initiated the process containing this entry. + /// + public string RootProcessInstanceId; + } +} diff --git a/Camunda.Api.Client/History/HistoricUserOperationLogAnnotation.cs b/Camunda.Api.Client/History/HistoricUserOperationLogAnnotation.cs new file mode 100644 index 0000000..e8c62fa --- /dev/null +++ b/Camunda.Api.Client/History/HistoricUserOperationLogAnnotation.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Camunda.Api.Client.History +{ + public class HistoricUserOperationLogAnnotation + { + public string Annotation { get; set; } + } +} diff --git a/Camunda.Api.Client/History/HistoricUserOperationLogQuery.cs b/Camunda.Api.Client/History/HistoricUserOperationLogQuery.cs new file mode 100644 index 0000000..c31903d --- /dev/null +++ b/Camunda.Api.Client/History/HistoricUserOperationLogQuery.cs @@ -0,0 +1,131 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Camunda.Api.Client.History +{ + public class HistoricUserOperationLogQuery : QueryParameters + { + /// + /// Filter by deployment id. + /// + public string DeploymentId; + + /// + /// Filter by process definition id. + /// + public string ProcessDefinitionId; + + /// + /// Filter by process definition key. + /// + public string ProcessDefinitionKey; + + /// + /// Filter by process instance id. + /// + public string ProcessInstanceId; + + /// + /// Filter by execution id. + /// + public string ExecutionId; + + /// + /// Filter by case definition id. + /// + public string CaseDefinitionId; + + /// + /// Filter by case instance id. + /// + public string CaseInstanceId; + + /// + /// Filter by case execution id. + /// + public string CaseExecutionId; + + /// + /// Only include operations on this task. + /// + public string TaskId; + + /// + /// Filter by job id. + /// + public string JobId; + + /// + /// Filter by job definition id. + /// + public string JobDefinitionId; + + /// + /// Only include operations of this user. + /// + public string UserId; + + /// + /// Filter by the id of the operation. This allows fetching of multiple entries which are part of a composite operation. + /// + public string OperationId; + + /// + /// Filter by the type of the operation like Claim or Delegate. See the Javadoc for a list of available operation types. + /// + public string OperationType; + + /// + /// Filter by the type of the entity that was affected by this operation, possible values are Task, Attachment or IdentityLink. + /// + public string EntityType; + + /// + /// Filter by types of the entities that was affected by this operation, possible values are Task, Attachment or IdentityLink. + /// + [JsonProperty("entityTypeIn")] + public List EntityTypes; + + /// + /// Filter by the category that this operation is associated with, possible values are TaskWorker, Admin or Operator. + /// + public string Category; + + /// + /// Filter by the categories that this operation is associated with, possible values are TaskWorker, Admin or Operator. + /// + [JsonProperty("categoryIn")] + public List Categories; + + /// + /// Only include operations that changed this property, e.g., owner or assignee. + /// + public string Property; + + /// + /// Restrict to entries that were created after the given timestamp.By default*, the timestamp must have the format yyyy-MM-dd'T'HH:mm:ss.SSSZ, e.g., 2014-02-25T14:58:37.000+0200. + /// + public DateTime? AfterTimestamp; + + /// + /// Restrict to entries that were created before the given timestamp.By default*, the timestamp must have the format yyyy-MM-dd'T'HH:mm:ss.SSSZ, e.g., 2014-02-25T14:58:37.000+0200. + /// + public DateTime? BeforeTimestamp; + + /// + /// Sort the results by a given criterion. At the moment the query only supports sorting based on the timestamp. + /// + public HistoricUserOperationLogQuerySorting SortBy; + /// + /// Sort the results in a given order. Values may be asc for ascending order or desc for descending order. Must be used in conjunction with the sortBy parameter. + /// + public SortOrder SortOrder; + } + + public enum HistoricUserOperationLogQuerySorting + { + Timestamp + } +} \ No newline at end of file diff --git a/Camunda.Api.Client/History/HistoricUserOperationLogResource.cs b/Camunda.Api.Client/History/HistoricUserOperationLogResource.cs new file mode 100644 index 0000000..e84ef63 --- /dev/null +++ b/Camunda.Api.Client/History/HistoricUserOperationLogResource.cs @@ -0,0 +1,30 @@ +using System.Threading.Tasks; + +namespace Camunda.Api.Client.History +{ + public class HistoricUserOperationLogResource + { + private IHistoricUserOperationLogRestService _api; + private string _operationId; + + internal HistoricUserOperationLogResource(IHistoricUserOperationLogRestService api, string operationId) + { + _api = api; + _operationId = operationId; + } + + /// + /// Set an annotation for auditing reasons. + /// + /// + /// + public Task SetAnnotation(HistoricUserOperationLogAnnotation historicUserOperationLogAnnotation) => _api.SetAnnotation(_operationId, historicUserOperationLogAnnotation); + + + /// + /// Clear the annotation which was previously set for auditing reasons. + /// + /// + public Task ClearAnnotation() => _api.ClearAnnotation(_operationId); + } +} \ No newline at end of file diff --git a/Camunda.Api.Client/History/HistoricUserOperationLogService.cs b/Camunda.Api.Client/History/HistoricUserOperationLogService.cs new file mode 100644 index 0000000..b492eed --- /dev/null +++ b/Camunda.Api.Client/History/HistoricUserOperationLogService.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Camunda.Api.Client.History +{ + public class HistoricUserOperationLogService + { + private IHistoricUserOperationLogRestService _api; + + internal HistoricUserOperationLogService(IHistoricUserOperationLogRestService api) + { + _api = api; + } + + public QueryResource Query(HistoricUserOperationLogQuery query = null) => + new QueryResource( + query, + (q, f, m) => _api.GetList(q, f, m), + q => _api.GetListCount(q)); + + /// The id of the operation log entry. + public HistoricUserOperationLogResource this[string historicOperationId] => new HistoricUserOperationLogResource(_api, historicOperationId); + } +} diff --git a/Camunda.Api.Client/History/HistoryService.cs b/Camunda.Api.Client/History/HistoryService.cs index 12e784e..1db1fdf 100644 --- a/Camunda.Api.Client/History/HistoryService.cs +++ b/Camunda.Api.Client/History/HistoryService.cs @@ -70,8 +70,13 @@ internal HistoryService(CamundaClient.HistoricApi api) public HistoricProcessDefinitionService ProcessDefinitions => new HistoricProcessDefinitionService(_api.ProcessDefinitionApi.Value); /// - /// External Tas kLog + /// External Task Log /// - public HistoricExternalTaskLogService ExternalTaskLogs => new HistoricExternalTaskLogService(_api.ExternalTaskLogApi.Value); + public HistoricExternalTaskLogService ExternalTaskLogs => new HistoricExternalTaskLogService(_api.externalTaskLogApi.Value); + + /// + /// User Operation Log + /// + public HistoricUserOperationLogService UserOperationLogs => new HistoricUserOperationLogService(_api.userOperationLogApi.Value); } } \ No newline at end of file diff --git a/Camunda.Api.Client/History/IHistoricUserOperationLogRestService.cs b/Camunda.Api.Client/History/IHistoricUserOperationLogRestService.cs new file mode 100644 index 0000000..78d9afd --- /dev/null +++ b/Camunda.Api.Client/History/IHistoricUserOperationLogRestService.cs @@ -0,0 +1,22 @@ +using Refit; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Camunda.Api.Client.History +{ + internal interface IHistoricUserOperationLogRestService + { + [Get("/history/user-operation")] + Task> GetList(QueryDictionary query, int? firstResult, int? maxResults); + + [Get("/history/user-operation/count")] + Task GetListCount(QueryDictionary query); + + [Put("/history/user-operation/{operationId}/set-annotation")] + Task SetAnnotation(string operationId, [Body] HistoricUserOperationLogAnnotation historicUserOperationLogAnnotation); + + [Put("/history/user-operation/{operationId}/clear-annotation")] + Task ClearAnnotation(string operationId); + } +} From e97cb0fe65f2565b6f63c81eb71d767f35789d12 Mon Sep 17 00:00:00 2001 From: Amr Badawy Date: Thu, 3 Sep 2020 16:08:31 +0300 Subject: [PATCH 02/15] Add SetCorrelationKey Just a simple method that make it easy to add CorrelationKey, same as SetVariable --- Camunda.Api.Client/Message/CorrelationMessage.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Camunda.Api.Client/Message/CorrelationMessage.cs b/Camunda.Api.Client/Message/CorrelationMessage.cs index ce9e2fc..e6396b7 100644 --- a/Camunda.Api.Client/Message/CorrelationMessage.cs +++ b/Camunda.Api.Client/Message/CorrelationMessage.cs @@ -53,6 +53,12 @@ public CorrelationMessage SetVariable(string name, object value) ProcessVariables = (ProcessVariables ?? new Dictionary()).Set(name, value); return this; } + + public CorrelationMessage SetCorrelationKey(string name, object value) + { + CorrelationKeys = (CorrelationKeys ?? new Dictionary()).Set(name, value); + return this; + } } } From 872bed10f3abed27c8fc70502c3c8a13a421c35c Mon Sep 17 00:00:00 2001 From: Silvan Brenner Date: Wed, 9 Sep 2020 13:37:00 +0200 Subject: [PATCH 03/15] add variables filter to HistoricProcessInstanceQuery --- Camunda.Api.Client/History/HistoricProcessInstanceQuery.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Camunda.Api.Client/History/HistoricProcessInstanceQuery.cs b/Camunda.Api.Client/History/HistoricProcessInstanceQuery.cs index 420c70a..5dc1ff8 100644 --- a/Camunda.Api.Client/History/HistoricProcessInstanceQuery.cs +++ b/Camunda.Api.Client/History/HistoricProcessInstanceQuery.cs @@ -144,6 +144,11 @@ public class HistoricProcessInstanceQuery : SortableQuery [JsonProperty("activeActivityIdIn")] public List ActiveActivityIds; + + /// + /// Array to only include process instances that have/had variables with certain values. + /// + public List Variables = new List(); } public enum HistoricProcessInstanceQuerySorting From 676336382f0ef2d2e7eef5b6332c5b1547e89220 Mon Sep 17 00:00:00 2001 From: Jan Lucansky Date: Wed, 16 Dec 2020 17:37:15 +0100 Subject: [PATCH 04/15] Simplify queries --- Camunda.Api.Client/CaseInstance/CaseInstanceService.cs | 5 +---- Camunda.Api.Client/Execution/ExecutionService.cs | 5 +---- Camunda.Api.Client/ExternalTask/ExternalTaskService.cs | 5 +---- .../History/HistoricActivityInstanceService.cs | 5 +---- Camunda.Api.Client/History/HistoricCaseInstanceService.cs | 7 ++----- .../History/HistoricExternalTaskLogService.cs | 5 +---- Camunda.Api.Client/History/HistoricJobLogService.cs | 5 +---- .../History/HistoricProcessInstanceService.cs | 5 +---- Camunda.Api.Client/History/HistoricUserTaskService.cs | 5 +---- Camunda.Api.Client/Job/JobService.cs | 2 +- Camunda.Api.Client/JobDefinition/JobDefinitionService.cs | 5 +---- .../ProcessInstance/ProcessInstanceService.cs | 5 +---- Camunda.Api.Client/UserTask/UserTaskService.cs | 2 +- 13 files changed, 14 insertions(+), 47 deletions(-) diff --git a/Camunda.Api.Client/CaseInstance/CaseInstanceService.cs b/Camunda.Api.Client/CaseInstance/CaseInstanceService.cs index bdb5bca..9a1330b 100644 --- a/Camunda.Api.Client/CaseInstance/CaseInstanceService.cs +++ b/Camunda.Api.Client/CaseInstance/CaseInstanceService.cs @@ -10,10 +10,7 @@ internal CaseInstanceService(ICaseInstanceRestService api) } public QueryResource Query(CaseInstanceQuery query = null) => - new QueryResource( - query, - (q, f, m) => _api.GetList(q, f, m), - q => _api.GetListCount(q)); + new QueryResource(query, _api.GetList, _api.GetListCount); /// Id of specific case instance public CaseInstanceResource this[string caseInstanceId] => new CaseInstanceResource(_api, caseInstanceId); diff --git a/Camunda.Api.Client/Execution/ExecutionService.cs b/Camunda.Api.Client/Execution/ExecutionService.cs index 6bd6161..52ef271 100644 --- a/Camunda.Api.Client/Execution/ExecutionService.cs +++ b/Camunda.Api.Client/Execution/ExecutionService.cs @@ -12,10 +12,7 @@ internal ExecutionService(IExecutionRestService api) public ExecutionResource this[string executionId] => new ExecutionResource(_api, executionId); public QueryResource Query(ExecutionQuery query = null) => - new QueryResource( - query, - (q, f, m) => _api.GetList(q, f, m), - q => _api.GetListCount(q)); + new QueryResource(query, _api.GetList, _api.GetListCount); } } diff --git a/Camunda.Api.Client/ExternalTask/ExternalTaskService.cs b/Camunda.Api.Client/ExternalTask/ExternalTaskService.cs index 9393f55..c6c060b 100644 --- a/Camunda.Api.Client/ExternalTask/ExternalTaskService.cs +++ b/Camunda.Api.Client/ExternalTask/ExternalTaskService.cs @@ -11,10 +11,7 @@ public class ExternalTaskService internal ExternalTaskService(IExternalTaskRestService api) { _api = api; } public QueryResource Query(ExternalTaskQuery query = null) => - new QueryResource( - query, - (q, f, m) => _api.GetList(q, f, m), - q => _api.GetListCount(q)); + new QueryResource(query, _api.GetList, _api.GetListCount); /// The id of the external task to be retrieved. public ExternalTaskResource this[string externalTaskId] => new ExternalTaskResource(_api, externalTaskId); diff --git a/Camunda.Api.Client/History/HistoricActivityInstanceService.cs b/Camunda.Api.Client/History/HistoricActivityInstanceService.cs index f7b7424..6b1a193 100644 --- a/Camunda.Api.Client/History/HistoricActivityInstanceService.cs +++ b/Camunda.Api.Client/History/HistoricActivityInstanceService.cs @@ -11,10 +11,7 @@ internal HistoricActivityInstanceService(IHistoricActivityInstanceRestService ap public QueryResource Query( HistoricActivityInstanceQuery query = null) => - new QueryResource( - query, - (q, f, m) => _api.GetList(q, f, m), - q => _api.GetListCount(q)); + new QueryResource(query, _api.GetList, _api.GetListCount); /// The id of the historic activity instance to be retrieved. public HistoricActivityInstanceResource this[string activityInstanceId] => new HistoricActivityInstanceResource(_api, activityInstanceId); diff --git a/Camunda.Api.Client/History/HistoricCaseInstanceService.cs b/Camunda.Api.Client/History/HistoricCaseInstanceService.cs index 73fa27b..34c68de 100644 --- a/Camunda.Api.Client/History/HistoricCaseInstanceService.cs +++ b/Camunda.Api.Client/History/HistoricCaseInstanceService.cs @@ -11,11 +11,8 @@ internal HistoricCaseInstanceService(IHistoricCaseInstanceRestService api) public QueryResource Query( HistoricCaseInstanceQuery query = null) => - new QueryResource( - query, - (q, f, m) => _api.GetList(q, f, m), - q => _api.GetListCount(q)); - + new QueryResource(query, _api.GetList, _api.GetListCount); + /// The id of the historic case instance to be retrieved. public HistoricCaseInstanceResource this[string caseInstanceId] => new HistoricCaseInstanceResource(_api, caseInstanceId); } diff --git a/Camunda.Api.Client/History/HistoricExternalTaskLogService.cs b/Camunda.Api.Client/History/HistoricExternalTaskLogService.cs index 528cf52..c74609d 100644 --- a/Camunda.Api.Client/History/HistoricExternalTaskLogService.cs +++ b/Camunda.Api.Client/History/HistoricExternalTaskLogService.cs @@ -13,10 +13,7 @@ internal HistoricExternalTaskLogService(IHistoricExternalTaskLogRestService api) } public QueryResource Query(HistoricExternalTaskLogQuery query = null) => - new QueryResource( - query, - (q, f, m) => _api.GetList(q, f, m), - q => _api.GetListCount(q)); + new QueryResource(query, _api.GetList, _api.GetListCount); public HistoricExternalTaskLogResource this[string logId] => new HistoricExternalTaskLogResource(_api, logId); } diff --git a/Camunda.Api.Client/History/HistoricJobLogService.cs b/Camunda.Api.Client/History/HistoricJobLogService.cs index 6130b0e..eefbac4 100644 --- a/Camunda.Api.Client/History/HistoricJobLogService.cs +++ b/Camunda.Api.Client/History/HistoricJobLogService.cs @@ -10,10 +10,7 @@ internal HistoricJobLogService(IHistoricJobLogRestService api) } public QueryResource Query(HistoricJobLogQuery query = null) => - new QueryResource( - query, - (q, f, m) => _api.GetList(q, f, m), - q => _api.GetListCount(q)); + new QueryResource(query, _api.GetList, _api.GetListCount); /// The id of the log entry. public HistoricJobLogResource this[string historicJobLogId] => new HistoricJobLogResource(_api, historicJobLogId); diff --git a/Camunda.Api.Client/History/HistoricProcessInstanceService.cs b/Camunda.Api.Client/History/HistoricProcessInstanceService.cs index a28079a..a92fb38 100644 --- a/Camunda.Api.Client/History/HistoricProcessInstanceService.cs +++ b/Camunda.Api.Client/History/HistoricProcessInstanceService.cs @@ -15,10 +15,7 @@ internal HistoricProcessInstanceService(IHistoricProcessInstanceRestService api) public QueryResource Query( HistoricProcessInstanceQuery query = null) => - new QueryResource( - query, - (q, f, m) => _api.GetList(q, f, m), - q => _api.GetListCount(q)); + new QueryResource(query, _api.GetList, _api.GetListCount); /// The id of the historic process instance to be retrieved. public HistoricProcessInstanceResource this[string processInstanceId] => new HistoricProcessInstanceResource(_api, processInstanceId); diff --git a/Camunda.Api.Client/History/HistoricUserTaskService.cs b/Camunda.Api.Client/History/HistoricUserTaskService.cs index 2775c02..a4d3ade 100644 --- a/Camunda.Api.Client/History/HistoricUserTaskService.cs +++ b/Camunda.Api.Client/History/HistoricUserTaskService.cs @@ -13,10 +13,7 @@ internal HistoricUserTaskService(IHistoricUserTaskRestService api) } public QueryResource Query(HistoricTaskQuery query = null) => - new QueryResource( - query, - (q, f, m) => _api.GetList(q, f, m), - q => _api.GetListCount(q)); + new QueryResource(query, _api.GetList, _api.GetListCount); /// /// Retrieves a report of completed tasks. When the report type is set to count, the report contains a list of completed task counts where an entry contains the task name, the definition key of the task, the process definition id, the process definition key, the process definition name and the count of how many tasks were completed for the specified key in a given period. When the report type is set to duration, the report contains a minimum, maximum and average duration value of all completed task instances in a given period. diff --git a/Camunda.Api.Client/Job/JobService.cs b/Camunda.Api.Client/Job/JobService.cs index a5c4ad5..6d2ff07 100644 --- a/Camunda.Api.Client/Job/JobService.cs +++ b/Camunda.Api.Client/Job/JobService.cs @@ -13,7 +13,7 @@ internal JobService(IJobRestService api) } public QueryResource Query(JobQuery query = null) => - new QueryResource(query, (q, f, m) => _api.GetList(q, f, m), q => _api.GetListCount(q)); + new QueryResource(query, _api.GetList, _api.GetListCount); /// The id of the job to be retrieved. public JobResource this[string jobId] => new JobResource(_api, jobId); diff --git a/Camunda.Api.Client/JobDefinition/JobDefinitionService.cs b/Camunda.Api.Client/JobDefinition/JobDefinitionService.cs index 26aa1ad..a1295fc 100644 --- a/Camunda.Api.Client/JobDefinition/JobDefinitionService.cs +++ b/Camunda.Api.Client/JobDefinition/JobDefinitionService.cs @@ -12,10 +12,7 @@ internal JobDefinitionService(IJobDefinitionRestService api) } public QueryResource Query(JobDefinitionQuery query = null) => - new QueryResource( - query, - (q, f, m) => _api.GetList(q, f, m), - q => _api.GetListCount(q)); + new QueryResource(query, _api.GetList, _api.GetListCount); /// The id of the job to be retrieved. public JobDefinitionResource this[string jobDefinitionId] => new JobDefinitionResource(_api, jobDefinitionId); diff --git a/Camunda.Api.Client/ProcessInstance/ProcessInstanceService.cs b/Camunda.Api.Client/ProcessInstance/ProcessInstanceService.cs index 0e4ad08..fb2133d 100644 --- a/Camunda.Api.Client/ProcessInstance/ProcessInstanceService.cs +++ b/Camunda.Api.Client/ProcessInstance/ProcessInstanceService.cs @@ -10,10 +10,7 @@ public class ProcessInstanceService internal ProcessInstanceService(IProcessInstanceRestService api) { _api = api; } public QueryResource Query(ProcessInstanceQuery query = null) => - new QueryResource( - query, - (q, f, m) => _api.GetList(q, f, m), - q => _api.GetListCount(q)); + new QueryResource(query, _api.GetList, _api.GetListCount); /// The id of the process instance to be retrieved. public ProcessInstanceResource this[string processInstanceId] => new ProcessInstanceResource(_api, processInstanceId); diff --git a/Camunda.Api.Client/UserTask/UserTaskService.cs b/Camunda.Api.Client/UserTask/UserTaskService.cs index 12b5eec..eb42509 100644 --- a/Camunda.Api.Client/UserTask/UserTaskService.cs +++ b/Camunda.Api.Client/UserTask/UserTaskService.cs @@ -20,7 +20,7 @@ internal UserTaskService(IUserTaskRestService api) public Task> GetTaskCountByCandidateGroup() => _api.GetTaskCountByCandidateGroup(); public QueryResource Query(TaskQuery query = null) => - new QueryResource(query, (q, f, m) => _api.GetList(q, f, m), q => _api.GetListCount(q)); + new QueryResource(query, _api.GetList, _api.GetListCount); public Task Create(UserTask task) => _api.CreateTask(task); } From fe6541396060f14c093532b0b4f26e0929b97b76 Mon Sep 17 00:00:00 2001 From: Jan Lucansky Date: Wed, 16 Dec 2020 17:41:56 +0100 Subject: [PATCH 05/15] Make UserTaskInfo.Created non-nullable --- Camunda.Api.Client/UserTask/UserTaskInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Camunda.Api.Client/UserTask/UserTaskInfo.cs b/Camunda.Api.Client/UserTask/UserTaskInfo.cs index 8a7a0b9..1a719dc 100644 --- a/Camunda.Api.Client/UserTask/UserTaskInfo.cs +++ b/Camunda.Api.Client/UserTask/UserTaskInfo.cs @@ -11,7 +11,7 @@ public class UserTaskInfo : UserTask /// /// The time the task was created. /// - public DateTime? Created; + public DateTime Created; /// /// The id of the execution the task belongs to. /// From 7db8f063560327df08e6057f9d4c857968f3cef9 Mon Sep 17 00:00:00 2001 From: Jan Lucansky Date: Tue, 22 Dec 2020 10:17:41 +0100 Subject: [PATCH 06/15] Update README.md --- README.md | 65 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 34 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 4df48cd..083cba9 100644 --- a/README.md +++ b/README.md @@ -5,37 +5,40 @@ Camunda REST API Client for .NET platform ## Covered API Each part listed below is fully covered according to https://docs.camunda.org/manual/7.9/reference/rest specification. -- [x] [Case Definition](https://docs.camunda.org/manual/7.9/reference/rest/case-definition/) -- [x] [Case Execution](https://docs.camunda.org/manual/7.9/reference/rest/case-execution/) -- [ ] [Case Instance](https://docs.camunda.org/manual/7.9/reference/rest/case-instance/) -- [x] [Decision Definition](https://docs.camunda.org/manual/7.9/reference/rest/decision-definition/) -- [ ] [Decision Requirements Definition](https://docs.camunda.org/manual/7.9/reference/rest/decision-requirements-definition/) -- [x] [Deployment](https://docs.camunda.org/manual/7.9/reference/rest/deployment/) -- [x] [Execution](https://docs.camunda.org/manual/7.9/reference/rest/execution/) -- [x] [External Task](https://docs.camunda.org/manual/7.9/reference/rest/external-task/) -- [x] [Group](https://docs.camunda.org/manual/7.9/reference/rest/group/) -- [x] [History / Activity Instance](https://docs.camunda.org/manual/7.9/reference/rest/history/activity-instance/) -- [ ] [History / Case Definition](https://docs.camunda.org/manual/7.9/reference/rest/history/case-definition/) -- [ ] [History / Case Instance](https://docs.camunda.org/manual/7.9/reference/rest/history/case-instance/) -- [ ] [History / Case Activity Instance](https://docs.camunda.org/manual/7.9/reference/rest/history/case-activity-instance/) -- [ ] [History / Decision Instance](https://docs.camunda.org/manual/7.9/reference/rest/history/decision-instance/) -- [ ] [History / Decision Requirements Definition](https://docs.camunda.org/manual/7.9/reference/rest/history/decision-requirements-definition/) -- [x] [History / Detail](https://docs.camunda.org/manual/7.9/reference/rest/history/detail/) -- [x] [History / Incident](https://docs.camunda.org/manual/7.9/reference/rest/history/incident/) -- [x] [History / Job Log](https://docs.camunda.org/manual/7.9/reference/rest/history/job-log/) -- [x] [History / Process Instance](https://docs.camunda.org/manual/7.9/reference/rest/history/process-instance/) -- [x] [History / Variable Instance](https://docs.camunda.org/manual/7.9/reference/rest/history/variable-instance/) -- [x] [Incident](https://docs.camunda.org/manual/7.9/reference/rest/incident/) -- [X] [Job](https://docs.camunda.org/manual/7.9/reference/rest/job/) -- [x] [Job Definition](https://docs.camunda.org/manual/7.9/reference/rest/job-definition/) -- [x] [Message](https://docs.camunda.org/manual/7.9/reference/rest/message/) -- [x] [Process Definition](https://docs.camunda.org/manual/7.9/reference/rest/process-definition/) -- [x] [Process Instance](https://docs.camunda.org/manual/7.9/reference/rest/process-instance/) -- [x] [Signal](https://docs.camunda.org/manual/7.9/reference/rest/signal/) -- [x] [Task](https://docs.camunda.org/manual/7.9/reference/rest/task/) -- [x] [Tenant](https://docs.camunda.org/manual/7.9/reference/rest/tenant/) -- [x] [User](https://docs.camunda.org/manual/7.9/reference/rest/user/) -- [x] [Variable Instance](https://docs.camunda.org/manual/7.9/reference/rest/variable-instance/) +- [x] [Case Definition](https://docs.camunda.org/manual/latest/reference/rest/case-definition/) +- [x] [Case Execution](https://docs.camunda.org/manual/latest/reference/rest/case-execution/) +- [x] [Case Instance](https://docs.camunda.org/manual/latest/reference/rest/case-instance/) +- [x] [Decision Definition](https://docs.camunda.org/manual/latest/reference/rest/decision-definition/) +- [x] [Decision Requirements Definition](https://docs.camunda.org/manual/latest/reference/rest/decision-requirements-definition/) +- [x] [Deployment](https://docs.camunda.org/manual/latest/reference/rest/deployment/) +- [x] [Execution](https://docs.camunda.org/manual/latest/reference/rest/execution/) +- [x] [External Task](https://docs.camunda.org/manual/latest/reference/rest/external-task/) +- [x] [Group](https://docs.camunda.org/manual/latest/reference/rest/group/) +- [x] [History / Activity Instance](https://docs.camunda.org/manual/latest/reference/rest/history/activity-instance/) +- [x] [History / Case Definition](https://docs.camunda.org/manual/latest/reference/rest/history/case-definition/) +- [x] [History / Case Instance](https://docs.camunda.org/manual/latest/reference/rest/history/case-instance/) +- [x] [History / Case Activity Instance](https://docs.camunda.org/manual/latest/reference/rest/history/case-activity-instance/) +- [x] [History / Decision Instance](https://docs.camunda.org/manual/latest/reference/rest/history/decision-instance/) +- [x] [History / Decision Requirements Definition](https://docs.camunda.org/manual/latest/reference/rest/history/decision-requirements-definition/) +- [x] [History / Detail](https://docs.camunda.org/manual/latest/reference/rest/history/detail/) +- [x] [History / External Task Log](https://docs.camunda.org/manual/latest/reference/rest/history/external-task-log/) +- [x] [History / Incident](https://docs.camunda.org/manual/latest/reference/rest/history/incident/) +- [x] [History / Job Log](https://docs.camunda.org/manual/latest/reference/rest/history/job-log/) +- [x] [History / Process Definition](https://docs.camunda.org/manual/latest/reference/rest/history/process-definition/) +- [x] [History / Process Instance](https://docs.camunda.org/manual/latest/reference/rest/history/process-instance/) +- [x] [History / Task](https://docs.camunda.org/manual/latest/reference/rest/history/task/) +- [x] [History / Variable Instance](https://docs.camunda.org/manual/latest/reference/rest/history/variable-instance/) +- [x] [Incident](https://docs.camunda.org/manual/latest/reference/rest/incident/) +- [X] [Job](https://docs.camunda.org/manual/latest/reference/rest/job/) +- [x] [Job Definition](https://docs.camunda.org/manual/latest/reference/rest/job-definition/) +- [x] [Message](https://docs.camunda.org/manual/latest/reference/rest/message/) +- [x] [Process Definition](https://docs.camunda.org/manual/latest/reference/rest/process-definition/) +- [x] [Process Instance](https://docs.camunda.org/manual/latest/reference/rest/process-instance/) +- [x] [Signal](https://docs.camunda.org/manual/latest/reference/rest/signal/) +- [x] [Task](https://docs.camunda.org/manual/latest/reference/rest/task/) +- [x] [Tenant](https://docs.camunda.org/manual/latest/reference/rest/tenant/) +- [x] [User](https://docs.camunda.org/manual/latest/reference/rest/user/) +- [x] [Variable Instance](https://docs.camunda.org/manual/latest/reference/rest/variable-instance/) ## Install The Camunda REST API Client is available on [nuget.org](https://www.nuget.org/packages/Camunda.Api.Client) From fb53080d4a94cae97bce0ceb74a773780593857d Mon Sep 17 00:00:00 2001 From: Jan Lucansky Date: Tue, 22 Dec 2020 10:21:52 +0100 Subject: [PATCH 07/15] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 083cba9..6d7f7e5 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Camunda REST API Client for .NET platform - [x] .NET Standard 2.0 ## Covered API -Each part listed below is fully covered according to https://docs.camunda.org/manual/7.9/reference/rest specification. +Each part listed below is fully covered according to https://docs.camunda.org/manual/latest/reference/rest specification. - [x] [Case Definition](https://docs.camunda.org/manual/latest/reference/rest/case-definition/) - [x] [Case Execution](https://docs.camunda.org/manual/latest/reference/rest/case-execution/) - [x] [Case Instance](https://docs.camunda.org/manual/latest/reference/rest/case-instance/) @@ -13,6 +13,7 @@ Each part listed below is fully covered according to https://docs.camunda.org/ma - [x] [Deployment](https://docs.camunda.org/manual/latest/reference/rest/deployment/) - [x] [Execution](https://docs.camunda.org/manual/latest/reference/rest/execution/) - [x] [External Task](https://docs.camunda.org/manual/latest/reference/rest/external-task/) +- [x] [Filter](https://docs.camunda.org/manual/latest/reference/rest/filter/) - [x] [Group](https://docs.camunda.org/manual/latest/reference/rest/group/) - [x] [History / Activity Instance](https://docs.camunda.org/manual/latest/reference/rest/history/activity-instance/) - [x] [History / Case Definition](https://docs.camunda.org/manual/latest/reference/rest/history/case-definition/) @@ -32,6 +33,7 @@ Each part listed below is fully covered according to https://docs.camunda.org/ma - [X] [Job](https://docs.camunda.org/manual/latest/reference/rest/job/) - [x] [Job Definition](https://docs.camunda.org/manual/latest/reference/rest/job-definition/) - [x] [Message](https://docs.camunda.org/manual/latest/reference/rest/message/) +- [x] [Migration](https://docs.camunda.org/manual/latest/reference/rest/migration/) - [x] [Process Definition](https://docs.camunda.org/manual/latest/reference/rest/process-definition/) - [x] [Process Instance](https://docs.camunda.org/manual/latest/reference/rest/process-instance/) - [x] [Signal](https://docs.camunda.org/manual/latest/reference/rest/signal/) From 62ca08102c3b09527f8344858861db72a7338263 Mon Sep 17 00:00:00 2001 From: Jan Lucansky Date: Tue, 22 Dec 2020 10:33:14 +0100 Subject: [PATCH 08/15] Bump version --- Camunda.Api.Client/Camunda.Api.Client.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Camunda.Api.Client/Camunda.Api.Client.csproj b/Camunda.Api.Client/Camunda.Api.Client.csproj index 5085ee1..e788a9c 100644 --- a/Camunda.Api.Client/Camunda.Api.Client.csproj +++ b/Camunda.Api.Client/Camunda.Api.Client.csproj @@ -4,8 +4,8 @@ netstandard2.0;net461 true - 2.5.2 - 2.5.2.0 + 2.6.0 + 2.6.0.0 Camunda REST API Client Camunda REST API Client Jan Lucansky From de014d8a85c57057fdd28d4579120460b7df0f4e Mon Sep 17 00:00:00 2001 From: Jan Lucansky Date: Tue, 22 Dec 2020 10:52:52 +0100 Subject: [PATCH 09/15] Fix FilterSorting case --- Camunda.Api.Client/Filter/FilterQuery.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Camunda.Api.Client/Filter/FilterQuery.cs b/Camunda.Api.Client/Filter/FilterQuery.cs index e12bc4e..cd9eb37 100644 --- a/Camunda.Api.Client/Filter/FilterQuery.cs +++ b/Camunda.Api.Client/Filter/FilterQuery.cs @@ -49,9 +49,9 @@ public class FilterQuery : QueryParameters public enum FilterSorting { - filterId, - firstName, - lastName, - email + FilterId, + FirstName, + LastName, + Email } } From 9cbe4d1176ca713cd6027a13b0ba49c79db302de Mon Sep 17 00:00:00 2001 From: Mohammad Sharifi Date: Wed, 20 Jan 2021 10:12:14 +0330 Subject: [PATCH 10/15] add get and resolve into incident service --- .../Incident/IIncidentRestService.cs | 6 ++++ .../Incident/IncidentResource.cs | 30 +++++++++++++++++++ .../Incident/IncidentService.cs | 2 ++ 3 files changed, 38 insertions(+) create mode 100644 Camunda.Api.Client/Incident/IncidentResource.cs diff --git a/Camunda.Api.Client/Incident/IIncidentRestService.cs b/Camunda.Api.Client/Incident/IIncidentRestService.cs index b4dac76..75f08e2 100644 --- a/Camunda.Api.Client/Incident/IIncidentRestService.cs +++ b/Camunda.Api.Client/Incident/IIncidentRestService.cs @@ -11,5 +11,11 @@ internal interface IIncidentRestService [Get("/incident/count")] Task GetListCount(QueryDictionary query); + + [Get("/incident/{id}")] + Task Get(string id); + + [Delete("/incident/{id}")] + Task Resolve(string id); } } diff --git a/Camunda.Api.Client/Incident/IncidentResource.cs b/Camunda.Api.Client/Incident/IncidentResource.cs new file mode 100644 index 0000000..f7bf4b2 --- /dev/null +++ b/Camunda.Api.Client/Incident/IncidentResource.cs @@ -0,0 +1,30 @@ +using System.Threading.Tasks; + +namespace Camunda.Api.Client.Incident +{ + public class IncidentResource + { + private IIncidentRestService _api; + private string _incidentId; + + internal IncidentResource(IIncidentRestService api, string incidentId) + { + _api = api; + _incidentId = incidentId; + } + + /// + /// Retrieves an incident by ID + /// + /// + public Task Get() => _api.Get(_incidentId); + + /// + /// Resolves an incident with given id + /// + /// + public Task Resolve() => _api.Resolve(_incidentId); + + public override string ToString() => _incidentId; + } +} diff --git a/Camunda.Api.Client/Incident/IncidentService.cs b/Camunda.Api.Client/Incident/IncidentService.cs index a396e53..acb18c5 100644 --- a/Camunda.Api.Client/Incident/IncidentService.cs +++ b/Camunda.Api.Client/Incident/IncidentService.cs @@ -14,5 +14,7 @@ public QueryResource Query(IncidentQuery query = nu query, (q, f, m) => _api.GetList(q, f, m), q => _api.GetListCount(q)); + + public IncidentResource this[string incidentId] => new IncidentResource(_api, incidentId); } } From 5b79cdf6f62947c21b9722ea623e87d6a522989a Mon Sep 17 00:00:00 2001 From: Mohammad Sharifi Date: Tue, 9 Feb 2021 15:14:34 +0330 Subject: [PATCH 11/15] fixes historicTask properties. --- Camunda.Api.Client/History/HistoricTask.cs | 137 +++++++++++++++++++-- 1 file changed, 129 insertions(+), 8 deletions(-) diff --git a/Camunda.Api.Client/History/HistoricTask.cs b/Camunda.Api.Client/History/HistoricTask.cs index d897e4f..db8502a 100644 --- a/Camunda.Api.Client/History/HistoricTask.cs +++ b/Camunda.Api.Client/History/HistoricTask.cs @@ -1,14 +1,135 @@ -using Camunda.Api.Client.UserTask; -using System; -using System.Runtime.Serialization; - -namespace Camunda.Api.Client.History +namespace Camunda.Api.Client.History { - public class HistoricTask: UserTaskInfo + public class HistoricTask { /// - /// Whether the task belongs to a process instance that is suspended. + /// The task id. + /// + public string Id; + + /// + /// The key of the process definition the task belongs to. + /// + public string ProcessDefinitionKey; + + /// + /// The id of the process definition the task belongs to. + /// + public string ProcessDefinitionId; + + /// + /// The id of the process instance the task belongs to. + /// + public string ProcessInstanceId; + + /// + /// The id of the execution the task belongs to. + /// + public string ExecutionId; + + /// + /// The key of the case definition the task belongs to. + /// + public string CaseDefinitionKey; + + /// + /// The id of the case definition the task belongs to. + /// + public string CaseDefinitionId; + + /// + /// The id of the case instance the task belongs to. + /// + public string CaseInstanceId; + + /// + /// The id of the case execution the task belongs to. + /// + public string CaseExecutionId; + + /// + /// The id of the activity that this object is an instance of. + /// + public string ActivityInstanceId; + + /// + /// The task name. + /// + public string Name; + + /// + /// The task's description. + /// + public string Description; + + /// + /// The task's delete reason. + /// + public string DeleteReason; + + /// + /// The owner's id. + /// + public string Owner; + + /// + /// The assignee's id. + /// + public string Assignee; + + /// + /// The time the task was started. Default format* yyyy-MM-dd'T'HH:mm:ss.SSSZ. + /// + public string StartTime; + + /// + /// The time the task ended.Default format* yyyy-MM-dd'T'HH:mm:ss.SSSZ. + /// + public string EndTime; + + /// + /// The time the task took to finish (in milliseconds). + /// + public long Duration; + + /// + /// The task's key. + /// + public string TaskDefinitionKey; + + /// + /// The task's priority. + /// + public int Priority; + + /// + /// The task's due date. Default format* yyyy-MM-dd'T'HH:mm:ss.SSSZ. + /// + public string Due; + + /// + /// The id of the parent task, if this task is a subtask. + /// + public string ParentTaskId; + + /// + /// The follow-up date for the task. Default format* yyyy-MM-dd'T'HH:mm:ss.SSSZ. + /// + public string FollowUp; + + /// + /// The tenant id of the task instance. + /// + public string TenantId; + + /// + /// The time after which the task should be removed by the History Cleanup job. Default format* yyyy-MM-dd'T'HH:mm:ss.SSSZ. + /// + public string RemovalTime; + + /// + /// The process instance id of the root process instance that initiated the process containing this task. /// - public bool Suspended; + public string RootProcessInstanceId; } } From c888e9a40f10bec2104d5bfb30ada4fded1ab156 Mon Sep 17 00:00:00 2001 From: Mohammad Sharifi Date: Sun, 21 Feb 2021 14:49:37 +0330 Subject: [PATCH 12/15] Add CaseInstance service --- .../CaseInstanceDeleteVariable.cs | 1 - .../CaseInstance/CaseInstanceQuery.cs | 24 ++++--------------- .../CaseInstance/CaseInstanceQueryVariable.cs | 20 ---------------- .../CaseInstance/CaseInstanceVariableValue.cs | 1 - .../CaseInstance/ChangeCaseInstanceState.cs | 2 -- 5 files changed, 5 insertions(+), 43 deletions(-) delete mode 100644 Camunda.Api.Client/CaseInstance/CaseInstanceQueryVariable.cs diff --git a/Camunda.Api.Client/CaseInstance/CaseInstanceDeleteVariable.cs b/Camunda.Api.Client/CaseInstance/CaseInstanceDeleteVariable.cs index d26fed2..2d4e12a 100644 --- a/Camunda.Api.Client/CaseInstance/CaseInstanceDeleteVariable.cs +++ b/Camunda.Api.Client/CaseInstance/CaseInstanceDeleteVariable.cs @@ -8,7 +8,6 @@ namespace Camunda.Api.Client.CaseInstance { public class CaseInstanceDeleteVariable { - [JsonProperty("name")] public string Name; } } diff --git a/Camunda.Api.Client/CaseInstance/CaseInstanceQuery.cs b/Camunda.Api.Client/CaseInstance/CaseInstanceQuery.cs index b0b14ef..74ab74d 100644 --- a/Camunda.Api.Client/CaseInstance/CaseInstanceQuery.cs +++ b/Camunda.Api.Client/CaseInstance/CaseInstanceQuery.cs @@ -9,55 +9,41 @@ namespace Camunda.Api.Client.CaseInstance { public class CaseInstanceQuery { - [JsonProperty("caseInstanceId")] public string CaseInstanceId; - [JsonProperty("businessKey")] public string BusinessKey; - [JsonProperty("caseDefinitionId")] public string CaseDefinitionId; - [JsonProperty("caseDefinitionKey")] public string CaseDefinitionKey; - [JsonProperty("deploymentId")] public string DeploymentId; - [JsonProperty("superProcessInstance")] public string SuperProcessInstance; - [JsonProperty("subProcessInstance")] public string SubProcessInstance; - [JsonProperty("superCaseInstance")] public string SuperCaseInstance; - [JsonProperty("subCaseInstance")] public string SubCaseInstance; - [JsonProperty("active")] public bool? Active; - [JsonProperty("completed")] public bool? Completed; [JsonProperty("tenantIdIn")] - public List TenantIdIn; + public List TenantIds; - [JsonProperty("withoutTenantId")] public bool? WithoutTenantId; - [JsonProperty("variables")] - public List Variables; + public List Variables; - [JsonProperty("variableNamesIgnoreCase")] public bool VariableNamesIgnoreCase; - [JsonProperty("variableValuesIgnoreCase")] public bool VariableValuesIgnoreCase; - [JsonProperty("sorting")] - public List Sorting; + public CaseInstanceSorting SortBy; + + public SortOrder SortOrder; } } diff --git a/Camunda.Api.Client/CaseInstance/CaseInstanceQueryVariable.cs b/Camunda.Api.Client/CaseInstance/CaseInstanceQueryVariable.cs deleted file mode 100644 index c9ec3fc..0000000 --- a/Camunda.Api.Client/CaseInstance/CaseInstanceQueryVariable.cs +++ /dev/null @@ -1,20 +0,0 @@ -#region Usings - -using Newtonsoft.Json; - -#endregion - -namespace Camunda.Api.Client.CaseInstance -{ - public class CaseInstanceQueryVariable - { - [JsonProperty("name")] - public string Name; - - [JsonProperty("operator")] - public ConditionOperator Operator; - - [JsonProperty("value")] - public object Value; - } -} diff --git a/Camunda.Api.Client/CaseInstance/CaseInstanceVariableValue.cs b/Camunda.Api.Client/CaseInstance/CaseInstanceVariableValue.cs index 9c63a72..6211814 100644 --- a/Camunda.Api.Client/CaseInstance/CaseInstanceVariableValue.cs +++ b/Camunda.Api.Client/CaseInstance/CaseInstanceVariableValue.cs @@ -8,7 +8,6 @@ namespace Camunda.Api.Client.CaseInstance { public class CaseInstanceVariableValue : VariableValue { - [JsonProperty("local")] public bool Local; } } diff --git a/Camunda.Api.Client/CaseInstance/ChangeCaseInstanceState.cs b/Camunda.Api.Client/CaseInstance/ChangeCaseInstanceState.cs index c2c76c0..4394c29 100644 --- a/Camunda.Api.Client/CaseInstance/ChangeCaseInstanceState.cs +++ b/Camunda.Api.Client/CaseInstance/ChangeCaseInstanceState.cs @@ -9,10 +9,8 @@ namespace Camunda.Api.Client.CaseInstance { public class ChangeCaseInstanceState { - [JsonProperty("variables")] public Dictionary Variables; - [JsonProperty("deletions")] public List Deletions; } } From f6220512d3d7c81f51f0454202104d64f7a2f6a2 Mon Sep 17 00:00:00 2001 From: Mohammad Sharifi Date: Sun, 11 Apr 2021 10:04:58 +0430 Subject: [PATCH 13/15] add HistoricDecisionInstanceService --- .../HistoricDecisionInstanceService.cs | 22 +++++- .../History/HistoricDeleteDecisionInstance.cs | 24 +++++++ .../HistoricDeleteDecisionInstanceResult.cs | 69 +++++++++++++++++++ .../HistoricSetRemovalTimeDecisionInstance.cs | 45 ++++++++++++ .../IHistoricDecisionInstanceRestService.cs | 6 ++ 5 files changed, 165 insertions(+), 1 deletion(-) create mode 100644 Camunda.Api.Client/History/HistoricDeleteDecisionInstance.cs create mode 100644 Camunda.Api.Client/History/HistoricDeleteDecisionInstanceResult.cs create mode 100644 Camunda.Api.Client/History/HistoricSetRemovalTimeDecisionInstance.cs diff --git a/Camunda.Api.Client/History/HistoricDecisionInstanceService.cs b/Camunda.Api.Client/History/HistoricDecisionInstanceService.cs index 40f91c4..2ac43bf 100644 --- a/Camunda.Api.Client/History/HistoricDecisionInstanceService.cs +++ b/Camunda.Api.Client/History/HistoricDecisionInstanceService.cs @@ -1,4 +1,6 @@ -namespace Camunda.Api.Client.History +using System.Threading.Tasks; + +namespace Camunda.Api.Client.History { public class HistoricDecisionInstanceService { @@ -18,5 +20,23 @@ public QueryResource Qu /// The id of the historic decision instance to be retrieved. public HistoricDecisionInstanceResource this[string decisionInstanceId] => new HistoricDecisionInstanceResource(_api, decisionInstanceId); + + /// + /// Delete multiple historic decision instances asynchronously (batch). + /// At least historicDecisionInstanceIds or historicDecisionInstanceQuery has to be provided. + /// If both are provided then all instances matching query criterion and instances from the list will be deleted. + /// + /// + /// + public Task Delete(HistoricDeleteDecisionInstance historicDeleteDecisionInstance) => _api.Delete(historicDeleteDecisionInstance); + + /// + /// Sets the removal time to multiple historic decision instances asynchronously (batch). + /// At least historicDecisionInstanceIds or historicDecisionInstanceQuery has to be provided. + /// If both are provided, all instances matching query criterion and instances from the list will be updated with a removal time. + /// + /// + /// + public Task SetRemovalTime(HistoricSetRemovalTimeDecisionInstance historicSetRemovalTimeDecisionInstance) => _api.SetRemovalTime(historicSetRemovalTimeDecisionInstance); } } \ No newline at end of file diff --git a/Camunda.Api.Client/History/HistoricDeleteDecisionInstance.cs b/Camunda.Api.Client/History/HistoricDeleteDecisionInstance.cs new file mode 100644 index 0000000..9eb80a6 --- /dev/null +++ b/Camunda.Api.Client/History/HistoricDeleteDecisionInstance.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Camunda.Api.Client.History +{ + public class HistoricDeleteDecisionInstance + { + /// + /// A list historic decision instance ids to delete. + /// + public List HistoricDecisionInstanceIds; + + /// + /// A historic decision instance query like the request body described by POST /history/decision-instance . + /// + public HistoricDecisionInstanceQuery Query; + + /// + /// A string with delete reason. + /// + public string DeleteReason; + } +} diff --git a/Camunda.Api.Client/History/HistoricDeleteDecisionInstanceResult.cs b/Camunda.Api.Client/History/HistoricDeleteDecisionInstanceResult.cs new file mode 100644 index 0000000..577d8db --- /dev/null +++ b/Camunda.Api.Client/History/HistoricDeleteDecisionInstanceResult.cs @@ -0,0 +1,69 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Camunda.Api.Client.History +{ + public class HistoricDeleteDecisionInstanceResult + { + /// + /// The id of the batch. + /// + public string Id; + + /// + /// The type of the batch.See the User Guide for more information about batch types. + /// + public string Type; + + /// + /// The total jobs of a batch is the number of batch execution jobs required to complete the batch. + /// + public int TotalJobs; + + /// + /// The number of batch execution jobs already created by the seed job. + /// + public int JobsCreated; + + /// + /// The number of batch execution jobs created per seed job invocation. The batch seed job is invoked until it has created all batch execution jobs required by the batch (see totalJobs property). + /// + public int BatchJobsPerSeed; + + /// + /// Every batch execution job invokes the command executed by the batch invocationsPerBatchJob times.E.g., for a process instance migration batch this specifies the number of process instances which are migrated per batch execution job. + /// + public int InvocationsPerBatchJob; + + /// + /// The job definition id for the seed jobs of this batch. + /// + public string SeedJobDefinitionId; + + /// + /// The job definition id for the monitor jobs of this batch. + /// + public string MonitorJobDefinitionId; + + /// + /// The job definition id for the batch execution jobs of this batch. + /// + public string MatchJobDefinitionId; + + /// + /// Indicates whether this batch is suspended or not. + /// + public bool Suspended; + + /// + /// The tenant id of the batch. + /// + public string TenantId; + + /// + /// The id of the user that created the batch. + /// + public string CreateUserId; + } +} diff --git a/Camunda.Api.Client/History/HistoricSetRemovalTimeDecisionInstance.cs b/Camunda.Api.Client/History/HistoricSetRemovalTimeDecisionInstance.cs new file mode 100644 index 0000000..fbd5189 --- /dev/null +++ b/Camunda.Api.Client/History/HistoricSetRemovalTimeDecisionInstance.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Camunda.Api.Client.History +{ + public class HistoricSetRemovalTimeDecisionInstance + { + /// + /// The date for which the historic decision instances shall be removed. + /// Value my not be null. + /// Note: Cannot be set in conjunction with clearedRemovalTime or calculatedRemovalTime. + /// + public DateTime AbsoluteRemovalTime; + + /// + /// Sets the removal time to null. Value may only be true, as false is the default behavior. + /// Note: Cannot be set in conjunction with absoluteRemovalTime or calculatedRemovalTime. + /// + public bool ClearedRemovalTime; + + /// + /// The removal time is calculated based on the engine's configuration settings. + ///Value may only be true, as false is the default behavior. + ///Note: Cannot be set in conjunction with absoluteRemovalTime or clearedRemovalTime. + /// + public bool CalculatedRemovalTime; + + /// + /// Sets the removal time to all historic decision instances in the hierarchy. + /// Value may only be true, as false is the default behavior. + /// + public bool Hierarchical; + + /// + /// Query for the historic decision instances to set the removal time for. + /// + public HistoricDecisionInstanceQuery Query; + + /// + /// The ids of the historic decision instances to set the removal time for. + /// + public List HistoricDecisionInstanceIds; + } +} diff --git a/Camunda.Api.Client/History/IHistoricDecisionInstanceRestService.cs b/Camunda.Api.Client/History/IHistoricDecisionInstanceRestService.cs index e06f64d..d7690e9 100644 --- a/Camunda.Api.Client/History/IHistoricDecisionInstanceRestService.cs +++ b/Camunda.Api.Client/History/IHistoricDecisionInstanceRestService.cs @@ -14,5 +14,11 @@ internal interface IHistoricDecisionInstanceRestService [Get("/history/decision-instance/count")] Task GetListCount(QueryDictionary query); + + [Post("/history/decision-instance/delete")] + Task Delete([Body] HistoricDeleteDecisionInstance historicDeleteDecisionInstance); + + [Post("/history/decision-instance/set-removal-time")] + Task SetRemovalTime([Body] HistoricSetRemovalTimeDecisionInstance historicSetRemovalTimeDecisionInstance); } } \ No newline at end of file From b813b1857a3d5a107e5a2feb07f5bb763c20c7ec Mon Sep 17 00:00:00 2001 From: Mohammad Sharifi Date: Sun, 25 Apr 2021 09:32:53 +0430 Subject: [PATCH 14/15] add properties of HistoryTimeToLive and StartableInTasklist into ProcessDefinitionInfo --- .../ProcessDefinition/ProcessDefinitionInfo.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Camunda.Api.Client/ProcessDefinition/ProcessDefinitionInfo.cs b/Camunda.Api.Client/ProcessDefinition/ProcessDefinitionInfo.cs index 26e99c8..7a4ac21 100644 --- a/Camunda.Api.Client/ProcessDefinition/ProcessDefinitionInfo.cs +++ b/Camunda.Api.Client/ProcessDefinition/ProcessDefinitionInfo.cs @@ -36,6 +36,14 @@ public class ProcessDefinitionInfo /// public string DeploymentId; /// + /// History time to live value of the process definition. Is used within History cleanup. + /// + public int HistoryTimeToLive; + /// + /// A flag indicating whether the process definition is startable in Tasklist or not. + /// + public bool StartableInTasklist; + /// /// The file name of the process definition diagram, if it exists. /// public string Diagram; From a70241ef5b43361b4e90a9b5247f78f43a2ff722 Mon Sep 17 00:00:00 2001 From: Mohammad Sharifi Date: Sun, 25 Apr 2021 09:33:28 +0430 Subject: [PATCH 15/15] add sorting into taskQuery --- Camunda.Api.Client/UserTask/TaskQuery.cs | 47 ++++-------------------- 1 file changed, 8 insertions(+), 39 deletions(-) diff --git a/Camunda.Api.Client/UserTask/TaskQuery.cs b/Camunda.Api.Client/UserTask/TaskQuery.cs index 0aabe3e..2f81edc 100644 --- a/Camunda.Api.Client/UserTask/TaskQuery.cs +++ b/Camunda.Api.Client/UserTask/TaskQuery.cs @@ -5,7 +5,7 @@ namespace Camunda.Api.Client.UserTask { - public class TaskQuery + public class TaskQuery : QueryParameters { /// /// Restrict to tasks that belong to process instances with the given business key. @@ -325,44 +325,15 @@ public class TaskQuery public bool? WithoutCandidateGroups; /// - /// 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 parameter. /// - public List> Sorting = new List>(); - - /// - /// - /// - /// Mandatory when is either - /// , , , or - /// - public TaskQuery Sort(TaskSorting sortBy, SortOrder sortOrder = SortOrder.Ascending, VariableOrder variable = null) - { - Dictionary 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() { - ["variable"] = variable.VariableName, - ["type"] = variable.Type.ToString(), - }; - } - - Sorting.Add(new SortingInfo() { SortBy = sortBy, SortOrder = sortOrder, Parameters = parameters }); + public TaskSorting SortBy; + + /// + /// Sort the results in a given order. Must be used in conjunction with the parameter. + /// + public SortOrder SortOrder; - return this; - } } public enum TaskSorting @@ -379,12 +350,10 @@ public enum TaskSorting Name, NameCaseInsensitive, Priority, - ProcessVariable, ExecutionVariable, TaskVariable, CaseExecutionVariable, CaseInstanceVariable } - }