Module: UU::OS::Artifact

Extended by:
Artifact
Included in:
Artifact
Defined in:
uu_os-0.29.16/lib/uu/os/artifact.rb,
uu_os-0.29.16/lib/uu/os/artifact/artifact_type.rb,
uu_os-0.29.16/lib/uu/os/artifact/artifact_move.rb,
uu_os-0.29.16/lib/uu/os/artifact/reference_type.rb,
uu_os-0.29.16/lib/uu/os/artifact/security_level.rb,
uu_os-0.29.16/lib/uu/os/artifact/artifact_create.rb,
uu_os-0.29.16/lib/uu/os/artifact/artifact_export.rb,
uu_os-0.29.16/lib/uu/os/artifact/artifact_layout.rb,
uu_os-0.29.16/lib/uu/os/artifact/export_mime_type.rb,
uu_os-0.29.16/lib/uu/os/artifact/artifact_set_state.rb,
uu_os-0.29.16/lib/uu/os/artifact/artifact_width_type.rb,
uu_os-0.29.16/lib/uu/os/artifact/artifact_attributes.rb,
uu_os-0.29.16/lib/uu/os/artifact/reference_direction.rb,
uu_os-0.29.16/lib/uu/os/artifact/artifact_state_type.rb,
uu_os-0.29.16/lib/uu/os/artifact/artifact_visual_style.rb,
uu_os-0.29.16/lib/uu/os/artifact/artifact_display_mode.rb,
uu_os-0.29.16/lib/uu/os/artifact/artifact_set_attributes.rb,
uu_os-0.29.16/lib/uu/os/artifact/artifact_get_export_data.rb,
uu_os-0.29.16/lib/uu/os/artifact/artifact_reference_entry.rb,
uu_os-0.29.16/lib/uu/os/artifact/artifact_get_reference_list.rb,
uu_os-0.29.16/lib/uu/os/artifact/artifact_set_competent_role.rb,
uu_os-0.29.16/lib/uu/os/artifact/artifact_header_display_mode.rb,
uu_os-0.29.16/lib/uu/os/artifact/artifact_comments_display_mode.rb,
uu_os-0.29.16/lib/uu/os/artifact/artifact_set_visual_presentation.rb,
uu_os-0.29.16/lib/uu/os/artifact/artifact_presentation_attributes.rb,
uu_os-0.29.16/lib/uu/os/artifact/artifact_control_bar_display_mode.rb,
uu_os-0.29.16/lib/uu/os/artifact/artifact_context_menu_display_mode.rb,
uu_os-0.29.16/lib/uu/os/artifact/artifact_set_presentation_attributes.rb,
uu_os-0.29.16/lib/uu/os/artifact/artifact_navigation_area_display_mode.rb

Overview

Module Artifact.

Defined Under Namespace

Classes: ArtifactAttributes, ArtifactCommentsDisplayMode, ArtifactContextMenuDisplayMode, ArtifactControlBarDisplayMode, ArtifactCreate, ArtifactDisplayMode, ArtifactExport, ArtifactGetExportData, ArtifactGetReferenceList, ArtifactHeaderDisplayMode, ArtifactLayout, ArtifactMove, ArtifactNavigationAreaDisplayMode, ArtifactPresentationAttributes, ArtifactSetAttributes, ArtifactSetCompetentRole, ArtifactSetPresentationAttributes, ArtifactSetState, ArtifactSetVisualPresentation, ArtifactStateType, ArtifactType, ArtifactVisualStyle, ArtifactWidthType, ExportMimeType, ReferenceDirection, ReferenceEntry, ReferenceType, SecurityLevel

Constant Summary

PATH =

Service path

'ues/core/artifact/UESArtifact'

Instance Method Summary (collapse)

Instance Method Details

- (UU::OS::UESURI) create(location_uri, artifact = nil)

Creates an artifact of class Artifact. Command creates new artifact in specified location. Meta artifact can be specified in ArtifactCreate Object, otherwise is used default meta artifact for territory. Competent role for artifact will be selected as the most suitable according to specified location and meta artifact (executive/authorized role with connected interface), or can be also specified in ArtifactCreate Object.

Examples:

# Create new artifact.
UU::OS::Artifact.create('ues:TERRITORY:FOLDER', :code => 'NEW_ARTIFACT', :name => 'New Artifact')

# Verifying that new artifact can be created.
UU::OS::Artifact.create('ues:TERRITORY:FOLDER', :code => 'NEW_ARTIFACT', :name => 'New Artifact', :dryRun => true) 

