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

The Register class has been added to the DOCUMENTS PortalScripting API to gain full access to the registers of a DOCUMENTS file by scripting means. More...

Public Member Functions

boolean addFileLink (DocFile file)
 Adds a file to a file link register. More...
 
boolean deleteDocument (Document doc)
 Delete a Document at the Register. More...
 
String getAttribute (String attribute)
 Get the String value of an attribute of the Register. More...
 
DocumentIterator getDocuments ()
 Retrieve a list of all Documents stored on the given Register. More...
 
DocFile getFile ()
 Returns the DocFile the Register belongs to. More...
 
FileResultset getFiles ()
 Retrieve a FileResultset of all DocFile objects linked to the register. More...
 
String getLastError ()
 Function to get the description of the last error that occurred. More...
 
String getOID (boolean oidLow=false)
 Returns the object-id. More...
 
boolean removeFileLink (DocFile file)
 Removes a file from a file link register. More...
 
boolean setAttribute (String attribute, String value)
 Set the String value of an attribute of the Register to the desired value. More...
 
Document uploadDocument (String filePath, String registerFileName)
 Upload a new Document stored on the server's filesystem to the Register. More...
 

Public Attributes

String label
 The ergonomic label of the Register object. More...
 
String name
 The technical name of the Register object. More...
 
String type
 The type of the Register object. More...
 

Private Member Functions

String getLocaleLabel (String locale)
 Get the ergonomic label of the Register. More...
 

Detailed Description

The Register class has been added to the DOCUMENTS PortalScripting API to gain full access to the registers of a DOCUMENTS file by scripting means.

Since
ELC 3.50n / otrisPORTAL 5.0n

Member Function Documentation

◆ addFileLink()

boolean Register::addFileLink ( DocFile  file)

Adds a file to a file link register.

Returns
true if successful, false in case of any error
Since
DOCUMENTS 5.0d
Example:
var file = context.file;
var linkFile = context.createFile("Filetype1");
var reg = file.getRegisterByName("flReg");
if (!reg.addFileLink(linkFile))
util.out(reg.getLastError());

◆ deleteDocument()

boolean Register::deleteDocument ( Document  doc)

Delete a Document at the Register.

With the necessary access rights the user can delete a Document at the Register.

Parameters
docDocument to delete
Returns
true if successful, false in case of any error
Since
ELC 3.60d / otrisPORTAL 6.0d
Example:
// deleting all documents at a register
var docFile = context.file;
var reg = docFile.getRegisterByName("Documents");
if (reg)
{
var docs = reg.getDocuments();
for (var doc = docs.first(); doc; doc = docs.next())
reg.deleteDocument(doc);
}

◆ getAttribute()

String Register::getAttribute ( String  attribute)

Get the String value of an attribute of the Register.

Parameters
attributeString containing the name of the desired attribute
Returns
String containing the value of the desired attribute
Since
ELC 3.50n / otrisPORTAL 5.0n
ELC 3.60i / otrisPORTAL 6.0i available for archive files

◆ getDocuments()

DocumentIterator Register::getDocuments ( )

Retrieve a list of all Documents stored on the given Register.

This method is available for documents registers only. You cannot use it with different types of Register objects.

Returns
DocumentIterator containing the Document objects stored on the Register
Since
ELC 3.50n / otrisPORTAL 5.0n
ELC 3.60i / otrisPORTAL 6.0i available for archive files
Example:
var docFile = context.file;
var reg = docFile.getRegisterByName("Documents");
var docIter = reg.getDocuments();
for (var doc = docIter.first(); doc; doc = docIter.next())
{
util.out(doc.Fullname);
}

◆ getFile()

DocFile Register::getFile ( )

Returns the DocFile the Register belongs to.

Returns
DocFile object or null if missing
Since
DOCUMENTS 5.0c HF1
Example:
var file = context.file;
var reg = file.getRegisterByName("RegisterA");
var alwaysTrue = reg.getFile().getid() == file.getid();

◆ getFiles()

FileResultset Register::getFiles ( )

Retrieve a FileResultset of all DocFile objects linked to the register.

