Module: UU::OS::VisualUseCase

Extended by:
VisualUseCase
Included in:
VisualUseCase
Defined in:
uu_os-0.29.16/lib/uu/os/visual_use_case.rb,
uu_os-0.29.16/lib/uu/os/visual_use_case/controller_engine.rb,
uu_os-0.29.16/lib/uu/os/visual_use_case/visual_use_case_create.rb,
uu_os-0.29.16/lib/uu/os/visual_use_case/visual_use_case_export.rb,
uu_os-0.29.16/lib/uu/os/visual_use_case/visual_use_case_attributes.rb,
uu_os-0.29.16/lib/uu/os/visual_use_case/visual_use_case_get_options.rb,
uu_os-0.29.16/lib/uu/os/visual_use_case/visual_use_case_set_options.rb,
uu_os-0.29.16/lib/uu/os/visual_use_case/visual_use_case_set_attributes.rb,
uu_os-0.29.16/lib/uu/os/visual_use_case/visual_use_case_get_export_data.rb,
uu_os-0.29.16/lib/uu/os/visual_use_case/visual_use_case_get_use_case_list.rb,
uu_os-0.29.16/lib/uu/os/visual_use_case/visual_use_case_get_use_case_list_item.rb

Overview

Module Visual Use Case.

Defined Under Namespace

Classes: ControllerEngine, VisualUseCaseAttributes, VisualUseCaseCreate, VisualUseCaseExport, VisualUseCaseGetExportData, VisualUseCaseGetOptions, VisualUseCaseGetUseCaseList, VisualUseCaseGetUseCaseListItem, VisualUseCaseSetAttributes, VisualUseCaseSetOptions

Constant Summary

PATH =

Service path

'uu/os/VisualUseCase'

Instance Method Summary (collapse)

Instance Method Details

- (UU::OS::UESURI) create(uri, criteria = nil)

The command creates a visual use case in a specified location. At the very least meta artifact must be specified in VisualUseCaseCreate Object. Competent role for the new visual use case 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 VisualUseCaseCreate Object.

Examples:

# Create visual use case
vucUri = UU::OS::VisualUseCase.create('ues:TERRITORY:APP_PACKAGE', :name => 'New Visual Use Case', :code => 'NEW_VISUAL_USE_CASE',
         :controller_engine => UU::OS::VisualUseCase::ControllerEngine::UXML_USECASE_2_0, :controller_class => 'UNI::SimpleValue::Saver::Handle',
         :controller_url_path => '/mvc/UNI/SimpleValue/Saver/Handle', :meta_artifact_uri => 'ues:TERRITORY:META_ARTIFACT')

Parameters:

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

    URI of the MetaModelDictionary where the VUC should be created.

  • criteria (VisualUseCaseCreate) (defaults to: nil)

    Object containing attributes for the new VUC.

Options Hash (criteria):

  • :name (String)

    Name of the new visual use case. If nil is set, default name from meta artifact is used if set, otherwise the create command fails.

  • :code (String)

    Code of the new visual use case. If nil is set, the code is generated automatically using the system sequence. The code must be unique in the given territory, otherwise the create command fails.

  • :description (String)

    Description of the new visual use case. If nil is set, default description from meta artifact is used if set, otherwise no description is set on the new visual use case.

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

    Security level. If nil is set, security level is taken from the meta artifact default security level. If the meta artifact template security level is higher than the user’s security clearance, the create command fails.

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

    URI of the visual use case’s icon. If nil is set, the role uses icon from meta artifact. An example of icon URI: ‘ues:#{system}:#{ues_v5.core_v1.codetable_v1.base_v1.CodeTable_Icons}:#{ART_077}’.

  • :controller_url_path (String)

    Path at which the controller will be deployed.

  • :controller_class (String)

    Class to look for when executing this VUC.

  • :controller_engine (String, UU::OS::VisualUseCase::ControllerEngine)

    Engine used for this VUC.

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

    URI of the competent role. If nil is set, the executive role from authorization is used. If no role is authorized to create the visual use case into specified container, the create command fails. If the selected role doesn’t have connected the role interface with the selected meta artifact, the create command fails. If the selected role doesn’t belong to the same organizational unit as a new visual use case or if it doesn’t belong to one of superior organizational units, the create command fails.

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

    URI of the meta artifact. Only a meta artifact with the template class of Visual use case (not its descendants) can be used. If the rights does not permit to create a new visual use case from the meta artifact in the specified location, the create command fails.

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

    Options data for use case calling. Accepted format is JSON.

  • :component_content (Boolean)

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

