Module: UU::OS::ActivityStateTemplate

Extended by:
ActivityStateTemplate
Included in:
ActivityStateTemplate
Defined in:
uu_os-0.29.16/lib/uu/os/activity_state_template.rb,
uu_os-0.29.16/lib/uu/os/activity_state_template/activity_state_visibility.rb,
uu_os-0.29.16/lib/uu/os/activity_state_template/activity_state_participant.rb,
uu_os-0.29.16/lib/uu/os/activity_state_template/activity_state_template_create.rb,
uu_os-0.29.16/lib/uu/os/activity_state_template/activity_state_template_attributes.rb,
uu_os-0.29.16/lib/uu/os/activity_state_template/activity_state_template_set_attributes.rb,
uu_os-0.29.16/lib/uu/os/activity_state_template/activity_state_template_get_activity_state_template_list.rb

Overview

Module Activity State Template.

Defined Under Namespace

Classes: ActivityStateParticipant, ActivityStateTemplateAttributes, ActivityStateTemplateCreate, ActivityStateTemplateGetActivityStateTemplateList, ActivityStateTemplateSetAttributes, ActivityStateVisibility

Constant Summary

PATH =

Service path

'uu/os/ActivityStateTemplate'

Instance Method Summary (collapse)

Instance Method Details

- (UU::OS::UESURI) create(activity_template_uri, options)

Creates a new activity state template on the specified activity template.

Examples:

# Create an activity state template
UU::OS::ActivityStateTemplate.create('ues:TERRITORY:META_ARTIFACT:ACTIVITY_TEMPLATE',
   :name => 'Activity state template name',
   :code => 'Activity state template code',
   :description => 'Activity state template description',
   :type => 'ACTIVE',
   :subtype => 'III',
   :icon_uri => 'ues:#{system}:#{ues_v5.core_v1.codetable_v1.base_v1.CodeTable_Icons}:#{S10_C02}',
   :order => 30,
   :entry_state => false,
   :exit_state => false,
   :participants => ["COMPETENT_ROLE","EXECUTIVE_ROLE","OWNER","OTHERS"],
   :digital_workspace_visibility => ["COMPETENT_ROLE","EXECUTIVE_ROLE"])

Parameters:

Options Hash (options):

  • :name (String)

    Not nil. Name of the new activity state template.

  • :code (String)

    Code of the new activity state template. If not specified, the code is generated automatically using the system sequence. The code must be unique in the scope of the given meta artifact, otherwise the create command fails.

  • :description (String)

    Description of the new activity state template. If not specified, it is left empty.

  • :type (String, UU::OS::Activity::ActivityStateType)

    Not nil. Type of the new activity state template. All possible types can be found as constants in UU::OS::Activity::ActivityStateType class. It is not possible to use the constant SYSTEM from this class.

  • :subtype (String, UU::OS::Activity::ActivityStateSubtype)

    Subtype of the new activity state template. All possible subtypes can be found as constants in UU::OS::Activity::ActivityStateSubtype class. If not specified, the first possible subtype will be used.

  • :entry_state (Boolean)

    If this parameter is true, this state will be set as the initial state for activities created according to this template. The default value is false.

  • :exit_state (Boolean)

    If this parameter is true, this state will be considered the final state of activities created according to this template. The default value is false.

  • :icon_uri (String, UU::OS::UESURI)

    Icon of the new activity state template. If not specified, there will be used a default icon derived from the specified type. Allowed format of icon: ‘ues:#{system}:#{ues_v5.core_v1.codetable_v1.base_v1.CodeTable_Icons}:#{CODE_OF_ICON}’.

  • :order (Integer)

    Order of the new activity state template. All activity state templates are suggested to the user in this order when setting the activity state to an activity which is created according to the given activity template. If it is not set, no specific order is specified.

  • :participants (Array)

    Set of participants who can set the activity state according to this template. If it is set to the value SYSTEM, it cannot contain any other value in the given set. The default value is [‘COMPETENT_ROLE’, ‘EXECUTIVE_ROLE’, ‘OWNER’]. All possible participants can be found as constants in ActivityStateParticipant class.

  • :digital_workspace_visibility (Array)

    Set of roles which will get a digital workspace record in their digital workspace in the case when an activity is set to the state which is created according to this activity state template. If it is set to the value NOBODY, it cannot contain any other value in the given set. The default value is [‘COMPETENT_ROLE’, ‘EXECUTIVE_ROLE’]. All possible visibilities can be found as constants in ActivityStateVisibility class.

