ReplaceOrigCollection - Teradata Meta Data Services

Teradata Meta Data Services Programmer Guide

Product
Teradata Meta Data Services
Release Number
15.00
Language
English (United States)
Last Update
2018-09-28
Product Category
Teradata Tools and Utilities

ReplaceOrigCollection

Purpose

The CMetaObject class ReplaceOrigCollection function replaces the collection with Ids in the specified list (lOrigIDs or origRelList) by adding the IDs in the list not in the collection; removing IDs from the collection that are not in the specified list.

The lOrigIDs list contains object ids. The origRelList contains origin loids and explanation strings.

Description

The relationship id is specified by the GUID relationship id or internal relationship id (one of which must be set).

ReplaceOrigCollection only modifies the collection of the current version of the CMetaObject, and it only uses the current version of each object in the lOrigIDs or origRelList list. If necessary, RemoveFromOrigCollection will determine the current version for the CMetaObject and each entry in lOrigIDs or origRelList.

When origRelList is specified, only the origin loid and explanation from each entry are used; the other fields are ignored.

If the origin class of the relationship is a superclass, this function will replace only the collections for classes of objects on the replace list. Note the example in Figure 24.

Figure 24: ReplaceOrigCollection Function Example

The replace list contains object IDs for A3, B1, and B3. The collection of object O1 with ClassA objects is replaced with A3. The collection of object O1 with ClassB objects is replaced with B1 and B3. The collection of object O1 with ClassC objects is not affected as there are no ClassC objects on the replace list. To remove all objects from a collection use the RemoveAllFromOrigCollection2 function.

Requirements

The internal object id must be set in the object and it must be for a version of the object. Each object id in lOrigIDs must be for a version of an object. CMetaObject must be an object in the destination class.

Syntax

HRESULT ReplaceOrigCollection(
const LLOBJECTID_t &origIDList, 
const GUID &gRelID, 
const OBJECTID_t lRelID = NULLLOID);
 
HRESULT ReplaceOrigCollection(
const vector<CMetaRelationship> &origRelList 
const GUID &gRelID, 
const OBJECTID_t lRelID = NULLLOID);
 

Argument

In/Out

Description

IOrigIDs

In

List of objectIDs to be set in the origin collection.; if necessary, they will be adjusted to the current version of the associated object.

origRelList

In

List of origin IDs and explanatory strings to be set in the origin collection; if necessary, they will be adjusted to the current version of each associated object.

gRelID

In

Relationship ID

lRelID

In

Internal Relationship ID optional unless gRelID is NULLGUID