Index

DKAttrGroupDefICM

Purpose:

This class is used to represent attribute group definitions in a Content Manager server. An attribute group is composed of several related individual attributes that must exist together as a group. For example, the attribute group Address can be defined to contain the attributes StreetAddress, City, and ZipCode. These attributes must be defined together as a group in order to make the definition valid. As a regular attribute, an attribute group has basic properties, such as name, description, and so forth. Persistent operations on attribute group definitions are also supported using add, update, and delete methods. This class has methods to manage the list of attributes belonging to this group. Reference attributes are represented using this attribute group class. When you define an item type, you can include attribute groups as well as regular attributes.

See Also classes DKAttrDefICM, DKItemTypeDefICM, and DKItemTypeViewDefICM.

Since: Version 8

Class summary:

class DKEXPORT DKAttrGroupDefICM : public dkAttrGroupDef
{
public:
     DKAttrGroupDefICM();
     DKAttrGroupDefICM(dkDatastore* ds);
     DKAttrGroupDefICM(dkDatastore* ds, long opt);
     DKAttrGroupDefICM(const DKAttrGroupDefICM& group);
     virtual ~DKAttrGroupDefICM ();
     virtual long getID();
     virtual void setID(long id);
     virtual DKString getDescription();
     virtual void setDescription(const char* description);
     virtual DKString getDescription(const char* langCode);
     virtual void setDescription(const char* desc, const char* langCode);
     virtual dkCollection* listAttrs();
     dkCollection* listAttrs(long option);
     virtual DKString* listAttrNames(long& arraySize);
     DKString* listAttrNames(long option, long& arraySize);
     virtual void add();
     virtual void del();
     virtual void update();
     virtual void addAttr(dkAttrDef* attr);
     virtual void removeAttr(const char* attrName);
     virtual void updateAttr(dkAttrDef* def);
     long getReferenceSequenceNumber();
     void setReferenceSequenceNumber( long seqNo );
     long getAttrCount();
     DKBoolean isReferenceAttributeGroup();
     short getRefDeleteRule();
     void setRefDeleteRule(short refDeleteRule);
};

Members:

Constructors and destructor
DKAttrGroupDefICM();

Default constructor. Constructs an instance of attribute group definition class.

DKAttrGroupDefICM(dkDatastore* ds);

Constructs an instance of attribute group definition class for a given ICM datastore. Parameters: ds - ICM datastore.

DKAttrGroupDefICM(const DKAttrGroupDefICM& def);

A copy constructor for attribute group definition for ICM datastore. Parameters: def - an attribute group definition object.

DKAttrGroupDefICM(dkDatastore* ds, long opt)

Constructs an attribute group definition for the given ICM datastore. Parameters:

  • ds - The ICM datastore.
  • option - To indicate if this attribute group is a reference attribute. The caller needs to set this option value to DK_ICM_REFERENCE_ATTRGROUP to specify that this attribute is a reference attribute. This is the way to create a reference attribute. The default is a regular attribute group, not a reference attribute, so in this case the other two constructors can be used instead.

virtual ~DKAttrGroupDefICM ();

Destructor for the object.

Member functions

getID
Returns the attribute group identifier. Returns: The identifier of this attribute group.
virtual long getID();   

setID
Sets the attribute group identifier. Parameters: id - the identifier of this attribute group. Returns: The identifier of this attribute group.
virtual void setID(long id);

getDescription
Gets the description of this attribute group. Returns: DKString - the description of this attribute group.
virtual DKString getDescription;

getDescription
Gets the description of this attribute group in the given language. Parameters: langCode, the language code. The valid language codes are: "AFR", "ARA", "BEL", "BGR", "CAT", "CHT", "CHS", "CSY", "CZE", "DAN", "DEU", "DES", "ELL", "ENA", "ENG", "ENU", "FRB", "FRC", "ENP", "ESP", "FIN", "FRA", "FRS", "GAE", "HEB", "HRV", "HUN", "ISL", "ITA", "ITS", "JPN", "KOR", "MKD", "NLD", "NLB", "NON", "NOR", "PLK", "PTB", "PTG", "RMS", "ROM", "RUS", "SKY", "SLO", "SQI", "SRB", "SRL", "SVE", "THA", "TRK", "UKR", "URD" Returns: The description for this specified attribute group. Throws: DKException if an error occurs.
virtual DKString getDescription(const char* langCode);

