You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

Introduction

The purpose of this task is to clear all tokens for the specified product code and manufacturing code that are have passed their token expiry date.

The task can be found by navigating to "Administration | Tasks", then scrolling down to the task "Clear expired tokens";

Task Parameters

The task parameters are used by the task script to determine which tokens are to be deleted and are edited by left clicking on the context menu of the task and selecting "Parameters";

A new window titled "Task Parameters" will now open that lists the parameters making them available for editing, and the default parameters for this task are as follows;




Specifies the Product Code of the tokens to be deleted.


The parameters may then be editing by selecting one of the parameters, then clicking on the button.

  • Before tasks are scheduled (or run manually), we should provide the task parameters that are used during processing of the task script.

    To access the task parameters left click on the context menu of the task then select "Parameters";

    A new window titled "Task Parameters" will now open that lists the parameters that have been created for this task (see example below);



    Specify the domain that assigned users of the tokens must be members of if the tokens are to be deleted by the task.

    Specifies the Product Code of the tokens to be deleted.


    Specifies if only inactive tokens are to be deleted when the task is run.

    In the top right hand corner of this window are the buttons that all viewing, editing and deletion of task parameters;

    To edit one of the listed parameters first select the parameter to be edited then click on the button.

    A new window will now open that will allow you to edit the parameter (example below);

    In most cases the only value that should be changed is the "Default Value" setting.

    If the default value is updated, and the button is pressed, then this new value will be used by the task script next time the task is run.

Editing and Scheduling the Task

Viewing and Editing the task

The task can be edited by left clicking on the context menu of the task and selecting "Edit";

A new window will now open titled "Task - Edit";




Enter the name to be assigned to the task within the management console.


Enter a description of what the task will do.


The version number of the task.


This field is used to specify when the task is scheduled to execute.


This field will determine if the task schedule is enabled (if enabled the task will execute at the scheduled time).


Specifies how many times the task should be repeated after the task is executed.



import com.deepnet.das.token.*
import com.deepnet.das.util.*
import com.deepnet.das.exception.ProductNotFoundException

def prod = null

if (!Util.isNullOrEmpty(product)) {
                    prod = Product.findById(product as long)
if(!prod)
throw new ProductNotFoundException()
}

def criteria = TokenAssignment.createCriteria()
def now = new Date()

def query = {
if(prod){
token{
eq('product', prod)
}
}

and {
isNotNull 'expires'
lt 'expires', now
}
}

def count = 0
def all = criteria.list(query)

all.each{
it.unlink()
count++
onProgress(count, "Tokens deleted:  " + count)
}

def msg =  count + " tokens deleted"
setEndMessage(msg)

Scheduling the Task

Select the "Enable Schedule" checkbox to ensure the task schedule is activated, then use the pencil icon ("")  to specify the time and frequency settings for automated task execution.

  • Unable to render {include} The included page could not be found.

Manual Task Execution

The task can be run manually from the management console by left click on the context menu of the task, then selecting "Run";


A new window will open titled "Execute Task" will then open (the window will be populated with the default task property values);




Provide a brief description that will be used to describe the purpose of the task in the audit log.


If specified, this property will restrict token deletion to tokens that have the specified Product Code.



To execute the task click  the  button.

  • Unable to render {include} The included page could not be found.
  • No labels