Returns
FileResultset containing a list of all DocFile objects linked to the register.
Since
DOCUMENTS 4.0b
Example:
var docFile = context.file;
var reg = docFile.getRegisterByName("LinksReg");
if (reg)
{
var myFRS = reg.getFiles();
for (var file = myFRS.first(); file; file = myFRS.next())
util.out(file.getAutoText("title"));
}

◆ getLastError()

String Register::getLastError ( )

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

Returns
Text of the last error as String
Since
ELC 3.50n / otrisPORTAL 5.0n
ELC 3.60i / otrisPORTAL 6.0i available for archive files
See also
DocFile.getLastError()

◆ getLocaleLabel()

String Register::getLocaleLabel ( String  locale)
private

Get the ergonomic label of the Register.

Parameters
localeOptional String value with the locale abbreviation (according to the principal's configuration); if omitted, the current user's portal language is used automatically.
Returns
String containing the ergonomic label of the Register in the appropriate portal language.
Since
DOCUMENTS 5.0c HF1

◆ getOID()

String Register::getOID ( boolean  oidLow = false)

Returns the object-id.

Parameters
oidLowOptional flag:
If true only the id of the Register object (m_oid) will be returned.
If false the id of the Register 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
Since
ELC 3.60c / otrisPORTAL 6.0c
ELC 3.60i / otrisPORTAL 6.0i available for archive files
DOCUMENTS 5.0 (new parameter oidLow)

◆ removeFileLink()

boolean Register::removeFileLink ( DocFile  file)

Removes a file from a file link register.

Returns
true if successful, false in case of any error
Since
DOCUMENTS 5.0d
Example:
var file = context.file;
var reg = file.getRegisterByName("flReg");
var frs = reg.getFiles();
for (var linkFile = frs.first(); linkFile; linkFile = frs.next())
{
if (!reg.removeFileLink(linkFile))
util.out(reg.getLastError());
}

◆ setAttribute()

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

Set the String value of an attribute of the Register to the desired 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
ELC 3.50n / otrisPORTAL 5.0n
ELC 3.60i / otrisPORTAL 6.0i available for archive files

◆ uploadDocument()

Document Register::uploadDocument ( String  filePath,
String  registerFileName 
)

Upload a new Document stored on the server's filesystem to the Register.

The filePath parameter must contain not only the directory path but the filename as well. Otherwise the server will take the first file to be found in the given filePath. The registerFileName parameter has the purpose to allow to rename the Document already while uploading it.

Note
After successful upload of the Document the source file on the server's directory structure is removed!
Parameters
filePathString containing the filePath and filename of the desired file to be uploaded. Note: Backslashes contained in the filepath must be quoted with a leading backslash, since the backslash is a special char in ECMAScript!
registerFileNameString containing the desired target filename of the Document on the Register
Returns
Document if successful, null in case of any error
Since
ELC 3.50n / otrisPORTAL 5.0n
ELC 3.60i / otrisPORTAL 6.0i available for archive files
Example:
var docFile = context.file;
var reg = docFile.getRegisterByName("Documents");
var newDoc = reg.uploadDocument("c:\\tmp\\sourcefile.rtf", "Filename_on_Register.rtf");
if (!newDoc)
util.out("Error while uploading the file! " + reg.getLastError());
else
util.out(newDoc.Name);

Member Data Documentation

◆ label

String Register::label

The ergonomic label of the Register object.

Note
This property is readonly and cannot be overwritten.
Returns
String containing the ergonomic label of the Register
Since
ELC 3.50n / otrisPORTAL 5.0n
ELC 3.60i / otrisPORTAL 6.0i available for archive files

◆ name

String Register::name

The technical name of the Register object.

Note
This property is readonly and cannot be overwritten.
Returns
String containing the technical name of the Register
Since
ELC 3.50n / otrisPORTAL 5.0n
ELC 3.60i / otrisPORTAL 6.0i available for archive files

◆ type

String Register::type

The type of the Register object.

The possible values of the type attribute are listed below:

  • documents
  • fields
  • links
  • archiveddocuments
  • externalcall
Note
This property is readonly and cannot be overwritten.
Returns
String containing the type of the Register
Since
ELC 3.50n / otrisPORTAL 5.0n
ELC 3.60i / otrisPORTAL 6.0i available for archive files

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