Parameters:

Options Hash (artifact):

  • :code (String)

    Code of the new artifact.

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

    URI of the competent role.

  • :description (String)

    Description of the new artifact.

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

    URI of the artifact’s icon. If nil is set, the icon is not modified. If nil UESURI (“ues:[-1]:[-1]:”) is set, the role icon is removed and the artifact uses icon from meta artifact. Allowed format of icon URI: ‘ues:#{system}:#{ues_v5.core_v1.codetable_v1.base_v1.CodeTable_Icons}:#{CODE_OF_ICON}’. An example of icon URI: ‘ues:#{system}:#{ues_v5.core_v1.codetable_v1.base_v1.CodeTable_Icons}:#{ART_077}’.

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

    URI of the meta artifact.

  • :name (String)

    Name of the new artifact.

  • :security_level (String, UU::OS::Artifact::SecurityLevel)

    Security level.

  • :create_workflow_async (Boolean)

    Created asynchronously.

  • :dry_run (Boolean)

    Specifies whether this is only a test run to verify that the object can be created. The default value is false.

  • :component_content (Boolean)

    Defines whether the primarily displayed content of the created Artifact is component content. Default value is false.

Returns:



58
59
60
61
62
63
64
65
66
67
68
# File 'uu_os-0.29.16/lib/uu/os/artifact.rb', line 58

def create(location_uri, artifact = nil)
  svc = UU::OS::REST::RemoteClient.new(Artifact)
  payload = Artifact::ArtifactCreate.new(artifact).to_json
  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.post('create', location_uri, payload)
    # res is nil if dry_run was set to true. In that case, return nil (do nothing)
    if !(res.nil? || res.empty?)
      return UU::OS::UESURI.new(res)
    end
  end
end

- (Object) delete(artifact_uri)

Deletes the specified artifact from the system. The artifact is deleted even if it contains a locked sheet or attachment. The artifact cannot be deleted when:

- the artifact's workflow is not created
- a property contains a reference to this artifact
- a time sheet exists with a reference to this artifact

Examples:

# Delete artifact with specified URI.
UU::OS::Artifact.delete('ues:TERRITORY:ARTIFACT')

Parameters:

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

    UESURI of the artifact which is about to be deleted.



147
148
149
150
151
152
# File 'uu_os-0.29.16/lib/uu/os/artifact.rb', line 147

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

- (UU::OS::UESURI) export(artifact_uri)

Exports an artifact to the XML file, which is saved to the export storage. The export is an asynchronous process.
It is possible to wait for the end of the process. More information in Env::Process and in REST::Future.

Examples:

# Start exporting an artifact.
process_uri = UU::OS::Artifact.export('ues:TERRITORY:ARTIFACT')

# Wait for the end of the process.
export_uri = UU::OS::REST::Future.new(process_uri).get(nil, 600)

Parameters:

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

    UESURI of the artifact to export.

Returns:



327
328
329
330
331
332
333
334
335
# File 'uu_os-0.29.16/lib/uu/os/artifact.rb', line 327

def export(artifact_uri)
  svc = UU::OS::REST::RemoteClient.new(Artifact)
  payload = UU::OS::Artifact::ArtifactExport.new(nil).to_json

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

- (ArtifactAttributes) get_attributes(artifact_uri)

Gets the attributes of the artifact specified by artifact URI and returns its detail.

Examples:

# Get artifact attributes.
artifactAttributes = UU::OS::Artifact.get_attributes('ues:UNI:ARTIFACT')

Parameters:

Returns:



79
80
81
82
83
84
85
# File 'uu_os-0.29.16/lib/uu/os/artifact.rb', line 79

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

- (UU::OS::REST::BinaryValue) get_export_data(artifact_uri, artifact = nil)

Returns a XML file generated by the export command.

Examples:

# Start exporting an artifact
process_uri = UU::OS::Artifact.export('ues:TERRITORY:ARTIFACT')

# Wait for the end of the process.
export_uri = UU::OS::REST::Future.new(process_uri).get(nil, 600)

# Get exported XML file.
exported_data = UU::OS::Artifact.get_export_data(export_uri, :requested_mime_type => 'application/xml')

Parameters:

Options Hash (artifact):

Returns:



354
355
356
357
358
359
360
361
362
363
# File 'uu_os-0.29.16/lib/uu/os/artifact.rb', line 354