Returns:



52
53
54
55
56
57
58
59
60
# File 'uu_os-0.29.16/lib/uu/os/visual_use_case.rb', line 52

def create(uri, criteria = nil)
  svc = UU::OS::REST::RemoteClient.new(VisualUseCase)
  payload = UU::OS::VisualUseCase::VisualUseCaseCreate.new(criteria).to_json

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

- (Object) delete(uri)

The command deletes the specified visual use case from the system. The command fails when the specified visual use case is referenced by some use case.

Examples:

# Delete visual use case
UU::OS::VisualUseCase.delete('ues:TERRITORY:VISUAL_USE_CASE')

Parameters:



70
71
72
73
74
75
# File 'uu_os-0.29.16/lib/uu/os/visual_use_case.rb', line 70

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

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

Exports a visual use case 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 Process and in Future.

Examples:

# Start exporting a visual use case.
process_uri = UU::OS::VisualUseCase.export('ues:TERRITORY:VISUAL_USE_CASE')

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

Parameters:

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

    URI of the visual use case to export.

Returns:



222
223
224
225
226
227
228
229
230
# File 'uu_os-0.29.16/lib/uu/os/visual_use_case.rb', line 222

def export(uri)
  svc = UU::OS::REST::RemoteClient.new(VisualUseCase)
  payload = UU::OS::VisualUseCase::VisualUseCaseExport.new(nil).to_json

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

- (VisualUseCaseAttributes) get_attributes(visual_use_case_uri)

This command returns attributes representing the visual use case specified by the visual_use_case_uri parameter.

Examples:

# Get visual use case attributes.
attributes = UU::OS::VisualUseCase.get_attributes('ues:TERRITORY:VISUAL_USE_CASE')

Parameters:

Returns:



86
87
88
89
90
91
92
# File 'uu_os-0.29.16/lib/uu/os/visual_use_case.rb', line 86

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

- (UU::OS::REST::BinaryValue) get_data(visual_use_case_uri)

Returns data of the first attachment on the VUC - supposed controller written in ruby.

Examples:

# Get visual use case data.
data = UU::OS::VisualUseCase.get_data('ues:TERRITORY:VISUAL_USE_CASE')

Parameters:

Returns:



133
134
135
136
137
138
139
# File 'uu_os-0.29.16/lib/uu/os/visual_use_case.rb', line 133

def get_data(visual_use_case_uri)
  svc = UU::OS::REST::RemoteClient.new(VisualUseCase)
  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.get_binary('getData', visual_use_case_uri)
    return UU::OS::REST::BinaryValue.new(res, true)
  end
end

- (UU::OS::REST::BinaryValue) get_export_data(visual_use_case_uri, visual_use_case = nil)

Returns a XML file generated by the export command export.

Examples:

# Start exporting a visual use case
process_uri = UU::OS::VisualUseCase.export('ues:TERRITORY:VISUAL_USE_CASE')

# 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::VisualUseCase.get_export_data(export_uri, :requested_mime_type => 'application/xml')

Parameters:

Options Hash (visual_use_case):

  • :requested_mime_type (String)

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

Returns:



249
250
251
252
253
254
255
256
257
258
# File 'uu_os-0.29.16/lib/uu/os/visual_use_case.rb', line 249

def get_export_data(visual_use_case_uri, visual_use_case = nil)
  svc = UU::OS::REST::RemoteClient.new(VisualUseCase)
  dto = UU::OS::VisualUseCase::VisualUseCaseGetExportData.new(visual_use_case)
  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', visual_use_case_uri)
  end
end

- (UU::OS::REST::BinaryValue) get_options(uri, criteria = nil)

The command returns options of the specified use case.

Examples:

# Get visual use case options.
UU::OS::VisualUseCase.get_options('ues:TERRITORY:VISUAL_USE_CASE')

Parameters:

Returns:



170
171
172
173
174
175
176
177
# File 'uu_os-0.29.16/lib/uu/os/visual_use_case.rb', line 170

def get_options(uri, criteria = nil)
  svc = UU::OS::REST::RemoteClient.new(VisualUseCase)
  options = UU::OS::VisualUseCase::VisualUseCaseGetOptions.new(criteria)
  svc.add_parameter('requestedMimeType', options.requested_mime_type)
  UU::OS::QoS::QoSHandler.auto_retry do
    return UU::OS::REST::BinaryValue.new(svc.get('getOptions', uri), true)
  end
end