Returns:



53
54
55
56
57
58
59
60
61
# File 'uu_os-0.29.16/lib/uu/os/activity_state_template.rb', line 53

def create(activity_template_uri, options)
  svc = UU::OS::REST::RemoteClient.new(ActivityStateTemplate)
  payload = UU::OS::ActivityStateTemplate::ActivityStateTemplateCreate.new(options).to_json

  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.post('create', activity_template_uri, payload)
    return UU::OS::UESURI.new(res)
  end
end

- (Object) delete(activity_state_template_uri)

Deletes the specified activity state template. It it not possible to delete the entry or the exit state template, or a state template used in a condition or an action, or if it is important for the system according to its type.

Examples:

# Delete an activity state template
UU::OS::ActivityStateTemplate.delete('ues:TERRITORY:META_ARTIFACT:ACTIVITY_STATE_TEMPLATE')

Parameters:

  • activity_state_template_uri (String, UU::OS::UESURI)

    Not nil. URI of the activity state template which is to be deleted.



129
130
131
132
133
134
# File 'uu_os-0.29.16/lib/uu/os/activity_state_template.rb', line 129

def delete(activity_state_template_uri)
  svc = UU::OS::REST::RemoteClient.new(ActivityStateTemplate)
  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.post('delete', activity_state_template_uri)
  end
end

- (UU::OS::REST::ResultList<ActivityStateTemplate::ActivityStateTemplateGetActivityStateTemplateList, ActivityStateTemplate::ActivityStateTemplateAttributes>) get_activity_state_template_list(activity_template_uri, criteria = nil)

Returns a list of activity state templates for the specified activity template according to entered criteria.

Examples:

# Return list of activity state templates which are not the exit state and have the initial type
UU::OS::ActivityStateTemplate.get_activity_state_template_list('ues:TERRITORY:META_ARTIFACT:ACTIVITY_TEMPLATE',
   :query => 'type="INITIAL" AND exit_state=false')

Parameters:

Options Hash (criteria):

  • :query (String)

    The query for filtering and ordering of the result list. It has to conform the ues query syntax (see documentation for more info). If nil is set, no filtering is applied and entries are ordered by the parameter order and name as the second criteria. Otherwise, it is possible to filter and sort the result list by the following attributes: name, code, type, entryState, exitState and order.

Returns:

See Also:



150
151
152
153
154
155
156
157
158
159
160
# File 'uu_os-0.29.16/lib/uu/os/activity_state_template.rb', line 150

def get_activity_state_template_list(activity_template_uri, criteria = nil)
  svc = UU::OS::REST::RemoteClient.new(ActivityStateTemplate)
  dto = ActivityStateTemplate::ActivityStateTemplateGetActivityStateTemplateList.new(criteria)
  svc.add_parameter('pageIndex', dto.page_index)
  svc.add_parameter('pageSize', dto.page_size)
  svc.add_parameter('query', dto.query)
  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.get('getActivityStateTemplateList', activity_template_uri)
    return UU::OS::REST::ResultList.new(ActivityStateTemplate::ActivityStateTemplateGetActivityStateTemplateList, ActivityStateTemplate::ActivityStateTemplateAttributes, res)
  end
end

- (UU::OS::ActivityStateTemplate::ActivityStateTemplateAttributes) get_attributes(activity_state_template_uri)

Returns attributes of the specified activity state template.

Examples:

# Get attributes of an activity state template
UU::OS::ActivityStateTemplate.get_attributes('ues:TERRITORY:META_ARTIFACT:ACTIVITY_STATE_TEMPLATE')

Parameters:

  • activity_state_template_uri (String, UU::OS::UESURI)

    Not nil. URI of the activity state template whose attributes are to be returned.

Returns:



72
73
74
75
76
77
78
# File 'uu_os-0.29.16/lib/uu/os/activity_state_template.rb', line 72

