Module: UU::OS::UseCase

Extended by:
UseCase
Included in:
UseCase
Defined in:
uu_os-0.29.16/lib/uu/os/use_case.rb,
uu_os-0.29.16/lib/uu/os/use_case/use_case_type.rb,
uu_os-0.29.16/lib/uu/os/use_case/use_case_create.rb,
uu_os-0.29.16/lib/uu/os/use_case/use_case_attributes.rb,
uu_os-0.29.16/lib/uu/os/use_case/use_case_set_options.rb,
uu_os-0.29.16/lib/uu/os/use_case/use_case_get_options.rb,
uu_os-0.29.16/lib/uu/os/use_case/use_case_set_attributes.rb,
uu_os-0.29.16/lib/uu/os/use_case/use_case_get_use_case_list.rb

Defined Under Namespace

Classes: UseCaseAttributes, UseCaseCreate, UseCaseGetOptions, UseCaseGetUseCaseList, UseCaseSetAttributes, UseCaseSetOptions, UseCaseType

Constant Summary

PATH =

Service path

'uu/os/UseCase'

Instance Method Summary (collapse)

Instance Method Details

- (UU::OS::UESURI) create(meta_artifact_uri, usecase = nil)

The command creates a use case in a specified meta artifact. @param metaArtifactUri URI of the meta artifact where the use case is aggregated. @paramuseCase DTO containing attributes of the new use case @return URI of the new use case @throws UseCaseRTException

Examples:

# Create usecase for metaartifact.
UU::OS::UseCase.create('ues:TERRITORY:METAARTIFACT', :name=>'Usecase name', :code=>'USECASE', 
:description=>'Some sample data', :use_case_realization_uri=>'ues:TERRITORY:USECASE_REALIZATION', :options=>'{"key1":"value1","key2":true}' )

Parameters:

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

    UESURI of MetaArtifact in which the UC will be created

  • usecase (UseCaseCreate) (defaults to: nil)

    DTO containing attributes needed for UC creation

Options Hash (usecase):

  • :name (String)

    The name of the use case. Cannot be nil.

  • :code (String)

    The code of the use case. The code must be unique in the given meta artifact, otherwise the create command fails.

  • :description (String)

    The description of the use case. When nil is set, the description will be empty.

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

    The UESURI of a use case realization.

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

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

Returns:



39
40
41
42
43
44
45
46
47
# File 'uu_os-0.29.16/lib/uu/os/use_case.rb', line 39

def create(meta_artifact_uri, usecase = nil)
  svc = UU::OS::REST::RemoteClient.new(UseCase)
  payload = UU::OS::UseCase::UseCaseCreate.new(usecase).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(use_case_uri)

The command deletes the specified use case from the system.

Examples:

# Delete usecase specified by ues uri
UU::OS::UseCase.delete('ues:TERRITOTY:USECASE')

Parameters:

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

    UESURI of the UC to be deleted



57
58
59
60
61
62
# File 'uu_os-0.29.16/lib/uu/os/use_case.rb', line 57

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

- (UseCaseAttributes) get_attributes(use_case_uri)

This command returns attributes representing the use case specified by the useCaseUri parameter. of the use case

Examples:

# Get attributes of usecase.
UU::OS::UseCase.get_attributes('ues:TERRITORY:USECASE')

Parameters:

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

    UESURI URI of the use case

Returns:



76
77
78
79
80
81
82
# File 'uu_os-0.29.16/lib/uu/os/use_case.rb', line 76

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

- (UseCaseGetOptions) get_options(use_case_uri, get_dto = nil)

The command returns options of the specified use case.

Examples:

# Get use case options from usecase only - default returned format will be json.
UU::OS::UseCase.get_options('ues:TERRITORY:USECASE',:summed=>false)

Parameters:

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

    UESURI of the use case

  • get_dto (UseCaseGetOptions) (defaults to: nil)

    DTO containing options for getting usecase options.

Options Hash (get_dto):

  • :summed (Boolean)

    When summed is true, the command returns summed options from the meta use case realization, use case realization and use case. Otherwise the command returns use case options only.

  • :requested_mime_type (String)

    Type of use case options. When nil is set, the JSON value is used.

Returns:



