Module: UU::OS::Artifact

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

Overview

Module Artifact.

Defined Under Namespace

Classes: ArtifactAttributes, ArtifactCommentsDisplayMode, ArtifactContextMenuDisplayMode, ArtifactControlBarDisplayMode, ArtifactCreate, ArtifactExport, ArtifactGetExportData, ArtifactGetReferenceList, ArtifactHeaderDisplayMode, ArtifactLayout, ArtifactMove, ArtifactPresentationAttributes, ArtifactSetAttributes, ArtifactSetCompetentRole, ArtifactSetPresentationAttributes, ArtifactSetState, ArtifactSetVisualPresentation, ArtifactStateType, ArtifactType, ArtifactVisualStyle, ArtifactWidthType, ExportMimeType, ReferenceEntry, 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):

  • :artifact_type (String)

    Artifact type.

  • :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.

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

    URI of the meta artifact.

  • :name (String)

    Name of the new artifact.

  • :security_level (String)

    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.

Returns:



58
59
60
61
62
63
64
65
# File 'uu_os_client-0.10.6/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)
    return UU::OS::UESURI.new(res)
  end
end

- (Object) delete(artifact_uri)

This command 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

Parameters:

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

    UESURI of the artifact which is about to be deleted



117
118
119
120
121
122
# File 'uu_os_client-0.10.6/lib/uu/os/artifact.rb', line 117

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:



267
268
269
270
271
272
273
274
275
# File 'uu_os_client-0.10.6/lib/uu/os/artifact.rb', line 267

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)

This command gets the attributes of the artifact specified by artifact URI and returns its detail.

Parameters:

Returns:



72
73
74
75
76
77
78
# File 'uu_os_client-0.10.6/lib/uu/os/artifact.rb', line 72

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::UESURI) get_export_data(artifact_uri, artifact = nil)

Returns a XML file generated by the export command Artifact#export.

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):

  • :requested_mime_type (String)

    MIME type of the returned value. All possible MIME types can be found as constants in UU::OS::Artifact::ExportMimeType class. ZIP is returned by default.

Returns:

  • (UU::OS::UESURI)

    Data file of an exported artifact (XML or ZIP containing XML).



294
295
296
297
298
299
300
301
302
303
304
# File 'uu_os_client-0.10.6/lib/uu/os/artifact.rb', line 294

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
    res = svc.get('getExportData', artifact_uri)
    return UU::OS::REST::BinaryValue.new(res, true)
  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 context menu visibility. 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:



246
247
248
249
250
251
252
# File 'uu_os_client-0.10.6/lib/uu/os/artifact.rb', line 246

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)

This command 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 artefact, 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.

name, code, entityTypeUri, type : UESReferenceType UESReferenceType, direction : UESReferenceDirection UESReferenceDirection and count. TODO reference enums

See UESQuery Documentation.

Parameters:

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

    UESURI of the artifact to which and/or from which the references are listed.

  • criteria (ArtifactGetReferenceList) (defaults to: nil)

    Object containing criteria for listing references. Available parameters are:

Returns:



181
182
183
184
185
186
187
188
189
190
191
# File 'uu_os_client-0.10.6/lib/uu/os/artifact.rb', line 181

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)

This command 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.

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



101
102
103
104
105
106
107
# File 'uu_os_client-0.10.6/lib/uu/os/artifact.rb', line 101

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.

Parameters:

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

    URI of required artifact

  • artifact (ArtifactSetAttributes) (defaults to: nil)

    Object containing attributes for updating the artifact

Returns:



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

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)

This command sets a new competent role for an artifact (asynchronously).

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



128
129
130
131
132
133
134
# File 'uu_os_client-0.10.6/lib/uu/os/artifact.rb', line 128

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 context menu visibility. 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.

Returns:



225
226
227
228
229
230
231
232
# File 'uu_os_client-0.10.6/lib/uu/os/artifact.rb', line 225

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)

This command 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 two ways to specify this activity:

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

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

  1. The ues uri of the activity template can be 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).

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.



157
158
159
160
161
162
163
# File 'uu_os_client-0.10.6/lib/uu/os/artifact.rb', line 157

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.

This command 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:



201
202
203
204
205
206
207
# File 'uu_os_client-0.10.6/lib/uu/os/artifact.rb', line 201

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