Argomento precedente: UpdateResourceByMap

Argomento successivo: Resource Group Methods

UpdateResourceGeneralDetails

Description

This method updates the resource general details.

This update does not need to be committed by the CommitResources or CommitChangeSets methods.

Syntax

UpdateResourceGeneralDetails (OldResourceName, ResourceGeneralDetails)

Parameters

Name

Type

Description

OldResourceName

string

The name of the resource before the update.

ResourceGeneralDetails

Map

Map with the new general details, as returned from GetResourceGeneralDetails.

The user can change any field in the map.

Remarks

This method fails if the resource group does not exist.

Bulk Methods

The usage of the methods is different than the existing translation script methods, and therefore they are prefixed with the term Bulk.

Each method obtains input parameters in two manners:

The schema of the T_API tables is maintained by CA Business Service Insight, but their content is maintained by the end user.

Each table is used in exactly one translation script method (although one translation script method can use many user database tables).

Each table has a session-Id column for supporting running two scripts simultaneously with different session-Ids. The session-Id column defaults to zero.

The user can populate the T_API tables via the translation script before calling the new translation script methods or within a separate external process before calling the translation script..

The T_API tables mentioned here do not reference other CA Business Service Insight tables.

The T_API tables may have primary key or uniqueness constraints, and they may have foreign key constraints to other T_API tables for the same method.

BulkUpdateResourceGroup

Referenced Tables

T_API_UPDATE_RG

Resource Groups to create/update:

Primary key: (SESSION_ID, RESOURCE_GROUP_NAME)

T_API_UPDATE_RG_ATTRIBUTES

The custom attributes of each Resource Group:

Primary key: (SESSION_ID, RESOURCE_GROUP_NAME, CA_NAME)

Note: RESOURCE_NAME must correspond to an existing Resource Group names

Note: CA_NAME must correspond to existing Resource Group Custom Attribute names

Note: CA_VALUE must conform to type of the Custom Attribute (e.g. Text/Number/List)

Explicit Parameters

Parameter

Type

Description

sessionId

Integer

Only reference rows in the associated tables with the specified session-Id.

changeSetName

String

String Corresponds to an existing change set (e.g. “LV 2008”).

Note: This method ensures that all the resource groups mentioned exist within CA Business Service Insight with the updated custom attribute values.

Note: CA Business Service Insight resource groups not mentioned in the select statements are not affected.

Note: Cleaning up the tables T_API_UPDATE_RG and T_API_UPDATE_RG_ATTRIBUTES before (and optionally after) the method call is the responsibility of the translation script. This method can be called multiple times with the same data, only changing the referenced resources to “uncommitted resources” if there is an actual change to the specific resources custom attributes.

Limitations

Example

T_API_UPDATE_RG

insert into T_API_UPDATE_RG
(
RESOURCE_GROUP_NAME,
RESOURCE_GROUP_DISPLAY_NAME
)
select
SAP_RESOURCENAME "RESOURCE_NAME",
SAP_DISPLAYNAME "RESOURCE_DISPLAY_NAME"
from sbb_contract_topologie_new
UNION
select
ISAP_RESOURCENAME,
ISAP_DISPLAYNAME
from sbb_contract_topologie_new

T_API_UPDATE_RG_ATTRIBUTES

insert into T_API_UPDATE_RG_ATTRIBUTES
(
RESOURCE_GROUP_NAME,
CA_NAME,
CA_VALUE
)
select SAP_RESOURCENAME,
to_char('Basis Service Name'),
SAP_BASIS_SERVICE_NAME
from sbb_contract_topologie_new
UNION
select SAP_RESOURCENAME,
to_char('Station Code'),
SAP_STATIONCODE
from sbb_contract_topologie_new
UNION
select SAP_RESOURCENAME,
to_char('Location'),
SAP_LOCATION
from sbb_contract_topologie_new
UNION
select SAP_RESOURCENAME,
to_char('sap State'),
SAP_SAPSTATE
from sbb_contract_topologie_new
UNION
select SAP_RESOURCENAME,
to_char('RFS Date'),
SAP_RFSDATE
from sbb_contract_topologie_new
UNION
select SAP_RESOURCENAME,
to_char('SLA'),
SAP_SLA
from sbb_contract_topologie_new
UNION
select SAP_RESOURCENAME,
to_char('Accountable CI'),
SAP_ACCOUNTABLE_CI
from sbb_contract_topologie_new
UNION
select ISAP_RESOURCENAME,
to_char('Basis Service Name'),
ISAP_BASIS_SERVICE_NAME
from sbb_contract_topologie_new
UNION
select ISAP_RESOURCENAME,
to_char('Station Code'),
ISAP_STATIONCODE
from sbb_contract_topologie_new
UNION
select ISAP_RESOURCENAME,
to_char('Location'),
ISAP_LOCATION
from sbb_contract_topologie_new
UNION
select ISAP_RESOURCENAME,
to_char('sap State'),
ISAP_SAPSTATE
from sbb_contract_topologie_new
UNION
select ISAP_RESOURCENAME,
to_char('RFS Date'),
ISAP_RFSDATE
from sbb_contract_topologie_new
UNION
select ISAP_RESOURCENAME,
to_char('SLA'),
ISAP_SLA
from sbb_contract_topologie_new
UNION
select ISAP_RESOURCENAME,
to_char('Accountable CI'),
ISAP_ACCOUNTABLE_CI
from sbb_contract_topologie_new

Calling Method

