DOCUMENTS 5 - PortalScripting API
Public Member Functions | Public Attributes | List of all members
UserAction Class Reference

The UserAction class represents the user-defined action of DOCUMENTS. More...

Public Member Functions

boolean addToFolder (Folder folder)
 Add the user action to a Folder. More...
 
String getLastError ()
 Get the description of the last error that occurred. More...
 
String getOID (boolean oidLow=false)
 Returns the object-id. More...
 
int getPosition ()
 Retrieve the position of the user action within the user-defined action list of the parent object. More...
 
boolean remove ()
 Remove the user action from the parent object. More...
 
boolean setContext (String context)
 Set the context for a user action of type JSP. More...
 
boolean setCreateDefaultWorkflow (boolean createDefaultWorkflow)
 Set the flag whether to create the default workflow for a user action of type NewFile. More...
 
boolean setFileTypeForNewFile (String fileType)
 Set the file type for a user action of type NewFile. More...
 
boolean setPortalScript (String scriptName)
 Set the portal script for a user action of type PortalScript. More...
 
boolean setPosition (int position)
 Place the user action at the given position in the user-defined action list of the parent object. More...
 
UserAction UserAction (String name, String label="", String widget="Button", String type="NewFile", String scope="Unrestricted")
 Create a new instance of the UserAction class. More...
 

Public Attributes

String label
 The entire label defined for the UserAction object. More...
 
String name
 The technical name of the UserAction object. More...
 
String scope
 The scope of the UserAction object. More...
 
String type
 The type of the UserAction object. More...
 
String widget
 The widget identifier of the UserAction object. More...
 

Detailed Description

The UserAction class represents the user-defined action of DOCUMENTS.

Since
DOCUMENTS 4.0d
Example:
var folder = context.createFolder("test", "public");
var action = new UserAction("testAction");
action.widget = "DropdownList";
action.setFileTypeForNewFile("FileType1");
if (!action.addToFolder(folder))
util.out(action.getLastError());

Constructor & Destructor Documentation

◆ UserAction()

UserAction UserAction::UserAction ( String  name,
String  label = "",
String  widget = "Button",
String  type = "NewFile",
String  scope = "Unrestricted" 
)

Create a new instance of the UserAction class.

Parameters
nameString value containing the desired user action name.
labelString value containing the desired user action label.
widgetString value containing the desired user action widget.
typeString value containing the desired user action type.
scopeString value containting the desired user action scope.
Since
DOCUMENTS 4.0d
Example:
var action = new UserAction("testAction", "de:Aktion;en:Action", "DropdownList", "PortalScript", "ProcessesOnly");
See also
UserAction.widget, UserAction.type, UserAction.scope

Member Function Documentation

◆ addToFolder()

boolean UserAction::addToFolder ( Folder  folder)

Add the user action to a Folder.

Parameters
folderFolder object representing the desired Folder.
Returns
true if successful, false in case of any error
Since
DOCUMENTS 4.0d
Example:
var it = context.getFoldersByName("testFolder");
var folder = it.first();
if (folder)
{
var action = new UserAction("testAction");
if (action)
{
if (!action.addToFolder(folder))
util.out(action.getLastError());
}
}

◆ getLastError()

String UserAction::getLastError ( )

Get the description of the last error that occurred.

Returns
Text of the last error as String
Since
DOCUMENTS 4.0d

◆ getOID()

String UserAction::getOID ( boolean  oidLow = false)

Returns the object-id.

Parameters
oidLowOptional flag:
If true only the id of the user action object (m_oid) will be returned.
If false the id of the user action object will be returned together with the id of the corresponding class in the form class-id:m_oid.
The default value is false.
Returns
String with the object-id or an empty string in case the user action has not yet been added to a proper parent object.
Since
DOCUMENTS 4.0d
DOCUMENTS 5.0 (new parameter oidLow)

◆ getPosition()

int UserAction::getPosition ( )

Retrieve the position of the user action within the user-defined action list of the parent object.

Returns
The zero-based position of the user action as integer or -1 in case of any error.
Since
DOCUMENTS 4.0d
Example:
var it = context.getFoldersByName("testFolder");
var folder = it.first();
if (folder)
{
var action = folder.getActionByName("testAction");
if (action)
util.out(action.getPosition());
}

