Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »


 
This function adds an element to an aggregate in a protected attribute. Some system models are created and maintained by EDM and therefore the users need no write access to them. However, in these system models, some attributes may still be manipulated by selected users even if the model itself is open for read only. The ordinary operations such as e.g. sdaiAdd and sdaiDelete would return an error code if used on these attributes. To manipulate protected attributes one must use the protected-versions of the operations.
 
Header:
#include "sdai.h"
Prototype:
EdmiError edmiAddProtectedElement(SdaiAggr          aggrId,
                                   SdaiPrimitiveType valueType, 
                                    ...);
Arguments:

aggrId

A numeric aggregateID that uniquely identifies the aggregate instance in the operation.

valueType

The primitive type of the elements in the aggregate.

Returns:
A completion code of datatype EdmiError is the returned function value. The completion code has the following values:
Completion code = 0: Operation successfully performed.
Completion code != 0: Error in operation. Completion code is an EDMinterface error code. Use edmiGetErrorText to get the error text corresponding to the error code.
Example:
EdmiError rstat;
SdaiModel modId, edmModId;
SdaiAggr adminAggrId;
SdaiInstance johnnyId, lucyId;
 
/* Get the sdaiModel Id */
modId = edmiGetModelBN("MyRepository", "MyModel");
 
/* Get Johnnys and lucys user Ids */
rstat = edmiGetUser("johnny", &johnnyId);
rstat = edmiGetUser("lucy", &lucyId);
 
/* Get the edm_model Id in the ExpressDataManager Model */
sdaiGetAttrBN(modId, "edm_model", sdaiINSTANCE, &edmModId);
 
/* Get the model administrator aggregate */
sdaiGetAttrBN(edmModId, "ADMINISTRATORS", sdaiAGGR, &adminAggrId);
 
/* Remove Lucy from list of model administrators */
rstat = edmiDeleteProtectedElement(adminAggrId, sdaiINSTANCE, lucyId);
 
/* Add Johnny to list of model administrators */
rstat = edmiAddProtectedElement(adminAggrId, sdaiINSTANCE, johnnyId);
 
/* Grant create_repository_rights to Johnny */
rstat = edmiPutProtectedAttrBN(johnnyId, "creating_repository_permission",
sdaiBOOLEAN, sdaiTRUE); 
 
/* Remove the description of MyModel */
rstat = edmiUnsetProtectedAttrBN(edmModId, "description");
 
. . .

  • No labels