Module: UU::OS::ActivityTemplate

Extended by:
ActivityTemplate
Included in:
ActivityTemplate
Defined in:
uu_os-0.29.16/lib/uu/os/activity_template.rb,
uu_os-0.29.16/lib/uu/os/activity_template/activity_template_create.rb,
uu_os-0.29.16/lib/uu/os/activity_template/activity_template_attributes.rb,
uu_os-0.29.16/lib/uu/os/activity_template/activity_template_set_attributes.rb,
uu_os-0.29.16/lib/uu/os/activity_template/activity_template_get_activity_template_list.rb

Overview

Module Activity Template.

Defined Under Namespace

Classes: ActivityTemplateAttributes, ActivityTemplateCreate, ActivityTemplateGetActivityTemplateList, ActivityTemplateSetAttributes

Constant Summary

PATH =

Service path

'uu/os/ActivityTemplate'

Instance Method Summary (collapse)

Instance Method Details

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

Creates a new activity template either on the specified meta artifact or on the specified activity template (in the case of creating a new template for subactivities). At least, its future name and type have to be specified in this command.

Examples:

# Create an activity template with type DECIDE
UU::OS::ActivityTemplate.create('ues:TERRITORY:META_ARTIFACT',
  :name => 'Activity template name',
  :code => 'Activity template code',
  :type => UU::OS::Activity::ActivityType::DECIDE,
  :description => 'Activity template description',
  :related_object_uri => 'ues:TERRITORY:ARTIFACT:OBJECT',
  :icon_uri => 'ues:#{system}:#{ues_v5.core_v1.codetable_v1.base_v1.CodeTable_Icons}:#{ART_221}',
  :allow_creation_through_ui => true,
  :notification => 'P0DT1H0M0.000S',
  :expiration => 'P14DT0H0M0.000S',
  :allow_as_subactivity_template => true,
  :default_subactivity_template_uri => 'ues:TERRITORY:META_ARTIFACT:GENERIC_ACTIVITY_TEMPLATE',
  :executive_role_uri => 'ues:TERRITORY:ROLE',
  :allow_executive_role_change => true,
  :allow_subactivities => true)

# Create a template with type COVER_MEETING
UU::OS::ActivityTemplate.create('ues:TERRITORY:META_ARTIFACT',
   :name => 'Activity template name',
   :code => 'Activity template code',
   :type => 'COVER_MEETING',
   :description => 'Activity template description',
   :related_object_uri => 'ues:TERRITORY:ARTIFACT:OBJECT',
   :icon_uri => 'ues:#{system}:#{ues_v5.core_v1.codetable_v1.base_v1.CodeTable_Icons}:#{ART_221}',
   :allow_creation_through_ui => true,
   :notification => 'P1DT0H0M0.000S',
   :duration => 'P0DT1H0M0.000S',
   :expiration => false,
   :allow_as_subactivity_template => true,
   :default_subactivity_template_uri => 'ues:TERRITORY:META_ARTIFACT:GENERIC_ACTIVITY_TEMPLATE',
   :block_time_in_calendar => true,
   :executive_role_uri => 'ues:TERRITORY:ROLE',
   :allow_executive_role_change => true,
   :allow_subactivities => true)

# Create a template of a subactivity
UU::OS::ActivityTemplate.create('ues:TERRITORY:META_ARTIFACT:ACTIVITY_TEMPLATE',
   :name => 'Activity template name',
   :code => 'Activity template code',
   :type => 'DECIDE',
   :description => 'Activity template description',
   :related_object_uri => 'ues:TERRITORY:ARTIFACT:OBJECT',
   :icon_uri => 'ues:#{system}:#{ues_v5.core_v1.codetable_v1.base_v1.CodeTable_Icons}:#{ART_221}',
   :notification => 'P0DT1H0M0.000S',
   :expiration => 'P14DT0H0M0.000S',
   :allow_as_subactivity_template => true,
   :executive_role_uri => 'ues:TERRITORY:ROLE',
   :allow_executive_role_change => true,
   :allow_subactivities => true)

Parameters:

