Index

DKLink

Purpose:

A DKLink object represents an instance of a one to one relationship between two objects, a source and a target object. The link relationship has a name and an identifier, for example, "contains", "has", and so forth. A link relationship can also have some other optional properties or attributes that further describe the relationship. These properties are kept in an object called link item, which is usually another DDO.

Usually, the source and target objects are both DDOs that represent items. For example, if the link type name is "contains," it is reasonable to interpret this as a container-containee relationship, the source item contains the target item. It could also mean a folder-document relationship, where the folder contains the document.

A link type name is the name by which links are categorized and grouped and often describe a meaningful relationship. Depending on the backend, the link type names used may be required to be a valid name defined first in a link type definition object, such as DKLinkTypeDefICM in Content Manager Verison 8.

Note: By default, DKLink deletes the DDOs it contains when the DKLink destructor is called. Alternatively, you can declare one or more of the DDOs to be shared. Any of the DDOs declared as shared will not be deleted by the destructor. You can use instances of DDOs that are managed elsewhere by setting the apprioriate shared status. Once a DDO that is not declared as shared is supplied to a DKLink object, the DKLink object owns that DDO and will delete it automatically.

Since: Version 8

Class summary:

class DKEXPORT DKLink
{
public:
DKLink();
DKLink(const char* typeName, dkDataObject* source, dkDataObject* target,
DKBoolean sharedSource = FALSE, DKBoolean sharedTarget = FALSE);
DKLink(const char* typeName, dkDataObject* source, dkDataObject* target, dkDataObject* linkItem, DKBoolean sharedSource = FALSE, DKBoolean sharedTarget = FALSE, DKBoolean sharedLinkItem = FALSE);
   virtual ~DKLink();
   virtual DKString getTypeName();
   virtual void setTypeName(const char* typeName);
   virtual dkDataObject* getSource();
   virtual void setSource(dkDataObject* source, DKBoolean shared = FALSE);
   virtual dkDataObject* getTarget();
   virtual void setTarget(dkDataObject* target, DKBoolean shared = FALSE);
   virtual dkDataObject* getLinkItem();
   virtual void setLinkItem(dkDataObject* linkItem, DKBoolean shared = FALSE);
};

Members:

Constructors and destructor
DKLink()

Constructs a link object

DKLink(const char* typeName, dkDataObject* source, dkDataObject* target, DKBoolean sharedSource = FALSE, DKBoolean sharedTarget = FALSE);

Constructs a link object and initialize it with the type name, the source and target objects. Parameters:

typeName - link type name, an identifier, for example "contains".

source - link source

target - link target

sharedSource - Set to true if the source data object is a shared instance and will have the deletion managed outside of this object. Set to false (default) if the source data object will be owned by this DKLink object.

sharedTarget - Set to true if the target data object is a shared instance and will have the deletion managed outside of this object. Set to false (default) if the target data object will be owned by this DKLink object.

DKLink(const char* typeName, dkDataObject* source, dkDataObject* target, dkDataObject* linkItem, DKBoolean sharedSource = FALSE, DKBoolean sharedTarget = FALSE, DKBoolean sharedLinkItem = FALSE);

Constructs a link object and initializes it with the type name, the source and target objects as well as the link item. Parameters:

typeName - link type name, an identifier, for example "contains".

source - link source

target - link target

linkItem - link item. Data object containing Optional properties or attributes that further describe the relationship.

sharedSource - Set to true if the source data object is a shared instance and will have the deletion managed outside of this object. Set to false (default) if the source data object will be owned by this DKLink object.

sharedTarget - Set to true if the target data object is a shared instance and will have the deletion managed outside of this object. Set to false (default) if the target data object will be owned by this DKLink object.

sharedLinkItem - Set to true if the link item data object is a shared instance and will have the deletion managed outside of this object. Set to false (default) if the link item data object will be owned by this DKLink object.

virtual ~DKLink()

Destructor. Destroys the in-memory representation of the link

Member functions

getTypeName
Gets the link type name. A link type name is the name by which links are categorized and grouped and often describe a meaningful relationship. Depending on the backend, the link type names used may be required to be a valid name defined first in a link type definition object, such as DKLinkTypeDefICM.

Returns: The link type name

virtual DKString getTypeName();

setTypeName
Sets the link type name. A link type name is the name by which links are categorized and grouped and often describe a meaningful relationship. Depending on the backend, the link type names used may be required to be a valid name defined first in a link type definition object, such as DKLinkTypeDefICM.

Parameters: typeName - link type name

virtual void setTypeName(const char* typeName);

getSource
Gets the link source object

Returns the data object for the source of the link if it has been specified in this DKLink object. NULL will be returned if it has not been specified.

 virtual void setSource(dkDataObject* source, DKBoolean shared = FALSE);

setSource
Sets the link source object. Parameters:

source - link source object

sharedSource - Set to true if the source data object is a shared instance and will have the deletion managed outside of this object. Set to false (default) if the source data object will be owned by this DKLink object.

source - data object for the source of the link.

virtual void setSource(dkDataObject* source, DKBoolean shared = FALSE);

getTarget
Gets the link target object

Returns the data object for the target of the link if it has been specified in this DKLink object. NULL will be returned if it has not been specified.

virtual dkDataObject* getTarget();

setTarget
Sets the link target object. Parameters:

target - link target object

sharedTarget - Set to true if the target data object is a shared instance and will have the deletion managed outside of this object. Set to false (default) if the target data object will be owned by this DKLink object.

target - data object for the target of the link.

virtual void setTarget(dkDataObject* target, DKBoolean shared = FALSE);

getLinkItem
Gets the link item object

Returns the data object for the link item of the link if it has been specified in this DKLink object. NULL will be returned if it has not been specified.

virtual dkDataObject* getLinkItem();

setLinkItem
Sets the link item object. This object is optional in a link.

linkItem - link item object. Optional data object containing properties or attributes that further describe the relationship.

sharedLinkItem - Set to true if the link item data object is a shared instance and will have the deletion managed outside of this object. Set to false (default) if the link item data object will be owned by this DKLink object.

virtual void setLinkItem(dkDataObject* linkItem, DKBoolean shared = FALSE);

(c) Copyright International Business Machines Corporation 1996, 2003. IBM Corp. All rights reserved.