diff --git a/lib/process-services-cloud/src/lib/process/process-filters/models/process-filter-cloud.model.ts b/lib/process-services-cloud/src/lib/process/process-filters/models/process-filter-cloud.model.ts index 93d4e5750a..ab87e9f8c8 100644 --- a/lib/process-services-cloud/src/lib/process/process-filters/models/process-filter-cloud.model.ts +++ b/lib/process-services-cloud/src/lib/process/process-filters/models/process-filter-cloud.model.ts @@ -108,17 +108,56 @@ export class ProcessFilterCloudModel { this._suspendedFrom = obj._suspendedFrom || null; this._suspendedTo = obj._suspendedTo || null; - this.processDefinitionNames = obj.processDefinitionNames || obj.processDefinitionName ? [obj.processDefinitionName] : null; - this.processNames = obj.processNames || obj.processName ? [obj.processName] : null; - this.processInstanceIds = obj.processInstanceIds || obj.processInstanceId ? [obj.processInstanceId] : null; - this.parentIds = obj.parentIds || obj.parentId ? [obj.parentId] : null; - this.initiators = obj.initiators || obj.initiator ? [obj.initiator] : null; - this.appVersions = obj.appVersions || obj.appVersion ? [`${obj.appVersion}`] : null; - this.statuses = obj.statuses || obj.status ? [obj.status] : null; - this.processVariableFilters = obj.processVariableFilters ?? []; + this.initArrayProperties(obj); } } + private initArrayProperties(obj) { + if (obj.processDefinitionNames) { + this.processDefinitionNames = obj.processDefinitionNames; + } else { + this.processDefinitionNames = obj.processDefinitionName ? [obj.processDefinitionName] : null; + } + + if (obj.processNames) { + this.processNames = obj.processNames; + } else { + this.processNames = obj.processName ? [obj.processName] : null; + } + + if (obj.processInstanceIds) { + this.processInstanceIds = obj.processInstanceIds; + } else { + this.processInstanceIds = obj.processInstanceId ? [obj.processInstanceId] : null; + } + + if (obj.parentIds) { + this.parentIds = obj.parentIds; + } else { + this.parentIds = obj.parentId ? [obj.parentId] : null; + } + + if (obj.initiators) { + this.initiators = obj.initiators; + } else { + this.initiators = obj.initiator ? [obj.initiator] : null; + } + + if (obj.appVersions) { + this.appVersions = obj.appVersions; + } else { + this.appVersions = obj.appVersion ? [`${obj.appVersion}`] : null; + } + + if (obj.statuses) { + this.statuses = obj.statuses; + } else { + this.statuses = obj.status ? [obj.status] : null; + } + + this.processVariableFilters = obj.processVariableFilters ?? []; + } + set completedFrom(completedFrom: string) { this._completedFrom = completedFrom; } diff --git a/lib/process-services-cloud/src/lib/task/task-filters/models/filter-cloud.model.ts b/lib/process-services-cloud/src/lib/task/task-filters/models/filter-cloud.model.ts index cba7ba82f9..606f400f08 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/models/filter-cloud.model.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/models/filter-cloud.model.ts @@ -123,20 +123,74 @@ export class TaskFilterCloudModel { this.candidateGroups = obj.candidateGroups || null; this.showCounter = obj.showCounter || false; - this.taskNames = obj.taskNames || obj.taskName ? [obj.taskName] : null; - this.statuses = obj.statuses || obj.status ? [obj.status] : null; - this.assignees = obj.assignees || obj.assignee ? [obj.assignee] : null; - this.processNames = obj.processNames || obj.processName ? [obj.processName] : null; - this.processDefinitionNames = obj.processDefinitionNames || obj.processDefinitionName ? [obj.processDefinitionName] : null; - this.taskIds = obj.taskIds || obj.taskId ? [obj.taskId] : null; - this.parentTaskIds = obj.parentTaskIds || obj.parentTaskId ? [obj.parentTaskId] : null; - this.processInstanceIds = obj.processInstanceIds || obj.processInstanceId ? [obj.processInstanceId] : null; - this.priorities = obj.priorities || obj.priority ? [obj.priority] : null; - this.completedByUsers = obj.completedByUsers || obj.completedBy ? [obj.completedBy] : null; - this.processVariableFilters = obj.processVariableFilters ?? []; + this.initArrayProperties(obj); } } + private initArrayProperties(obj) { + if (obj.taskNames) { + this.taskNames = obj.taskNames; + } else { + this.taskNames = obj.taskName ? [obj.taskName] : null; + } + + if (obj.statuses) { + this.statuses = obj.statuses; + } else { + this.statuses = obj.status ? [obj.status] : null; + } + + if (obj.assignees) { + this.assignees = obj.assignees; + } else { + this.assignees = obj.assignee ? [obj.assignee] : null; + } + + if (obj.processNames) { + this.processNames = obj.processNames; + } else { + this.processNames = obj.processName ? [obj.processName] : null; + } + + if (obj.processDefinitionNames) { + this.processDefinitionNames = obj.processDefinitionNames; + } else { + this.processDefinitionNames = obj.processDefinitionName ? [obj.processDefinitionName] : null; + } + + if (obj.taskIds) { + this.taskIds = obj.taskIds; + } else { + this.taskIds = obj.taskId ? [obj.taskId] : null; + } + + if (obj.parentTaskIds) { + this.parentTaskIds = obj.parentTaskIds; + } else { + this.parentTaskIds = obj.parentTaskId ? [obj.parentTaskId] : null; + } + + if (obj.processInstanceIds) { + this.processInstanceIds = obj.processInstanceIds; + } else { + this.processInstanceIds = obj.processInstanceId ? [obj.processInstanceId] : null; + } + + if (obj.priorities) { + this.priorities = obj.priorities; + } else { + this.priorities = obj.priority ? [obj.priority] : null; + } + + if (obj.completedByUsers) { + this.completedByUsers = obj.completedByUsers; + } else { + this.completedByUsers = obj.completedBy ? [obj.completedBy] : null; + } + + this.processVariableFilters = obj.processVariableFilters ?? []; + } + set dueDateFrom(dueDateFrom: string) { this._dueDateFrom = dueDateFrom; }