- (UU::OS::REST::ResultList<VisualUseCase::VisualUseCaseGetUseCaseList, VisualUseCase::VisualUseCaseGetUseCaseListItem>) get_use_case_list(uri, criteria = nil)

Returns list of the use cases that are connected to the specified visual use case. The list of returned use cases could be filtered by the name or code. Returned list does not contain any objects filtered out by executed UESQuery. The list is sorted by the name (and codes in case are equal) of an use case by default.

See UESQuery Documentation.

Examples:

# Get visual use case list.
UU::OS::VisualUseCase.get_use_case_list('ues:TERRITORY:VISUAL_USE_CASE')

#Get a list of visual use cases with name that starts with string Protocol.
UU::OS::VisualUseCase.get_use_case_list('ues:TERRITORY:VISUAL_USE_CASE', :query => "name='Protocol%'")

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:



197
198
199
200
201
202
203
204
205
206
207
# File 'uu_os-0.29.16/lib/uu/os/visual_use_case.rb', line 197

def get_use_case_list(uri, criteria=nil)
  svc = UU::OS::REST::RemoteClient.new(VisualUseCase)
  dto = VisualUseCase::VisualUseCaseGetUseCaseList.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('getUseCaseList', uri)
    return UU::OS::REST::ResultList.new(VisualUseCase::VisualUseCaseGetUseCaseList, VisualUseCase::VisualUseCaseGetUseCaseListItem, res)
  end
end

- (UU::OS::UESURI) set_attributes(uri, criteria = nil)

The command for setting attributes of a specified visual use case. The command can't modify references to object like storage, competent role and so on.

Examples:

# Set visual use case attributes.
vucUri = UU::OS::VisualUseCase.set_attributes('ues:TERRITORY:VISUAL_USE_CASE', :description => 'Visual Use Case designated for testing purposes',
  :name => 'New Visual Use Case', :controller_engine => 'UXML_USECASE_2_0')

Parameters:

Options Hash (criteria):

  • :name (String)

    The new name of the visual use case. If nil is set, the name is not modified.

  • :code (String)

    The new code of the visual use case. If nil is set, the code is not modified.

  • :description (String)

    The new description of the visual use case. If nil is set, the description is not modified.

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

    Security level of the visual use case. If nil is set, the security level is not modified.

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

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

  • :controller_url_path (String)

    Path at which the controller will be deployed.

  • :controller_class (String)

    Class to look for when executing this VUC.

  • :controller_engine (String, UU::OS::VisualUseCase::ControllerEngine)

    Engine used for this VUC.

Returns:



114
115
116
117
118
119
120
121
122
# File 'uu_os-0.29.16/lib/uu/os/visual_use_case.rb', line 114

def set_attributes(uri, criteria = nil)
  svc = UU::OS::REST::RemoteClient.new(VisualUseCase)
  payload = UU::OS::VisualUseCase::VisualUseCaseSetAttributes.new(criteria).to_json

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

- (Object) set_options(uri, criteria = nil)

The command sets options of the specified visual use case.

Examples:

# Set visual use case options.
UU::OS::VisualUseCase.set_options('ues:TERRITORY:VISUAL_USE_CASE', :data => "{\n    \"glossary\": {\n\"title\":\"example ě+ščřěščřžýáíé glossary\",\n\t\t\"GlossDiv\":{\n\"title\":\"S\",\n\t\t\t\"GlossList\":{\n\"GlossEntry\": {\n\"ID\":\"SGML\",\n\t\t\t\t\t\"SortAs\":\"SGML\",\n\t\t\t\t\t\"GlossTerm\":\"Standard Generalized Markup Language\",\n\t\t\t\t\t\"Acronym\":\"SGML\",\n\t\t\t\t\t\"Abbrev\":\"ISO 8879:1986\",\n\t\t\t\t\t\"GlossDef\":{\n\"para\":\"A meta-markup language, used to create markup languages such as DocBook.\",\n\t\t\t\t\t\t\"GlossSeeAlso\":[\"GML\",\"XML\"]\n},\n\t\t\t\t\t\"GlossSee\":\"markup\"\n}\n}\n}\n}\n}")

Parameters:

Options Hash (criteria):

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

    Data for use case options. Only JSON (“application/json”) format is accepted.



150
151
152
153
154
155
156
157
158
# File 'uu_os-0.29.16/lib/uu/os/visual_use_case.rb', line 150

def set_options(uri, criteria = nil)
  svc = UU::OS::REST::RemoteClient.new(VisualUseCase)

  payload = UU::OS::VisualUseCase::VisualUseCaseSetOptions.new(criteria).to_json

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