Index

DKAttrDefICM

Purpose:

This class is used to represent an attribute definition in Content Manager server. It has basic attribute properties, such as name, description, nullability, text-searchability, and so forth. Persistent operations on an attribute definition are also supported via add, update, and delete methods. Attributes in Content Manager are created as independent objects and have generic properties. When creating an item type, the user decides which attributes to include into the item type. Once an attribute is included in an item type, it can have specific properties for the particular item type. For example, the attribute ISBN under item type Journal is set to unable, but under item type Book, it is non-unable. Such specific properties includes unable, readable, writable, text-searchable, uniqueness, RM attribute, excluders, representative property, etc. See DKItemTypeDefICM for the definition of the item type, and DKItemTypeViewDef for the definition of item type view. Attributes can be used to compose attribute groups. See DKAttrGroupICM for the definition of the attribute group.

Since: Version 8

Class summary:

class DKEXPORT DKAttrDefICM : public dkAttrDef
{
public:
     DKAttrDefICM();
     DKAttrDefICM(dkDatastore* ds);
     DKAttrDefICM(const DKAttrDefICM& attr);
     virtual ~DKAttrDefICM();
     virtual void add ();
     virtual void del ();
     virtual void update();
     virtual DKString getName();
     virtual void setName(const char* attrName);
     long getGroupMemberId();
     long getEntityId();
     void setUserFlag(long userFlag);
     long getUserFlag();
     long getStringType();
     void setStringType(long stringType);
     DKString getAttrGroupName();
     void setAttrGroupName(const char* attrGroupName);
     DKString getAttrGroupMemberName();
     void setAttrGroupMemberName(const char* attrGroupMemName);
     long getIntId();
     long getGroupId();
     short getDefaultType();
     void setDefaultType(short defaultType);
     DKString getDefaultValue();
     void setDefaultValue(const char* defaultValue);
     DKBoolean isRepresentative();
     void setRepresentative(DKBoolean isReprentative);
     DKBoolean isNullable();
     void setNullable(DKBoolean nullable);
     DKBoolean isUnique();
     void setUnique(DKBoolean unique);
     DKBoolean isRMAttr();
     void setRMAttr(DKBoolean rmAttr);
     DKBoolean isTextSearchable();
     void setTextSearchable(DKBoolean textSearchable);
     short getAttrFlag();
     void setAttrFlag(short attrFlag);
     DKTextIndexDefICM* getTextIndexDef();
     void setTextIndexDef(DKTextIndexDefICM* textIndexDef);
     DKBoolean isReadable();
     void setReadable(DKBoolean readble);
     DKBoolean isWriteable();
     void setWriteable(DKBoolean writeable);
     DKBoolean isExcludeRow();
     void setExcludeRow(DKBoolean isExcludeRow);
     short getAttrViewFlag();
     void setAttrViewFlag(short attrViewFlag);
     short getIndexOrder();
     void setIndexOrder(short indexOrder);
     short getViewSequenceNo();
     void setViewSequenceNo( short viewSeqno );
     void setComponentViewId(long compViewId ); 
     long getComponentViewId();
     short getViewOperator();
     void setViewOperator(short viewOperator );
     DKString getViewCompareValue();
     void setViewCompareValue(const char* viewCompareValue );
     DKString getQualifiedName();
     void setQualifiedName(const char* fullQualifyName);
     DKString* parseQualifiedName(const char* qualifiedName, long&     arraySize);
     DKString* parseQualifiedName(long& arrSize);
     DKString getDescription(const char* langCode);
     void setDescription(const char* desc, const char* langCode);
};

Members:

Constructors and destructor
DKAttrDefICM();

Default constructor. Constructs an attribute definition for an ICM datastore.

DKAttrDefICM(dkDatastore *ds);

Constructs an attribute definition for the specified ICM datastore. Parameters: ds - ICM datastore.

DKAttrDefICM(const DKAttrDefICM& def);

