LSPS documentation logo
LSPS Documentation
Functions

Todo

allocateTodo(todo* : Todo, person* : Person) : voidSIDE EFFECT

Allocates the todo to the person. If the to-do is allocated to another person, any form changes are dropped unless the todo is saved before the call.

Parameters:

  • todo todo to allocate
  • person person that belongs to the current todo assignees

Throws:

  • NullParameterError if a mandatory parameter is null
  • PersonIsNotAssigneeError if the person does not belong to the set of the current todo assignees
getCurrentTodo() : Todo
Returns the currently opened to-do. If not called from the context of a to-do, it returns null.
getTodoCurrentAssignees(todo* : Todo) : Set<Person>

Returns the set of persons who can see the todo. The function takes the effect of delegation, rejection, and substitution into account.

getTodoCurrentAssignees(findById(Todo, 13006))

Parameters:

  • todo todo

Throws:

  • NullParameterError if a mandatory parameter is null
getTodoPerformers(todo* : Todo) : Set<Performer>

Returns the set of the performers of the todo as defined by the corresponding taskl; that means it returns the set of the RoleUnits and Persons as defined by the performers parameter of the task.

getTodoPerformers(findById(Todo, 13004))
//returns 
//{
//human::Person(name->"john", id->"john0", firstName->"john", lastName->"john", email->"john@john.com", phone->"", isEnabled->true),
// human::Role(name->"orgModel::MyRole", parameters->Map<String, Null>, metadata->Map<Null, Null>)
//}

Parameters:

  • todo todo

Throws:

  • NullParameterError if a mandatory parameter is null
getTodoSubmitter(todo* : Todo) : Person

Returns the person who submitted the todo. The todo must be in the "Accomplished" state, otherwise the call returns null.

getTodoSubmitter(Todo.findById(13005))

Parameters:

  • todo accomplished todo

Throws:

  • NullParameterError if a mandatory parameter is null
getTodosFor(person* : Person) : Set<Todo>

Returns the set of alive to-dos that are assigned to the person and not allocated to any other person.

getTodosFor(getPerson("john"))

Parameters:

  • person

Throws:

  • NullParameterError if a mandatory parameter is null
getTodosFor(person* : Person, includeAllocatedByOthers* : Boolean) : Set<Todo>

Returns the set of alive to-dos assigned to the person and provides the option to include or exclude to-dos allocated to other persons.

getTodosFor(getPerson("john"), true)

Parameters:

  • person
  • includeAllocatedByOthers whether the output includes the to-dos allocated to another person

Throws:

  • NullParameterError if a mandatory parameter is null
reassignTodo(todo* : Todo, performers* : Set<Performer>) : voidSIDE EFFECT

Changes the set of performers of the todo. Delegations and allocation are removed.

Parameters:

  • todo todo to reassign
  • performers the set of new perfomers

Throws:

  • NullParameterError if a mandatory parameter is null
rejectTodo(todo* : Todo, persons* : Set<Person>, reason : String) : voidSIDE EFFECT

Rejects the todo on behalf of the persons.

rejectTodo(
    getCurrentTodo(),
    { getPerson("admin") },
    "I am admin and will not deal with this."
    )
}

Parameters:

  • todo todo to reject
  • persons persons that reject the todo
  • reason message with the rejection reason

Throws:

  • NullParameterError if a mandatory parameter is null
resetTodo(todo* : Todo) : voidSIDE EFFECT

Removes any saved states of the todo.

Parameters:

  • todo

Throws:

  • NullParameterError if a mandatory parameter is null
unallocateTodo(todo* : Todo) : voidSIDE EFFECT

Unallocates a todo (unlocks a to-do locked by a user) and assigns it to the initial performers as defined in the Performers parameter of the task. Any form changes are dropped unless the todo is saved before the call.

Parameters:

  • todo to-do to unallocate

Throws:

  • NullParameterError if a mandatory parameter is null

Organization

addPersonToRole(person* : Person, roleUnit* : RoleUnit) : voidSIDE EFFECT

Adds the person to the role. Note that atempting to add a person to an organization unit results in a runtime exception.

addPersonToRole(getPerson("john"), Developer(["project"->"lsps"]))

Parameters:

  • person person
  • roleUnit role or role unit

Throws:

  • NullParameterError if a mandatory parameter is null
anyPerformer() : Performer
Returns a performer representing any process performer; with this performer, every performer has access to the entity.
children(roleUnit* : RoleUnit) : Set<RoleUnit>

Returns the set of the direct children of a role unit, that is, an organization role or a unit.

children(getRoleUnitByName("org", "Engineering"))

Parameters:

  • roleUnit role or organization unit