def get_export_data(artifact_uri, artifact = nil)
  svc = UU::OS::REST::RemoteClient.new(Artifact)
  dto = UU::OS::Artifact::ArtifactGetExportData.new(artifact)
  if dto.requested_mime_type
    svc.add_parameter('requestedMimeType', dto.requested_mime_type)
  end
  UU::OS::QoS::QoSHandler.auto_retry do
    return svc.get_binary('getExportData', artifact_uri)
  end
end

- (ArtifactPresentationAttributes) get_presentation_attributes(artifact_uri)

Retrieves presentation settings of an artifact. Artifact presentation settings consist of width, layout artifact UESURI, header visibility, toolbar visibility, and artifact display mode. All of these attributes control presentation of the artifact. When viewing an artifact, presentation settings are looked up in the following order: User settings, artifact presentation settings, meta artifact template presentation settings, and layout artifact, if it is configured, or default system settings otherwise.

#

Examples:

# Get presentation attributes of an artifact
UU::OS::Artifact.get_presentation_attributes('ues:TERRITORY:ARTIFACT')

Parameters:

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

    URI of the artifact whose presentation settings are to be retrieved.

Returns:



306
307
308
309
310
311
312
# File 'uu_os-0.29.16/lib/uu/os/artifact.rb', line 306

def get_presentation_attributes(artifact_uri)
  svc = UU::OS::REST::RemoteClient.new(Artifact)
  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.get('getPresentationAttributes', artifact_uri)
    return Artifact::ArtifactPresentationAttributes.new(res)
  end
end

- (UU::OS::REST::ResultList<Artifact::ArtifactGetReferenceList, Artifact::ReferenceEntry>) get_reference_list(artifact_uri, criteria = nil)

Returns a list of all references from the specified artifact and / or all references to the specified artifact. The command does not return all references, only a sublist. The list of returned references can be filtered by the name and code of the artifact, by the meta artifact uri of the artifact, by the type of the reference, direction and the reference count. The list is sorted by the name, code and type by default, or it can be sorted arbitrarily by any of reference attributes usable for the filtering or these attributes combinations.

See UESQuery Documentation.

Examples:

# Get reference list for specified artifact without criteria.
UU::OS::Artifact.get_reference_list('ues:UNI:TESTARTIFACT')

# Get reference list with query.
UU::OS::Artifact.get_reference_list('ues:UNI:TESTARTIFACT', :query=>'direction = in ORDER BY entityTypeUri DESC')

Parameters:

Options Hash (criteria):

  • :query (String)

    The UES query string. It has to conform the ues query syntax (see documentation for more info). Filtering and order of the result list can be specified there. If nil is set, no filtering is applied and entries are ordered by name of referenced artifact (and code and type as the second and the third criteria).

Returns:



232
233
234
235
236
237
238
239
240
241
242
# File 'uu_os-0.29.16/lib/uu/os/artifact.rb', line 232

def get_reference_list(artifact_uri, criteria = nil)
  svc = UU::OS::REST::RemoteClient.new(Artifact)
  dto = UU::OS::Artifact::ArtifactGetReferenceList.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('getReferenceList', artifact_uri)
    return UU::OS::REST::ResultList.new(Artifact::ArtifactGetReferenceList, Artifact::ReferenceEntry, res)
  end
end

- (Object) move(artifact_uri, new_location = nil)

Moves an artifact to the new location (folder, organizational unit, meta mode dictionary) in the same territory. It optionally leaves a shortcut at the original location.

Examples:

# Move artifact to new location without keeping shortcut in original location.
UU::OS::Artifact.move('ues:UNI:ARTIFACT',:keep_shortcut=>false, :location_uri=>'ues:UNI:NEWLOCATION')

Parameters:

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

    UESURI of the artifact to be moved

  • new_location (ArtifactMove) (defaults to: nil)

    Object containing details of the moving

Options Hash (new_location):

  • :keep_shortcut (Boolean)

    Specifies if a new shortcut pointing to the artifactUri should be created at the original location.

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

    UESURI of a location (folder/organizational unit, meta model) where to the artifact will be moved.



127
128
129
130
131
132
133
# File 'uu_os-0.29.16/lib/uu/os/artifact.rb', line 127

def move(artifact_uri, new_location  = nil)
  svc = UU::OS::REST::RemoteClient.new(Artifact)
  payload = UU::OS::Artifact::ArtifactMove.new(new_location).to_json
  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.post('move', artifact_uri, payload)
  end
