Module: UU::OS::MetaArtifact

Extended by:
MetaArtifact
Included in:
MetaArtifact
Defined in:
uu_os_client-0.10.6/lib/uu/os/meta_artifact.rb,
uu_os_client-0.10.6/lib/uu/os/meta_artifact/meta_artifact_copy.rb,
uu_os_client-0.10.6/lib/uu/os/meta_artifact/meta_artifact_export.rb,
uu_os_client-0.10.6/lib/uu/os/meta_artifact/meta_artifact_create.rb,
uu_os_client-0.10.6/lib/uu/os/meta_artifact/meta_artifact_attributes.rb,
uu_os_client-0.10.6/lib/uu/os/meta_artifact/meta_artifact_set_attributes.rb,
uu_os_client-0.10.6/lib/uu/os/meta_artifact/meta_artifact_get_export_data.rb,
uu_os_client-0.10.6/lib/uu/os/meta_artifact/meta_artifact_presentation_attributes.rb,
uu_os_client-0.10.6/lib/uu/os/meta_artifact/meta_artifact_set_presentation_attributes.rb,
uu_os_client-0.10.6/lib/uu/os/meta_artifact/meta_artifact_default_presentation_attributes.rb,
uu_os_client-0.10.6/lib/uu/os/meta_artifact/meta_artifact_set_default_presentation_attributes.rb

Overview

Module Meta Artifact.

Defined Under Namespace

Classes: MetaArtifactAttributes, MetaArtifactCopy, MetaArtifactCreate, MetaArtifactDefaultPresentationAttributes, MetaArtifactExport, MetaArtifactGetExportData, MetaArtifactPresentationAttributes, MetaArtifactSetAttributes, MetaArtifactSetDefaultPresentationAttributes, MetaArtifactSetPresentationAttributes

Constant Summary

PATH =

Service path

'ues/core/artifact/UESMetaArtifact'

Instance Method Summary (collapse)

Instance Method Details

- (UU::OS::UESURI) copy(source_meta_artifact_uri, meta_artifact = nil)

Copy a meta artifact. The command creates a new meta artifact according to specified source meta artifact in a specified location in the same territory as source meta artifact. At the very least location and name must be specified in MetaArtifactCopy DTO. Only basic meta artifact types can be copied by this command (no meta role, meta group, etc.). Competent role for the new meta artifact copy will be selected as the most suitable according to specified container and meta artifact (executive/authorized role with connected interface), or can be also specified in MetaArtifactCopy DTO.

Parameters:

Returns:



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

def copy(source_meta_artifact_uri, meta_artifact = nil)
  svc = UU::OS::REST::RemoteClient.new(MetaArtifact)
  svc.timeout = 120 # may take longer than default 60 seconds
  payload = UU::OS::MetaArtifact::MetaArtifactCopy.new(meta_artifact).to_json

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

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

Deprecated.

The uuCommand MetaArtifact.create is used for creating meta artifact from the XML file temporarily. This feature will be removed in a future version and replaced by the specific uuCommands for creating template objects.

The uuCommand creates a meta artifact from an exported XML file in the specified location. Source meta artifact must be derived (at least indirectly) from a meta artifact which is a part of UU.OS uuApp.

Examples:

# Get exported data from an existing meta artifact.
exported_data = UU::OS::MetaArtifact.get_export_data('ues:TERRITORY:META_ARTIFACT', :requested_mime_type=>'application/xml')

# Create a new meta artifact according to exported one without creating sheets and attachments specified in the XML. Also set different code and name.
UU::OS::MetaArtifact.create('ues:TERRITORY:APP_PACKAGE', :code => 'NEW_META_ARTIFACT', :name => 'New Meta Artifact', :data => exported_data.data, :import_sheets => false, :import_attachments => false)

# Create a new meta artifact and set new objects to the references.
UU::OS::MetaArtifact.create('ues:TERRITORY:APP_PACKAGE', :reference_map => '{"ues:TERRITORY:OLD_ARTIFACT1":"ues:TERRITORY:ARTIFACT1","ues:TERRITORY:OLD_ARTIFACT2:OLD_OBJECT":"ues:TERRITORY:ARTIFACT2:OBJECT"}')

Parameters:

