Module: UU::OS::Activity

Extended by:
Activity
Included in:
Activity
Defined in:
uu_os_client-0.10.6/lib/uu/os/activity.rb,
uu_os_client-0.10.6/lib/uu/os/activity/activity_type.rb,
uu_os_client-0.10.6/lib/uu/os/activity/activity_create.rb,
uu_os_client-0.10.6/lib/uu/os/activity/activity_set_state.rb,
uu_os_client-0.10.6/lib/uu/os/activity/activity_attributes.rb,
uu_os_client-0.10.6/lib/uu/os/activity/activity_state_type.rb,
uu_os_client-0.10.6/lib/uu/os/activity/activity_state_subtype.rb,
uu_os_client-0.10.6/lib/uu/os/activity/activity_set_attributes.rb,
uu_os_client-0.10.6/lib/uu/os/activity/activity_get_instance_list.rb,
uu_os_client-0.10.6/lib/uu/os/activity/activity_get_activity_list.rb

Overview

Activity.

Defined Under Namespace

Classes: ActivityAttributes, ActivityCreate, ActivityGetActivityList, ActivityGetInstanceList, ActivitySetAttributes, ActivitySetState, ActivityStateSubtype, ActivityStateType, ActivityType

Constant Summary

PATH =

Service path

'ues/core/workflow/UESActivity'

Instance Method Summary (collapse)

Instance Method Details

- (UU::OS::UESURI) create(parent_node_uri, activity = nil)

This command creates a new activity on the specified artifact. At the very least activity template or the activity type have to be specified in this command. Attention: No activity actions or conditions are copied from the template when the new activity is created by templateUri.

Parameters:

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

    UESURI of an artifact (or a parent activity) where the new activity is created

  • activity (ActivityCreate) (defaults to: nil)

    DTO containing attributes of a new activity

Returns:



69
70
71
72
73
74
75
76
77
# File 'uu_os_client-0.10.6/lib/uu/os/activity.rb', line 69

def create(parent_node_uri, activity = nil)
  svc = UU::OS::REST::RemoteClient.new(Activity)
  payload = UU::OS::Activity::ActivityCreate.new(activity).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_uri)

This command deletes an unfinished activity. Planned activity will be removed from the system, activity in progress will be set to the canceled state.

Parameters:

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

    UESURI of the activity which is about to be deleted.



100
101
102
103
104
105
# File 'uu_os_client-0.10.6/lib/uu/os/activity.rb', line 100

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

- (UU::OS::REST::ResultList<Activity::ActivityGetActivityList, Activity::ActivityAttributes>) get_activity_list(parent_node_uri, criteria = nil)

Returns list of the activities and sub activities for the specified artifact or activity. Returned list does not contain any objects filtered out by executed UESQuery.

of the result list. Criteria are defined using UESQuery. Allowed filtering parameters are name, code, activityType, allowExecutiveRoleChange, allowSubactivities, blockTimeInCalendar, activityStateType, activityStateSubtype, recurrent, termModifiable, dateFrom, dateStart, dateTo and dateFinished.

Parameters:

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

    UES URI of the artifact or activity for which activities are about to be listed.

  • criteria (ActivityGetActivityList) (defaults to: nil)

    DTO containing the criteria for filtering

Returns:



142
143
144
145
146
147
148
149
150
151
152
153
# File 'uu_os_client-0.10.6/lib/uu/os/activity.rb', line 142

def get_activity_list(parent_node_uri, criteria = nil)
  svc = UU::OS::REST::RemoteClient.new(Activity)
  dto = Activity::ActivityGetActivityList.new(criteria)
  svc.add_parameter('pageIndex', dto.page_index)
  svc.add_parameter('pageSize', dto.page_size)
  svc.add_parameter('query', dto.query)
  svc.add_parameter('recursive', dto.recursive)
  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.get('getActivityList', parent_node_uri)
    return UU::OS::REST::ResultList.new(Activity::ActivityGetActivityList, Activity::ActivityAttributes, res)
  end
end

- (ActivityAttributes) get_attributes(activity_uri)

This command returns attributes representing the activity specified by the activityUri parameter. The command does not change the state of the activity in the system.

Parameters:

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

    UESURI of an activity whose attributes are returned

Returns:



52
53
54
55
56
57
58
# File 'uu_os_client-0.10.6/lib/uu/os/activity.rb', line 52

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

- (UU::OS::REST::ResultList<Activity::ActivityGetInstanceList, Activity::ActivityAttributes>) get_instance_list(activity_uri, criteria = nil)

Returns list of all instances of the recurrent activity. Returned list does not contain any objects filtered out by executed UESQuery.

Allowed filtering parameters are name, code, activityType, allowExecutiveRoleChange, allowSubactivities, blockTimeInCalendar, activityStateType, activityStateSubtype, recurrent, termModifiable, dateFrom, dateStart, dateTo and dateFinished.

TODO

Parameters:

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

    UESURI of the activity for which instances are to be listed.

  • criteria (defaults to: nil)

    DTO containing the criteria for filtering of the result list. Criteria are defined using UESQuery.

Returns:



118
119
120
121
122
123
124
125
126
127
128
# File 'uu_os_client-0.10.6/lib/uu/os/activity.rb', line 118

def get_instance_list(activity_uri, criteria = nil)
  svc = UU::OS::REST::RemoteClient.new(Activity)
  dto = Activity::ActivityGetInstanceList.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('getInstanceList', activity_uri)
    return UU::OS::REST::ResultList.new(Activity::ActivityGetInstanceList, Activity::ActivityAttributes, res)
  end
end

- (UU::OS::UESURI) set_attributes(activity_uri, activity = nil)

This command updates some basic attributes of an activity.

because command could change name and code.

Parameters:

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

    UESURI of the activity whose attributes are to be changed

  • activity (ActivitySetAttributes) (defaults to: nil)

    DTO containing new attributes the activity

Returns:



86
87
88
89
90
91
92
93
94
# File 'uu_os_client-0.10.6/lib/uu/os/activity.rb', line 86

def set_attributes(activity_uri, activity = nil)
  svc = UU::OS::REST::RemoteClient.new(Activity)
  payload = UU::OS::Activity::ActivitySetAttributes.new(activity).to_json

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

- (Object) set_state(activity_uri, activity = nil)

This command sets a new state for the specified activity. You can enter the state template using ues uri or by specifying its type and, additionally, subtype.

Examples:

# Set activity state by type and subtype.
UU::OS::Activity.set_state('ues:TERRITORY:ARTIFACT:ACTIVITY', :type => 'ACTIVE', :subtype => 'II')

# Set activity state by ues uri of state template.
UU::OS::Activity.set_state('ues:TERRITORY:ARTIFACT:ACTIVITY', :template_uri => 'ues:TERRITORY:META_ARTIFACT:ACTIVITY_TEMPLATE')

Parameters:

Options Hash (activity):

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

    When null is set, attribute type (and subtype) will be used to setting activity state.

  • :type (String)

    When null is set, attribute templateUri must be set.

  • :subtype (String)

    When null is set, the first possible subtype will be used.

  • :comment (String)

    Activity state’s comment. When null is set, comment will be left empty.



37
38
39
40
41
42
43
44
# File 'uu_os_client-0.10.6/lib/uu/os/activity.rb', line 37

def set_state(activity_uri, activity = nil)
  svc = UU::OS::REST::RemoteClient.new(Activity)
  payload = UU::OS::Activity::ActivitySetState.new(activity).to_json

  UU::OS::QoS::QoSHandler.auto_retry do
    svc.post('setState', activity_uri, payload)
  end
end