◆ remove()

boolean UserAction::remove ( )

Remove the user action from the parent object.

Note
If the user action has not yet been added to a proper parent object, this function does nothing.
Returns
true if successful, false in case of any error
Since
DOCUMENTS 4.0d
Example:
var it = context.getFoldersByName("testFolder");
var folder = it.first();
if (folder)
{
var action = folder.getActionByName("testAction");
if (action)
action.remove();
}

◆ setContext()

boolean UserAction::setContext ( String  context)

Set the context for a user action of type JSP.

Parameters
contextString containing the desired context.
Returns
true if successful, false in case of any error
Note
This function is only available for a user action of type JSP.
Since
DOCUMENTS 4.0d
Example:
var action = new UserAction("testAction");
action.type = "JSP";
if (!action.setContext("myContext"))
util.out(action.getLastError());

◆ setCreateDefaultWorkflow()

boolean UserAction::setCreateDefaultWorkflow ( boolean  createDefaultWorkflow)

Set the flag whether to create the default workflow for a user action of type NewFile.

Parameters
createDefaultWorkflowFlag indicating whether to create the default workflow for a new file.
Returns
true if successful, false in case of any error
Note
This function is only available for a user action of type NewFile.
Since
DOCUMENTS 4.0d
Example:
var action = new UserAction("testAction");
if (!action.setCreateDefaultWorkflow(false))
util.out(action.getLastError());

◆ setFileTypeForNewFile()

boolean UserAction::setFileTypeForNewFile ( String  fileType)

Set the file type for a user action of type NewFile.

Parameters
fileTypeThe technical name of the desired file type; use empty string ('') if you want to remove the associated file type.
Returns
true if successful, false in case of any error
Note
This function is only available for a user action of type NewFile.
Since
DOCUMENTS 4.0d
Example:
var action = new UserAction("testAction");
if (!action.setFileTypeForNewFile("Filetype1"))
util.out(action.getLastError());
// You can remove the file type as follows:
action.setFileTypeForNewFile('');

◆ setPortalScript()

boolean UserAction::setPortalScript ( String  scriptName)

Set the portal script for a user action of type PortalScript.

Parameters
scriptNameThe name of the desired portal script; use empty string ('') if you want to remove the associated script.
Returns
true if successful, false in case of any error
Note
This function is only available for a user action of type PortalScript.
Since
DOCUMENTS 4.0d
Example:
var action = new UserAction("testAction");
action.type = "PortalScript";
if (!action.setPortalScript("testScript"))
util.out(action.getLastError());
// You can remove the script as follows:
action.setPortalScript('');

◆ setPosition()

boolean UserAction::setPosition ( int  position)

Place the user action at the given position in the user-defined action list of the parent object.

Note
0 at the beginning and -1 at the end.
Parameters
positionThe 0-based position for the user action.
Returns
true if successful, false in case of any error.
Since
DOCUMENTS 4.0d
Example:
var it = context.getFoldersByName("testFolder");
var folder = it.first();
if (folder)
{
var action = folder.getActionByName("testAction");
if (action)
action.setPosition(-1);
}

Member Data Documentation

◆ label

String UserAction::label

The entire label defined for the UserAction object.

Returns
String containing the entire label.
Since
DOCUMENTS 4.0d

◆ name

String UserAction::name

The technical name of the UserAction object.

Returns
String containing the technical name of the UserAction.
Since
DOCUMENTS 4.0d

◆ scope

String UserAction::scope

The scope of the UserAction object.

Returns
String containing the scope. There are three possible scopes available:
  • Unrestricted
  • ProcessesOnly
  • EasArchiveOnly
Since
DOCUMENTS 4.0d

◆ type

String UserAction::type

The type of the UserAction object.

Returns
String containing the type. There are four possible types available:
  • NewFile
  • PortalScript
  • JSP
  • Gadget
Since
DOCUMENTS 4.0d

◆ widget

String UserAction::widget

The widget identifier of the UserAction object.

Returns
String containing the widget identifier. There are two possible widget identifiers available:
  • Button
  • DropdownList
Since
DOCUMENTS 4.0d

This documentation refers DOCUMENTS 5.0e (2105).
Created at 11-09-2019. - © 1998-2019 otris software AG, Königswall 21, D-44137 Dortmund. support@otris.de