Options Hash (meta_artifact):

  • :data (String, File, UU::OS::REST::BinaryValue)

    XML or zip compressed XML containing informations about meta artifact (e.g. exported with export)

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

    UESURI of the role that will be competent for the new meta artifact. When nil is set, the attribute from the XML (entered in :data option) is used.

  • :name (String)

    Name of the new meta artifact. When nil is set, the attribute from the XML (entered in :data option) is used.

  • :code (String)

    Code of the new meta artifact. When nil is set, the attribute from the XML (entered in :data option) is used.

  • :description (String)

    Description of the new meta artifact. When nil is set, the attribute from the XML (entered in :data option) is used.

  • :security_level (String)

    Security level of the new meta artifact. When nil is set, the attribute from the XML (entered in :data option) is used. All possible security levels may be found as constants in Artifact::SecurityLevel class.

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

    UESURI of the new meta artifact icon. When nil is set, the attribute from the XML (entered in :data option) is used.

  • :default_name (String)

    Default name of an artifact that will be created according to the new meta artifact. When nil is set, the attribute from the XML (entered in :data option) is used.

  • :default_code (String)

    Default code of an artifact that will be created according to the new meta artifact. When nil is set, the attribute from the XML (entered in :data option) is used.

  • :default_artifact_type (String)

    Default artifact type of the new meta artifact. When nil is set, the attribute from the XML (entered in :data option) is used. All possible artifact types may be found as constants in Artifact::ArtifactType class.

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

    UESURI of the artifact icon that will be created according to the new meta artifact. When nil is set, the attribute from the XML (entered in :data option) is used.

  • :default_security_level (String)

    Default security level of the new meta artifact. When nil is set, the attribute from the XML (entered in :data option) is used. All possible security levels may be found as constants in Artifact::SecurityLevel class.

  • :import_life_cycle_template (Boolean)

    Flag indicating whether the life cycle template will be created according to specification in the entered XML. Default value is true.

  • :import_property_templates (Boolean)

    Flag indicating whether the property templates will be created according to specification in the entered XML. Default value is true.

  • :import_sheet_templates (Boolean)

    Flag indicating whether the sheet templates will be created according to specification in the entered XML. Default value is true.

  • :import_properties (Boolean)

    Flag indicating whether the properties will be created according to specification in the entered XML. Default value is true.

  • :import_sheets (Boolean)

    Flag indicating whether the sheets will be created according to specification in the entered XML. Default value is true.

  • :import_attachments (Boolean)

    Flag indicating whether the attachments will be created according to specification in the entered XML. Default value is true.

  • :import_meta_permissions (Boolean)

    Flag indicating whether the meta permissions will be created according to specification in the entered XML. Default value is true.

  • :import_permissions (Boolean)

    Flag indicating whether the permissions will be created according to specification in the entered XML. Default value is true.

  • :import_use_cases (Boolean)

    Flag indicating whether the use cases will be created according to specification in the entered XML. Default value is true.

  • :import_masks (Boolean)

    Flag indicating whether the permission masks will be created according to specification in the entered XML. Default value is true.

  • :reference_map (String)

    JSON describing the linkage of references specified in XML to another objects (e.g. references in properties, activity related artifacts. …).

Returns:



150
151
152
153
154
155
156
157
158
# File 'uu_os_client-0.10.6/lib/uu/os/meta_artifact.rb', line 150

