KnowledgeInterfaces CATKweExposeObjectAdapter

Usage: you can derive this class.


public class CATKweExposeObjectAdapter

Class to be used as an adapter for objects that want to be used through Knowledge Expert and Search.
Dedicated for CAA partner
First of all, it inherits from CATKweObjectAdapter which is an adapter of CATICkeObject interface. This interface enables to represent Knowledge objects. It is mainly an adapter of CATIExposeObject. This interface is used by Knowledge Expert to identify an object through its type. It is also used by the Edit/Find of CATIA. In addition to extension, you must create the TIE object with - TIEchain_CATIExposeObject


Constructor and Destructor Index


o CATKweExposeObjectAdapter()
Constructor.
o ~CATKweExposeObjectAdapter()
Destructor.

Method Index


o GetLogicalName(CATUnicodeString&)
Returns the Logical name of the object.
o GetOwner()
Description: returns the owner of the object.
o GetValue(CATUnicodeString&)
Description: Gets an attributes value.
o GetValueInternal(CATUnicodeString&)
Description: Gets an attributes value.
o IsSupporting(CATIType_var&)
Description: Tests if an object supports a given type.
o ListSupportedTypes(CATListValCATIType_var&)
Description: fills the list of types supported by this object.
o ListSupportedTypesInternal(CATListValCATIType_var&)
Description: fills the list of types supported by this object in addition to the one returned by Type method.
o SendError(CATUnicodeString&,CATKWEErrorSeverity::Severity)
Description: Raises an error.
o SetLogicalName(CATUnicodeString&)
Sets the Logical name of the object.
o SetValue(CATUnicodeString&,CATIValue_var&)
Description: Sets an attributes value.
o SetValueInternal(CATUnicodeString&,CATIValue_var&)
Description: Sets an attributes value.
o Type()
Description: Returns the main type of an object.
o TypeInternal()
Description: Returns the main type of an object.

Constructor and Destructor


o CATKweExposeObjectAdapter
public CATKweExposeObjectAdapter()
Constructor.
o ~CATKweExposeObjectAdapter
public virtual ~CATKweExposeObjectAdapter()
Destructor.

Methods


o GetLogicalName
public virtual GetLogicalName( oLogicalName)
Returns the Logical name of the object. The logical name is a name that the end-user can give (modify) and that has no constraint of unicity.
Default implementation relies on CATIAlias::GetAlias method.
For objects in representation, it is usually sufficient. For PLM objects CATIAlias has been used to provide a computed name. That's why it cannot be used for logical name implementation.
As a consequence, for PLM objects, this method MUST BE overriden.
Parameters:
oLogicalName
Logical name in output
Returns:
  1. E_ACCESSDENIED if the logical name cannot be read.
  2. E_FAIL if the logical name cannot be read.
  3. S_OK if the logical name has been read successfully.
