Module: UU::Finman::BusinessCase

Extended by:
BusinessCase
Included in:
BusinessCase
Defined in:
lib/uu/finman/business_case.rb,
lib/uu/finman/businesscase/transaction_side.rb,
lib/uu/finman/businesscase/business_case_type.rb,
lib/uu/finman/businesscase/business_case_state.rb,
lib/uu/finman/businesscase/business_case_create.rb,
lib/uu/finman/businesscase/business_case_set_state.rb,
lib/uu/finman/businesscase/business_case_categories.rb,
lib/uu/finman/businesscase/business_case_attributes.rb,
lib/uu/finman/businesscase/business_case_get_categories.rb,
lib/uu/finman/businesscase/business_case_set_attributes.rb,
lib/uu/finman/businesscase/business_case_generate_report.rb,
lib/uu/finman/businesscase/business_case_attachment_report_type.rb

Overview

Module of finman Business case

Defined Under Namespace

Classes: BusinessCaseAttachmentReportType, BusinessCaseAttributes, BusinessCaseCategories, BusinessCaseCreate, BusinessCaseGenerateReport, BusinessCaseGetCategories, BusinessCaseSetAttributes, BusinessCaseSetState, BusinessCaseState, BusinessCaseType, TransactionSide

Constant Summary

PATH =

Service path

'uu/finman/businesscase/BusinessCase'

Instance Method Summary (collapse)

Instance Method Details

- (UU::OS::UESURI) create(location_uri, business_case)

Creates a new Business Case. The command creates a new Business Case in a specified location with passed DTO parameters.

Required attributes:

meta_artifact_uri or business_case_type, name, business_case_company_uri, location_uri, currency

Attributes default_account_uri and default_account_number cannot be set simultaneously.
Attriburte currency must be one from allowed reporting currencies

Examples:

# Prepare folder or Organization Unit URI, where we want to create Business Case.
location_uri = UU::OS::UESURI.new('ues:TERRITORY:ARTIFACT_FOLDER_OR_OU');

# Create business Case
  UU::Finman::BusinessCase.create(location_uri,
  :meta_artifact_uri => "ues:TERRITORY:BUSINESS_CASE_META_ARTIFACT",
  :name => "Business case",
  :currency => "CZK",
  :business_case_company_uri => "ues:TERRITORY:ARTIFACT_COMPANY",
  :competent_role_uri => "ues:TERRITORY:COMPETENT_ROLE");

# Create business Case
  UU::Finman::BusinessCase.create(location_uri,
  :business_case_type => "INTRATERRITORIAL",
  :name => "Business case",
  :currency => "CZK",
  :business_case_company_uri => "ues:TERRITORY:ARTIFACT_COMPANY",
  :competent_role_uri => "ues:TERRITORY:COMPETENT_ROLE");

Parameters:

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

    UESURI of the folder or organizational unit where Business Case will be created.

  • business_case (UU::Finman::BusinessCase::BusinessCaseCreate)

    DTO containing attributes of the new Business Case

Returns:

  • (UU::OS::UESURI)

    UESURI of the new Business Case. In case of setting dry_run parameter to true, UU::OS::UESURI::NIL_URI is returned instead.



55
56
57
58
59
60
61
62
63
# File 'lib/uu/finman/business_case.rb', line 55

def create(location_uri, business_case)
  svc = UU::OS::REST::RemoteClient.new(BusinessCase)
  bcase_create = UU::Finman::BusinessCase::BusinessCaseCreate.new(business_case).to_json

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

- (UU::OS::UESURI) generate_report(business_case_uri, attributes)

Generate report of Business Case.

If reportTypeAttachment and bcWithoutSubs and bcWithSubs is set to true, returns UESURI of created report attachment with subs.

);

Examples:

# Prepare Business Case URI, where we want to set attributes.
business_case_uri = UU::OS::UESURI.new('ues:TERRITORY:BUSINESS_CASE');