Copy constructor for the attribute definition object related to the ICM datastore. Parameters: def - attribute definition object that is used as a creation template.

virtual ~DKAttrDefICM();

Destructor for the object.

Member functions

add
Adds this attribute definition to the persistent store. Throws: DKException if an error occurs such as the name of the DKAttrDefICM object contains invalid characters. See setAttrGroupMemberName() for the detail information.
virtual void  add();

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

update
Updates this attribute definition in the persistent store. You cannot update an attribute if it is already associated with an item type. Throws: DKException if tries to update an attribute that already associates with an item type or update an attribute that does not exist in the persistent store.
virtual void  update();

getName
Gets the attribute name or its composite name. Composite name is in form of . format. For example, if an attribute "attar" is a part of an attribute group "group", then the composite name is "group.attr". Returns an attribute name if the attribute is not a part of an attribute group override gagmen in class dockyards. Returns: An instance of DKString variable.
virtual DKString getName();

setName
Sets the attribute name or its composite name. Composite name is in form of . format. If this attribute is not a part of an attribute group, then name is attribute name only. The valid characters of attribute group name are: 'a'-'z', 'A'-'Z', '0'-'9', '_' Attribute group name can not begin with '0'-'9, '_', and the length of the name can not exceed 15 characters. override setName in class dkAttrDef. Parameters: attrName - the attribute name or composite name according to the format. see getName()
virtual void setName(const char* attrName);

getGroupMemberId
Gets the attribute identifier. Always return the attribute identifier only without the group identifier even if this attribute is a part of an attribute group. Returns: The attribute identifier. SeegetIntId() See getGroupId()
long getGroupMemberId();

getEntityId
Returns the identifier of the item type in which this attribute belongs. Returns: Item type identifier for this attribute. Throws: DKException if an error occurs.
long getEntityId();

setUserFlag
Sets the user flag information for the attribute. Parameters: userFlag - value for user flag use this field to set the string type for the varchar or char attribute, either numeric, alphabetic, alphanumeric, etc. The valid user flags:
  • DK_CM_ATTR_ALPHA: The string contains alphabetic characters only.
  • DK_CM_ATTR_ALPHANUM: The string contains alpha-numeric characters.
  • DK_CM_ATTR_ALPHANUM_EXT: The string contains alpha-numeric and other special characters.
  • DK_CM_ATTR_NUMERIC: The string only contains numeric characters.
  • DK_CM_ATTR_OTHER: The string may follows application defined rules and the interpretation is left to the application.

void setUserFlag(long userFlag);

getUserFlag
Gets the user flag for this attribute object. Returns: The returned value will be one of the following:
  • DK_CM_ATTR_ALPHA: The string contains alphabetic characters only.
  • DK_CM_ATTR_ALPHANUM: The string contains alpha-numeric characters.
  • DK_CM_ATTR_ALPHANUM_EXT: The string contains alpha-numeric and other special characters.
  • DK_CM_ATTR_NUMERIC: The string only contains numeric characters.
  • DK_CM_ATTR_OTHER: The string may follows application defined rules and the interpretation is left to the application.

long getUserFlag();

getStringType
Gets the string type value for this attribute override getStringType in class dkAbstractAttrDef. Returns: The string type for this attribute, either numeric, alphabetic, alphanumeric, etc. The valid value is one of the following constants:
  • DK_CM_ATTR_ALPHA: The string contains alphabetic characters only.
  • DK_CM_ATTR_ALPHANUM: The string contains alpha-numeric characters.
  • DK_CM_ATTR_ALPHANUM_EXT: The string contains alpha-numeric and other special characters.
  • DK_CM_ATTR_NUMERIC: The string only contains numeric characters.
  • DK_CM_ATTR_OTHER: The string may follows application defined rules and the interpretation is left to the application.

long getStringType();

setStringType
Sets the string type value for this attribute. Parameters: stringType the string type for this attribute. The valid value is one of the following constants : See the method getStringType() in this class to find more information on the valid values for string type.
void setStringType(long stringType);