Throws:

  • NullParameterError if a mandatory parameter is not specified
emailAddresses(performers* : Set<Performer>) : Set<String>

Returns the set of email addresses of the performers. If a performer is of the type Person, its email address is added to the result. If a performer is of type RoleUnit, email addresses of all persons in that role or organization unit are added to the result.

Parameters:

  • performers

Throws:

  • NullParameterError if a mandatory parameter is null
emailAddresses(roleUnits : RoleUnit...) : Set<String>

Returns the set of email addresses of persons in the specified roles or organisation units.

Parameters:

  • roleUnits
getCurrentPerson() : Person

Returns the person who has initiated the current model processing request; for example, the person who has submitted a to-do or called a web service.

In the case of receiving time events or signals, the technical person “ProcessAgent” is returned; when called from the management perspective of PDS, the admin user is returned (this applies, for example, when you restart a model instance: the user who started the model instance is set to admin).

getLabel(roleUnit* : RoleUnit) : String

Returns the roleUnit label.

Parameters:

  • roleUnit

Throws:

  • NullParameterError if a mandatory parameter is null
getPerson(name* : String) : Person

Returns a person with the specified login name.

getPerson("john")

Parameters:

  • name name of the person

Throws:

  • NullParameterError if a mandatory parameter is not specified
  • PersonNotFoundError if there is no such person
getPersonFullName(person* : Person) : String

Returns the first and last name of the specified person.

getPersonFullName("john")
//returns "John Doe"

Parameters:

  • person

Throws:

  • NullParameterError if a mandatory parameter is null
getPersonPicture(person* : Person) : File

Returns the profile picture of the person. Returns null if no picture for the person exists.

Parameters:

  • person person

Throws:

  • NullParameterError if a mandatory parameter is not specified
getPersonProperties(person* : Person) : Map<String, String>

Returns the properties of the person.

Parameters:

  • person

Throws:

  • NullParameterError if a mandatory parameter is null
getPersonRoles(person* : Person) : Set<Role>

Returns the set of organization roles assigned to the person.

getPersonRoles(getPerson("develWithProject"))[0].parameters
//returns the paramater of the 1st role

Parameters:

  • person

Throws:

  • NullParameterError if a mandatory parameter is null
getPersonWithId(id* : String) : Person

Returns a person with the id.

getPersonWithId("john0")

Parameters:

  • id id of the person

Throws:

  • NullParameterError if a mandatory parameter is not specified
  • PersonNotFoundError if there is no such person
getRoleUnitByName(module* : String, name* : String) : RoleUnit

Returns an organization role or an organization unit with the specidi.

getRoleUnitByName("org", "Developer")

Parameters:

  • module module with the role unit
  • name name of the role unit

Throws:

  • NullParameterError if a mandatory parameter is not specified
  • RoleUnitNotFoundError if there is no such role or a unit
getRoleUnitByName(module* : String, name* : String, parameters : Map<String, String>) : RoleUnit

Returns an existing organization role or an organization unit with the parameters specified in the map and assigns the parameters the specified values.

addPersonToRole(
   getPerson("manager"), 
   getRoleUnitByName("org", "Developer", ["project" -> "lsps"])
 ) 
 //gets the manager person and assigns it the Developer role
 //with the parameter project set to lsps

Parameters:

  • module module with the role unit
  • name name of the role unit
  • parameters parameters of the role unit with the required values

Throws:

  • NullParameterError if a mandatory parameter is not specified
  • RoleUnitNotFoundError if no such role or a unit exists
isPersonIn(person* : Person, roleUnit* : RoleUnit) : Boolean

Returns true if the person belongs to the given roleUnit. A person belongs to a given organization role or unit if it belongs to the role directly or if it belongs to any of the role's or unit's descendants (evaluated recursively).

isPersonIn(getPerson("john"), getRoleUnitByName("org", "Engineering"))

Parameters:

  • person person
  • roleUnit role unit the person potentially belongs to

Throws:

  • NullParameterError if a mandatory parameter is not specified
isPersonStrictlyIn(person* : Person, role* : Role) : Boolean

Returns true if the given person belongs directly to the specified role. The descendant roles are excluded: it is a non-recursive version of the isPersonIn() function applied to organization roles.

isPersonStrictlyIn(getPerson("john"), getRoleUnitByName("org", "Developer"))

Parameters:

  • person person
  • role role the person is potentially in

Throws:

  • NullParameterError if a mandatory parameter is not specified
personsStrictlyWith(role* : Role) : Set<Person>

Returns the set of persons that belong directly to the given role. Persons that belong to the descendant roles are not considered. This is a non-recursive version of the personsWith() function applied to organization roles.

