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

The CustomProperty class provides access to the user properties. More...

Public Member Functions

CustomProperty addSubProperty (String name, String type, String value)
 Creates a new subproperty for the custom property. More...
 
boolean deleteCustomProperty ()
 Deletes the CustomProperty. More...
 
String getAttribute (String attribute)
 Get the String value of an attribute of the CustomProperty. More...
 
String getLastError ()
 Function to get the description of the last error that occurred. More...
 
CustomPropertyIterator getSubProperties (String nameFilter="", String typeFilter="")
 Get a CustomPropertyIterator with subproperties of the custom property. More...
 
boolean setAccessProfile (String nameAccessProfile="")
 Connects a custom property to an AccessProfile. More...
 
boolean setAttribute (String attribute, String value)
 Set the String value of an attribute of the CustomProperty to the desired value. More...
 
boolean setFiletype (String nameFiletype="")
 Connects a custom property to a filetype. More...
 
CustomProperty setOrAddSubProperty (String name, String type, String value)
 Creates a new subproperty or modifies a subproperty according the name and type for the custom property. More...
 
boolean setSystemUser (String login="")
 Connects a custom property to a SystemUser. More...
 

Public Attributes

String name
 String containing the name of the CustomProperty.
 
String type
 String containing the type of the CustomProperty.
 
String value
 String containing the value of the CustomProperty.
 

Detailed Description

The CustomProperty class provides access to the user properties.

The class CustomProperty provides a container where used specific data can be stored. E.g it will be used to store the last search masks. You can save project specific data using this class. The scripting classes SystemUser, AccessProfile and Context have the following access methods available:

In the DOCUMENTS-Manager you can find the CustomProperty on the relation-tab properties at the fellow and user account, access profiles and file types. The global custom properties are listed in Documents > Global properties. A global custom property must not belong to a SystemUser, an AccessProfile, a file type and another custom property. All custom properties are located in Documents > All properties.

Since
DOCUMENTS 4.0a
DOCUMENTS 5.0 available for AccessProfile and Context
Example:
var user = context.findSystemUser("schreiber");
if (!user)
throw "invalid user";
// Creation of an unique (name, type) CustomProperty
var custProp = user.setOrAddCustomProperty("superior", "person", "oppen");
if (!custProp)
throw "unable to create CustomProperty " + user.getLastError();
util.out("New CustomProperty: " + custProp.name);
custProp.deleteCustomProperty();
// Creation of multiple equal (name, type) CustomProperty
for (var i=0; i<5; i++)
{
var custProp = user.addCustomProperty("favorites", "something", "value_" + i);
}
var name = "favorites";
var type = "";
var it = user.getCustomProperties(name, type);
for (var prop = it.first(); prop; prop = it.next())
{
if (prop.type == "something")
prop.deleteCustomProperty();
}
See also
SystemUser.getCustomProperties(String nameFilter, String typeFilter)
SystemUser.setOrAddCustomProperty(String name, String type, String value)
SystemUser.addCustomProperty(String name, String type, String value)

Member Function Documentation

◆ addSubProperty()

CustomProperty CustomProperty::addSubProperty ( String  name,
String  type,
String  value 
)

Creates a new subproperty for the custom property.

Parameters
nameString value defining the name
typeString value defining the type
valueString value defining the value
Returns
CustomProperty
Since
DOCUMENTS 5.0
Example:
var currentUser = context.getSystemUser();
if (!currentUser) throw "currentUser is NULL";
var custProp = currentUser.setOrAddCustomProperty("superior", "string", "oppen");
if (!custProp)
util.out(currentUser.getLastError());
else
custProp.addSubProperty("Address", "string", "Dortmund");
See also
CustomProperty.setOrAddSubProperty(String name, String type, String value)
CustomProperty.getSubProperties(String nameFilter, String typeFilter)

◆ deleteCustomProperty()

boolean CustomProperty::deleteCustomProperty ( )

Deletes the CustomProperty.

Returns
true if successful, false in case of any error
Since
DOCUMENTS 4.0a

◆ getAttribute()

String CustomProperty::getAttribute ( String  attribute)

Get the String value of an attribute of the CustomProperty.

Valid attribute names are name, type and value

Parameters
attributeString containing the name of the desired attribute
Returns
String containing the value of the desired attribute
Since
DOCUMENTS 4.0a