Const SessionId="0"
Const ChangeSetName = "LV 2008"
Sub Cleanup_T_API_Tables()
Dim sql
sql = "delete T_API_UPDATE_RG where SESSION_ID = " & SessionId
ExecuteSQL(sql)
sql = "delete T_API_UPDATE_RG_ATTRIBUTES where SESSION_ID = " &
SessionId
ExecuteSQL(sql)
End Sub
Sub Main()
Cleanup_T_API_Tables()
Populate_T_API_UPDATE_RG()
Populate_T_API_UPDATE_RG_ATTRIBUTES()
Tools.BulkUpdateResourceGroup SessionId, ChangeSetName
Cleanup_T_API_Tables()
End Sub

BulkUpdateResourceTree

Referenced Tables

T_API_UPDATE_RESOURCE_ATTACH

The pairs to attach:

Primary key: (SESSION_ID, RESOURCE_NAME, RESOURCE_GROUP_NAME)

T_API_UPDATE_RESOURCE_DETACH

The pairs to detach:

Primary key: (SESSION_ID, RESOURCE_NAME, RESOURCE_GROUP_NAME)

Explicit Parameters

Parameter

Type

Description

sessionId

Integer

Only reference rows in the associated tables with the specified session-Id.

changeSetName

String

String Corresponds to an existing change set (e.g. “LV 2008”).

Note: Any rows mentioned in both T_API_UPDATE_RESOURCE_ATTACH and T_API_UPDATE_RESOURCE_DETACH are ignored.

Note: This method also detaches resources to resource groups according to the resource tree provided in T_API_UPDATE_RESOURCE_DETACH.

Note: This method attaches resources to resource groups according to the resource tree provided within T_API_UPDATE_RESOURCE_ATTACH.

Note: This method requires the resources and resource groups listed to already exist, and therefore is typically called after the BulkUpdateResouceGroup method (perhaps in the same translation script).

Note: Cleaning up the tables T_API_UPDATE_RESOURCE_DETACH and T_API_UPDATE_RESOURCE_ATTACH before/after the method call is the responsibility of the translation script.

Limitations

Example

T_API_UPDATE_RESOURCE_ATTACH

insert into T_API_UPDATE_RESOURCE_ATTACH
(
RESOURCE_NAME,
RESOURCE_GROUP_NAME
)
select
RESOURCE_NAME,
ISAP_RESOURCENAME
from sbb_contract_topologie_new
where Source = 'BATSUP P-KS-V'
UNION
select
ISAP_RESOURCENAME,
SAP_RESOURCENAME
from sbb_contract_topologie_new
where Source = 'BATSUP P-KS-V'

T_API_UPDATE_RESOURCE_DETACH

insert into T_API_UPDATE_RESOURCE_DETACH
(
RESOURCE_NAME,
RESOURCE_GROUP_NAME
)
select
RESOURCE_NAME,
ISAP_RESOURCENAME
from sbb_contract_topologie_new
where Source = '_old_BATSUP P-KS-V'
UNION
select
ISAP_RESOURCENAME,
SAP_RESOURCENAME
from sbb_contract_topologie_new
where Source = '_old_BATSUP P-KS-V'

Calling Method

Const SessionId="0"
Const ChangeSetName = "LV 2008"
Sub Cleanup_T_API_Tables()
Dim sql
sql = "delete T_API_UPDATE_RESOURCE_ATTACH where SESSION_ID = " &
SessionId
ExecuteSQL(sql)
sql = "delete T T_API_UPDATE_RESOURCE_ATTACH where SESSION_ID = " &
SessionId
ExecuteSQL(sql)
End Sub
Sub Main()
Cleanup_T_API_Tables()
Populate_T_API_UPDATE_RESOURCE_ATTACH()
Populate_T_API_UPDATE_RESOURCE_DETACH()
Tools.BulkUpdateResourceTree SessionId, ChangeSetName
Cleanup_T_API_Tables()
End Sub

BulkDeleteResourceGroup

Referenced Tables

T_API_DELETE_RG

The resource groups to delete:

Primary key: (SESSION_ID, RESOURCE_GROUP_NAME)

Explicit Parameters

Parameter

Type

Description

sessionId

Integer

Only reference rows in the associated tables with the specified session-Id.

changeSetName

String

String Corresponds to an existing change set (e.g. “LV 2008”).

Note: In order to detach a resource group from member resource groups, the method BulkUpdateResourceTree should be used.

Note: This method is intended to be used after BulkUpdateResourceTree has been called to remove all the attached resources.

Note: This method is currently designed for deleting resource groups only, and only resource groups with no attachments (member or child).

Note: In a future version, this method may deprecated in favor of a more generic “BulkDeleteResource” method that cater for deleting resources and resource groups

Limitations

The “forceDeletion” parameter is currently ignored (assumed to be false)

Example

T_API_DELETE_RG

insert into T_API_DELETE_RG
(
RESOURCE_GROUP_NAME
)
select
SAP_RESOURCENAME
from sbb_contract_topologie_new
where TASK = 'DELETED'
UNION
select
ISAP_RESOURCENAME
from sbb_contract_topologie_new
where TASK = 'DELETED'

Calling Method

Const SessionId="0"
Sub Cleanup_T_API_Tables()
Dim sql
sql = "delete T_API_DELETE_RG where SESSION_ID = " & SessionId
ExecuteSQL(sql)
End Sub
Sub Main()
Cleanup_T_API_Tables()
Populate_T_API_DELETE_RG()
Tools.BulkDeleteResourceGroup SessionId, False
Cleanup_T_API_Tables()
End Sub