setDescription
Sets the description for this attribute group. The language code for this method is 'ENU'. Parameters: description, the description to be assigned to this attribute group. Throws: DKException if the length of this attribute group description exceeds 254 characters.
virtual void setDescription(char* description);

setDescription
Sets the description of this attribute group for the given language. Parameters:
  • langCode, the language code.
  • desc, the description of this attribute group.

Throws: DKException if the length of this attribute group description exceeds 254 characters.

virtual void setDescription(const char* desc, const char* langCode);

listAttrs()
Lists attributes defined in this attribute group. Override: listAttrs in class dkAttrGroupDef. Throws: DKException if the attribute group doesn't exist in the persistent store. Returns: dkCollection of DKAttrDefICM objects. Memory Management: All the attributes in the collection and the collection itself must be deleted by the caller.
virtual dkCollection* listAttrs();

listAttrs(long option)
List attributes defined in this attribute group filtered according to the specified option. Parameters: option - the valid options are :
  • DK_ICM_ALL_ATTR Lists all attributes in this group regardless of its category.
  • DK_ICM_RESOURCE_ATTR List resource attributes only.
  • DK_ICM_USER_ATTR List user defined attributes only.
  • DK_ICM_USER_ATTR_NO_RESOURCE List user defined and non-resource attributes only.
  • DK_ICM_SYSTEM_ATTR Lists system attributes only.

Returns: dkCollection of DKAttrDefICM objects. Throws: DKException if the attribute group doesn't exist in the persistent store. Memory Management: All the attributes in the collection and the collection itself must be deleted by the caller.

dkCollection* listAttrs(long option);

listAttrNames
Lists the names of attribute defined in the attribute group. Override: listAttrNames in class dkAttrGroupDef. Parameters: arraySize - no of attribute names in the DKString array. Returns: An array of attribute names for attributes in this attribute group. Throws: DKException if the attribute group doesn't exist in the persistent store. Memory Management: The DKString array must be deleted by the caller.
virtual DKString* listAttrNames(long& arraySize);

listAttrNames
Lists the names of attributes defined in this attribute group filtered according to the specified options.
  • DK_ICM_ALL_ATTR Returns all the attribute names in the persistent datastore
  • DK_ICM_RESOURCE_ATTR Returns only the resource attribute names
  • DK_ICM_USER_ATTR Returns only the user defined attribute names
  • DK_ICM_USER_ATTR_NO_RESOURCE Returns only the user defined and non-resource attribute names
  • DK_ICM_SYSTEM_ATTR Returns only the system defined attribute names

@return an array of attribute names Override: listAttrNames in class dkAttrGroupDef. Parameters:

  • arraySize - no of attribute names in the DKString array.
  • option - the valid options are :
    • DK_ICM_ALL_ATTR Lists all attribute names in this group regardless of its category.
    • DK_ICM_RESOURCE_ATTR Lists resource attribute names only.
    • DK_ICM_USER_ATTR Lists user defined attribute names only.
    • DK_ICM_USER_ATTR_NO_RESOURCE Lists user defined and non-resource attribute names only.
    • DK_ICM_SYSTEM_ATTR Lists system attribute names only.

Returns: An array of attribute names. Throws: DKException if the error occurs. Memory Management: The DKString array must be deleted by the caller.

DKString* listAttrNames(long option, long& arraySize);

add
Adds this attribute group definition to the persistent store. Throws: DKException if there is no attribute defined in this attribute group.
virtual void add();

del
Deletes this attribute group definition from the persistent store. This attribute group can not be associated with an existing item-type, otherwise the delete operation will throw an exception. Throws: DKException if user tried to delete an attribute group that is associates with an item type.
virtual void del();