end

- (UU::OS::UESURI) set_attributes(artifact_uri, artifact = nil)

Command for setting attributes of artifact. Command can't modify references to object like storage, competent role and so on.

Examples:

# Set Artifact attributes - type, name, code, description and security level
UU::OS::Artifact.set_attributes('ues:UNI:NEWS',:code=>'ARTIFACT2',:description=>'Some sample description', :name=>'Artifact name', :security_level=>UU::OS::Artifact::SecurityLevel::INTERNAL_USE)

# Set Artifact attributes change only icon uri.
UU::OS::Artifact.set_attributes('ues:UNI:NEWS', :icon_uri=>'ues:#{system}:#{ues_v5.core_v1.codetable_v1.base_v1.CodeTable_Icons}:#{ART_077}')

Parameters:

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

    URI of required artifact.

  • artifact (ArtifactSetAttributes) (defaults to: nil)

    Object containing attributes for updating the artifact.

Options Hash (artifact):

  • :code (String)

    Code of the artifact.

  • :description (String)

    Description of the artifact.

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

    URI of the artifact’s icon. If nil is set, the icon is not modified. If nil UESURI (“ues:[-1]:[-1]:”) is set, the role icon is removed and the artifact uses icon from meta artifact. Allowed format of icon URI: ‘ues:#{system}:#{ues_v5.core_v1.codetable_v1.base_v1.CodeTable_Icons}:#{CODE_OF_ICON}’. An example of icon URI: ‘ues:#{system}:#{ues_v5.core_v1.codetable_v1.base_v1.CodeTable_Icons}:#{ART_077}’.

  • :name (String)

    Name of the artifact.

  • :security_level (String, UU::OS::Artifact::SecurityLevel)

    Security level of the artifact.

  • :component_content (Boolean)

    Defines whether the primarily displayed content of the created Artifact is component content. If attribute is not set, the value is not changed.

Returns:



107
108
109
110
111
112
113
114
# File 'uu_os-0.29.16/lib/uu/os/artifact.rb', line 107

def set_attributes(artifact_uri, artifact = nil)
  svc = UU::OS::REST::RemoteClient.new(Artifact)
  payload = UU::OS::Artifact::ArtifactSetAttributes.new(artifact).to_json
  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.post('setAttributes', artifact_uri, payload)
    return UU::OS::UESURI.new(res)
  end
end

- (Object) set_competent_role(artifact_uri, new_competency = nil)

Sets a new competent role for an artifact (asynchronously).

Examples:

# Set artifact competent role.
UU::OS::Artifact.set_competent_role('ues:UNI:ARTIFACT', :competent_role_uri=>'ues:UNI:ROLEA')

Parameters:

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

    UESURI of the artifact whose competence is about to be changed.

  • new_competency (ArtifactSetCompetentRole) (defaults to: nil)

    Object containing attributes of the competence change

Options Hash (new_competency):

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

    UESURI of the new competent role for the artifact.



163
164
165
166
167
168
169
# File 'uu_os-0.29.16/lib/uu/os/artifact.rb', line 163

def set_competent_role(artifact_uri, new_competency = nil)
  svc = UU::OS::REST::RemoteClient.new(Artifact)
  payload = UU::OS::Artifact::ArtifactSetCompetentRole.new(new_competency).to_json
  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.post('setCompetentRole', artifact_uri, payload)
  end
end

- (UU::OS::UESURI) set_presentation_attributes(artifact_uri, presentation_attributes = nil)

Configures presentation settings of an artifact. Artifact presentation settings consist of width, layout artifact UESURI, header visibility, toolbar visibility, and artifact display mode. All of these attributes control presentation of the artifact. When viewing an artifact, presentation settings are looked up in the following order: User settings, artifact presentation settings, meta artifact template presentation settings, and layout artifact, if it is configured, or default system settings otherwise.

Examples:

# Set presentation attributes of an artifact
UU::OS::Artifact.set_presentation_attributes('ues:TERRITORY:ARTIFACT', :layout_artifact_uri => 'ues:TERRITORY:ARTIFACT2',
:artifact_width => UU::OS::Artifact::ArtifactWidthType::DEFAULT,
:header_display_mode => UU::OS::Artifact::ArtifactHeaderDisplayMode::HIDDEN,
:comment_display_mode => UU::OS::Artifact::ArtifactCommentsDisplayMode::VISIBLE, :visual_style => UU::OS::Artifact::ArtifactVisualStyle::V2)

