Module: UU::OS::ActivityAction

Extended by:
ActivityAction
Included in:
ActivityAction
Defined in:
uu_os-0.29.16/lib/uu/os/activity_action.rb,
uu_os-0.29.16/lib/uu/os/activity_action/activity_action_type.rb,
uu_os-0.29.16/lib/uu/os/activity_action/activity_action_create.rb,
uu_os-0.29.16/lib/uu/os/activity_action/activity_action_attributes.rb,
uu_os-0.29.16/lib/uu/os/activity_action/activity_action_get_activity_action_list.rb

Overview

Module Activity Action.

Defined Under Namespace

Classes: ActivityActionAttributes, ActivityActionCreate, ActivityActionGetActivityActionList, ActivityActionType

Constant Summary

PATH =

Service path

'uu/os/ActivityAction'

Instance Method Summary (collapse)

Instance Method Details

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

Creates a new activity action for the specified entity (activity template or activity instance).

Examples:

# Create an activity action for setting an artifact state
UU::OS::ActivityAction.create('ues:TERRITORY:ARTIFACT:ENTITY',
   :code => 'Activity action code',
   :type => 'SET_ARTIFACT_STATE_ACTION',
   :activity_state_template_uri => 'ues:TERRITORY:META_ARTIFACT:ACTIVITY_STATE_TEMPLATE',
   :target_artifact_state_template_uri => 'ues:TERRITORY:META_ARTIFACT:ARTIFACT_STATE_TEMPLATE')

# Create an activity action for setting an activity state
UU::OS::ActivityAction.create('ues:TERRITORY:ARTIFACT:ENTITY',
   :code => 'Activity action code',
   :type => 'SET_ACTIVITY_STATE_ACTION',
   :activity_state_template_uri => 'ues:TERRITORY:META_ARTIFACT:ACTIVITY_STATE_TEMPLATE',
   :target_activity_state_template_uri => 'ues:TERRITORY:META_ARTIFACT:ACTIVITY_STATE_TEMPLATE')

# Create an activity action for executing a macro
UU::OS::ActivityAction.create('ues:TERRITORY:ARTIFACT:ENTITY',
   :code => 'Activity action code',
   :type => 'EXEC_MACRO_ACTION',
   :activity_state_template_uri => 'ues:TERRITORY:META_ARTIFACT:ACTIVITY_STATE_TEMPLATE',
   :macro_uri => 'ues:TERRITORY:MACRO')

Parameters:

Options Hash (options):

  • :code (String)

    Code of the new activity action. If it is 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.

  • :type (String, UU::OS::ActivityAction::ActivityActionType)

    Not nil. Type of the new activity action. All possible types can be found as constants in ActivityActionType class.

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

    Not nil. URI of an activity state template which is related to the activity template or its instance set as the main entity. When the main entity is set into the state represented by this state template, the created activity action will be executed. It is not allowed to use a state template that is already used by another action for setting artifact state.

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

    Not nil if the type is SET_ARTIFACT_STATE_ACTION. URI of an artifact state template which is related to the specific meta artifact according to the entered main entity. It represents a state that will be set to an artifact created according to the related meta artifact after this activity action is executed. This parameter must not represent a system state.

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

    Not nil if the type is SET_ACTIVITY_STATE_ACTION. URI of an activity state template. It represents a state that will be set to the given activity after this activity action is executed. It must not belong to a generic activity template unless the main entity is also generic.

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

    Not nil if the type is EXEC_MACRO_ACTION. URI of an artifact created according to a meta artifact for macro. This artifact represents a macro that will be run after this activity action is executed. This artifact must be in an active state.

Returns:



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

def create(entity_uri, options)
  svc = UU::OS::REST::RemoteClient.new(ActivityAction)
  payload = UU::OS::ActivityAction::ActivityActionCreate.new(options).to_json

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

- (Object) delete(activity_action_uri)

Deletes the specified activity action.

Examples:

# Delete an activity action
UU::OS::ActivityAction.delete('ues:TERRITORY:ARTIFACT:ACTIVITY_ACTION')

Parameters:

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

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



88
89
90
91
92
93
# File 'uu_os-0.29.16/lib/uu/os/activity_action.rb', line 88

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

- (UU::OS::REST::ResultList<ActivityAction::ActivityActionGetActivityActionList, ActivityAction::ActivityActionAttributes>) get_activity_action_list(entity_uri, criteria = nil)

Returns a list of activity actions of the specified entity (activity template or activity instance) according to the entered criteria.

Examples:

# Return list of execute macro actions returned in descending order by code
UU::OS::ActivityAction.get_activity_action_list('ues:TERRITORY:ARTIFACT:ENTITY',
   :query => 'type="EXEC_MACRO_ACTION" ORDER BY code DESC')

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 it is not specified, no filtering is applied and entries are ordered by the parameter type and code as the second criteria. Otherwise, it is possible to filter and sort the result list by the following attributes: type, code.

Returns:

See Also:



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

def get_activity_action_list(entity_uri, criteria = nil)
  svc = UU::OS::REST::RemoteClient.new(ActivityAction)
  dto = ActivityAction::ActivityActionGetActivityActionList.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('getActivityActionList', entity_uri)
    return UU::OS::REST::ResultList.new(ActivityAction::ActivityActionGetActivityActionList, ActivityAction::ActivityActionAttributes, res)
  end
end

- (UU::OS::ActivityAction::ActivityActionAttributes) get_attributes(activity_action_uri)

Returns attributes of the specified activity action.

Examples:

# Get attributes of an activity action
UU::OS::ActivityAction.get_attributes('ues:TERRITORY:ARTIFACT:ACTIVITY_ACTION')

Parameters:

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

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

Returns:



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

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