Parameters:

  • role

Throws:

  • NullParameterError if a mandatory parameter is not specified
personsWith(roleUnit* : RoleUnit) : Set<Person>

Returns the set of persons that belong to the given role. A person belongs to an organization role if it belongs directly to the specified role or it belongs to any of its descendants (evaluated recursively).

personsWith(getRoleUnitByName("org","Developer"))

Parameters:

  • roleUnit

Throws:

  • NullParameterError if a mandatory parameter is not specified
removePersonFromRole(person* : Person, roleUnit* : RoleUnit) : voidSIDE EFFECT

Remove the person from the role or role unit. Note that atempting to add a person to an organization unit results in a runtime exception.

removePersonFromRole(getPerson("john"), MyRole(["parameter" -> "value"]))

Parameters:

  • person person
  • roleUnit role or role unit

Throws:

  • NullParameterError if a mandatory parameter is null
setPersonPicture(person* : Person, picture : File) : voidSIDE EFFECT

Sets the picture as the profile picture of the person

setPersonPicture(getPerson("john"), getResource(module -> "my-module", path -> "john.png");

Parameters:

  • person person
  • picture picture

Throws:

  • NullParameterError if a mandatory parameter is not specified

Documents

deleteSavedDocuments(documents* : Set<SavedDocument>) : voidSIDE EFFECT

Markes the saved documents as deleted (the documents are retained in the dabase; use isDeleted() to check if a document is marked as deleted).

deleteSavedDocuments({findAll(SavedDocument)[0]})

Parameters:

  • documents documents to be deleted

Throws:

  • NullParameterError if a mandatory parameter is null

Utilities

getUIHistory() : Map<Integer, HistoricalNavigation>
Returns UI history. Key 0 contains the "current" page. Positive keys hold older entries (back); negative keys hold newer entries (forward).
sendEmail(subject : String, body* : String, attachments : Set<File>, recipientsTo* : Set<String>, recipientsCc : Set<String>, recipientsBcc : Set<String>, charset : String) : voidSIDE EFFECTDEPRECATED

Sends an e-mail. Deprecated: use function sendEmail with extended parameters.

Parameters:

  • subject email subject
  • body email body paragraphs
  • attachments attachments
  • recipientsTo email addresses of recipients TO
  • recipientsCc email addresses of recipients CC
  • recipientsBcc email addresses of recipients BCC
  • charset Name of character encoding used for subject and body of e-mail, for instance, “ISO-8859-1”, “UTF-8”, “windows-1250”, etc. If not speci- fied, the default is “UTF-8”. The supported encodings vary between different implementations of the Java 2 platform, see Java docu- mentation for details.

Throws:

  • NullParameterError if a mandatory parameter is null
sendEmail(subject : String, body* : String, attachments : Set<File>, from : String, recipientsTo* : Set<String>, recipientsCc : Set<String>, recipientsBcc : Set<String>, charset : String) : voidSIDE EFFECTDEPRECATED

Sends an e-mail. Deprecated: use function sendEmail with extended parameters.

Parameters:

  • subject email subject
  • body email body paragraphs
  • attachments attachments
  • from email address of sender. If not specified, the default (given by application server settings) is used.
  • recipientsTo email addresses of recipients TO
  • recipientsCc email addresses of recipients CC
  • recipientsBcc email addresses of recipients BCC
  • charset Name of character encoding used for subject and body of e-mail, for instance, “ISO-8859-1”, “UTF-8”, “windows-1250”, etc. If not speci- fied, the default is “UTF-8”. The supported encodings vary between different implementations of the Java 2 platform, see Java docu- mentation for details.

Throws:

  • NullParameterError if a mandatory parameter is null
sendEmail(subject : String, body* : String, attachments : Set<File>, from : String, recipientsTo* : Set<String>, recipientsCc : Set<String>, recipientsBcc : Set<String>, mime : String, charset : String) : voidSIDE EFFECT

Sends an e-mail.

Parameters:

  • subject email subject
  • body email body paragraphs
  • attachments attachments
  • from email address of sender. If not specified, the default (given by application server settings) is used.
  • recipientsTo email addresses of recipients TO
  • recipientsCc email addresses of recipients CC
  • recipientsBcc email addresses of recipients BCC
  • mime Mime subtype (without text/) e.g plain, html, rtf,...
  • charset character encoding used for subject and body of the e-mail, for instance, “ISO-8859-1”, “UTF-8”, “windows-1250”, etc. If not speci- fied, “UTF-8” is used. Note that supported encodings vary between implementations of Java, see your Java documentation for details.

Throws:

  • NullParameterError if a mandatory parameter is null