update
Updates this attribute group definition in the persistent store. You cannot update an attribute group if it is already associated with an item-type. You only can update attribute group description in this release. If you want to change the number of attributes ( add or delete) in this group you can call delete first and then add method. Throws: DKException if user tried to update an attribute group that assoicates with an item type or user tried to add or remove attribute from this attribute group.
virtual void update();

addAttr
Adds a new attribute to this attribute group. This is in-memory operation only. The new definition of this attribute group will be made persistent when the user calls add() or update() method on this class. Overrides: addAttr in class dkAttrGroupDef. Parameters: attr - A DKAttrDefICM object. Throws: DKException if the attribute already exists.
virtual void addAttr(dkAttrDef* attr);

removeAttr
Removes the specified attribute from this attribute group. This is in-memory operation only. The new definition of this attribute group will be made persistent when the user calls add() or update() method on this class. Overrides: removeAttr in class dkAttrGroupDef. Parameters: attr - A DKAttrDefICM object. Throws: DKNotExistException - if the attribute name does not exists in this attribute group. Try to remove an attribute that doesn't exist in this attribute group.
virtual void removeAttr(const char* attrName);

updateAttr
Updates the definition of the given attribute in this attribute group. This is in-memory operation only. The new definition of this attribute group will be made persistent when the user calls add() or update() method on this class. Overrides: updateAttr in class dkAttrGroupDef. Parameters: attr - A DKAttrDefICM object. Throws: DKException if an error occurs.
virtual void updateAttr(dkAttrDef* def);

clearCache
Clear Attribute group cache.
virtual void clearCache();

getReferenceSequenceNumber
Gets the first sequence number for this reference attribute group. The sequence number is determined according to the position of this reference attribute in the component type where it belongs. This call only applies for reference attribute. Returns: The first attribute sequence number in this reference attribute group. Throws: DKException if an error occurs See setReferenceSequenceNumber(long)
long getReferenceSequenceNumber();

setReferenceSequenceNumber
Set the first sequence number for this reference attribute group. The first sequence number is equal to the position of this reference attribute in the component type where it belongs. This call only applicable for reference attribute. Parameters: seqNo - the sequence number Set reference sequence number. Throws: DKException if an error occurs.
void setReferenceSequenceNumber(long seqNo );

getAttrCount
Gets the number of attributes in this attribute group Returns: The number of attributes in this attribute group. Throws: DKException if an error occurs.
long getAttrCount();

getSequenceNo
Gets the column number to which this attribute is assigned in this attribute group.
short getSequenceNo();

setSequenceNo
Sets the sequence number for this attribute (column number) in this attribute group.
 void setSequenceNo( short seqno );

isReferenceAttributeGroup
Checks if this attribute group is a reference attribute. Returns true if this attribute group is a reference attribute. Returns false if it is a regular attribute group. Returns: A boolean value true or false. Throws: DKException if an error occurs.
DKBoolean isReferenceAttributeGroup();

setReferenceAttributeGroup
returns this attribute group entity id.
void setReferenceAttributeGroup(DKBoolean isReferenceAttributeGroup);

getRefDeleteRule
Gets the delete rule for this reference attribute group. Returns: The delete rule of the attibute group. See the method setRefDeleteRule(short) in this class for more information on delete rules. See setRefDeleteRule(short)
short getRefDeleteRule();

setRefDeleteRule
Sets the reference delete rule for this reference attribute group. The reference delete rule governs the action to be done to the target reference when the instance of the component having this reference attribute (or source reference) is deleted. Parameters: refDeleteRule - reference delete rule. The possible values are:
  • DK_ICM_DELETE_RULE_NO_ACTION No action. Delete is prevented and an exception is thrown.
  • DK_ICM_DELETE_RULE_SET_NULLSet null. The source reference is deleted and relationship with the target reference is removed.
  • DK_ICM_DELETE_RULE_CASCADECascade on deletion. The source and target reference are both deleted.
  • DK_ICM_DELETE_RULE_RESTRICTRestrict on deletion. Same as no action.

void setRefDeleteRule(short refDeleteRule);

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