getAttrGroupName
Gets group name in which this attribute belongs to. Returns: The attribute group name if this attribute belongs to a group, otherwise it returns an empty string.
DKString getAttrGroupName();

setAttrGroupName
Sets group name in which this attribute belongs to. Parameters: attrGroupName - The attribute group name. This method is valid only if this attribute is a part of an attribute group. The valid characters of an attribute group name are: 'a'-'z', 'A'-'Z', '0'-'9', '_'Attribute group name can not begin with '0'-'9' or '_', and the length of the name can not exceed 15 characters.
void setAttrGroupName(const char* attrGroupName);

getAttrGroupMemberName
Gets the attribute name only. It returns the attribute name only without the group name even if this attribute is a part of an attribute group. Returns: attribute name in isolation as a DKString variable.
DKString getAttrGroupMemberName();

setAttrGroupMemberName
Sets the attribute name only. The input parameter should be the attribute name only, not the composite name. The valid characters are: 'a'-'z', 'A'-'Z', '0'-'9', '_','$', '#','@' Attribute name can not begin with '0'-'9, '_', and the length of the name can not exceed 15 characters. Parameters: attrGroupName - attribute name or the member name only if this attribute is part of an attribute group.
void setAttrGroupMemberName(const char* attrGroupMemName);

getIntId
Gets the integer identifier for this attribute. If this attribute is a part of an attribute group, then it will return 10 digits integer with the following values from right to left: bit 0 - bit 4 represents the attribute identifier bit 5 - bit 9 represents the group identifier, for example, if the return value is 100401001, 1004 indicates group identifier and 1001 indicates the attribute identifier. If this attribute doesn't belong to any group, then the call only returns attribute ID Returns: This attribute's identifier as a long variable.
long getIntId();

getGroupId
Gets the group identifier for this attribute. Returns zero if this attribute is not part of an attribute group. Returns: The long group identifier, or zero if this attribute is not part of a group.
long getGroupId();

getDefaultType
Gets the default type for this attribute. Returns: The default value type for this attribute, Valid default types are:
  • DK_ATTR_TYPE_DEFAULT_UNDEFINED: The attribute has no default value (default).
  • DK_ATTR_TYPE_DEFAULT_STRING: The attribute has a default value that is the string constant found in defaultValue column.
  • DK_ATTR_TYPE_DEFAULT_FLOAT: The attribute has a default value that is the floating-point constant found in defaultValue column.
  • DK_ATTR_TYPE_DEFAULT_DECIMAL: The attribute has a default value that is the decimal constant found in defaultValue column.
  • DK_ATTR_TYPE_DEFAULT_INTEGER: The attribute has a default value that is the integer constant found in defaultValue column.
  • DK_ATTR_TYPE_DEFAULT_HEXSTRING: The attribute has a default value that is the hex string found in defaultValue column.
  • DK_ATTR_TYPE_DEFAULT_OTHER: The default value depends on the data type of the attribute and bit of attrFlags. If bit 0 of attrFlags is 0 (not null), the default value depends on the data type of attribute.

See setDefaultType(short)

short getDefaultType();

setDefaultType
Sets the default type for this attribute. See the method getDefaultType() in this class to find more information on the valid values for default type. Parameters: defaultType - the default type for this attribute.
void setDefaultType(short defaultType);

getDefaultValue
Gets the default value for this attribute. Returns: This method is only valid if a default type is specified for this attribute. Returns the default value for this attribute. The default value of the numeric data type is 0. The default value of the fixed-length string data type is blanks. The default value of varying-length string data type is a string length of 0 The default value of date data type is the current date The default value of time data type is the current time The default value of timestamp data type is the current timestamp See setDefaultValue(const char*)
DKString getDefaultValue();

setDefaultValue
Sets the default value for this attribute. This method is only valid if a default type is specified for this attribute. See the method getDefaultValue()in this class to find more information on the valid values for default value. Parameters: defaultValue the default value for this attribute.
void setDefaultValue(char* defaultValue);