def get_attributes(activity_state_template_uri)
  svc = UU::OS::REST::RemoteClient.new(ActivityStateTemplate)
  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.get('getAttributes', activity_state_template_uri)
    return ActivityStateTemplate::ActivityStateTemplateAttributes.new(res)
  end
end

- (UU::OS::UESURI) set_attributes(activity_state_template_uri, options)

Sets attributes of an activity state template. This command cannot modify the type.

Examples:

# Set all attributes of an activity state template
UU::OS::ActivityStateTemplate.set_attributes('ues:TERRITORY:META_ARTIFACT:ACTIVITY_STATE_TEMPLATE',
   :name => 'Activity state template name',
   :code => 'Activity state template code',
   :description => 'Activity state template description',
   :subtype => 'IV',
   :icon_uri => 'ues:#{system}:#{ues_v5.core_v1.codetable_v1.base_v1.CodeTable_Icons}:#{S10_C02}',
   :order => 40,
   :entry_state => false,
   :exit_state => false,
   :participants => ["COMPETENT_ROLE","EXECUTIVE_ROLE","OWNER","OTHERS"],
   :digital_workspace_visibility => ["COMPETENT_ROLE","EXECUTIVE_ROLE"])

Parameters:

Options Hash (options):

  • :name (String)

    The new name of the activity state template. If it is not specified, the name is not modified.

  • :code (String)

    The new code of the activity state template. If it is not specified, the code is not modified. If blank string is set, the code is generated automatically using the system sequence. The code must be unique in the scope of the given meta artifact, otherwise the setAttributes command fails.

  • :description (String)

    The new description of the activity state template. If it is not specified, the description is not modified.

  • :subtype (String, UU::OS::Activity::ActivityStateSubtype)

    The new subtype of the activity state template. All possible subtypes can be found as constants in UU::OS::Activity::ActivityStateSubtype class. If it is not specified, the subtype is not modified.

  • :entry_state (Boolean)

    After an activity is created according to an activity template, it will be set into the state marked as the entry state. There is always just one activity state template marked as the entry state on every activity template. By setting true, the new activity state template will become the entry state instead of the one previously specified. The default value is false. If the user tries to set false to an existing entry state, the setAttributes command fails. If it is not specified, the parameter is not modified.

  • :exit_state (Boolean)

    There is always just one activity state template marked as the exit state on every activity template. By setting true, the new activity state template will become the exit state instead of the one previously specified. The default value is false. If the user tries to set false to an existing exit state, the setAttributes command fails. If it is not specified, the parameter is not modified.

  • :icon_uri (String, UU::OS::UESURI)

    URI of the new activity state template’s icon. If it is not specified, the icon is not modified. If nil URI (‘ues:[-1]:[-1]:’) is set, the activity state template’s icon is replaced by a default icon derived from the type. Allowed format of icon: ‘ues:#{system}:#{ues_v5.core_v1.codetable_v1.base_v1.CodeTable_Icons}:#{CODE_OF_ICON}’.

  • :order (Integer)

    Order of the activity state template. All activity state templates are suggested to the user in this order when setting the activity state to an activity which is created according to the given activity template. If it is not specified, the parameter is not modified.

  • :participants (Array)

    Set of participants who can set activity state according to this template. If it is set to the value SYSTEM, it cannot contain any other value in the given set. If it is not specified, the parameter is not modified. All possible participants can be found as constants in ActivityStateParticipant class.

  • :digital_workspace_visibility (Array)

    Set of roles which will get a digital workspace record in their digital workspace in the case when an activity is set to the state which is created according to this activity state template. If it is set to the value NOBODY, it cannot contain any other value in the given set. If it is not specified, the parameter is not modified. All possible visibilities can be found as constants in ActivityStateVisibility class.

Returns:



110
111
112
113
114
115
116
117
118
# File 'uu_os-0.29.16/lib/uu/os/activity_state_template.rb', line 110

def set_attributes(activity_state_template_uri, options)
  svc = UU::OS::REST::RemoteClient.new(ActivityStateTemplate)
  payload = UU::OS::ActivityStateTemplate::ActivityStateTemplateSetAttributes.new(options).to_json

  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.post('setAttributes', activity_state_template_uri, payload)
    return UU::OS::UESURI.new(res)
  end
end