# generate report of business Case
  UU::Finman::BusinessCase.generate_report(business_case_uri,
  :dateFrom => "2017-01-01",
  :dateTo => "2017-12-31",
  :bcWithoutSubs => true,
  :bcWithSubs => false,
  :reportTypeContent => true,
  :reportTypeAttachment => true,
  :attachmentType => "PAY_DATE"

Parameters:

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

    UESURI of modified Business Case

  • attributes (BusinessCaseGenerateReport)

    DTO containing attributes for generating report of the Business Case

Returns:

  • (UU::OS::UESURI)

    UESURI of created report attachment, or null UESURI if attachment was not generated.



178
179
180
181
182
183
184
185
186
# File 'lib/uu/finman/business_case.rb', line 178

def generate_report(business_case_uri, attributes)
  svc = UU::OS::REST::RemoteClient.new(BusinessCase)
  bc_attrs = UU::Finman::BusinessCase::BusinessCaseGenerateReport.new(attributes).to_json

  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.post('generateReport', business_case_uri, bc_attrs)
    return UU::OS::UESURI.new(res)
  end
end

- (UU::Finman::BusinessCase::BusinessCaseAttributes) get_attributes(business_case_uri)

Obtains Business Case attributes from service and returns them

Examples:

# Prepare Business Case URI, where we want to get attributes.
business_case_uri = UU::OS::UESURI.new('ues:TERRITORY:BUSINESS_CASE');

# get business Case attributes
  UU::Finman::BusinessCase.get_attributes(business_case_uri);

Parameters:

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

    UESURI of the Business Case

Returns:



78
79
80
81
82
83
84
# File 'lib/uu/finman/business_case.rb', line 78

def get_attributes(business_case_uri)
  svc = UU::OS::REST::RemoteClient.new(BusinessCase)
  UU::OS::QoS::QoSHandler.auto_retry do
    attrs = svc.get('getAttributes', business_case_uri)
    return UU::Finman::BusinessCase::BusinessCaseAttributes.new(attrs)
  end
end

- (UU::Finman::BusinessCaseCategories) get_categories(business_case_uri, business_case_get_categories)

Get transaction types and cost or income items.

Examples:

# Prepare Business Case URI, where we want to set attributes.
business_case_uri = UU::OS::UESURI.new('ues:TERRITORY:BUSINESS_CASE');

# get categories
categories = UU::Finman::BusinessCase.get_categories(business_case_uri,
  :financial_transaction_side => 'CREDIT');
puts "Transaction types: #{categories.transaction_types}" # prints array of transaction type data
puts "Items: #{categories.items.data.string}" # prints JSON with codetable content

Parameters:

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

    UESURI of Business Case from whose Company the income / cost items will be loaded.

  • business_case_get_categories (BusinessCaseGetCategories)

    DTO containing transaction side.

Returns:

  • (UU::Finman::BusinessCaseCategories)

    DTO with transaction types from configuration and income / cost items from Business Case’s company



231
232
233
234
235
236
237
238
239
240
# File 'lib/uu/finman/business_case.rb', line 231

def get_categories(business_case_uri, business_case_get_categories)
  svc = UU::OS::REST::RemoteClient.new(BusinessCase)
  dto_in = UU::Finman::BusinessCase::BusinessCaseGetCategories.new(business_case_get_categories).to_json

  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.post('getCategories', business_case_uri, dto_in)
    cats = UU::Finman::BusinessCase::BusinessCaseCategories.new(res)
    return cats
  end
end

- (UU::OS::UESURI) set_attributes(business_case_uri, business_case_attributes)

Sets attributes of Business Case.

Examples:

# Prepare Business Case URI, where we want to set attributes.
business_case_uri = UU::OS::UESURI.new('ues:TERRITORY:BUSINESS_CASE');

# set business Case attributes
  UU::Finman::BusinessCase.set_attributes(business_case_uri,
  :name => "Business case set name");

Parameters:

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

    UESURI of modified Business Case

  • business_case_attributes (BusinessCaseSetAttributes)

    DTO containing modified attributes of the Business Case

Returns:

  • (UU::OS::UESURI)

    UESURI of modified Business Case



101
102
103
104
105
106
107
108
109
# File 'lib/uu/finman/business_case.rb', line 101

def set_attributes(business_case_uri, business_case_attributes)
  svc = UU::OS::REST::RemoteClient.new(BusinessCase)
  bc_attrs = UU::Finman::BusinessCase::BusinessCaseSetAttributes.new(business_case_attributes).to_json

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

- (Object) set_default(business_case_uri)

Sets default business case for organizational unit..

This command sets new default business case (main entity) for OU where the BC is. Former default BC becomes regular BC that is subordinate of the new default BC. Updates befault attribute on primary satellite module and secondary satellite module. Recomputes assignments of payments (each payment is assigned to all superior default BCases) to properly reflect the new default BC.

Examples:

# Prepare Business Case URI, which should be the new default.
business_case_uri = UU::OS::UESURI.new('ues:TERRITORY:BUSINESS_CASE');

# Set default Business Case.
UU::Finman::BusinessCase.set_default(business_case_uri);

Parameters:

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

    UESURI of new default Business Case



147
148
149
150
151
152
153
# File 'lib/uu/finman/business_case.rb', line 147

def set_default(business_case_uri)
  svc = UU::OS::REST::RemoteClient.new(BusinessCase)
  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.post('setDefault', business_case_uri)
    return UU::OS::UESURI.new(res)
  end
end

- (Object) set_state(business_case_uri, state)

Sets state of business case artifact.

Examples:

# Prepare Business Case URI, where we want to set state.
business_case_uri = UU::OS::UESURI.new('ues:TERRITORY:BUSINESS_CASE');

# Set state of Business Case.
UU::Finman::BusinessCase.set_state(business_case_uri, :business_case_state => "ACTIVE" ,:comment=>"Some sample comment");

Parameters:

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

    UESURI of modified Business Case

  • business_case_attributes (BusinessCaseSetState)

    DTO containing modified attributes of the Business Case



123
124
125
126
127
128
129
# File 'lib/uu/finman/business_case.rb', line 123

def set_state(business_case_uri, state)
  svc = UU::OS::REST::RemoteClient.new(BusinessCase)
  payload = UU::Finman::BusinessCase::BusinessCaseSetState.new(state).to_json
  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.post('setState', business_case_uri, payload)
  end
end

- (Object) update_structure(control_panel_uri)

Request update of BC structure on SSDB.

This command sends request to PSM to update BC structure table. PSM then computes BC structure and sends request to SSM, where the structure will be stored.

Examples:

# Prepare Control Panel URI, which is in territory whose DB structure should be updated.
control_panel_uri = UU::OS::UESURI.new('ues:TERRITORY:APPS.UU.FINMAN/CONTROL_PANEL');

# Request structure update.
UU::Finman::BusinessCase.update_structure(control_panel_uri);

Parameters:

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

    UESURI of Control Panel



202
203
204
205
206
207
208
# File 'lib/uu/finman/business_case.rb', line 202

def update_structure(control_panel_uri)
  svc = UU::OS::REST::RemoteClient.new(BusinessCase)
  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.post('updateStructure', control_panel_uri)
    return UU::OS::UESURI.new(res)
  end
end