File

projects/netgrif-components-core/src/lib/task/services/data-focus-policy.service.ts

Description

Handles the sequence of actions that are performed when a task si opened.

Extends

TaskHandlingService

Index

Methods

Constructor

constructor(_taskContentService: TaskContentService)
Parameters :
Name Type Optional
_taskContentService TaskContentService No

Methods

Public performDataFocusPolicy
performDataFocusPolicy()

Performs the selection of some data fields if the policy is set to Auto Required.

Returns : void
Protected isTaskPresent
isTaskPresent()
Inherited from TaskHandlingService
Returns : boolean

true if a {

Protected isTaskRelevant
isTaskRelevant(requestedTaskId: string)
Inherited from TaskHandlingService

Checks whether the current state of the TaskContentService and optionally if the SelectedCaseService, is still relevant to the task that was requested.

This method is useful if you use UnlimitedTaskContentService, or a similar implementation. It is possible for the currently "selected" task to change in-between a backend request was sent and the response was received. In that case the response is no longer relevant and should be discarded, otherwise an illegal task state could be achieved on frontend.

Parameters :
Name Type Optional Description
requestedTaskId string No

the stringId of the requested task

Returns : boolean

true if the requested task is still relevant to the state of the frontend. Returns false otherwise.

import {Injectable} from '@angular/core';
import {DataFocusPolicy} from '../../task-content/model/policy';
import {TaskContentService} from '../../task-content/services/task-content.service';
import {TaskHandlingService} from './task-handling-service';

/**
 * Handles the sequence of actions that are performed when a task si [opened]{@link TaskOperations#open}.
 */
@Injectable()
export class DataFocusPolicyService extends TaskHandlingService {

    constructor(_taskContentService: TaskContentService) {
        super(_taskContentService);
    }

    /**
     * Performs the selection of some data fields if the policy is set to [Auto Required]{@link DataFocusPolicy#autoRequired}.
     */
    public performDataFocusPolicy(): void {
        if (this._safeTask.dataFocusPolicy === DataFocusPolicy.autoRequired) {
            this.autoRequiredDataFocusPolicy();
        }
    }

    /**
     * Currently does nothing
     */
    private autoRequiredDataFocusPolicy(): void {
        // TODO Implement focus in FUTURE, if someone wants this feature (for now we don't want it )
    }
}

result-matching ""

    No results matching ""