Module: UU::OS::ArtifactStateTemplate

Extended by:
ArtifactStateTemplate
Included in:
ArtifactStateTemplate
Defined in:
uu_os-0.29.16/lib/uu/os/artifact_state_template.rb,
uu_os-0.29.16/lib/uu/os/artifact_state_template/artifact_state_template_create.rb,
uu_os-0.29.16/lib/uu/os/artifact_state_template/artifact_state_template_attributes.rb,
uu_os-0.29.16/lib/uu/os/artifact_state_template/artifact_state_template_set_attributes.rb,
uu_os-0.29.16/lib/uu/os/artifact_state_template/artifact_state_template_get_artifact_state_template_list.rb

Overview

Module Artifact State Template.

Defined Under Namespace

Classes: ArtifactStateTemplateAttributes, ArtifactStateTemplateCreate, ArtifactStateTemplateGetArtifactStateTemplateList, ArtifactStateTemplateSetAttributes

Constant Summary

PATH =

Service path

'uu/os/ArtifactStateTemplate'

Instance Method Summary (collapse)

Instance Method Details

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

Creates a new artifact state template on the specified meta artifact.

Examples:

# Create an artifact state template
UU::OS::ArtifactStateTemplate.create('ues:TERRITORY:META_ARTIFACT',
   :name => 'New Artifact State Template Name',
   :type => 'FINAL',
   :icon_uri => 'ues:#{system}:#{ues_v5.core_v1.codetable_v1.base_v1.CodeTable_Icons}:#{S00_C01}',
   :order => 120)

Parameters:

Options Hash (options):

  • :name (String)

    Not nil. Name of the new artifact state template.

  • :code (String)

    Code of the new artifact state template. 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.

  • :description (String)

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

  • :type (String, UU::OS::Artifact::ArtifactStateType)

    Not nil. Type of the new artifact state template. All possible types can be found as constants in UU::OS::Artifact::ArtifactStateType class.

  • :entry_state (Boolean)

    After an artifact is created from the related meta artifact, it will be set into the state marked as the entry state. There is always just one artifact state template marked as the entry state on every meta artifact. By setting true, the new artifact state template will become the entry state instead of the one previously specified. The default value is false.

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

    Icon of the new artifact 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 artifact state template. All artifact state templates are suggested to the user in this order when setting the artifact state to an artifact which is created according to the given meta artifact. If it is not set, no specific order is specified.

  • :create_activity_template (Boolean)

    By setting this parameter to true, the user ensures that an activity for setting this state to artifacts will be created after the creation of the artifact state template is finished. The existence of such an activity will enable setting this state to artifacts. The default value is true.

Returns:



43
44
45
46
47
48
49
50
51
# File 'uu_os-0.29.16/lib/uu/os/artifact_state_template.rb', line 43

def create(meta_artifact_uri, options)
  svc = UU::OS::REST::RemoteClient.new(ArtifactStateTemplate)
  payload = UU::OS::ArtifactStateTemplate::ArtifactStateTemplateCreate.new(options).to_json

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

- (Object) delete(artifact_state_template_uri)

Deletes the specified artifact state template from the system. It cannot be deleted in case there is an action that sets a state based on this template. Also, a system state and any state set as entry state cannot be deleted.

Examples:

# Deletes an artifact state template
UU::OS::ArtifactStateTemplate.delete('ues:TERRITORY:META_ARTIFACT:ARTIFACT_STATE_TEMPLATE')

Parameters:

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

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



106
107
108
109
110
111
# File 'uu_os-0.29.16/lib/uu/os/artifact_state_template.rb', line 106

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

- (UU::OS::REST::ResultList<ArtifactStateTemplate::ArtifactStateTemplateGetArtifactStateTemplateList, ArtifactStateTemplate::ArtifactStateTemplateAttributes>) get_artifact_state_template_list(meta_artifact_uri, criteria = nil)

Returns a list of artifact state templates on the specified meta artifact.

Examples:

# Returns list of artifact state templates which are not the entry state and have an active type
UU::OS::ArtifactStateTemplate.get_artifact_state_template_list('ues:TERRITORY:META_ARTIFACT',
   :query => 'type="ACTIVE" AND entry_state=false')

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 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, order, activityTemplateExists.

Returns:

See Also:



127
128
129
130
131
132
133
134
135
136
137
# File 'uu_os-0.29.16/lib/uu/os/artifact_state_template.rb', line 127

def get_artifact_state_template_list(meta_artifact_uri, criteria = nil)
  svc = UU::OS::REST::RemoteClient.new(ArtifactStateTemplate)
  dto = ArtifactStateTemplate::ArtifactStateTemplateGetArtifactStateTemplateList.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('getArtifactStateTemplateList', meta_artifact_uri)
    return UU::OS::REST::ResultList.new(ArtifactStateTemplate::ArtifactStateTemplateGetArtifactStateTemplateList, ArtifactStateTemplate::ArtifactStateTemplateAttributes, res)
  end
end

- (UU::OS::ArtifactStateTemplate::ArtifactStateTemplateAttributes) get_attributes(artifact_state_template_uri)

Returns attributes of the specified artifact state template.

Examples:

# Get attributes of an artifact state template
UU::OS::ArtifactStateTemplate.get_attributes('ues:TERRITORY:META_ARTIFACT:ARTIFACT_STATE_TEMPLATE')

Parameters:

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

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

Returns:



62
63
64
65
66
67
68
# File 'uu_os-0.29.16/lib/uu/os/artifact_state_template.rb', line 62

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

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

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

Examples:

# Sets a few attributes of an artifact state template
UU::OS::ArtifactStateTemplate.set_attributes('ues:TERRITORY:META_ARTIFACT:ARTIFACT_STATE_TEMPLATE',
   :name => 'New Artifact State Template Name', :entry_state => true, order => 95,
   :icon_uri => 'ues:#{system}:#{ues_v5.core_v1.codetable_v1.base_v1.CodeTable_Icons}:#{S00_C01}')

Parameters:

Options Hash (options):

  • :name (String)

    Name of the new artifact state template. If not specified, the create command fails.

  • :code (String)

    Code of the new artifact state template. 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.

  • :description (String)

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

  • :entry_state (Boolean)

    After an artifact is created from the related meta artifact, it will be set into the state marked as the entry state. There is always just one artifact state template marked as the entry state on every meta artifact. By setting true, the new artifact state template will become the entry state instead of the one previously specified. The default value is false.

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

    URI of the new artifact state template’s icon. If it is not specified, the icon is not modified. If nil URI (‘ues:[-1]:[-1]:’) is set, the artifact 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 new artifact state template. All artifact state templates are suggested to the user in this order when setting the artifact state to an artifact which is created according to the given meta artifact. If it is not specified, the parameter is not modified.

Returns:



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

def set_attributes(artifact_state_template_uri, options)
  svc = UU::OS::REST::RemoteClient.new(ArtifactStateTemplate)
  payload = UU::OS::ArtifactStateTemplate::ArtifactStateTemplateSetAttributes.new(options).to_json

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