isRepresentative
Returns true if this attribute is a representative attribute for this item-type. If false, the attribute is not a representative attribute. Returns: DKBoolean value true or false. False indicates that this attribute is not a representative attribute for this item type.
DKBoolean isRepresentative();

setRepresentative
Sets the representative property of this attribute to true or false. True makes this attribute a representative attribute for this item-type. The default value is false. You can only set this property when you include this attribute as part of an item-type definition. If false, the attribute is not a representative attribute. Parameters: isRepresentative - a DKBoolean value true or false. False makes this attribute non representative attribute for this item-type.
void setRepresentative(DKBoolean isReprentative);

isNullable
Checks if this attribute is nullable. The default setting for an attribute is not nullable. that is, the attribute can not have a null value. override isNullable in class dkAbstractAttrDef. Returns: TRUE, if this attribute is nullable.
DKBoolean isNullable();

setNullable
Sets the nullability property of this attribute. The DKBoolean value true will set this attribute to nullable, that is, it can have a null value. You can only set this property when you include this attribute as part of an item type definition. In different item-types, an attribute can be set to nullable in item-type Journal, but set to non-nullalbe in item-type Book. Override setNullable in class dkAbstractAttrDef. Parameters: nullable - true or false, to indicate that this attribute can have a null value, or must have a non-null value. See isNullable().
void setNullable(DKBoolean nullable);

isUnique
Returns true if this attribute value is always unique in this item-type. The default value is false. Returns: DKBoolean value true or false See setUnique(DKBoolean).
DKBoolean isUnique();

setUnique
Sets the uniqueness property of this attribute value. The DKBoolean value true will set this attribute to always have unique value. You can only set this property when you include this attribute as part of an item type definition. In different item-types, an attribute can have different setting for unique property. For example, this attribute can be set to unique in item-type Journal, but set to non-unique in item-type Book. Parameters: unique - true or false, to indicate that this attribute is unique or not unique. See isUnique().
void setUnique(DKBoolean unique);

isRMAttr
Checks if this attribute is a resource manager attribute. Returns true if this attribute is associated with a resource object stored in the resource manager. The default value is false, which means that this attribute is a regular attribute, not associated with a resource object. Returns: true or false. See setRMAttr(DKBoolean)
DKBoolean isRMAttr();

setRMAttr
Sets the resource manager property of this attribute to a DKBoolean value true or false. True indicates that this attribute is associated with a resource object stored in the resource manager. You can only set this property when you include this attribute as part of an item type definition. The default property is false, that is, a regular attribute not associated with a resource object. Parameters: rmAttr - a DKBoolean value true or false. See isRMAttr()
void			 setRMAttr(DKBoolean rmAttr);

isTextSearchable
Returns true if this attribute is text searchable. Otherwise, returns false. The default value is non text searchable. that is, you cannot specify a text search expression against this attribute. This method is only valid for attribute with type string. Override isTextSearchable in class dkAbstractAttrDef. Returns: true or false. See setTextSearchable(DKBoolean).
DKBoolean isTextSearchable();

setTextSearchable
Makes this attribute text searchable or non-text searchable. You can only set this property when you include this attribute as part of an item-type definition. In different item-types, an attribute can have different settings for text searchable property. For example, this attribute can be set to text searchable in item-type Journal, but set to non-text searchable in item-type Book. This method is only valid for attribute with type string. You also need to specify the text indexing properties for this attribute, see the method setTextIndexDef in this class. Override setTextSearchable in class dkAbstractAttrDef. Parameters: textSearchable - true or false. True makes this attribute text searchable. See isTextSearchable(). See setTextIndexDef(DKTextIndexDefICM).
void setTextSearchable(DKBoolean textSearchable);