◆ getLastError()

String CustomProperty::getLastError ( )

Function to get the description of the last error that occurred.

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

◆ getSubProperties()

CustomPropertyIterator CustomProperty::getSubProperties ( String  nameFilter = "",
String  typeFilter = "" 
)

Get a CustomPropertyIterator with subproperties of the custom property.

Parameters
nameFilterString value defining an optional filter depending on the name
typeFilterString value defining an optional filter depending on the type
Returns
CustomPropertyIterator
Since
DOCUMENTS 5.0
Example:
var currentUser = context.getSystemUser();
if (!currentUser) throw "currentUser is NULL";
var itProp = currentUser.getCustomProperties();
for (var prop = itProp.first(); prop; prop = itProp.next())
{
util.out(prop.name + ": " + prop.value);
var itSubprop = prop.getSubProperties();
for (var subprop = itSubprop.first(); subprop; subprop = itSubprop.next())
{
util.out("Subproperty name: " + subprop.name + " Value: " + subprop.value);
}
}
See also
CustomProperty.setOrAddSubProperty(String name, String type, String value)
CustomProperty.addSubProperty(String name, String type, String value)

◆ setAccessProfile()

boolean CustomProperty::setAccessProfile ( String  nameAccessProfile = "")

Connects a custom property to an AccessProfile.

An empty profile name disconnects the AccessProfile

Parameters
nameAccessProfileOptional String value containing the name of the AccessProfile
Returns
true if successful, false in case of any error
Since
DOCUMENTS 5.0
Example:
if (!custProp.setAccessProfile("Service"))
throw custProp.getLastError();
custProp.setAccessProfile(""); // disconnects AccessProfile
See also
CustomProperty.setSystemUser(String login)
CustomProperty.setFiletype(String nameFiletype)

◆ setAttribute()

boolean CustomProperty::setAttribute ( String  attribute,
String  value 
)

Set the String value of an attribute of the CustomProperty to the desired value.

Valid attribute names are name, type and value

Parameters
attributeString containing the name of the desired attribute
valueString containing the desired value of the attribute
Returns
true if successful, false in case of any error
Since
DOCUMENTS 4.0a

◆ setFiletype()

boolean CustomProperty::setFiletype ( String  nameFiletype = "")

Connects a custom property to a filetype.

An empty filetype name disconnects the filetype

Parameters
nameFiletypeOptional String value containing the technical name of the filetype
Returns
true if successful, false in case of any error
Since
DOCUMENTS 5.0
Example:
if (!custProp.setFiletype("ftInvoice"))
throw custProp.getLastError();
custProp.setFiletype(""); // disconnects filetype
See also
CustomProperty.setSystemUser(String login)
CustomProperty.setAccessProfile(String nameAccessProfile)

◆ setOrAddSubProperty()

CustomProperty CustomProperty::setOrAddSubProperty ( String  name,
String  type,
String  value 
)

Creates a new subproperty or modifies a subproperty according the name and type for the custom property.

This method creates or modifies a unique subproperty for the custom property. The combination of the name and the type make the subproperty unique for the custom property.

Parameters
nameString value defining the name
typeString value defining the type
valueString value defining the value
Returns
CustomProperty
Since
DOCUMENTS 5.0
Example:
var currentUser = context.getSystemUser();
if (!currentUser) throw "currentUser is NULL";
var custProp = currentUser.setOrAddCustomProperty("superior", "string", "oppen");
if (!custProp)
util.out(currentUser.getLastError());
else
custProp.setOrAddSubProperty("Address", "string", "Dortmund");
See also
CustomProperty.getSubProperties(String nameFilter, String typeFilter)
CustomProperty.addSubProperty(String name, String type, String value)

◆ setSystemUser()

boolean CustomProperty::setSystemUser ( String  login = "")

Connects a custom property to a SystemUser.

An empty login disconnects the SystemUser

Parameters
loginOptional String value containing the login name of the SystemUser.
Returns
true if successful, false in case of any error
Since
DOCUMENTS 5.0
Example:
if (!custProp.setSystemUser("schreiber"))
throw custProp.getLastError();
custProp.setSystemUser(""); // disconnects SystemUser
See also
CustomProperty.setFiletype(String nameFiletype)
CustomProperty.setAccessProfile(String nameAccessProfile)

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