Release 2.x‎ > ‎Install - Reference‎ > ‎

Functions Plugins Guide


This guide will cover available functions and plugins in Project OpenPTK.  An example of many of these functions and plugins can be found in the Sample XML Configuration File (openptk.xml).



Functions

A Function is used to automatically derive and/or validate the Attribute in a particular Context and Operation. There can be multiple Functions. Each Functions will be processed in the order in which they are defined in the config file. The Function will be activated under one or both of these two conditions:

An example Function is defined below.  For all the details on Functions, please refer to the OpenPTK Configuration Guide.

Example Function

<Function id="InConcat" useexisting="true" classname="org.openptk.provision.definition.functions.Concat"> <Arguments> <Argument name="arg1" type="attribute" value="firstname"/> <Argument name="arg2" type="literal" value=" "/> <Argument name="arg3" type="attribute" value="lastname"/> </Arguments> <Operations> <Operation type="create"/> <Operation type="update"/> </Operations> </Function>


CalculateDigest


ConcatStrings


DateTimeStamp


DetectMimeType


EmailFormat


FirstInitialLastInitialEmployeeNumber


FirstInitialLastname


GUID


GenRandomData

This function will generate random data to be used to fill an attribute with randomly created data.  The properties can request random data based on size, case, numeric and/or alpha and a specific character set.  The function uses the class org.openptk.util.RandomData to generate the data.

ClassName

org.openptk.definition.functions.GenRandomData

Properties

Name Required Description Possible Values
size No Numer of characters to generate and return.  If no size property is specified, then 8 characters will be returned.
integer
case No In the case of any alpha characters returned, should the case be returned as lower or upper case.  If no case property is specified, then the generated alpha characters will be returned as generated (i.e. both). both|upper|lower
type No Specified whether alpha (a-zA-Z), numeric (0-9) or both (a-zA-Z0-9) are returned.  if no type property is specified, then the generated data will return both alpha and numeric (i.e. both)
both|alpha|numeric
charset No Specifies a string of characters used to generate the random data.  This can be any string (i.e. abcde0123456789).  If no charset property is specified, then all alphanumeric (a-zA-Z0-9) characters will be used to generate the random data. "abcde0123456789"

Example Usage

<Attribute id="password" required="true"> <Functions> <Function id="password" useexisting="true" classname="org.openptk.definition.functions.GenRandomData"> <Arguments> <Argument name="size" type="literal" value="8" /> <Argument name="type" type="literal" value="alpha" /> <Argument name="case" type="literal" value="both" /> </Arguments> <Operations> <Operation type="create" /> </Operations> </Function> </Functions> </Attribute>
 

PrefixFirstInitialLastname


SubString


Plugins

Define Plugins Here