getAttrFlag
Gets the attribute flag information for this attribute. Returns: short value for attrFlag. User can use return value & one of the following constant values to tell this attribute's property:
  • DK_ICM_COMPONENT_ATTR_NULLABLE
  • DK_ICM_COMPONENT_ATTR_NOTUNIQUE
  • DK_ICM_COMPONENT_ATTR_RMATTR
  • DK_ICM_COMPONENT_ATTR_XMLATTR
  • DK_ICM_COMPONENT_ATTR_TEXTSEARCHABLE

For example, getAttrFlag() & DK_ICM_COMPONENT_ATTR_NULLABLE == DK_ICM_COMPONENT_ATTR_NULLABLE True indicates this attribute is nullable, otherwise this attribute is non-nullable.

short getAttrFlag();

setAttrFlag
Sets attribute flag information for this attribute. Parameters: attrFlag - a short value of the flags. See getAttrFlag in this class to have the detail information.
void setAttrFlag(short attrFlag);

getTextIndexDef
Gets the text search index definition for this attribute. Returns null if this attribute is not defined as text searchable. Returns: The text search index definition object containing text indexing information, or null. See setTextIndexDef(DKTextIndexDefICM). See isTextSearchable().
DKTextIndexDefICM* 	getTextIndexDef();

setTextIndexDef
Sets the text search index definition for this attribute. Setting this value to null will remove the text index, as a result, it will make this attribute non text searchable. Only attributes with type string can be made text searchable. Parameters: textIndexDef the text search index definition object containing the text indexing information. Throws: DKException if an exception occurs. See getTextIndexDef(), isTextSearchable().
void setTextIndexDef(DKTextIndexDefICM* textIndexDef);

isReadable
Returns true if this attribute is readable. Otherwise, returns false. Returns: DKBoolean value true or false. See setReadable(DKBoolean)
DKBoolean isReadable();

setReadable
Sets the readable property of this attribute to true or false. True means that this attribute is readable. Parameters: A DKBoolean value true or false. True makes this attribute readable. See isReadable()
void setReadable(DKBoolean readble);

isWritable
Returns true if this attribute is writeable. Otherwise, returns false. Returns: DKBoolean value, indicates whether the attribute is writeable or not.
DKString getWorkingDir(); 

setWritable
Sets writeable property of this attribute to true or false. True means that this attribute is updatable, otherwise this attribute is read-only. Parameters: writeable as boolean true or false. True makes this attribute writeable.
void setWriteable(DKBoolean writeable);

isExcludeRow
Returns true if this attribute is used in an expression to filter unwanted component instances in component type view definition. See the description of methods setViewCompareValue and setViewOperator in this class for more information on filtering instances in component view definition. Returns: DKBoolean value true or false. See setViewCompareValue(cosnt char*), setViewOperator(short)
DKBoolean isExcludeRow();

setExcludeRow
Sets the excludeRow property of this attribute to true or false. True means that this attribute is used in an expression to filter unwanted component instances in the component view definition where this attribute belongs. False means that this attribute is not used in any expression to filter unwanted instances. See the description of methods setViewCompareValue and setViewOperator in this class for more information on filtering instances in a component view definition. Parameters: isExcludeRow - a DKBoolean true or false. The meaning is described above. See isExcludeRow(), setViewCompareValue(const char*), setViewOperator(short).
void setExcludeRow(DKBoolean isExcludeRow);

getAttrViewFlag
Gets the attribute view flag information. The flag indicates the properties set in this attribute, such as readable, writable, representative, excludeRow, etc. writeable, representative and exclude unwanted rows or not. User can use return value & one of the following constant values to tell this attribute's property:
  • DK_ICM_READ
  • DK_ICM_WRITE
  • DK_ICM_COMPONENT
  • DK_ICM_EXCLUDE_ROW

Returns: short value for attrViewFlag. The valid values are, for example, getAttrViewFlag() & DK_ICM_COMPONENT == DK_ICM_COMPONENT True indicates this attribute is a representative attribute for this item-type.

short getAttrViewFlag();