o GetOwner
public virtual GetOwner()
Description: returns the owner of the object. Default implementation returns NULL
Returns:
[CATBaseUnknown#Release] The Owner (an AddRef is done, if not NULL).
o GetValue
public GetValue( const iKey)
Description: Gets an attributes value.
Default implementation calls first GetValueInternal to have access to your attributes. Then it calls GetAccessors, trying to read value for the attributes that have accessors. able to access those kind of attributes. Do not override this method.
Parameters:
iKey:
the name of the attribute.
Returns:
[CATBaseUnknown#Release] iValue: the value of the attribute (an AddRef is done) It can return NULL.
o GetValueInternal
protected virtual GetValueInternal( const iKey)
Description: Gets an attributes value. Must be re-implemented when deriving from this adapter.
Default implementation does nothing. This method is called by GetValue.
Parameters:
iKey:
the name of the attribute.
Returns:
[CATBaseUnknown#Release] iValue: the value of the attribute (an AddRef is done) It can return NULL.
o IsSupporting
public virtual IsSupporting( const iType)
Description: Tests if an object supports a given type.
Parameters:
iType
type that we want to check.
An AddRef is done. Warning : In most cases, you don't need to override this method.
Default implementation returns this if the type belongs to the list of supported types. You may overide this method if you want to return another object (delegation).
Returns:
[CATBaseUnknown#Release] the instance supporting this type (may be NULL or self)
o ListSupportedTypes
public ListSupportedTypes( oListOfCATIType)
Description: fills the list of types supported by this object. Warning : Do not redefined this method. Redefine ListSupportedTypesInternal. Default implementation returns a list containing main Type first returned by Type method. and the list of types returned by ListSupportedTypesInternal.
Parameters:
oListOfCATIType
this list is filled.
Returns:
classic HRESULT
o ListSupportedTypesInternal
protected virtual ListSupportedTypesInternal( oListOfCATIType)
Description: fills the list of types supported by this object in addition to the one returned by Type method.
Default implementation adds nothing. In most cases, you don't need to implement this method. This method is called by the ListSupportedTypes method.
Parameters:
oListOfCATIType
this list is filled.
Returns:
classic HRESULT
o SendError
protected SendError( const iMessage,
const iSeverity= CATKWEErrorSeverity::Error)
Description: Raises an error. Use this method inside the GetValueInternal & SetValueInternal when you want to bring to the user more explanation about why the read or write operations has failed.
Note that you don't need to raise message (& use this method) in the standard error cases (bad type, attribute not found, attribute read only, ... Simply return the right HRESULT (E_INVALID_ARG, E_ACCESSDENIED) and a standard error message is raised (InexistingAttribute, ReadAttributeBadKind, ReadOnlyAttribute ).
Parameters:
iMessage:
the NLS message that will be brought to the end-user.
iSeverity:
severity of the error.
Returns:
classic HRESULT
o SetLogicalName
public virtual SetLogicalName( const iLogicalName)
Sets the Logical name of the object. The logical name is a name that the end-user can give (modify) and that has no constraint of unicity.
Default implementation relies on CATIAlias::SetAlias method.
For objects in representation, it is usually sufficient. For PLM objects CATIAlias has been used to provide a computed name. That's why it cannot be used for logical name implementation.
As a consequence, for PLM objects, this method MUST BE overriden.
Parameters:
iLogicalName
Logical name in input
Returns:
  1. E_ACCESSDENIED if the valuation has failed (read only attribute, object not editable).
  2. E_FAIL if the logical name cannot be set.
  3. S_OK if the logical name has been set successfully.
o SetValue
public SetValue( const iKey,
const iValue)
Description: Sets an attributes value. Default implementation calls first SetValueIntenal, and finally, tries to valuate the attribute if it has an accessor.
Do not override this method.
Parameters:
iKey:
the name of the attribute.
iValue:
the value of the attribute.
Returns:
  1. E_INVALIDARG if the valuation has failed (attribute non existing on object, attribute of a bad type).
  2. E_ACCESSDENIED if the valuation has failed (read only attribute, object not editable).
  3. S_OK if the attribute has been set successfully.
o SetValueInternal
protected virtual SetValueInternal( const iKey,
const iValue)
Description: Sets an attributes value. Must be re-implemented when deriving from this adapter.
Default implementation returns E_NOTIMPL. This method is called by the SetValue method
Parameters:
iKey:
the name of the attribute.
iValue:
the value of the attribute.
Returns:
  1. E_NOTIMPL if this method is overridden but that the SetValue is not done by your implementation.
  2. E_INVALIDARG if the valuation has failed (attribute non existing on object, attribute of a bad type).
  3. E_ACCESSDENIED if the valuation has failed (read only attribute, object not editable).
  4. S_OK if the attribute has been set successfully.
o Type
public Type()
Description: Returns the main type of an object.
An AddRef is done. Warning : Do not redefined this method. Redefine TypeInternal.
Default implementation calls TypeInternal(). And if the result is NULL, will return the root type "Feature".
Returns:
[CATBaseUnknown#Release] the main type of the object.
o TypeInternal
protected virtual TypeInternal()
Description: Returns the main type of an object. An AddRef must be done. This method must be re-implemented. The classic implementation of this method is to use CATGlobalFunctions::GetTypeDictionary()->FindSafe("MyType","MyPackage",oType) and return oType after having done an AddRef. This method finds a type by its name and loads the package in which the type is defined if needed. this method is called by the Type() method. If you do not want to specify an accurate type, you can return NULL and Type method will return the type Feature
Returns:
[CATBaseUnknown#Release] the main type of the object.

This object is included in the file: CATKweExposeObjectAdapter.h
If needed, your Imakefile.mk should include the module: KnowledgeItf

Copyright © 1999-2015, Dassault Systèmes. All rights reserved.