Self-Solve Knowledge Search

Minimize Maximize
How to change Application Area of a component programmatically?
Title :
How to change Application Area of a component programmatically?
Document ID :
KM00861580
Product - Version:
quality center ; quicktest professional ; unified functional testing ;
OS :
Updated :
Wed Oct 29 18:46:07 GMT 2014
Summary :
This article talks about the right method to change the application area of a component using Application Lifecycle Management (ALM) API, called Open Test Architecture (OTA)

How to change Application Area of a component programmatically?

Solution

This is only possible using Application Lifecycle Management (ALM) API, called Open Test Architecture (OTA), via the asset relation between the component ID and the resource ID of the current application area.

Note: When user wants to change the Application Area ( AA ) Id of a component , user shouldn’t change the component field ApplicationAreaId (which is handled as a virtual field ). User needs to locate an asset relation between the using component and a resource with the Id of the previous application area and change it to the Id of the new application area. Below is a sample script which needs to be edited as per the users need:

IMPORTANT: The following script is provided for example purposes only. It is not supported by Hewlett Packard.

'CO_ID = Component ID
'AA_ID = Application Area ID
Function changeAA(Byval CO_ID, Byval AA_ID)
  Dim tdc ',CO_ID
  'CO_ID = 1
  Set tdc = TDConnection
  Dim assetRelationFactory
  Set assetRelationFactory = tdc.AssetRelationFactory
  Dim filter
  Set filter = assetRelationFactory.Filter
  filter("ASR_OWNER_ID")= CO_ID
  filter("ASR_OWNER_TYPE") = "COMPONENT"
  filter("ASR_RELATED_TYPE") = "RESOURCES"
  Set relationsList = filter.NewList()
  For each relation in relationsList
    relation.Field("ASR_RELATED_ID") = AA_ID
    relation.Post
  Next
  msgbox "New Application Area is " + CStr(AA_ID)
  Actions.Action("act_filter_refresh").Execute
End Function

DISCLAIMER OF WARRANTY The example software is experimental and is provided as a courtesy, free of charge, "AS-IS" by Hewlett-Packard Development Company, L.P. ("HP"). HP shall have no obligation to maintain or support this software. HP MAKES NO EXPRESS OR IMPLIED WARRANTY OF ANY KIND REGARDING THIS SOFTWARE. HP SHALL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, WHETHER BASED ON CONTRACT, TORT OR ANY OTHER LEGAL THEORY, IN CONNECTION WITH OR ARISING OUT OF THE FURNISHING, PERFORMANCE OR USE OF THIS SOFTWARE