Parameters:

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

    URI of the artifact whose presentation settings are to be changed.

  • presentation_attributes (ArtifactSetPresentationAttributes) (defaults to: nil)

    Object containing artifact presentation settings.

Options Hash (presentation_attributes):

Returns:



286
287
288
289
290
291
292
293
# File 'uu_os-0.29.16/lib/uu/os/artifact.rb', line 286

def set_presentation_attributes(artifact_uri, presentation_attributes = nil)
  svc = UU::OS::REST::RemoteClient.new(Artifact)
  payload = UU::OS::Artifact::ArtifactSetPresentationAttributes.new(presentation_attributes).to_json
  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.post('setPresentationAttributes', artifact_uri, payload)
    return UU::OS::UESURI.new(res)
  end
end

- (Object) set_state(artifact_uri, state = nil)

Sets a new state of the specified artifact. The current state of an artifact can be retrieved by get_attributes command. Transition to the new state is driven by an activity on the artifact workflow. The activity itself sets the artifact state. There are three ways to specify this activity:

  1. The easiest way is to specify the required artifact state from the enumeration

ArtifactStateType. In this scenario, an appropriate activity template is found (an activity transforming the artifact to the required state) and it is used the same way as in the third scenario. If there is no such an activity template, the command fails. If there are a few such activities, then the first one is used (activity templates are ordered by name and code for this purpose).

  1. By the same pattern, it is possible to specify UESURI of the artifact state template we want

to set. The advantage compared to the first scenario is that we can also set some specific custom states that are not included in the enumeration UESArtifactStateType without knowing the activity template that sets it.

  1. The UESURI of the activity template can be also specified directly. This activity has to

contain an action to change the artifact state on its exit activity state. The activity is created and it changes the artifact state. If the activity contains an action with an attached script then the script is run first asynchronously and the artifact state is set after the script finishes successfully (therefore the artifact state can be actually set later, e.g. two minutes after set_state command finishes).

Examples:

# Set artifact state.
UU::OS::Artifact.set_state('ues:UNI:ARTIFACT',:state_template_uri=>'ues:UNI:ARTIFACT:ues_COMPLETED',:comment=>'Some sample comment') 

Parameters:

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

    UESURI of the artifact which state is about to be changed.

  • state (ArtifactSetState) (defaults to: nil)

    Object containing details of the state change.

Options Hash (state):

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

    UESURI of an artifact state template. If there’s no activity for setting this state, the command fails. On the contrary, if there are several such activities, the command will pick the first of them. If it is not specified, either activity_template_uri or type is used to determine the new state. Only one of these three parameters can be set to a non-nil value.

  • :comment (String)

    The artifact state comment. If it is not specified, the comment will be left empty.

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

    The new state of the artifact. If it is not specified, either state_template_uri or activity_template_uri is used to determine the new state. Only one of these three parameters can be set to a non-nil value.



205
206
207
208
209
210
211
# File 'uu_os-0.29.16/lib/uu/os/artifact.rb', line 205

def set_state(artifact_uri, state = nil)
  svc = UU::OS::REST::RemoteClient.new(Artifact)
  payload = UU::OS::Artifact::ArtifactSetState.new(state).to_json
  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.post('setState', artifact_uri, payload)
  end
end

- (Object) set_visual_presentation(artifact_uri, presentation = nil)

Deprecated.

Sets an artifact presentation settings. The current presentation settings of an artifact can be retrieved by getAttributes command. Artifact presentation settings consists of width. Changing the width of the artifact changes the width of the content part of the artifact. Artifact width is used as default width for all artifact sheets and in visual use cases over artifact and its aggregated objects.

Parameters:

Options Hash (presentation):

  • :layout (String, UU::OS::Artifact::ArtifactLayout)

    Layout of the artifact. If nil is set, the layout is not modified.

  • :width (String, UU::OS::Artifact::ArtifactArtifactWidthType)

    Width of the artifact. If nil is set, the width is not modified.



254
255
256
257
258
259
260
# File 'uu_os-0.29.16/lib/uu/os/artifact.rb', line 254

def set_visual_presentation(artifact_uri, presentation = nil)
  svc = UU::OS::REST::RemoteClient.new(Artifact)
  payload = UU::OS::Artifact::ArtifactSetVisualPresentation.new(presentation).to_json
  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.post('setVisualPresentation', artifact_uri, payload)
  end
end