Functions for creating, handling and deleting custom (Add-On specific), Teamwork-safe Add-On Objects. These Objects provide a safer way to handle custom data than the legacy ModulData.
More...
|
enum | API_AddonObjectType { GeneralAddOnObject
, UniqueAddOnObject
, ClientOnlyAddOnObject
} |
| Represents the two types of an AddOnObject: general (non-unique) and unique.
|
|
|
GSErrCode | ACAPI_AddOnObject_RegisterAddOnObjectHandler (void) |
| Registers the add-on to be called for merging and converting its custom data stored in AddOnObjects.
|
|
GSErrCode | ACAPI_AddOnObject_InstallAddOnObjectMergeHandler (APIAddonObjectMergeHandlerProc *mergeHandlerProc) |
| Installs a callback procedure for handling the AddOnObject merge operations.
|
|
GSErrCode | ACAPI_AddOnObject_InstallAddOnObjectSaveOldFormatHandler (APIAddonObjectSaveOldFormatHandlerProc *saveOldFormatProc) |
| Installs a callback procedure for converting AddOnObject data into older format.
|
|
GSErrCode | ACAPI_AddOnObject_InstallAddOnObjectConvertNewFormatHandler (APIAddonObjectConvertNewFormatHandlerProc *convertNewFormatProc) |
| Installs a callback procedure for converting old format AddOnObject data into current format.
|
|
GSErrCode | ACAPI_AddOnObject_CreateObject (const GS::UniString &objectName, const GSHandle &content, API_Guid *objectGuid) |
| Creates an AddOnObject.
|
|
GSErrCode | ACAPI_AddOnObject_CreateUniqueObject (const GS::UniString &objectName, API_Guid *objectGuid) |
| Creates a Unique AddOnObject.
|
|
GSErrCode | ACAPI_AddOnObject_CreateUniqueObjectMore (const GS::Array< GS::UniString > &objectNames, GS::Array< API_Guid > &objectGuids) |
| Creates more Unique AddOnObjects.
|
|
GSErrCode | ACAPI_AddOnObject_CreateClientOnlyObject (const GS::UniString &objectName, const GSHandle &content, API_Guid *objectGuid) |
| Creates an AddOnObject.
|
|
GSErrCode | ACAPI_AddOnObject_GetObjectList (GS::Array< API_Guid > *objects) |
| Returns the list of the AddOnObjects.
|
|
GSErrCode | ACAPI_AddOnObject_GetObjectContent (const API_Guid &objectGuid, GS::UniString *objectName, GSHandle *objectContent) |
| Retrieves the content and the name of the specified AddOnObject from the project database.
|
|
GSErrCode | ACAPI_AddOnObject_ModifyObject (const API_Guid &objectGuid, const GS::UniString *newObjectName, const GSHandle *newObjectContent) |
| Modifies the content and/or the name of the specified AddOnObject.
|
|
GSErrCode | ACAPI_AddOnObject_DeleteObject (const API_Guid &objectGuid) |
| Retrieves an attribute from the database.
|
|
GSErrCode | ACAPI_AddOnObject_GetObjectGuidFromName (const GS::UniString &name, API_Guid *objectGuid) |
| Returns the GUID of the specified object.
|
|
GSErrCode | ACAPI_AddOnObject_GetUniqueObjectGuidFromName (const GS::UniString &name, API_Guid *objectGuid) |
| Returns the GUID of the specified Unique AddOnObject.
|
|
GSErrCode | ACAPI_AddOnObject_GetClientOnlyObjectGuidFromName (const GS::UniString &name, API_Guid *objectGuid) |
| Returns the GUID of the specified object.
|
|
GSErrCode | ACAPI_AddOnObject_ReserveObjects (const GS::Array< API_Guid > &objectGuids, GS::HashTable< API_Guid, short > *conflicts) |
| In teamwork mode this function reserves the specified objects.
|
|
GSErrCode | ACAPI_AddOnObject_ReleaseObjects (const GS::Array< API_Guid > &objectGuids) |
| In teamwork mode this function releases the specified objects.
|
|
GSErrCode | ACAPI_AddOnObject_RequestObjects (const GS::Array< API_Guid > &objectGuids, const GS::UniString &mailText) |
| In teamwork mode this function sends a request mail in order to request the specified objects from the owners.
|
|
GSErrCode | ACAPI_AddOnObject_GrantObjects (const GS::Array< API_Guid > &objectGuids, short toUserId) |
| In teamwork mode this function grants the specified objects to the given user.
|
|
GSErrCode | ACAPI_AddOnObject_GetTeamworkOwnerId (const API_Guid &objectGuid, short *ownerId) |
| Returns the ownerId of the specified object in teamwork mode.
|
|
GSErrCode | ACAPI_AddOnObject_ExistsObject (const API_Guid &objectGuid, bool *objectExists) |
| Determines if the project database contains the specified AddOnObject or not.
|
|
GSErrCode | ACAPI_AddOnObject_SetUIProperties (const API_Guid *objectGuid, const GS::UniString *name, const GS::UniString &localisedName, short dialogMenuStringId) |
| Sets various UI properties of an AddOnObject.
|
|
Functions for creating, handling and deleting custom (Add-On specific), Teamwork-safe Add-On Objects. These Objects provide a safer way to handle custom data than the legacy ModulData.
The AddOnData Manager is a service introduced in API v19.
It allows each add-on to store custom data in Archicad project database. No limitation is imposed on the structure or content, not even on the amount of saved bytes. Archicad knows nothing about its internal format, it just preserves a number of bytes in the project database and returns them upon requests.
The container of the stored data is an object called AddOnObject. This data structure has a GUID and a name. The name is optional.
AddOnobjects are identified uniquely by the GUID of the object.
Unique AddOnObjects
Unique AddOnObjects were introduced to support more restricted but safer TeamWork behaviour. Because multiple general (non-unique) AddOnObjects can exist with the same name, in TeamWork it could happen that two users created "the same" AddOnObject simultaneously, but at the end they ended up with two different AddOnObjects (with the same name). This led to a lot of confusion.
With Unique AddOnObjects - like general AddOnObjects - you can store custom data in the project database. However - unlike general AddOnObjects - their names must be and will be unique among each other. Please note that names of a Unique AddOnObject and general AddOnObjects may still be equal.
In a TeamWork project creating Unique AddOnObjects will result in a Full Send to ensure project consistency. Due to this inconvenience, it is possible to create more Unique AddOnObjects at once with the ACAPI_AddOnObject_CreateUniqueObjectMore function.
All functions that work for general AddOnObjects work for Unique AddOnObjects, too, except ACAPI_AddOnObject_GetObjectGuidFromName : to get the GUID of a Unique AddOnObject from its name use ACAPI_AddOnObject_GetUniqueObjectGuidFromName instead.
Functions
All of the ModulData Manager functions begin with the ACAPI_AddOnObject_ prefix. They are as follows:
Refer to the AddOnObject Manager example project to see detailed examples on using these functions.
Merging AddOnObjects
When merging another plan into the project, it might be necessary to keep both the original and the incoming objects, and to combine them together. Since the host application does not know the content of the objects, the owner add-on is requested to resolve the conflict.
For this purpose the add-on needs to implement an APIAddOnObjectMergeHandlerProc
callback handler function, and pass the function pointer to Archicad with the For this purpose the add-on needs to implement an APIAddOnObjectMergeHandlerProc
callback handler function, and pass the function pointer to Archicad with the ACAPI_AddOnObject_InstallAddOnObjectMergeHandler in the Initialize routine. It is also necessary to inform Archicad that the add-on is prepared for merging custom data: this can be done with the ACAPI_AddOnObject_RegisterAddOnObjectHandler function called from RegisterInterface. ACAPI_AddOnObject_InstallAddOnObjectMergeHandler in the Initialize routine. It is also necessary to inform Archicad that the add-on is prepared for merging custom data: this can be done with the ACAPI_AddOnObject_RegisterAddOnObjectHandler function called from RegisterInterface.
In Teamwork mode the AddOnObject can only be modified by the owner of the object. The add-on can reserve or release one or more AddOnObject using ACAPI_AddOnObject_ReserveObjects and ACAPI_AddOnObject_ReleaseObjects. Only one user can modifiy an object at one time, so no conflict resolution is needed.
Saving data into old format project
If the structure of the custom data has changed since the previous version, you need to implement an APIAddonObjectSaveOldFormatHandlerProc callback function to be able to convert your data when saving into an older format project. In order to be called this handler, the function pointer must be passed with ACAPI_AddOnObject_InstallAddOnObjectSaveOldFormatHandler, and the data handling feature must be registered with ACAPI_AddOnObject_RegisterAddOnObjectHandler.
When Archicad calls this function, the add-on should create the converted data according to the given plan file format, and pass it back to the application.
If the add-on does not install this converter callback routine, the available current format data is saved into the old version project as well.
Converting data when reading an old format project
If the structure of the custom data has changed since the older versions, you need to implement an APIAddonObjectConvertNewFormatHandlerProc
callback function to be able to convert your data when opening an older format project. In order to be called this handler, the function pointer must be passed with ACAPI_AddOnObject_InstallAddOnObjectConvertNewFormatHandler, and registration with ACAPI_AddOnObject_RegisterAddOnObjectHandler is also needed.
When Archicad calls this function, the add-on should create the current version data, and pass it back to the application.
If the add-on does not install this converter callback routine, the available orignal format data will be kept in the current version project as well.
◆ APIAddonObjectConvertNewFormatHandlerProc
typedef GSErrCode APIAddonObjectConvertNewFormatHandlerProc(API_FTypeID planFileType, const GS::Array< API_AddonObject > &oldFormatAddOnObjectArray, GS::Array< API_AddonObject > ¤tFormatAddOnObjectArray) |
User supplied callback procedure for converting AddOnObjects into current format.
- Parameters
-
planFileType | [in] The original version of the plan of the project is being opened. |
oldFormatAddOnObjectArray | [in] AddOnObject data in original format. |
currentFormatAddOnObjectArray | [out] Array for the converted AddOnObject data in current format. |
- Returns
- NoError - The function has completed with success.
◆ APIAddonObjectMergeHandlerProc
APIAddonObjectMergeHandlerProc |
User supplied callback procedure for handling AddOnObject merge operations.
- Parameters
-
sourceAddOnObjectArray | [in] The list of the source AddOnObjects. |
- Returns
- NoError - The function has completed with success.
◆ APIAddonObjectSaveOldFormatHandlerProc
typedef GSErrCode APIAddonObjectSaveOldFormatHandlerProc(API_FTypeID planFileType, const GS::Array< API_AddonObject > ¤tFormatAddOnObjectArray, GS::Array< API_AddonObject > &oldFormatAddOnObjectArray) |
User supplied callback procedure for converting AddOnObjects into previous format.
- Parameters
-
planFileType | [in] The old format plan version the project is being saved. |
currentFormatAddOnObjectArray | [in] AddOnObject data in current format. |
oldFormatAddOnObjectArray | [out] Array for the converted AddOnObject data in old format. |
- Returns
- NoError - The function has completed with success.
◆ ACAPI_AddOnObject_CreateClientOnlyObject()
GSErrCode ACAPI_AddOnObject_CreateClientOnlyObject |
( |
const GS::UniString & |
objectName, |
|
|
const GSHandle & |
content, |
|
|
API_Guid * |
objectGuid |
|
) |
| |
Creates an AddOnObject.
- Parameters
-
objectName | [in] The name of the AddOnObject. |
content | [in] The content of the AddOnObject. |
objectGuid | [out] The GUID of the created object. |
- Returns
- NoError - The function has completed with success.
◆ ACAPI_AddOnObject_CreateObject()
GSErrCode ACAPI_AddOnObject_CreateObject |
( |
const GS::UniString & |
objectName, |
|
|
const GSHandle & |
content, |
|
|
API_Guid * |
objectGuid |
|
) |
| |
Creates an AddOnObject.
- Parameters
-
objectName | [in] The name of the AddOnObject. |
content | [in] The content of the AddOnObject. |
objectGuid | [out] The GUID of the created object. |
- Returns
- NoError - The function has completed with success.
◆ ACAPI_AddOnObject_CreateUniqueObject()
GSErrCode ACAPI_AddOnObject_CreateUniqueObject |
( |
const GS::UniString & |
objectName, |
|
|
API_Guid * |
objectGuid |
|
) |
| |
Creates a Unique AddOnObject.
- Parameters
-
objectName | [in] The name of the Unique AddOnObject. |
objectGuid | [out] The GUID of the created object. Value is undefined if an error happened. |
- Returns
- NoError - The function has completed with success.
- APIERR_CANCEL - If the user refused to Send Receive all changes.
- APIERR_NAMEALREADYUSED - If there is already a Unique AddOnObject with the given objectName.
- APIERR_NOTEAMWORKPROJECT - Indicates that the project is an Offline TeamWork project. Due to possible conflicts, it is not allowed to create Unique AddOnObjects in an Offline Teamwork Project.
- APIERR_SERVICEFAILED - The created Unique AddOnObject could not be sent to the TeamWork server.
◆ ACAPI_AddOnObject_CreateUniqueObjectMore()
GSErrCode ACAPI_AddOnObject_CreateUniqueObjectMore |
( |
const GS::Array< GS::UniString > & |
objectNames, |
|
|
GS::Array< API_Guid > & |
objectGuids |
|
) |
| |
Creates more Unique AddOnObjects.
- Parameters
-
objectNames | [in] The names of the Unique AddOnObjects. The names must be unique. |
objectGuids | [out] The GUIDs of the created objects. One guid is returned to each given name. Empty array is returned if an error happened. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - If the objectNames array is empty or the names in it are not unique among each other.
- APIERR_NAMEALREADYUSED - If there is already a Unique AddOnObject with one of the given objectNames.
- APIERR_NOTEAMWORKPROJECT - Indicates that the project is an Offline TeamWork project. Due to possible conflicts, it is not allowed to create Unique AddOnObjects in an Offline Teamwork Project.
- APIERR_SERVICEFAILED - The created Unique AddOnObjects could not be sent to the TeamWork server.
◆ ACAPI_AddOnObject_DeleteObject()
GSErrCode ACAPI_AddOnObject_DeleteObject |
( |
const API_Guid & |
objectGuid | ) |
|
Retrieves an attribute from the database.
- Parameters
-
objectGuid | [in] The GUID of the object. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADID - The object does not exist.
- APIERR_NOTMINE - The object is not owned by the current user in teamwork mode.
◆ ACAPI_AddOnObject_ExistsObject()
GSErrCode ACAPI_AddOnObject_ExistsObject |
( |
const API_Guid & |
objectGuid, |
|
|
bool * |
objectExists |
|
) |
| |
Determines if the project database contains the specified AddOnObject or not.
- Parameters
-
objectGuid | [in] The GUID of the specified object.. |
objectExists | [out] true if the object exists, otherwise false. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - The passed parameter objectGuid is APINULLGuid or objectExists is nullptr
- APIERR_BADID - The object specified by GUID exists, but its type is not AddOnObject.
◆ ACAPI_AddOnObject_GetClientOnlyObjectGuidFromName()
GSErrCode ACAPI_AddOnObject_GetClientOnlyObjectGuidFromName |
( |
const GS::UniString & |
name, |
|
|
API_Guid * |
objectGuid |
|
) |
| |
Returns the GUID of the specified object.
- Parameters
-
name | [in] The name of the specified object. |
objectGuid | [out] The GUID of the object, if the project database contains AddOnObject with the specified name, otherwise APINULLGuid. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - The passed parameter objectGuid is nullptr.
◆ ACAPI_AddOnObject_GetObjectContent()
GSErrCode ACAPI_AddOnObject_GetObjectContent |
( |
const API_Guid & |
objectGuid, |
|
|
GS::UniString * |
objectName, |
|
|
GSHandle * |
objectContent |
|
) |
| |
Retrieves the content and the name of the specified AddOnObject from the project database.
- Parameters
-
objectGuid | [in] The GUID of the object. |
objectName | [out] The name of the specified object. |
objectContent | [out] The content of the specified object. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - The passed parameter objectGuid is APINULLGuid or either objectName or objectContent is nullptr.
- APIERR_BADID - No object with the specified GUID exists.
◆ ACAPI_AddOnObject_GetObjectGuidFromName()
GSErrCode ACAPI_AddOnObject_GetObjectGuidFromName |
( |
const GS::UniString & |
name, |
|
|
API_Guid * |
objectGuid |
|
) |
| |
Returns the GUID of the specified object.
- Parameters
-
name | [in] The name of the specified object. |
objectGuid | [out] The GUID of the object, if the project database contains AddOnObject with the specified name, otherwise APINULLGuid. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - The passed parameter objectGuid is nullptr.
◆ ACAPI_AddOnObject_GetObjectList()
GSErrCode ACAPI_AddOnObject_GetObjectList |
( |
GS::Array< API_Guid > * |
objects | ) |
|
Returns the list of the AddOnObjects.
- Parameters
-
objects | [out] This array will be filled with the GUIDs of the AddOnObjects. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - The passed parameter objects is nullptr
◆ ACAPI_AddOnObject_GetTeamworkOwnerId()
GSErrCode ACAPI_AddOnObject_GetTeamworkOwnerId |
( |
const API_Guid & |
objectGuid, |
|
|
short * |
ownerId |
|
) |
| |
Returns the ownerId of the specified object in teamwork mode.
- Parameters
-
objectGuid | [in] The GUID of the specified object. |
ownerId | [out] The teamwork owner user of the specified object. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - The passed parameter objectGuid is APINULLGuid or ownerId is nullptr
- APIERR_BADID - AddOnObject does not exist.
◆ ACAPI_AddOnObject_GetUniqueObjectGuidFromName()
GSErrCode ACAPI_AddOnObject_GetUniqueObjectGuidFromName |
( |
const GS::UniString & |
name, |
|
|
API_Guid * |
objectGuid |
|
) |
| |
Returns the GUID of the specified Unique AddOnObject.
- Parameters
-
name | [in] The name of the specified object. |
objectGuid | [out] The GUID of the object, if the project database contains Unique AddOnObject with the specified name, otherwise APINULLGuid. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - The passed parameter objectGuid is NULL.
◆ ACAPI_AddOnObject_GrantObjects()
GSErrCode ACAPI_AddOnObject_GrantObjects |
( |
const GS::Array< API_Guid > & |
objectGuids, |
|
|
short |
toUserId |
|
) |
| |
In teamwork mode this function grants the specified objects to the given user.
- Parameters
-
objectGuids | [in] The list of the objects which must be granted. |
toUserId | [in] The teamwork owner, to which the objects must be granted. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - The passed parameter objectGuids is empty or contains APINULLGuid.
- APIERR_BADID - If any of the objectGuids is not an AddOnObject GUID.
◆ ACAPI_AddOnObject_InstallAddOnObjectConvertNewFormatHandler()
Installs a callback procedure for converting old format AddOnObject data into current format.
- Parameters
-
convertNewFormatProc | [in] The callback procedure to convert AddOnObject data. Passing nullptr in this parameter uninstalls the previously installed handler function. |
- Returns
- NoError - The function has completed with success.
◆ ACAPI_AddOnObject_InstallAddOnObjectMergeHandler()
Installs a callback procedure for handling the AddOnObject merge operations.
- Parameters
-
mergeHandlerProc | [in] The callback procedure which will handle the AddOnObject data merge. Can be nullptr ; this removes the installed callback. |
- Returns
- NoError - The function has completed with success.
◆ ACAPI_AddOnObject_InstallAddOnObjectSaveOldFormatHandler()
Installs a callback procedure for converting AddOnObject data into older format.
- Parameters
-
saveOldFormatProc | [in] The callback procedure to convert AddOnObject data. Passing nullptr in this parameter uninstalls the previously installed handler function. |
- Returns
- NoError - The function has completed with success.
◆ ACAPI_AddOnObject_ModifyObject()
GSErrCode ACAPI_AddOnObject_ModifyObject |
( |
const API_Guid & |
objectGuid, |
|
|
const GS::UniString * |
newObjectName, |
|
|
const GSHandle * |
newObjectContent |
|
) |
| |
Modifies the content and/or the name of the specified AddOnObject.
- Parameters
-
objectGuid | [in] The GUID of the object. |
newObjectName | [in] The new name of the specified object. If nullptr, the name of the object remains the original name. Must be nullptr if modifying a Unique AddOnObject. |
newObjectContent | [in] The new content of the specified object. If nullptr, the content of the object remains the original content. Must not be nullptr if modifying a Unique AddOnObject. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - If the passed objectGuid parameter is NULLGuid, or if neither newObjectName nor newObjectContent is filled, or if modifying a Unique AddOnObject and either newObjectName is not nullptr (it must be) or newObjectContent is nullptr (it must not be).
- APIERR_BADID - The specified object does not exist.
- APIERR_NOTMINE - The object is not owned by the current user in teamwork mode.
◆ ACAPI_AddOnObject_RegisterAddOnObjectHandler()
GSErrCode ACAPI_AddOnObject_RegisterAddOnObjectHandler |
( |
void |
| ) |
|
Registers the add-on to be called for merging and converting its custom data stored in AddOnObjects.
- Returns
- NoError - The function has completed with success.
◆ ACAPI_AddOnObject_ReleaseObjects()
GSErrCode ACAPI_AddOnObject_ReleaseObjects |
( |
const GS::Array< API_Guid > & |
objectGuids | ) |
|
In teamwork mode this function releases the specified objects.
- Parameters
-
objectGuids | [in] The list of the objects which must be released. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - The passed parameter objectGuids is empty or contains APINULLGuid.
- APIERR_BADID - If any of the objectGuids is not an AddOnObject GUID.
◆ ACAPI_AddOnObject_RequestObjects()
GSErrCode ACAPI_AddOnObject_RequestObjects |
( |
const GS::Array< API_Guid > & |
objectGuids, |
|
|
const GS::UniString & |
mailText |
|
) |
| |
In teamwork mode this function sends a request mail in order to request the specified objects from the owners.
- Parameters
-
objectGuids | [in] The list of the objects which must be requested. |
mailText | [in] The text of the request mail. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - The passed parameter objectGuids is empty or contains APINULLGuid.
- APIERR_BADID - If any of the objectGuids is not an AddOnObject GUID.
◆ ACAPI_AddOnObject_ReserveObjects()
GSErrCode ACAPI_AddOnObject_ReserveObjects |
( |
const GS::Array< API_Guid > & |
objectGuids, |
|
|
GS::HashTable< API_Guid, short > * |
conflicts |
|
) |
| |
In teamwork mode this function reserves the specified objects.
- Parameters
-
objectGuids | [in] The list of the objects which must be released. |
conflicts | [out] Can be nullptr. If some of the specified objects cannot be reserved because of reservations of other users, this table will be filled with the conflicts. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - The passed parameter objectGuids is empty or contains APINULLGuid.
- APIERR_BADID - If any of the objectGuids is not an AddOnObject GUID.
◆ ACAPI_AddOnObject_SetUIProperties()
GSErrCode ACAPI_AddOnObject_SetUIProperties |
( |
const API_Guid * |
objectGuid, |
|
|
const GS::UniString * |
name, |
|
|
const GS::UniString & |
localisedName, |
|
|
short |
dialogMenuStringId |
|
) |
| |
Sets various UI properties of an AddOnObject.
- Parameters
-
objectGuid | [in] GUID of the specified object. Can be NULL if name-based identification is intended. |
name | [in] The name of the specified object. Can be NULL if only GUID-based identification is intended. |
localisedName | [in] The localised name of the specified object (or objects if objectGuid is NULL and there are more AddOnObjects with the same name). |
dialogMenuStringId | [in] The id of the menu which must be called if Show button is pressed on Teamwork User interface. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - Both objectGuid and name are NULL, or localisedName is empty string.