Options Hash (options):

  • :name (String)

    Not nil. Name of the new activity template.

  • :code (String)

    Code of the new activity 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 template. If not specified, it is left empty.

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

    Not nil. Type of the new activity template. Specific generic activity template will be used as the source for the new activity template according to the specified type. Subactivity templates whose parent has the type TIME_RESERVATION must also have the type TIME_RESERVATION. All possible types can be found as constants in UU::OS::Activity::ActivityType class.

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

    URI of the artifact or object which is somehow related to the activity template.

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

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

  • :allow_creation_through_ui (Boolean)

    Parameter specifies whether activities can be created according to this activity template through the user interface or not. The default value is true.

  • :notification (String)

    Parameter specifies the default time from creation of the activity to its expected completion. The entered value must be in ISO 8601 format. The default value is one day. If the user creates a subactivity template, the default value is derived from the parent activity template. The value must not be longer than the value of the same parameter at the superior activity (if it exists).

  • :duration (String)

    Parameter specifies the duration of the activity template. It can be set only for activity templates with type COVER_MEETING or TIME_RESERVATION. For those types of templates, the default value is one hour. The entered value must be in ISO 8601 format. If the user creates a subactivity template, the default value is derived from the parent activity template. The value must not be longer than the value of the same parameter at the superior activity (if it exists).

  • :expiration (String, Boolean)

    Parameter specifies how long after the expected completion date the activities created according to this template should be automatically terminated. This parameter can contain two possible types of values: If it’s a time duration, it sets the activity to expire after that duration. This value must be in ISO 8601 format. If it’s set to false, the activity created according to this activity template will never expire. The default value is false. If the user creates a subactivity template, the default value is derived from the parent activity template. The value must not be longer than the value of the same parameter at the superior activity (if it exists).

  • :allow_as_subactivity_template (Boolean)

    Parameter specifies whether this activity template will be usable as a template for subactivities. The default value is false.

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

    URI of the activity template which should be used as the default template for subactivities. The URI must refer to an activity template on the same meta artifact which is usable as delegation template. If it is not set, no default subactivity is specified. This parameter must not be set when the user creates a template for subactivities!

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

    Not nil for subactivity templates. URI of the executive role for the activities created according to this template.

  • :block_time_in_calendar (Boolean)

    Specifies whether the activities created according to this template will reserve time in the related users’ calendars. This parameter can be used only for activity templates with type COVER_MEETING or TIME_RESERVATION. For those types of templates, the default value is true.

  • :allow_executive_role_change (Boolean)

    Parameter specifies whether Specifies whether the executive role of the activities created according to this template can be changed. The default value is true.

  • :allow_subactivities (Boolean)

    Parameter specifies whether it is allowed to create subactivities of the activities created according to this template. The default value is true.

Returns:



94
95
96
97
98
99
100
101
102
# File 'uu_os-0.29.16/lib/uu/os/activity_template.rb', line 94

def create(parent_node_uri, options)
  svc = UU::OS::REST::RemoteClient.new(ActivityTemplate)
  payload = UU::OS::ActivityTemplate::ActivityTemplateCreate.new(options).to_json

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

- (Object) delete(activity_template_uri)

Deletes the activity template. It cannot be deleted in case there is an action or condition that contains this template or if the template has already been used for creating another template. Also, it is not possible to delete generic templates.

Examples:

# Deletes an activity template
UU::OS::ActivityTemplate.delete('ues:TERRITORY:META_ARTIFACT:ACTIVITY_TEMPLATE')

Parameters:

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

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



178
179
180
181
182
183
# File 'uu_os-0.29.16/lib/uu/os/activity_template.rb', line 178

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

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

Returns a list of activity templates of the specified meta artifact according to the entered criteria.

Examples:

# Returns list of templates of messages whose instances can have subactivities
UU::OS::ActivityTemplate.get_activity_template_list('ues:TERRITORY:META_ARTIFACT',
   :query => 'type="MESSAGE" AND allowSubactivities=true')

Parameters:

Options Hash (criteria):

  • :query (String)

    Query for filtering and ordering of the result list. It has to conform the ues query syntax (see the documentation below for more info). If it is not specified, no filtering is applied and entries are ordered by the parameter name and code as the second criteria. Otherwise, it is possible to filter and sort the result list by the following attributes: name, code, type, blockTimeInCalendar, allowExecutiveRoleChange and allowSubactivities.

Returns:

See Also:



199
200
201
202
203
204
205
206
207
208
209
# File 'uu_os-0.29.16/lib/uu/os/activity_template.rb', line 199

def get_activity_template_list(meta_artifact_uri, criteria = nil)
  svc = UU::OS::REST::RemoteClient.new(ActivityTemplate)
  dto = ActivityTemplate::ActivityTemplateGetActivityTemplateList.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('getActivityTemplateList', meta_artifact_uri)
    return UU::OS::REST::ResultList.new(ActivityTemplate::ActivityTemplateGetActivityTemplateList, ActivityTemplate::ActivityTemplateAttributes, res)
  end
end

- (UU::OS::ActivityTemplate::ActivityTemplateAttributes) get_attributes(activity_template_uri)

Returns attributes of the specified activity template.

Examples:

# Get attributes of an activity template
UU::OS::ActivityTemplate.get_attributes('ues:TERRITORY:META_ARTIFACT:ACTIVITY_TEMPLATE')