setAttrViewFlag
Sets the attribute view flag to the given bit combinations. See getAttrViewFlag for the detail information. Parameters: attrViewFlag a short value with the desired combination of bit settings as described above.
void setAttrViewFlag(short attrViewFlag);

getIndexOrder
Gets the index order information for this attribute. Returns: A short value of the index order The valid values are:
  • DK_ICM_INDEX_FLAG_ASCENDING
  • DK_ICM_INDEX_FLAG_DESCENDING

short getIndexOrder();

setIndexOrder
Sets attribute index order information for the attribute. Parameters: short value for indexOrder.
void setIndexOrder(short indexOrder);

getViewSequenceNo
Gets the order of an attribute within the component view. Returns: short value of view sequence number.
short getViewSequenceNo();

setViewSequenceNo
Sets the order of an attribute within the component view. Parameters: viewSeqno - user defined the order of an attribute with in the component view.
void setViewSequenceNo(short viewSeqno);

setComponentViewId
Sets the component view id this attribute belongs to. Parameters: compViewId - component view Id.
void setComponentViewId(long compViewId); 

getComponentViewId
Returns this component type view ID to which the attribute belongs. Returns: component type view identifier. Throws: DKException if an error occurs.
long getComponentViewId();

getViewOperator
Only DK_CM_OPCODE_EQ is supported in this release. Returns: component view operator. Throws:DKException if an error occurs.
short getViewOperator();

setViewOperator
Sets the component view operator to which the attribute belongs. Only DK_CM_OPCODE_EQ is supported in this release. Parameters: viewOperator - component view operator. Throws: DKException if an error occurs.
void setViewOperator(short viewOperator );

getViewCompareValue
Returns the attribute's compare value. Returns: component view compare value. Throws: DKException if an error occurs.
DKString getViewCompareValue();

setViewCompareValue
Sets the attribute's compare value e.g. User only want to view rows which attribute "zipCode" equals to "95120" the viewCompareValue = 95120. Parameters: viewCompareValue attribute compare value. Throws: DKException if an error occurs.
void setViewCompareValue(const char* viewCompareValue );

getQualifiedName
Gets the attribute fully qulified name. The format of an attribute fullQualifyName is "chapter/section/sectionName" or "publisherName" if this attribute belongs to the root component type Returns: qualified name of this attribute as a DKString variable. Throws: DKException if an error occurs.
DKString getQualifiedName();

setQualifiedName
Sets the attribute's fully qualified name. If we build a hierarchy item type, root component type is "Book". "Book" has a child component type "chapter", which has a child component type "section" and attribute "sectionName" was defined in it, then the fullQualifyName will be "chapter/section/sectionName". fullQualifyName will exclude the root component type name. If an attribute "publisherName" is defined in the root component type "Book" this attribute's fully qualified name is publisherName. Parameters: short value for attrViewFlag. Throws: DKException if an error occurs.
void setQualifiedName(const char* fullQualifyName);

parseQualifiedName
Parses the string qualifiedName to become a string array e.g. qualifiedName='chapter/section/SectionName', After this function call the information will be stored in array {"chapter", "section", "SectionName"}. Parameters:
  • qualifiedName - qualified name of an attribute.
  • arraySize - size of the returned name.

Returns: qualified name as an array of DKString variables. Throws: DKException if an error occurs.

DKString* parseQualifiedName(const char* qualifiedName, long& arraySize);

parseQualifiedName
Parses the string to return a string array. The arraySize returns the number of elements in the array. Parameters: arrSize - size of the returned string array. Returns: qualified name as an array of DKString variables.
DKString* parseQualifiedName(long& arrSize);

getDescription
Gets the attribute description. Parameters: langCode attribute language code. e.g. ENU. Returns: attribute description as a DKString variable.

KString getDescription(const char* langCode);

setDescription
Sets the attribute description. Parameters:
  • desc - attribute description.
  • langCode - language code for which the description is to be set (e.g. "ENU").

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" Throws: DKException if an error occurs.

DKString getDescription(const char* langCode);

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