def create(location_uri, meta_artifact = nil)
  svc = UU::OS::REST::RemoteClient.new(MetaArtifact)
  payload = UU::OS::MetaArtifact::MetaArtifactCreate.new(meta_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

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

The uuCommand exports a meta 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.
To get exported data from the storage use #get_export_data.

Examples:

# Start exporting a meta artifact
process_uri = UU::OS::MetaArtifact.export('ues:TERRITORY:META_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::MetaArtifact.get_export_data(export_uri)

Parameters:

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

    UESURI of the meta artifact to export.

Returns:



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

def export(meta_artifact_uri)
  svc = UU::OS::REST::RemoteClient.new(MetaArtifact)
  payload = UU::OS::MetaArtifact::MetaArtifactExport.new(nil).to_json

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

- (UU::OS::MetaArtifact::MetaArtifactAttributes) get_attributes(meta_artifact_uri)

This command returns attributes representing the meta artifact specified by the metaArtifactUri parameter. Only basic meta artifact types attributes can be returned by this command (no meta role, meta group, etc.). The command does not change the state of the meta artifact in the system.

Parameters:

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

    UESURI of a meta artifact whose attributes are returned

Returns:



34
35
36
37
38
39
40
# File 'uu_os_client-0.10.6/lib/uu/os/meta_artifact.rb', line 34

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

- (UU::OS::MetaArtifact::MetaArtifactDefaultPresentationAttributes) get_default_presentation_attributes(meta_artifact_uri)

Retrieves an artifact presentation template. Artifact presentation template consist of width, header visibility, toolbar visibility, and context menu visibility. All of these attributes control default presentation of an artifact created with this meta 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. Attribute lockSettings on the DTO can make user settings and artifact presentation settings to be ignored.

Examples:

# Get default presentation attributes of a meta-artifact
UU::OS::MetaArtifact.get_default_presentation_attributes('ues:TERRITORY:META_ARTIFACT')

Parameters:

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

    UESURI of the meta artifact whose presentation template is to be retrieved.

Returns:



229
230
231
232
233
234
235
# File 'uu_os_client-0.10.6/lib/uu/os/meta_artifact.rb', line 229

def get_default_presentation_attributes(meta_artifact_uri)
  svc = UU::OS::REST::RemoteClient.new(MetaArtifact)
  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.get('getDefaultPresentationAttributes', meta_artifact_uri)
    return MetaArtifact::MetaArtifactDefaultPresentationAttributes.new(res)
  end
end

- (UU::OS::UESURI) get_export_data(meta_artifact_uri, meta_artifact = nil)

The uuCommand returns a XML file generated by the export command.

Examples:

# Start exporting a meta artifact
process_uri = UU::OS::MetaArtifact.export('ues:TERRITORY:META_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::MetaArtifact.get_export_data(export_uri)

Parameters:

Options Hash (meta_artifact):

  • :requested_mime_type (String)

    MIME type of the returned value. Possible values are ‘application/xml’ for XML and ‘application/zip’ for ZIP. ZIP is returned by default.

Returns:

  • (UU::OS::UESURI)

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



177
178
179
180
181
182
183
184
185
186
187
# File 'uu_os_client-0.10.6/lib/uu/os/meta_artifact.rb', line 177

def get_export_data(meta_artifact_uri, meta_artifact = nil)
  svc = UU::OS::REST::RemoteClient.new(MetaArtifact)
  dto = UU::OS::MetaArtifact::MetaArtifactGetExportData.new(meta_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', meta_artifact_uri)
    return UU::OS::REST::BinaryValue.new(res, true)
  end
end

- (UU::OS::MetaArtifact::MetaArtifactPresentationAttributes) get_presentation_attributes(meta_artifact_uri)

This command gets an meta artifact presentation settings. Meta artifact presentation settings consists of width, layout artifact UESURI, header visibility, toolbar visibility or context menu visibility. All of this attributes control presentation of meta artifact. For default setting of this attributes will be meta artifact presentation resolved by algorithm looking for setting on user setting than on artifact presentation setting than on meta artifact template presentation setting then on layout artifact if is configured end if not is used system default setting.

Parameters:

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

    UESURI of a meta artifact whose presentation are returned

Returns:



264
265
266
267
268
269
270
# File 'uu_os_client-0.10.6/lib/uu/os/meta_artifact.rb', line 264

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

- (UU::OS::UESURI) set_attributes(meta_artifact_uri, meta_artifact = nil)

Command for setting attributes of a meta artifact. The command can't modify references to objects like location, competent role and so on.

Parameters:

Returns:



49
50
51
52
53
54
55
56
57
# File 'uu_os_client-0.10.6/lib/uu/os/meta_artifact.rb', line 49

def set_attributes(meta_artifact_uri, meta_artifact = nil)
  svc = UU::OS::REST::RemoteClient.new(MetaArtifact)
  payload = UU::OS::MetaArtifact::MetaArtifactSetAttributes.new(meta_artifact).to_json

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

- (UU::OS::UESURI) set_default_presentation_attributes(meta_artifact_uri, presentation_attributes = nil)

Configures an artifact presentation template. Artifact presentation template consist of width, header visibility, toolbar visibility, and context menu visibility. All of these attributes control default presentation of an artifact created with this meta 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. Attribute lockSettings on the DTO can make user settings and artifact presentation settings to be ignored.

Examples:

# Sets default presentation attributes of a meta-artifact
UU::OS::MetaArtifact.set_default_presentation_attributes('ues:TERRITORY:META_ARTIFACT', :artifact_width => UU::OS::Artifact::ArtifactWidthType::DEFAULT,
:header_display_mode => UU::OS::Artifact::ArtifactHeaderDisplayMode::HIDDEN,
:comment_display_mode => UU::OS::Artifact::ArtifactCommentsDisplayMode::VISIBLE,
:lock_settings => true, :visual_style => UU::OS::Artifact::ArtifactVisualStyle::V2)

Parameters:

Returns:



206
207
208
209
210
211
212
213
214
# File 'uu_os_client-0.10.6/lib/uu/os/meta_artifact.rb', line 206

def set_default_presentation_attributes(meta_artifact_uri, presentation_attributes = nil)
  svc = UU::OS::REST::RemoteClient.new(MetaArtifact)
  payload = UU::OS::MetaArtifact::MetaArtifactSetDefaultPresentationAttributes.new(presentation_attributes).to_json

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

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

Configures meta artifact presentation settings. Meta 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 meta artifact. When viewing a meta artifact, presentation settings are looked up in the following order: User settings, meta artifact presentation settings, meta artifact template presentation settings, and layout artifact, if it is configured, or default system settings otherwise.

Parameters:

Returns:



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

def set_presentation_attributes(meta_artifact_uri, presentation_attributes = nil)
  svc = UU::OS::REST::RemoteClient.new(MetaArtifact)
  payload = UU::OS::MetaArtifact::MetaArtifactSetPresentationAttributes.new(presentation_attributes).to_json

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