Parameters:

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

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

Returns:



113
114
115
116
117
118
119
# File 'uu_os-0.29.16/lib/uu/os/activity_template.rb', line 113

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

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

Sets basic attributes of the specified activity template. This command cannot modify the type.

Examples:

# Sets attributes of an activity template
UU::OS::ActivityTemplate.set_attributes('ues:TERRITORY:META_ARTIFACT:ACTIVITY_TEMPLATE',
   :name => 'Activity template name',
   :code => 'Activity template code',
   :description => 'Activity template description',
   :related_object_uri => 'ues:TERRITORY:ARTIFACT:OBJECT',
   :icon_uri => 'ues:#{system}:#{ues_v5.core_v1.codetable_v1.base_v1.CodeTable_Icons}:#{ART_221}',
   :allow_creation_through_ui => true,
   :notification => 'P0DT1H0M0.000S',
   :expiration => 'PT256H0M0.000S',
   :allow_as_subactivity_template => true,
   :allow_subactivities => true,
   :default_subactivity_template_uri => 'ues:TERRITORY:META_ARTIFACT:GENERIC_ACTIVITY_TEMPLATE',
   :executive_role_uri => 'ues:TERRITORY:ROLE',
   :allow_executive_role_change => true)

Parameters:

Options Hash (options):

  • :name (String)

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

  • :code (String)

    The new code of the activity 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 template. If it is not specified, the description is not modified.

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

    The new related object of the activity template. If it is not specified, the related object reference is not modified. If nil URI (‘ues:[-1]:[-1]:’) is set, the related artifact is set empty.

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

    URI of the new activity template’s icon. The same icon will be used for created activity instances. If it is not specified, the icon is not modified. If nil URI (‘ues:[-1]:[-1]:’) is set, the activity 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}’.

  • :allow_creation_through_ui (Boolean)

    Parameter specifies whether activities can be created according to this activity template through the user interface or not. This option cannot be turned off for generic templates. If it is not specified, the value is not modified.

  • :notification (String)

    Parameter specifies the default time from creation of the activity to its expected completion. The entered value must be in ISO 8601 format. If it is not specified, the value is not modified. The value must not be longer than the value of the same parameter at the superior activity (if it exists).

  • :duration (String)

    Parameter specifies the duration of the activity template. This parameter can be used only for activity templates with type COVER_MEETING or TIME_RESERVATION. The entered value must be in ISO 8601 format. If it is not specified, the value is not modified. The value must not be longer than the value of the same parameter at the superior activity (if it exists).

  • :expiration (String, Boolean)

    Parameter specifies how long after the expected completion date the activities created according to this template should be automatically terminated. This parameter can contain two possible types of values: If it’s a time duration, it sets the activity to expire after that duration. This value must be in ISO 8601 format. If it’s set to false, the activity created according to this activity template will never expire. If it is not specified, the value is not modified. The value must not be longer than the value of the same parameter at the superior activity (if it exists).

  • :allow_as_subactivity_template (Boolean)

    Parameter specifies whether this activity template will be usable as a template for subactivities. If it is not specified, the value is not modified.

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

    URI of the activity template which should be used as the default template for subactivities. The URI must refer to an activity template on the same meta artifact which is usable as delegation template. If it is not specified, the value is not modified. If nil URI (‘ues:[-1]:[-1]:’) is set, this parameter is set empty. This parameter must not be set on templates for subactivities!

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

    URI of the executive role for the activities created according to this template. If it is not specified, the value is not modified.If nil URI (‘ues:[-1]:[-1]:’) is set, the activity template’s executive role is replaced by a default executive role which is the competent role of meta artifact in which activity template is located.

  • :block_time_in_calendar (Boolean)

    Specifies whether the activities created according to this template will reserve time in the related users’ calendars. This parameter can be used only for activity templates with type COVER_MEETING or TIME_RESERVATION. If it is not specified, the value is not modified.

  • :allow_executive_role_change (Boolean)

    Parameter specifies whether the executive role of the activities created according to this template can be changed. If it is not specified, the value is not modified.

  • :allow_subactivities (Boolean)

    Parameter specifies whether it is allowed to create subactivities of the activities created according to this template. If it is not specified, the value is not modified.

Returns:



159
160
161
162
163
164
165
166
167
# File 'uu_os-0.29.16/lib/uu/os/activity_template.rb', line 159

def set_attributes(activity_template_uri, options)
  svc = UU::OS::REST::RemoteClient.new(ActivityTemplate)
  payload = UU::OS::ActivityTemplate::ActivityTemplateSetAttributes.new(options).to_json

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