142
143
144
145
146
147
148
149
150
# File 'uu_os-0.29.16/lib/uu/os/use_case.rb', line 142

def get_options(use_case_uri, get_dto = nil)
  svc = UU::OS::REST::RemoteClient.new(UseCase)
  dto = UU::OS::UseCase::UseCaseGetOptions.new(get_dto)
  svc.add_parameter('requestedMimeType', dto.requested_mime_type)
  UU::OS::QoS::QoSHandler.auto_retry do
    ret = svc.get('getOptions', use_case_uri)
    return UU::OS::REST::BinaryValue.new(ret, true)
  end
end

- (UU::OS::REST::ResultList<UseCase::UseCaseGetUseCaseList, UseCase::UseCaseAttributes>) get_use_case_list(meta_artifact_uri, criteria = nil)

Returns list of the use cases that are defined on the specified meta artifact. The list of returned use cases could be filtered by the name, code, useCaseRealizationUri and useCaseType. 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.

Examples:

# Return usecases for specified meta artifact and descend ordered by code. 
UU::OS::UseCase.get_use_case_list('ues:TERRITORY:METAARTIFACT', :criteria=>'ORDER BY code DESC')

Parameters:

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

    UESURI of the meta artifact uri

  • criteria (UseCaseGetUseCaseList) (defaults to: nil)

    DTO containing the criteria for listing use cases.

Options Hash (criteria):

  • :query (String)

    Query in uesQuery syntax (see documentation for more info). Records can be filtered and ordered by name, code, useCaseRealizationUri and useCaseType. If set to nil, no filtering will be applied and results will be ordered by name and code as the second criteria.

Returns:



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

def get_use_case_list(meta_artifact_uri, criteria = nil)
  svc = UU::OS::REST::RemoteClient.new(UseCase)
  dto = UseCase::UseCaseGetUseCaseList.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', meta_artifact_uri)
    return UU::OS::REST::ResultList.new(UseCase::UseCaseGetUseCaseList, UseCase::UseCaseAttributes, res)
  end
end

- (UU::OS::UESURI) set_attributes(use_case_uri, usecase = nil)

The command sets attributes on specified use case according to useCaseUri.

Examples:

# Set attributes of usecase.
useCaseUri = UU::OS::UseCase.set_attributes('ues:TERRITORY:USECASE', :name=>'Visual usecase name', :code=>'NEW_CODE',
:description=>'Some sample description', :use_case_realization_uri=>'ues:TERRITORY:USECASE_REALIZATION')

Parameters:

Options Hash (usecase):

  • :name (String)

    The name of the use case.

  • :code (String)

    The code of the use case.

  • :description (String)

    The description of the use case.

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

    The UESURI of a use case realization.If it is not specified, the value is not modified.If nil URI (‘ues:[-1]:[-1]:’) is set, use case realization is detached. Detaching use case realization from use case is not recommended as it may lead to inaccessibility of certain features provided by this use case. Use case realization should either be in the same meta model as use case object or in another meta model with code VENDOR_CODE ‘.’ APP_CODE ‘-V’ VERSION.

Returns:



100
101
102
103
104
105
106
107
108
# File 'uu_os-0.29.16/lib/uu/os/use_case.rb', line 100

def set_attributes(use_case_uri, usecase = nil)
  svc = UU::OS::REST::RemoteClient.new(UseCase)
  payload = UU::OS::UseCase::UseCaseSetAttributes.new(usecase).to_json

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

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

The command sets options of the specified use case.

Examples:

# Set options for usecase.
UU::OS::UseCase.set_options('ues:TERRITORY:USECASE',:options=>'{"key1":"value1","key2":true}')

Parameters:

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

    UESURI of the use case

  • dto (UseCaseSetOptions) (defaults to: nil)

    DTO containing the options data for setting use case options.

Options Hash (dto):

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

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



120
121
122
123
124
125
126
127
# File 'uu_os-0.29.16/lib/uu/os/use_case.rb', line 120

def set_options(uri, dto = nil)
  svc = UU::OS::REST::RemoteClient.new(UseCase)
  payload = UU::OS::UseCase::UseCaseSetOptions.new(dto).to_json
  
  UU::OS::QoS::QoSHandler.auto_retry do
    svc.post('setOptions', uri, payload)
  end
end