ARSperl
view release on metacpan or search on metacpan
}
OUTPUT:
RETVAL
ARControlStruct *
ars_Login(server, username, password, lang=NULL, authString=NULL, tcpport=0, rpcnumber=0, ...)
char * server
char * username
char * password
char * lang
char * authString
unsigned int tcpport
unsigned int rpcnumber
CODE:
{
int ret = 0, s_ok = 1;
int staticParams = 7;
ARStatusList status;
ARServerNameList serverList;
ARControlStruct *ctrl;
#ifdef PROFILE
struct timeval tv;
#endif
DBG( ("ars_Login(%s, %s, %s, %s, %s, %d, %d)\n",
SAFEPRT(server),
SAFEPRT(username),
SAFEPRT(password),
SAFEPRT(lang),
SAFEPRT(authString),
tcpport,
rpcnumber)
);
RETVAL = NULL;
Zero(&status, 1, ARStatusList);
Zero(&serverList, 1, ARServerNameList);
(void) ARError_reset();
#ifdef PROFILE
/* XXX
This is something of a hack... a safemalloc will always
complain about differing structures. However, it's
pretty deep into the code. Perhaps a static would be cleaner?
*/
ctrl = (ARControlStruct *)MALLOCNN(sizeof(ars_ctrl));
Zero(ctrl, 1, ars_ctrl);
((ars_ctrl *)ctrl)->queries = 0;
((ars_ctrl *)ctrl)->startTime = 0;
((ars_ctrl *)ctrl)->endTime = 0;
#else
DBG( ("safemalloc ARControlStruct\n") );
ctrl = (ARControlStruct *)safemalloc(sizeof(ARControlStruct));
/* DBG( ("malloc ARControlStruct\n") );
ctrl = (ARControlStruct *)MALLOCNN(sizeof(ARControlStruct)); */
Zero(ctrl, 1, ARControlStruct);
#endif
#ifdef PROFILE
if (gettimeofday(&tv, 0) != -1)
((ars_ctrl *)ctrl)->startTime = tv.tv_sec;
else
perror("gettimeofday");
#endif
ctrl->cacheId = 0;
#if AR_EXPORT_VERSION >= 4
ctrl->sessionId = 0;
#endif
ctrl->operationTime = 0;
strncpy(ctrl->user, username, sizeof(ctrl->user));
ctrl->user[sizeof(ctrl->user)-1] = 0;
strncpy(ctrl->password, password, sizeof(ctrl->password));
ctrl->password[sizeof(ctrl->password)-1] = 0;
#ifndef AR_MAX_LOCALE_SIZE
/* 6.0.1 and 6.3 are AR_EXPORT_VERSION = 8L but 6.3 does not
* contain the language field
*/
ctrl->language[0] = 0;
if ( CVLD(lang) ) {
strncpy(ctrl->language, lang, AR_MAX_LANG_SIZE);
}
#else
ctrl->localeInfo.locale[0] = 0;
if ( CVLD(lang) ) {
strncpy(ctrl->localeInfo.locale, lang, AR_MAX_LANG_SIZE);
}
if( items > staticParams ){
int i;
HV *h;
if( (items - staticParams) % 2 ){
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_BAD_ARGS);
#ifdef PROFILE
AP_FREE(ctrl); /* invalid, cleanup */
#else
safefree(ctrl);
#endif
goto ar_login_end;
}
h = newHV();
for( i = staticParams; i < items; i+=2 ){
hv_store_ent( h, newSVsv(ST(i)), newSVsv(ST(i+1)), 0 );
}
if( hv_exists(h,"charSet",7) ){
strncpy( ctrl->localeInfo.charSet, SvPV_nolen( *(hv_fetch(h,"charSet",7,0)) ), AR_MAX_LANG_SIZE );
}
if( hv_exists(h,"timeZone",8) ){
strncpy( ctrl->localeInfo.timeZone, SvPV_nolen( *(hv_fetch(h,"timeZone",8,0)) ), AR_MAX_LOCALE_SIZE );
}
if( hv_exists(h,"customDateFormat",16) ){
strncpy( ctrl->localeInfo.customDateFormat, SvPV_nolen( *(hv_fetch(h,"customDateFormat",16,0)) ), AR_MAX_FORMAT_SIZE );
}
if( hv_exists(h,"customTimeFormat",16) ){
strncpy( ctrl->localeInfo.customTimeFormat, SvPV_nolen( *(hv_fetch(h,"customTimeFormat",16,0)) ), AR_MAX_FORMAT_SIZE );
}
if( hv_exists(h,"separators",10) ){
strncpy( ctrl->localeInfo.separators, SvPV_nolen( *(hv_fetch(h,"separators",10,0)) ), AR_MAX_LANG_SIZE );
}
hv_undef( h );
if (((items - 2) % 2) || c < 1) {
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_BAD_ARGS);
} else {
cacheFields = fieldcache_get_schema_fields( ctrl, schema, FALSE );
if( ! cacheFields ){
goto create_entry_end;
}
fieldList.numItems = c;
AMALLOCNN(fieldList.fieldValueList,c,ARFieldValueStruct);
getFieldIds.numItems = 0;
getFieldIds.internalIdList = NULL;
/* try to get data type from field cache, collect fieldIds which are not cached */
for (i=0; i<c; ++i) {
ARInternalId fieldId;
a = i*2+2;
fieldId = fieldList.fieldValueList[i].fieldId = SvIV(ST(a));
dataType = fieldcache_get_data_type( cacheFields, fieldId );
if (dataType <= AR_DATA_TYPE_MAX_TYPE) {
/* printf( "%s [%d] found in cache\n", schema, fieldId ); fflush(stdout); */ /* _DEBUG_ */
if (sv_to_ARValue(ctrl, ST(a+1), dataType, &fieldList.fieldValueList[i].value) < 0) {
goto create_entry_end;
}
}else{
if( getFieldIds.numItems == 0 ){
AMALLOCNN(getFieldIds.internalIdList,c,ARInternalId);
}
/* printf( "%s [%d] collect for loading\n", schema, fieldId ); fflush(stdout); */ /* _DEBUG_ */
getFieldIds.internalIdList[getFieldIds.numItems] = fieldId;
++getFieldIds.numItems;
}
}
/* load missing fields into cache */
if( getFieldIds.numItems > 0 ){
/* printf( "--- load missing fields ---\n" ); fflush(stdout); */ /* _DEBUG_ */
/* if( fieldcache_load_schema(ctrl,schema,&getFieldIds,NULL) != AR_RETURN_OK ){ */
if( fieldcache_load_schema(ctrl,schema,&getFieldIds,NULL) > AR_RETURN_WARNING ){
goto create_entry_end;
}
}
/* now get data type from the freshly cached fields */
i = 0;
for (j=0; j<getFieldIds.numItems; ++j) {
ARInternalId fieldId = getFieldIds.internalIdList[j];
while(fieldId != fieldList.fieldValueList[i].fieldId) ++i;
a = i*2+2;
dataType = fieldcache_get_data_type( cacheFields, fieldId );
if (dataType <= AR_DATA_TYPE_MAX_TYPE) {
/* printf( "%s [%d] freshly loaded\n", schema, fieldId ); fflush(stdout); */ /* _DEBUG_ */
if (sv_to_ARValue(ctrl, ST(a+1), dataType, &fieldList.fieldValueList[i].value) < 0) {
goto create_entry_end;
}
}else{
char errTxt[256];
sprintf( errTxt, "Failed to fetch field %d from hash", fieldId );
ARError_add(AR_RETURN_ERROR, AP_ERR_FIELD_TYPE);
ARError_add(AR_RETURN_ERROR, AP_ERR_CONTINUE, errTxt );
goto create_entry_end;
}
}
/* printf( "--------------------\n" ); fflush(stdout); */ /* _DEBUG_ */
ret = ARCreateEntry(ctrl, schema, &fieldList, entryId, &status);
#ifdef PROFILE
((ars_ctrl *)ctrl)->queries++;
#endif
if (! ARError( ret, status)) rv = 1;
create_entry_end:;
if(rv == 0) {
RETVAL = newSVsv(&PL_sv_undef);
} else {
RETVAL = newSVpv( entryId, strlen(entryId) );
}
AP_FREE(fieldList.fieldValueList);
if( getFieldIds.internalIdList != NULL ) AP_FREE(getFieldIds.internalIdList);
}
}
OUTPUT:
RETVAL
int
ars_DeleteEntry(ctrl,schema,entry_id)
ARControlStruct * ctrl
char * schema
char * entry_id
CODE:
{
int ret = 0;
ARStatusList status;
#if AR_EXPORT_VERSION >= 3
AREntryIdList entryList;
RETVAL = 0; /* assume error */
(void) ARError_reset();
Zero(&status, 1, ARStatusList);
if(perl_BuildEntryList(ctrl, &entryList, entry_id) != 0)
goto delete_fail;
ret = ARDeleteEntry(ctrl, schema, &entryList, 0, &status);
if (entryList.entryIdList) AP_FREE(entryList.entryIdList);
#else /* ARS 2 */
RETVAL = 0; /* assume error */
if(!entry_id || !*entry_id) {
ARError_add( AR_RETURN_ERROR, AP_ERR_BAD_EID);
goto delete_fail;
}
ret = ARDeleteEntry(ctrl, schema, entry_id, &status);
#endif
#ifdef PROFILE
((ars_ctrl *)ctrl)->queries++;
#endif
if (ARError(ret, status))
RETVAL = 0;
else
RETVAL = 1;
delete_fail:;
}
OUTPUT:
RETVAL
void
ars_GetEntryBLOB(ctrl,schema,entry_id,field_id,locType,locFile=NULL)
ARControlStruct * ctrl
char * schema
char * entry_id
ARInternalId field_id
int locType
char * locFile
PPCODE:
{
ARStatusList status;
AREntryIdList entryList;
#if AR_EXPORT_VERSION >= 4
ARLocStruct loc;
#endif
int ret = 0;
(void) ARError_reset();
Zero(&entryList, 1, AREntryIdList);
Zero(&status, 1, ARStatusList);
#if AR_EXPORT_VERSION >= 4
/* build entryList */
ret = perl_BuildEntryList(ctrl, &entryList, entry_id);
if(ret)
goto get_entryblob_end;
switch(locType) {
case AR_LOC_FILENAME:
if(locFile == NULL) {
ARError_add(AR_RETURN_ERROR,
AP_ERR_USAGE,
"locFile parameter required when specifying AR_LOC_FILENAME");
goto get_entryblob_end;
}
loc.locType = AR_LOC_FILENAME;
loc.u.filename = strdup(locFile); /* strdup(locFile) ? i'm not completely sure
which to use. will FreeARLocStruct call
free(loc.locType)? i'm assuming it will.
Purify doesnt complain, so i'm going
to leave this alone. */
break;
case AR_LOC_BUFFER:
loc.locType = AR_LOC_BUFFER;
XPUSHs(sv_2mortal(newSVpv(serverList.nameList[i], 0)));
}
FreeARServerNameList(&serverList,FALSE);
}
}
HV *
ars_GetActiveLink(ctrl,name)
ARControlStruct * ctrl
char * name
CODE:
{
int ret = 0;
unsigned int order = 0;
ARInternalIdList assignedGroupList;
ARInternalIdList groupList;
unsigned int executeMask = 0;
ARInternalId controlField;
ARInternalId focusField;
unsigned int enable = 0;
ARActiveLinkActionList actionList;
ARActiveLinkActionList elseList;
ARWorkflowConnectStruct schemaList;
ARPropList objPropList;
char *helpText = CPNULL;
ARTimestamp timestamp;
ARAccessNameType owner;
ARAccessNameType lastChanged;
char *changeDiary = CPNULL;
ARStatusList status;
SV *ref;
ARQualifierStruct *query;
ARDiaryList diaryList;
AMALLOCNN(query,1,ARQualifierStruct);
(void) ARError_reset();
Zero(&assignedGroupList, 1, ARInternalIdList);
Zero(&groupList, 1, ARInternalIdList);
Zero(×tamp, 1, ARTimestamp);
Zero(owner, 1, ARAccessNameType);
Zero(lastChanged, 1, ARAccessNameType);
Zero(&diaryList, 1, ARDiaryList);
Zero(&status, 1, ARStatusList);
Zero(&actionList, 1, ARActiveLinkActionList);
Zero(&elseList, 1, ARActiveLinkActionList);
Zero(&schemaList, 1, ARWorkflowConnectStruct);
Zero(&objPropList, 1, ARPropList);
ret = ARGetActiveLink(ctrl, name, &order,
&schemaList, /* new in 4.5 */
#if AR_CURRENT_API_VERSION >= 17
&assignedGroupList,
#endif
&groupList,
&executeMask, &controlField, &focusField,
&enable, query, &actionList, &elseList, &helpText,
×tamp, owner, lastChanged, &changeDiary,
&objPropList, /* new in 4.5 */
#if AR_CURRENT_API_VERSION >= 14
NULL, /* errorActlinkOptions, reserved for future use */
NULL, /* errorActlinkName, reserved for future use */
#endif
&status);
#ifdef PROFILE
((ars_ctrl *)ctrl)->queries++;
#endif
if (!ARError( ret,status)) {
RETVAL = newHV();
sv_2mortal( (SV*) RETVAL );
hv_store(RETVAL, "name", strlen("name") , newSVpv(name, 0), 0);
hv_store(RETVAL, "order", strlen("order") , newSViv(order),0);
hv_store(RETVAL, "schemaList", strlen("schemaList") , /* WorkflowConnectStruct */
perl_ARNameList(ctrl, schemaList.u.schemaList), 0);
hv_store(RETVAL, "objPropList", strlen("objPropList") ,
perl_ARPropList(ctrl, &objPropList), 0);
#if AR_CURRENT_API_VERSION >= 17
hv_store(RETVAL, "assignedGroupList", strlen("assignedGroupList") ,
perl_ARList( ctrl,
(ARList *)&assignedGroupList,
(ARS_fn)perl_ARInternalId,
sizeof(ARInternalId)), 0);
#endif
hv_store(RETVAL, "groupList", strlen("groupList") ,
perl_ARList( ctrl,
(ARList *)&groupList,
(ARS_fn)perl_ARInternalId,
sizeof(ARInternalId)), 0);
hv_store(RETVAL, "executeMask", strlen("executeMask") , newSViv(executeMask),0);
hv_store(RETVAL, "focusField", strlen("focusField") , newSViv(focusField), 0);
hv_store(RETVAL, "controlField", strlen("controlField") ,
newSViv(controlField), 0);
hv_store(RETVAL, "enable", strlen("enable") , newSViv(enable), 0);
/* a bit of a hack -- makes blessed reference to qualifier */
ref = newSViv(0);
sv_setref_pv(ref, "ARQualifierStructPtr", (void*)query);
hv_store(RETVAL, "query", strlen("query") , ref, 0);
hv_store(RETVAL, "actionList", strlen("actionList") ,
perl_ARList(ctrl,
(ARList *)&actionList,
(ARS_fn)perl_ARActiveLinkActionStruct,
sizeof(ARActiveLinkActionStruct)), 0);
hv_store(RETVAL, "elseList", strlen("elseList") ,
perl_ARList(ctrl,
(ARList *)&elseList,
(ARS_fn)perl_ARActiveLinkActionStruct,
sizeof(ARActiveLinkActionStruct)), 0);
if (helpText)
hv_store(RETVAL, "helpText", strlen("helpText") , newSVpv(helpText,0), 0);
hv_store(RETVAL, "timestamp", strlen("timestamp") , newSViv(timestamp), 0);
hv_store(RETVAL, "owner", strlen("owner") , newSVpv(owner,0), 0);
hv_store(RETVAL, "lastChanged", strlen("lastChanged") , newSVpv(lastChanged,0), 0);
if (changeDiary) {
ret = ARDecodeDiary(ctrl, changeDiary, &diaryList, &status);
if (!ARError(ret, status)) {
hv_store(RETVAL, "changeDiary", strlen("changeDiary") ,
perl_ARList(ctrl, (ARList *)&diaryList,
(ARS_fn)perl_diary,
sizeof(ARDiaryStruct)), 0);
FreeARDiaryList(&diaryList, FALSE);
}
}
FreeARInternalIdList(&groupList,FALSE);
FreeARActiveLinkActionList(&actionList,FALSE);
FreeARActiveLinkActionList(&elseList,FALSE);
FreeARWorkflowConnectStruct(&schemaList, FALSE);
FreeARPropList(&objPropList, FALSE);
if(helpText) arsperl_FreeARTextString(helpText);
if(changeDiary) arsperl_FreeARTextString(changeDiary);
}else{
XSRETURN_UNDEF;
}
}
OUTPUT:
RETVAL
HV *
ars_GetFilter(ctrl,name)
ARControlStruct * ctrl
char * name
CODE:
{
int ret;
unsigned int order;
unsigned int opSet;
unsigned int enable;
char *helpText = CPNULL;
char *changeDiary = CPNULL;
ARFilterActionList actionList;
ARFilterActionList elseList;
ARTimestamp timestamp;
ARAccessNameType owner;
ARAccessNameType lastChanged;
ARStatusList status;
SV *ref;
ARQualifierStruct *query;
ARDiaryList diaryList;
ARWorkflowConnectStruct schemaList;
ARPropList objPropList;
#if AR_CURRENT_API_VERSION >= 13
unsigned int errorFilterOptions;
ARNameType errorFilterName;
#endif
AMALLOCNN(query,1,ARQualifierStruct);
(void) ARError_reset();
Zero(&actionList, 1, ARFilterActionList);
Zero(&elseList, 1, ARFilterActionList);
Zero(×tamp, 1, ARTimestamp);
Zero(owner, 1, ARAccessNameType);
Zero(lastChanged, 1, ARAccessNameType);
Zero(&diaryList, 1, ARDiaryList);
Zero(&status, 1,ARStatusList);
Zero(&schemaList, 1, ARWorkflowConnectStruct);
Zero(&objPropList, 1, ARPropList);
#if AR_CURRENT_API_VERSION >= 13
Zero(&errorFilterName, 1,ARNameType);
#endif
ret = ARGetFilter(ctrl, name, &order,
&schemaList,
&opSet, &enable,
query, &actionList, &elseList, &helpText,
×tamp, owner, lastChanged, &changeDiary,
&objPropList,
#if AR_CURRENT_API_VERSION >= 13
&errorFilterOptions,
errorFilterName,
#endif
&status);
#ifdef PROFILE
((ars_ctrl *)ctrl)->queries++;
#endif
if (!ARError( ret,status)) {
RETVAL = newHV();
sv_2mortal( (SV*) RETVAL );
hv_store(RETVAL, "name", strlen("name") , newSVpv(name, 0), 0);
hv_store(RETVAL, "order", strlen("order") , newSViv(order), 0);
hv_store(RETVAL, "schemaList", strlen("schemaList") , /* WorkflowConnectStruct */
perl_ARNameList(ctrl, schemaList.u.schemaList), 0);
hv_store(RETVAL, "objPropList", strlen("objPropList") ,
perl_ARPropList(ctrl, &objPropList), 0);
hv_store(RETVAL, "opSet", strlen("opSet") , newSViv(opSet), 0);
hv_store(RETVAL, "enable", strlen("enable") , newSViv(enable), 0);
/* a bit of a hack -- makes blessed reference to qualifier */
ref = newSViv(0);
sv_setref_pv(ref, "ARQualifierStructPtr", (void *)query);
hv_store(RETVAL, "query", strlen("query") , ref, 0);
hv_store(RETVAL, "actionList", strlen("actionList") ,
perl_ARList(ctrl,
(ARList *)&actionList,
(ARS_fn)perl_ARFilterActionStruct,
sizeof(ARFilterActionStruct)), 0);
hv_store(RETVAL, "elseList", strlen("elseList") ,
perl_ARList(ctrl,
(ARList *)&elseList,
(ARS_fn)perl_ARFilterActionStruct,
sizeof(ARFilterActionStruct)), 0);
if(helpText)
hv_store(RETVAL, "helpText", strlen("helpText") , newSVpv(helpText, 0), 0);
hv_store(RETVAL, "timestamp", strlen("timestamp") , newSViv(timestamp), 0);
hv_store(RETVAL, "owner", strlen("owner") , newSVpv(owner, 0), 0);
hv_store(RETVAL, "lastChanged", strlen("lastChanged") , newSVpv(lastChanged, 0), 0);
if (changeDiary) {
ret = ARDecodeDiary(ctrl, changeDiary, &diaryList, &status);
if (!ARError(ret, status)) {
hv_store(RETVAL, "changeDiary", strlen("changeDiary") ,
perl_ARList(ctrl, (ARList *)&diaryList,
(ARS_fn)perl_diary,
sizeof(ARDiaryStruct)), 0);
FreeARDiaryList(&diaryList, FALSE);
}
}
#if AR_CURRENT_API_VERSION >= 13
hv_store(RETVAL, "errorFilterOptions", strlen("errorFilterOptions") , newSViv(errorFilterOptions), 0);
hv_store(RETVAL, "errorFilterName", strlen("errorFilterName") , newSVpv(errorFilterName, 0), 0);
#endif
FreeARFilterActionList(&actionList,FALSE);
FreeARFilterActionList(&elseList,FALSE);
FreeARWorkflowConnectStruct(&schemaList, FALSE);
FreeARPropList(&objPropList, FALSE);
if(helpText) {
AP_FREE(helpText);
}
if(changeDiary) {
AP_FREE(changeDiary);
}
}else{
XSRETURN_UNDEF;
}
}
OUTPUT:
RETVAL
void
ars_GetServerStatistics(ctrl,...)
ARControlStruct * ctrl
PPCODE:
{
ARServerInfoRequestList requestList;
ARServerInfoList serverInfo;
int i = 0, ret = 0;
unsigned int ui = 0;
ARStatusList status;
(void) ARError_reset();
Zero(&requestList, 1, ARServerInfoRequestList);
Zero(&serverInfo, 1, ARServerInfoList);
Zero(&status, 1, ARStatusList);
if(items < 1) {
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_BAD_ARGS);
} else {
requestList.numItems = items - 1;
AMALLOCNN(requestList.requestList,(items-1),unsigned int);
if(requestList.requestList) {
for(i=1; i<items; i++) {
requestList.requestList[i-1] = SvIV(ST(i));
}
ret = ARGetServerStatistics(ctrl, &requestList, &serverInfo, &status);
#ifdef PROFILE
((ars_ctrl *)ctrl)->queries++;
#endif
if (!ARError(ret, status)) {
for(ui=0; ui<serverInfo.numItems; ui++) {
XPUSHs(sv_2mortal(newSViv(serverInfo.serverInfoList[ui].operation)));
switch(serverInfo.serverInfoList[ui].value.dataType) {
case AR_DATA_TYPE_ENUM:
case AR_DATA_TYPE_TIME:
case AR_DATA_TYPE_BITMASK:
case AR_DATA_TYPE_INTEGER:
XPUSHs(sv_2mortal(newSViv(serverInfo.serverInfoList[ui].value.u.intVal)));
break;
case AR_DATA_TYPE_REAL:
XPUSHs(sv_2mortal(newSVnv(serverInfo.serverInfoList[ui].value.u.realVal)));
break;
case AR_DATA_TYPE_CHAR:
ret = ARGetFieldCached(ctrl, schema, id, fieldName, &fieldMap, &dataType, &option, &createMode, &defaultVal, &permissions, &limit, &displayList, &helpText, ×tamp, owner, lastChanged, &changeDiary, &Status);
#endif
#ifdef PROFILE
((ars_ctrl *)ctrl)->queries++;
#endif
if (! ARError( ret, Status)) {
RETVAL = newHV();
sv_2mortal( (SV*) RETVAL );
/* store field id for convenience */
hv_store(RETVAL, "fieldId", strlen("fieldId") , newSViv(id), 0);
if (createMode == AR_FIELD_OPEN_AT_CREATE)
hv_store(RETVAL, "createMode", strlen("createMode") , newSVpv("open",0), 0);
else
hv_store(RETVAL, "createMode", strlen("createMode") ,
newSVpv("protected",0), 0);
hv_store(RETVAL, "option", strlen("option") , newSViv(option), 0);
#if AR_CURRENT_API_VERSION >= 12
hv_store(RETVAL, "fieldOption", strlen("fieldOption") , newSViv(fieldOption), 0);
#endif
hv_store(RETVAL, "dataType", strlen("dataType") ,
perl_dataType_names(ctrl, &dataType), 0);
hv_store(RETVAL, "defaultVal", strlen("defaultVal") ,
perl_ARValueStruct(ctrl, &defaultVal), 0);
#if AR_CURRENT_API_VERSION >= 17
hv_store(RETVAL, "assignedGroupList", strlen("assignedGroupList") ,
perl_ARPermissionList(ctrl, &assignedGroupList, PERMTYPE_FIELD), 0);
#endif
hv_store(RETVAL, "permissions", strlen("permissions") ,
perl_ARPermissionList(ctrl, &permissions, PERMTYPE_FIELD), 0);
hv_store(RETVAL, "limit", strlen("limit") ,
perl_ARFieldLimitStruct(ctrl, &limit), 0);
hv_store(RETVAL, "fieldName", strlen("fieldName") ,
newSVpv(fieldName, 0), 0);
hv_store(RETVAL, "fieldMap", strlen("fieldMap") ,
perl_ARFieldMappingStruct(ctrl, &fieldMap), 0);
hv_store(RETVAL, "displayInstanceList", strlen("displayInstanceList") ,
perl_ARDisplayInstanceList(ctrl, &displayList), 0);
if (helpText)
hv_store(RETVAL, "helpText", strlen("helpText") ,
newSVpv(helpText, 0), 0);
hv_store(RETVAL, "timestamp", strlen("timestamp") ,
newSViv(timestamp), 0);
hv_store(RETVAL, "owner", strlen("owner") ,
newSVpv(owner, 0), 0);
hv_store(RETVAL, "lastChanged", strlen("lastChanged") ,
newSVpv(lastChanged, 0), 0);
if (changeDiary) {
ret = ARDecodeDiary(ctrl, changeDiary, &diaryList, &Status);
if (!ARError(ret, Status)) {
hv_store(RETVAL, "changeDiary", strlen("changeDiary") ,
perl_ARList(ctrl, (ARList *)&diaryList,
(ARS_fn)perl_diary,
sizeof(ARDiaryStruct)), 0);
FreeARDiaryList(&diaryList, FALSE);
}
}
FreeARFieldLimitStruct(&limit,FALSE);
FreeARDisplayInstanceList(&displayList,FALSE);
if(helpText) {
/* AP_FREE(helpText); */ /* TS 20060207 disabled bc of memory errors with 5.8.8 */
}
if(changeDiary) {
AP_FREE(changeDiary);
}
}else{
XSRETURN_UNDEF;
}
}
OUTPUT:
RETVAL
HV*
ars_GetImage(ctrl,name)
ARControlStruct * ctrl
ARNameType name
CODE:
{
ARStatusList status;
#if AR_CURRENT_API_VERSION >= 14
unsigned int enable = 0;
ARImageDataStruct content;
char *imageType;
ARTimestamp timestamp;
char *checkSum = CPNULL;
char *description = CPNULL;
char *helpText = CPNULL;
ARAccessNameType owner;
ARAccessNameType lastChanged;
char *changeDiary = CPNULL;
ARPropList objPropList;
ARDiaryList diaryList;
int ret;
(void) ARError_reset();
Zero(&status, 1,ARStatusList);
Zero(&content, 1, ARImageDataStruct);
Zero(×tamp, 1, ARTimestamp);
Zero(owner, 1, ARAccessNameType);
Zero(&objPropList, 1, ARPropList);
Zero(&diaryList, 1, ARDiaryList);
ret = ARGetImage(ctrl, name,
&content,
&imageType,
×tamp,
&checkSum,
&description,
&helpText,
owner,
lastChanged,
&changeDiary,
&objPropList,
&status );
if(!ARError( ret, status)) {
RETVAL = newHV();
sv_2mortal( (SV*) RETVAL );
hv_store(RETVAL, "name", strlen("name"), newSVpv(name, 0), 0);
hv_store(RETVAL, "imageData", strlen("imageData"),
hv_store(RETVAL, "lastChanged", strlen("lastChanged") , newSVpv(lastChanged, 0), 0);
if( changeDiary ){
ret = ARDecodeDiary(ctrl, changeDiary, &diaryList, &status);
if (!ARError(ret, status)) {
hv_store(RETVAL, "changeDiary", strlen("changeDiary") ,
perl_ARList(ctrl,
(ARList *)&diaryList,
(ARS_fn)perl_diary,
sizeof(ARDiaryStruct)), 0);
FreeARDiaryList(&diaryList, FALSE);
}
}
if(helpText) { AP_FREE(helpText); }
if(changeDiary) { AP_FREE(changeDiary); }
if(imageType) { AP_FREE(imageType); }
if(checkSum) { AP_FREE(checkSum); }
if(description) { AP_FREE(description); }
FreeARImageDataStruct(&content, FALSE);
FreeARPropList(&objPropList, FALSE);
}else{
XSRETURN_UNDEF;
}
#else /* prior to ARS 7.5 */
(void) ARError_reset();
Zero(&status, 1, ARStatusList);
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_DEPRECATED,
"ars_GetImage() is only available in ARS >= 7.5");
XSRETURN_UNDEF;
#endif
}
OUTPUT:
RETVAL
int
ars_SetEntry(ctrl,schema,entry_id,getTime,...)
ARControlStruct * ctrl
char * schema
char * entry_id
unsigned long getTime
CODE:
{
int a = 0, i = 0, c = (items - 4) / 2;
int offset = 4;
ARFieldValueList fieldList;
ARInternalIdList getFieldIds;
ARStatusList status;
int ret = 0;
unsigned int dataType = 0, j = 0;
unsigned int option = AR_JOIN_SETOPTION_NONE;
AREntryIdList entryList;
HV *cacheFields;
(void) ARError_reset();
Zero(&status, 1,ARStatusList);
Zero(&fieldList, 1, ARFieldValueList);
Zero(&getFieldIds, 1, ARInternalIdList);
Zero(&entryList, 1,AREntryIdList);
RETVAL = 0; /* assume error */
if ((items - 4) % 2) {
option = SvIV(ST(offset));
offset ++;
}
if (c < 1) {
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_BAD_ARGS);
goto set_entry_exit;
}
cacheFields = fieldcache_get_schema_fields( ctrl, schema, FALSE );
if( ! cacheFields ){
goto set_entry_exit;
}
fieldList.numItems = c;
AMALLOCNN(fieldList.fieldValueList,c,ARFieldValueStruct);
getFieldIds.numItems = 0;
getFieldIds.internalIdList = NULL;
for (i=0; i<c; i++) {
ARInternalId fieldId;
a = i*2+offset;
fieldId = fieldList.fieldValueList[i].fieldId = SvIV(ST(a));
if (! SvOK(ST(a+1))) {
/* pass a NULL */
fieldList.fieldValueList[i].value.dataType = AR_DATA_TYPE_NULL;
}else{
/* determine data type and pass value */
dataType = fieldcache_get_data_type( cacheFields, fieldId );
if (dataType <= AR_DATA_TYPE_MAX_TYPE) {
if (sv_to_ARValue(ctrl, ST(a+1), dataType, &fieldList.fieldValueList[i].value) < 0) {
goto set_entry_end;
}
}else{
if( getFieldIds.numItems == 0 ){
AMALLOCNN(getFieldIds.internalIdList,c,ARInternalId);
}
/* printf( "%s [%d] collect for loading\n", schema, fieldId ); fflush(stdout); */ /* _DEBUG_ */
getFieldIds.internalIdList[getFieldIds.numItems] = fieldId;
++getFieldIds.numItems;
}
}
}
/* load missing fields into cache */
if( getFieldIds.numItems > 0 ){
/* printf( "--- load missing fields ---\n" ); fflush(stdout); */ /* _DEBUG_ */
/* if( fieldcache_load_schema(ctrl,schema,&getFieldIds,NULL) != AR_RETURN_OK ){ */
if( fieldcache_load_schema(ctrl,schema,&getFieldIds,NULL) > AR_RETURN_WARNING ){
goto set_entry_end;
}
}
/* now get data type from the freshly cached fields */
i = 0;
for (j=0; j<getFieldIds.numItems; ++j) {
ARInternalId fieldId = getFieldIds.internalIdList[j];
while(fieldId != fieldList.fieldValueList[i].fieldId) ++i;
a = i*2+offset;
dataType = fieldcache_get_data_type( cacheFields, fieldId );
if (dataType <= AR_DATA_TYPE_MAX_TYPE) {
/* printf( "%s [%d] freshly loaded\n", schema, fieldId ); fflush(stdout); */ /* _DEBUG_ */
if (sv_to_ARValue(ctrl, ST(a+1), dataType, &fieldList.fieldValueList[i].value) < 0) {
goto set_entry_end;
}
}else{
char errTxt[256];
sprintf( errTxt, "Failed to fetch field %d from hash", fieldId );
ARError_add(AR_RETURN_ERROR, AP_ERR_FIELD_TYPE);
ARError_add(AR_RETURN_ERROR, AP_ERR_CONTINUE, errTxt );
goto set_entry_end;
}
}
/* printf( "--------------------\n" ); fflush(stdout); */ /* _DEBUG_ */
/* build entryList */
if(perl_BuildEntryList(ctrl, &entryList, entry_id) != 0){
goto set_entry_end;
}
ret = ARSetEntry(ctrl, schema, &entryList, &fieldList, getTime, option, &status);
if (entryList.entryIdList) AP_FREE(entryList.entryIdList);
#ifdef PROFILE
((ars_ctrl *)ctrl)->queries++;
#endif
if (! ARError( ret, status)) {
RETVAL = 1;
}
set_entry_end:;
if (fieldList.fieldValueList) AP_FREE(fieldList.fieldValueList);
set_entry_exit:;
}
OUTPUT:
RETVAL
SV *
ars_Export(ctrl,displayTag,vuiType,...)
ARControlStruct * ctrl
char * displayTag
unsigned int vuiType
CODE:
{
int ret = 0, i = 0, a = 0, c = (items - 3) / 2, ok = 1;
ARStructItemList structItems;
char *buf = CPNULL;
ARStatusList status;
#if AR_CURRENT_API_VERSION >= 17
unsigned int exportOption = AR_EXPORT_DEFAULT; /* TODO: support this as ars_Export() argument */
#endif
#if AR_EXPORT_VERSION >= 8L
ARWorkflowLockStruct workflowLockStruct;
#endif
(void) ARError_reset();
Zero(&status, 1, ARStatusList);
Zero(&structItems, 1, ARStructItemList);
#if AR_EXPORT_VERSION >= 8L
Zero(&workflowLockStruct, 1, ARWorkflowLockStruct);
#endif
RETVAL = &PL_sv_undef;
if ( (items % 2 == 0) || (c < 1) ) {
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_BAD_ARGS);
ok = 0;
} else {
structItems.numItems = c;
AMALLOCNN(structItems.structItemList, c, ARStructItemStruct);
for (i = 0 ; i < c ; i++) {
unsigned int et = 0;
a = i * 2 + 3;
#if AR_CURRENT_API_VERSION >= 17
objectModificationLogLabel,
#endif
&status);
#ifdef PROFILE
((ars_ctrl *)ctrl)->queries++;
#endif
if(!ARError( ret, status)) {
RETVAL = 1;
}
} else {
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_BAD_ARGS);
}
}
OUTPUT:
RETVAL
int
ars_DeleteSchema(ctrl, name, deleteOption)
ARControlStruct * ctrl
char * name
unsigned int deleteOption
CODE:
{
char *objectModificationLogLabel = NULL;
ARStatusList status;
int ret = 0;
(void) ARError_reset();
Zero(&status, 1, ARStatusList);
RETVAL = 0;
if(ctrl && CVLD(name)) {
ret = ARDeleteSchema(ctrl, name,
deleteOption,
#if AR_CURRENT_API_VERSION >= 17
objectModificationLogLabel,
#endif
&status);
#ifdef PROFILE
((ars_ctrl *)ctrl)->queries++;
#endif
if(!ARError( ret, status))
RETVAL = 1;
} else
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_BAD_ARGS);
}
OUTPUT:
RETVAL
int
ars_DeleteMultipleFields(ctrl, schema, deleteOption, ...)
ARControlStruct * ctrl
char * schema
unsigned int deleteOption
CODE:
{
int i = 0, ret = 0, c = (items - 3);
ARStatusList status;
ARInternalIdList fieldList;
RETVAL = 0; /* assume error */
Zero(&status, 1,ARStatusList);
Zero(&fieldList, 1, ARInternalIdList);
(void) ARError_reset();
#if AR_EXPORT_VERSION >= 3
if(items < 4)
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_BAD_ARGS);
else {
/* slurp in each fieldId and put it in a list */
fieldList.numItems = c;
fieldList.internalIdList = MALLOCNN(sizeof(ARInternalId) * c);
for(i = 0; i < c; i++) {
fieldList.internalIdList[i] = SvIV(ST(i + 3));
}
ret = ARDeleteMultipleFields(ctrl, schema,
&fieldList,
deleteOption,
&status);
#ifdef PROFILE
((ars_ctrl *)ctrl)->queries++;
#endif
if(!ARError( ret, status))
RETVAL = 1;
FreeARInternalIdList(&fieldList, FALSE);
}
#else /* 2.x */
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_DEPRECATED, "Not available in 2.x");
#endif
}
OUTPUT:
RETVAL
int
ars_DeleteImage(ctrl, name, updateRef=FALSE)
ARControlStruct * ctrl
char * name
ARBoolean updateRef
CODE:
{
char *objectModificationLogLabel = NULL;
ARStatusList status;
#if AR_CURRENT_API_VERSION >= 14
int ret = 0;
(void) ARError_reset();
Zero(&status, 1,ARStatusList);
RETVAL = 0;
if(ctrl && name && *name) {
ret = ARDeleteImage(ctrl, name,
updateRef,
#if AR_CURRENT_API_VERSION >= 17
objectModificationLogLabel,
#endif
&status);
if( !ARError( ret, status) ){
RETVAL = 1;
}
}else{
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_BAD_ARGS);
}
char buf[256];
serverInfo.numItems = (items - 1) / 2;
serverInfo.serverInfoList = MALLOCNN(serverInfo.numItems * sizeof(ARServerInfoStruct));
/* Zero(serverInfo.serverInfoList, 1, ARServerInfoStruct); # happens already in MALLOCNN */
for(j = 0 ; j < serverInfo.numItems ; ++j) {
i = 2 * j + 1;
infoType = lookUpServerInfoTypeHint(SvIV(ST(i)));
serverInfo.serverInfoList[j].operation = SvIV(ST(i));
serverInfo.serverInfoList[j].value.dataType = infoType;
switch(infoType) {
case AR_DATA_TYPE_CHAR:
serverInfo.serverInfoList[j].value.u.charVal = strdup(SvPV(ST(i+1), PL_na));
break;
case AR_DATA_TYPE_INTEGER:
serverInfo.serverInfoList[j].value.u.intVal = SvIV(ST(i+1));
break;
default:
sprintf( buf, "(%d) type = %d", serverInfo.serverInfoList[j].operation, serverInfo.serverInfoList[j].value.dataType );
(void) ARError_add(AR_RETURN_ERROR, AP_ERR_INV_ARGS,
buf);
FreeARServerInfoList(&serverInfo, FALSE);
XPUSHs(sv_2mortal(newSViv(0))); /* ERR */
goto SetServerInfo_fail;
}
}
ret = ARSetServerInfo(ctrl, &serverInfo, &status);
FreeARServerInfoList(&serverInfo, FALSE);
if(ARError(ret, status)) {
XPUSHs(sv_2mortal(newSViv(0))); /* ERR */
} else {
XPUSHs(sv_2mortal(newSViv(1))); /* OK */
}
}
SetServerInfo_fail:;
}
void
ars_GetServerInfo(ctrl, ...)
ARControlStruct * ctrl
PPCODE:
{
ARStatusList status;
ARServerInfoRequestList requestList;
ARServerInfoList serverInfo;
int ret = 0;
int i = 0;
unsigned int ui = 0, count = 0;
unsigned int rlist[AR_MAX_SERVER_INFO_USED];
(void) ARError_reset();
Zero(&status, 1,ARStatusList);
Zero(&requestList, 1, ARServerInfoRequestList);
Zero(&serverInfo, 1, ARServerInfoList);
count = 0;
if(items == 1) { /* none specified.. fetch all */
for(i = 0; i < AR_MAX_SERVER_INFO_USED ; i++) {
/* we'll exclude ones that can't be retrieved to avoid errors */
switch(i+1) {
case AR_SERVER_INFO_DB_PASSWORD:
#if AR_CURRENT_API_VERSION < 17
case 332:
case 331:
case 330:
case 329:
case 328:
case 327:
case 326:
case 325:
#endif
break;
default:
rlist[count++] = i+1;
}
}
}else if(items > AR_MAX_SERVER_INFO_USED + 1) {
ARError_add( AR_RETURN_ERROR, AP_ERR_BAD_ARGS);
}else { /* user has asked for specific ones */
for(i = 1 ; i < items ; i++) {
rlist[count++] = SvIV(ST(i));
}
}
if(count > 0) {
requestList.numItems = count;
requestList.requestList = rlist;
ret = ARGetServerInfo(ctrl, &requestList, &serverInfo, &status);
#ifdef PROFILE
((ars_ctrl *)ctrl)->queries++;
#endif
if(!ARError( ret, status)) {
for(ui = 0 ; ui < serverInfo.numItems ; ui++) {
/* provided we have a mapping for the operation code,
* push out it's translation. else push out the code itself
*/
if(serverInfo.serverInfoList[ui].operation <= AR_MAX_SERVER_INFO_USED) {
/* printf( "%d %s: data type = %d\n", serverInfo.serverInfoList[ui].operation, ServerInfoMap[serverInfo.serverInfoList[ui].operation].name, serverInfo.serverInfoList[ui].value.dataType ); */
XPUSHs(sv_2mortal(newSVpv(ServerInfoMap[serverInfo.serverInfoList[ui].operation].name, 0)));
} else {
XPUSHs(sv_2mortal(newSViv(serverInfo.serverInfoList[ui].operation)));
}
XPUSHs(sv_2mortal(perl_ARValueStruct(ctrl,
&(serverInfo.serverInfoList[ui].value))));
}
}
FreeARServerInfoList(&serverInfo, FALSE);
}
}
HV *
ars_GetVUI(ctrl, schema, vuiId)
ARControlStruct * ctrl
char * schema
ARInternalId vuiId
CODE:
{
#if AR_EXPORT_VERSION >= 3
ARStatusList status;
ARNameType vuiName;
sizeof(ARDiaryStruct)), 0);
FreeARDiaryList(&diaryList, FALSE);
}
}
hv_store(RETVAL, "timestamp", strlen("timestamp") , newSViv(timestamp), 0);
hv_store(RETVAL, "props", strlen("props") ,
perl_ARList( ctrl,
(ARList *)&dPropList,
(ARS_fn)perl_ARPropStruct,
sizeof(ARPropStruct)), 0);
hv_store(RETVAL, "objPropList", strlen("objPropList") ,
perl_ARList( ctrl,
(ARList *)&objPropList,
(ARS_fn)perl_ARPropStruct,
sizeof(ARPropStruct)), 0);
}
FreeARPropList(&dPropList, FALSE);
FreeARPropList(&objPropList, FALSE);
if(helpText) {
AP_FREE(helpText);
}
if(changeDiary) {
AP_FREE(changeDiary);
}
#else /* ars 2.x */
(void) ARError_reset();
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_DEPRECATED, "Not available in 2.x");
RETVAL = newHV();
#endif
}
OUTPUT:
RETVAL
int
ars_CreateCharMenu( ctrl, menuDefRef, removeFlag=TRUE )
ARControlStruct * ctrl
SV * menuDefRef
ARBoolean removeFlag;
CODE:
{
#if AR_EXPORT_VERSION >= 6L
ARNameType name;
int ret = 0, rv = 0;
unsigned int refreshCode;
char *refreshCodeStr = NULL;
char *menuTypeStr = NULL;
ARCharMenuStruct arMenuDef;
char *helpText = NULL;
ARAccessNameType owner;
char *changeDiary = NULL;
ARPropList objPropList;
char *objectModificationLogLabel = NULL;
ARStatusList status;
HV *menuDef = NULL;
SV **pSvTemp;
RETVAL = 0; /* assume error */
(void) ARError_reset();
Zero(&arMenuDef, 1,ARCharMenuStruct);
Zero(owner, 1,ARAccessNameType);
Zero(&objPropList, 1,ARPropList);
Zero(&status, 1,ARStatusList);
if( SvROK(menuDefRef) && SvTYPE(SvRV(menuDefRef)) == SVt_PVHV ){
menuDef = (HV*) SvRV(menuDefRef);
}else{
croak("usage: ars_CreateCharMenu(...)");
}
rv += strcpyHVal( menuDef, "name", name, AR_MAX_NAME_SIZE );
/* rv += uintcpyHVal( menuDef, "refreshCode", &type ); */
rv += strmakHVal( menuDef, "refreshCode", &refreshCodeStr );
refreshCode = revTypeName( (TypeMapStruct*)CharMenuRefreshCodeTypeMap, refreshCodeStr );
if( refreshCode == TYPEMAP_LAST ){
ARError_add(AR_RETURN_ERROR, AP_ERR_GENERAL,
"ars_CreateCharMenu: refreshCode key invalid. key follows:");
ARError_add(AR_RETURN_WARNING, AP_ERR_CONTINUE,
refreshCodeStr ? refreshCodeStr : "[key null]" );
}
if( refreshCodeStr != NULL ){ AP_FREE(refreshCodeStr); }
rv += strmakHVal( menuDef, "menuType", &menuTypeStr );
arMenuDef.menuType = revTypeName( (TypeMapStruct*)CharMenuTypeMap, menuTypeStr );
if( arMenuDef.menuType == TYPEMAP_LAST ){
ARError_add(AR_RETURN_ERROR, AP_ERR_GENERAL,
"ars_CreateCharMenu: menuType key invalid. key follows:");
ARError_add(AR_RETURN_WARNING, AP_ERR_CONTINUE,
menuTypeStr ? menuTypeStr : "[key null]" );
}
if( menuTypeStr != NULL ){ AP_FREE(menuTypeStr); }
switch( arMenuDef.menuType ){
case AR_CHAR_MENU_LIST:
pSvTemp = hv_fetch( menuDef, "menuList", strlen("menuList") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
rv += rev_ARCharMenuList( ctrl, menuDef, "menuList", &(arMenuDef.u.menuList) );
}
break;
case AR_CHAR_MENU_QUERY:
pSvTemp = hv_fetch( menuDef, "menuQuery", strlen("menuQuery") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
rv += rev_ARCharMenuQueryStruct( ctrl, menuDef, "menuQuery", &(arMenuDef.u.menuQuery) );
}
break;
case AR_CHAR_MENU_FILE:
pSvTemp = hv_fetch( menuDef, "menuFile", strlen("menuFile") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
rv += rev_ARCharMenuFileStruct( ctrl, menuDef, "menuFile", &(arMenuDef.u.menuFile) );
}
break;
case AR_CHAR_MENU_SQL:
pSvTemp = hv_fetch( menuDef, "menuSQL", strlen("menuSQL") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
rv += rev_ARCharMenuSQLStruct( ctrl, menuDef, "menuSQL", &(arMenuDef.u.menuSQL) );
}
break;
&objPropList,
#if AR_CURRENT_API_VERSION >= 17
objectModificationLogLabel,
#endif
&status );
RETVAL = ARError(ret,status) ? 0 : 1;
}else{
ARError_add( AR_RETURN_ERROR, AP_ERR_PREREVFAIL);
RETVAL = 0;
}
if( helpText != NULL ){
AP_FREE( helpText );
}
if( changeDiary != NULL ){
AP_FREE( changeDiary );
}
FreeARCharMenuStruct( &arMenuDef, FALSE );
FreeARPropList( &objPropList, FALSE );
#else /* < 5.0 */
XPUSHs(sv_2mortal(newSViv(0))); /* ERR */
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_DEPRECATED,
"ARSperl supports CreateCharMenu() only for ARSystem >= 5.0");
RETVAL = AR_RETURN_ERROR;
#endif
}
OUTPUT:
RETVAL
int
ars_SetCharMenu( ctrl, name, menuDefRef, removeFlag=TRUE )
ARControlStruct * ctrl
ARNameType name
SV * menuDefRef
ARBoolean removeFlag;
CODE:
{
#if AR_EXPORT_VERSION >= 6L
int ret = 0, rv = 0;
ARNameType newName;
char *newNamePtr = NULL;
unsigned int refreshCode;
unsigned int *refreshCodePtr = NULL;
char *refreshCodeStr = NULL;
char *menuTypeStr = NULL;
ARCharMenuStruct *arMenuDef = NULL;
char *helpText = NULL;
ARAccessNameType owner;
char *changeDiary = NULL;
ARPropList *objPropList = NULL;
char *objectModificationLogLabel = NULL;
ARStatusList status;
HV *menuDef = NULL;
SV **pSvTemp;
RETVAL = 0; /* assume error */
(void) ARError_reset();
Zero(owner, 1,ARAccessNameType);
Zero(&status, 1,ARStatusList);
if( SvROK(menuDefRef) && SvTYPE(SvRV(menuDefRef)) == SVt_PVHV ){
menuDef = (HV*) SvRV(menuDefRef);
}else{
croak("usage: ars_SetCharMenu(...)");
}
if( hv_exists(menuDef,"name",4) ){
rv += strcpyHVal( menuDef, "name", newName, AR_MAX_NAME_SIZE );
newNamePtr = newName;
}
if( hv_exists(menuDef,"refreshCode",4) ){
/* rv += uintcpyHVal( menuDef, "refreshCode", &refreshCode ); */
rv += strmakHVal( menuDef, "refreshCode", &refreshCodeStr );
refreshCode = revTypeName( (TypeMapStruct*)CharMenuRefreshCodeTypeMap, refreshCodeStr );
if( refreshCode == TYPEMAP_LAST ){
ARError_add(AR_RETURN_ERROR, AP_ERR_GENERAL,
"ars_CreateCharMenu: refreshCode key invalid. key follows:");
ARError_add(AR_RETURN_WARNING, AP_ERR_CONTINUE,
refreshCodeStr ? refreshCodeStr : "[key null]" );
}
if( refreshCodeStr != NULL ){ AP_FREE(refreshCodeStr); }
refreshCodePtr = &refreshCode;
}
if( hv_exists(menuDef,"menuType",4) ){
/* rv += uintcpyHVal( menuDef, "menuType", &menuType ); */
arMenuDef = (ARCharMenuStruct*) MALLOCNN( sizeof(ARCharMenuStruct) );
rv += strmakHVal( menuDef, "menuType", &menuTypeStr );
arMenuDef->menuType = revTypeName( (TypeMapStruct*)CharMenuTypeMap, menuTypeStr );
if( arMenuDef->menuType == TYPEMAP_LAST ){
ARError_add(AR_RETURN_ERROR, AP_ERR_GENERAL,
"ars_CreateCharMenu: menuType key invalid. key follows:");
ARError_add(AR_RETURN_WARNING, AP_ERR_CONTINUE,
menuTypeStr ? menuTypeStr : "[key null]" );
}
if( menuTypeStr != NULL ){ AP_FREE(menuTypeStr); }
switch( arMenuDef->menuType ){
case AR_CHAR_MENU_LIST:
pSvTemp = hv_fetch( menuDef, "menuList", strlen("menuList") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
rv += rev_ARCharMenuList( ctrl, menuDef, "menuList", &(arMenuDef->u.menuList) );
}
break;
case AR_CHAR_MENU_QUERY:
pSvTemp = hv_fetch( menuDef, "menuQuery", strlen("menuQuery") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
rv += rev_ARCharMenuQueryStruct( ctrl, menuDef, "menuQuery", &(arMenuDef->u.menuQuery) );
}
break;
case AR_CHAR_MENU_FILE:
pSvTemp = hv_fetch( menuDef, "menuFile", strlen("menuFile") , 0 );
}
if( helpText != NULL ){
AP_FREE( helpText );
}
if( changeDiary != NULL ){
AP_FREE( changeDiary );
}
if( arMenuDef != NULL ){
FreeARCharMenuStruct( arMenuDef, TRUE );
}
if( objPropList != NULL ){
FreeARPropList( objPropList, TRUE );
}
#else /* < 5.0 */
XPUSHs(sv_2mortal(newSViv(0))); /* ERR */
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_DEPRECATED,
"ARSperl supports SetCharMenu() only for ARSystem >= 5.0");
RETVAL = AR_RETURN_ERROR;
#endif
}
OUTPUT:
RETVAL
#define STR_TEMP_SIZE 30
int
ars_CreateField( ctrl, schema, fieldDefRef, reservedIdOK=0 )
ARControlStruct * ctrl
ARNameType schema
SV * fieldDefRef
ARBoolean reservedIdOK
CODE:
{
#if AR_EXPORT_VERSION >= 6L
int ret = 0, rv = 0;
ARInternalId fieldId;
ARNameType fieldName;
ARFieldMappingStruct fieldMap;
unsigned int dataType;
unsigned int option;
unsigned int createMode = AR_FIELD_PROTECTED_AT_CREATE;
#if AR_EXPORT_VERSION >= 9L
unsigned int fieldOption;
#endif
ARValueStruct *defaultVal = NULL;
ARPermissionList permissions;
ARFieldLimitStruct *limit = NULL;
ARDisplayInstanceList dInstanceList;
char *helpText = NULL;
ARAccessNameType owner;
char *changeDiary = NULL;
ARPropList *objPropList = NULL;
ARStatusList status;
HV *fieldDef = NULL;
SV **pSvTemp;
char strTemp[STR_TEMP_SIZE+1];
RETVAL = 0; /* assume error */
(void) ARError_reset();
Zero(owner, 1,ARAccessNameType);
Zero(fieldName, 1,ARNameType);
Zero(&status, 1,ARStatusList);
Zero(&fieldMap, 1,ARFieldMappingStruct);
Zero(&permissions, 1,ARPermissionList);
Zero(&dInstanceList, 1, ARDisplayInstanceList);
if( SvROK(fieldDefRef) && SvTYPE(SvRV(fieldDefRef)) == SVt_PVHV ){
fieldDef = (HV*) SvRV(fieldDefRef);
}else{
croak("usage: ars_CreateField(...)");
}
rv += ulongcpyHVal( fieldDef, "fieldId", &fieldId );
rv += strcpyHVal( fieldDef, "fieldName", fieldName, AR_MAX_NAME_SIZE );
fieldMap.fieldType = AR_FIELD_REGULAR;
rv += rev_ARFieldMappingStruct( ctrl, fieldDef, "fieldMap", &fieldMap );
rv += strcpyHVal( fieldDef, "dataType", strTemp, STR_TEMP_SIZE );
dataType = caseLookUpTypeNumber( (TypeMapStruct*) DataTypeMap, strTemp );
rv += uintcpyHVal( fieldDef, "option", &option );
rv += strcpyHVal( fieldDef, "createMode", strTemp, STR_TEMP_SIZE );
if( !strncmp(strTemp,"open",STR_TEMP_SIZE) ){
createMode = AR_FIELD_OPEN_AT_CREATE;
}else if( !strncmp(strTemp,"protected",STR_TEMP_SIZE) ){
createMode = AR_FIELD_PROTECTED_AT_CREATE;
}else{
ARError_add(AR_RETURN_WARNING, AP_ERR_GENERAL,
"ars_CreateField: invalid createmode:");
ARError_add(AR_RETURN_WARNING, AP_ERR_CONTINUE,
strTemp ? strTemp : "n/a");
}
#if AR_EXPORT_VERSION >= 9L
rv += uintcpyHVal( fieldDef, "fieldOption", &fieldOption );
#endif
pSvTemp = hv_fetch( fieldDef, "defaultVal", strlen("defaultVal") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
defaultVal = (ARValueStruct*) MALLOCNN( sizeof(ARValueStruct) );
rv += rev_ARValueStruct( ctrl, fieldDef, "defaultVal", "dataType", defaultVal );
}
permissions.numItems = 0;
permissions.permissionList = NULL;
rv += rev_ARPermissionList( ctrl, fieldDef, "permissions", &permissions );
pSvTemp = hv_fetch( fieldDef, "limit", strlen("limit") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
limit = (ARFieldLimitStruct*) MALLOCNN( sizeof(ARFieldLimitStruct) );
/* rv += rev_ARFieldLimitStruct( ctrl, fieldDef, "limit", "dataType", limit ); */
rv += rev_ARFieldLimitStruct( ctrl, fieldDef, "limit", limit );
}
#if AR_CURRENT_API_VERSION >= 17
pSvTemp = hv_fetch( fieldDef, "objPropList", strlen("objPropList") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
objPropList = (ARPropList*) MALLOCNN( sizeof(ARPropList) );
/* rv += rev_ARPropList( ctrl, fieldDef, "objPropList", "dataType", objPropList ); */
if( defaultVal != NULL ){
FreeARValueStruct( defaultVal, TRUE );
}
FreeARPermissionList( &permissions, FALSE );
if( limit != NULL ){
FreeARFieldLimitStruct( limit, TRUE );
}
FreeARDisplayInstanceList( &dInstanceList, FALSE );
/*
FreeARStatusList( &status, FALSE );
printf( "-- FreeARStatusList -- OK\n" ); // _DEBUG_
*/
#else /* < 5.0 */
XPUSHs(sv_2mortal(newSViv(0))); /* ERR */
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_DEPRECATED,
"ARSperl supports CreateField() only for ARSystem >= 5.0");
RETVAL = AR_RETURN_ERROR;
#endif
}
OUTPUT:
RETVAL
int
ars_SetField( ctrl, schema, fieldId, fieldDefRef )
ARControlStruct * ctrl
ARNameType schema
ARInternalId fieldId
SV * fieldDefRef
CODE:
{
#if AR_EXPORT_VERSION >= 6L
int ret = 0, rv = 0;
ARNameType fieldName;
char *fieldNamePtr = NULL;
ARFieldMappingStruct *fieldMap = NULL;
unsigned int *option = NULL;
unsigned int *createMode = NULL;
#if AR_EXPORT_VERSION >= 9L
unsigned int *fieldOption = NULL;
#endif
ARValueStruct *defaultVal = NULL;
ARPermissionList *permissions = NULL;
ARFieldLimitStruct *limit = NULL;
ARDisplayInstanceList *dInstanceList = NULL;
char *helpText = NULL;
ARAccessNameType owner;
char *ownerPtr = NULL;
#if AR_EXPORT_VERSION >= 9L
unsigned int setFieldOptions = 0;
#endif
char *changeDiary = NULL;
ARPropList *objPropList = NULL;
ARStatusList status;
HV *fieldDef = NULL;
SV **pSvTemp;
char strTemp[STR_TEMP_SIZE+1];
RETVAL = 0; /* assume error */
(void) ARError_reset();
Zero(fieldName, 1,ARNameType);
Zero(owner, 1,ARAccessNameType);
Zero(&status, 1,ARStatusList);
if( SvROK(fieldDefRef) && SvTYPE(SvRV(fieldDefRef)) == SVt_PVHV ){
fieldDef = (HV*) SvRV(fieldDefRef);
}else{
croak("usage: ars_SetField(...)");
}
/* rv += ulongcpyHVal( fieldDef, "fieldId", &fieldId ); */
pSvTemp = hv_fetch( fieldDef, "fieldName", strlen("fieldName") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
rv += strcpyHVal( fieldDef, "fieldName", fieldName, AR_MAX_NAME_SIZE );
fieldNamePtr = fieldName;
}
pSvTemp = hv_fetch( fieldDef, "fieldMap", strlen("fieldMap") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
fieldMap = (ARFieldMappingStruct*) MALLOCNN( sizeof(ARFieldMappingStruct) );
rv += rev_ARFieldMappingStruct( ctrl, fieldDef, "fieldMap", fieldMap );
}
pSvTemp = hv_fetch( fieldDef, "option", strlen("option") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
option = (unsigned int*) MALLOCNN( sizeof(unsigned int) );
rv += uintcpyHVal( fieldDef, "option", option );
}
pSvTemp = hv_fetch( fieldDef, "createMode", strlen("createMode") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
createMode = (unsigned int*) MALLOCNN( sizeof(unsigned int) );
rv += strcpyHVal( fieldDef, "createMode", strTemp, STR_TEMP_SIZE );
if( !strncmp(strTemp,"open",STR_TEMP_SIZE) ){
*createMode = AR_FIELD_OPEN_AT_CREATE;
}else if( !strncmp(strTemp,"protected",STR_TEMP_SIZE) ){
*createMode = AR_FIELD_PROTECTED_AT_CREATE;
}else{
ARError_add(AR_RETURN_WARNING, AP_ERR_GENERAL,
"ars_CreateField: invalid createmode:");
ARError_add(AR_RETURN_WARNING, AP_ERR_CONTINUE,
strTemp ? strTemp : "n/a");
}
}
#if AR_EXPORT_VERSION >= 9L
pSvTemp = hv_fetch( fieldDef, "fieldOption", strlen("fieldOption") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
fieldOption = (unsigned int*) MALLOCNN( sizeof(unsigned int) );
rv += uintcpyHVal( fieldDef, "fieldOption", fieldOption );
}
#endif
pSvTemp = hv_fetch( fieldDef, "defaultVal", strlen("defaultVal") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
defaultVal = (ARValueStruct*) MALLOCNN( sizeof(ARValueStruct) );
rv += rev_ARValueStruct( ctrl, fieldDef, "defaultVal", "dataType", defaultVal );
}
pSvTemp = hv_fetch( fieldDef, "permissions", strlen("permissions") , 0 );
FreeARValueStruct( defaultVal, TRUE );
}
if( permissions != NULL ){
FreeARPermissionList( permissions, TRUE );
}
if( limit != NULL ){
FreeARFieldLimitStruct( limit, TRUE );
}
if( dInstanceList != NULL ){
FreeARDisplayInstanceList( dInstanceList, TRUE );
}
/*
FreeARStatusList( &status, FALSE );
printf( "-- FreeARStatusList -- OK\n" ); // _DEBUG_
*/
#else /* < 5.0 */
XPUSHs(sv_2mortal(newSViv(0))); /* ERR */
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_DEPRECATED,
"ARSperl supports SetField() only for ARSystem >= 5.0");
RETVAL = AR_RETURN_ERROR;
#endif
}
OUTPUT:
RETVAL
int
ars_CreateSchema( ctrl, schemaDefRef )
ARControlStruct * ctrl
SV * schemaDefRef
CODE:
{
#if AR_EXPORT_VERSION >= 6L
int ret = 0, rv = 0;
ARNameType name;
ARCompoundSchema compoundSchema;
ARPermissionList groupList;
ARInternalIdList admingrpList;
AREntryListFieldList getListFields;
ARSortList sortList;
ARIndexList indexList;
#if AR_EXPORT_VERSION >= 8L
ARArchiveInfoStruct *archiveInfo = NULL;
#endif
#if AR_EXPORT_VERSION >= 9L
ARAuditInfoStruct *auditInfo = NULL;
#endif
ARNameType defaultVui;
char *helpText = NULL;
ARAccessNameType owner;
char *changeDiary = NULL;
ARPropList *objPropList = NULL;
char *objectModificationLogLabel = NULL;
ARStatusList status;
HV *schemaDef = NULL;
SV **pSvTemp;
/* char strTemp[STR_TEMP_SIZE+1]; */
RETVAL = 0; /* assume error */
(void) ARError_reset();
Zero(name, 1,ARNameType);
Zero(&compoundSchema, 1,ARCompoundSchema);
Zero(&groupList, 1,ARPermissionList);
Zero(&admingrpList, 1,ARInternalIdList);
Zero(&getListFields, 1,AREntryListFieldList);
Zero(&sortList, 1,ARSortList);
Zero(&indexList, 1,ARIndexList);
Zero(defaultVui, 1,ARNameType);
Zero(owner, 1,ARAccessNameType);
Zero(&status, 1,ARStatusList);
if( SvROK(schemaDefRef) && SvTYPE(SvRV(schemaDefRef)) == SVt_PVHV ){
schemaDef = (HV*) SvRV(schemaDefRef);
}else{
croak("usage: ars_CreateSchema(...)");
}
rv += strcpyHVal( schemaDef, "name", name, AR_MAX_NAME_SIZE );
compoundSchema.schemaType = AR_SCHEMA_REGULAR;
pSvTemp = hv_fetch( schemaDef, "schema", strlen("schema") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
rv += rev_ARCompoundSchema( ctrl, schemaDef, "schema", &compoundSchema );
}
groupList.numItems = 0;
groupList.permissionList = NULL;
pSvTemp = hv_fetch( schemaDef, "groupList", strlen("groupList") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
rv += rev_ARPermissionList( ctrl, schemaDef, "groupList", &groupList );
}
admingrpList.numItems = 0;
admingrpList.internalIdList = NULL;
pSvTemp = hv_fetch( schemaDef, "adminList", strlen("adminList") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
rv += rev_ARInternalIdList( ctrl, schemaDef, "adminList", &admingrpList );
}
getListFields.numItems = 0;
getListFields.fieldsList = NULL;
pSvTemp = hv_fetch( schemaDef, "getListFields", strlen("getListFields") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
rv += rev_AREntryListFieldList( ctrl, schemaDef, "getListFields", &getListFields );
}
sortList.numItems = 0;
sortList.sortList = NULL;
pSvTemp = hv_fetch( schemaDef, "sortList", strlen("sortList") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
rv += rev_ARSortList( ctrl, schemaDef, "sortList", &sortList );
}
indexList.numItems = 0;
indexList.indexList = NULL;
pSvTemp = hv_fetch( schemaDef, "indexList", strlen("indexList") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
rv += rev_ARIndexList( ctrl, schemaDef, "indexList", &indexList );
}
AP_FREE(sortList.sortList);
AP_FREE(indexList.indexList);
#if AR_EXPORT_VERSION >= 8L
if( archiveInfo != NULL ){
FreeARArchiveInfoStruct( archiveInfo, TRUE ); // TODO: we need our own free routine
}
#endif
if( objPropList != NULL ){
FreeARPropList( objPropList, TRUE ); // TODO: we need our own free routine
}
#else /* < 5.0 */
XPUSHs(sv_2mortal(newSViv(0))); /* ERR */
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_DEPRECATED,
"ARSperl supports CreateSchema() only for ARSystem >= 5.0");
RETVAL = AR_RETURN_ERROR;
#endif
}
OUTPUT:
RETVAL
int
ars_SetSchema( ctrl, name, schemaDefRef )
ARControlStruct * ctrl
ARNameType name
SV * schemaDefRef
CODE:
{
#if AR_EXPORT_VERSION >= 6L
int ret = 0, rv = 0;
ARNameType newName;
char *newNamePtr = NULL;
ARCompoundSchema *compoundSchema = NULL;
ARPermissionList *groupList = NULL;
ARInternalIdList *admingrpList = NULL;
AREntryListFieldList *getListFields = NULL;
ARSortList *sortList = NULL;
ARIndexList *indexList = NULL;
#if AR_EXPORT_VERSION >= 8L
ARArchiveInfoStruct *archiveInfo = NULL;
#endif
#if AR_EXPORT_VERSION >= 9L
ARAuditInfoStruct *auditInfo = NULL;
#endif
ARNameType defaultVui;
char *defaultVuiPtr = NULL;
char *helpText = NULL;
ARAccessNameType owner;
char *ownerPtr = NULL;
char *changeDiary = NULL;
ARPropList *objPropList = NULL;
char *objectModificationLogLabel = NULL;
ARStatusList status;
HV *schemaDef = NULL;
SV **pSvTemp;
/* char strTemp[STR_TEMP_SIZE+1]; */
RETVAL = 0; /* assume error */
(void) ARError_reset();
Zero(newName, 1,ARNameType);
Zero(defaultVui, 1,ARNameType);
Zero(owner, 1,ARAccessNameType);
Zero(&status, 1,ARStatusList);
if( SvROK(schemaDefRef) && SvTYPE(SvRV(schemaDefRef)) == SVt_PVHV ){
schemaDef = (HV*) SvRV(schemaDefRef);
}else{
croak("usage: ars_SetSchema(...)");
}
if( hv_exists(schemaDef,"name",4) ){
rv += strcpyHVal( schemaDef, "name", newName, AR_MAX_NAME_SIZE );
newNamePtr = newName;
}
pSvTemp = hv_fetch( schemaDef, "schema", strlen("schema") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
compoundSchema = (ARCompoundSchema*) MALLOCNN( sizeof(ARCompoundSchema) );
rv += rev_ARCompoundSchema( ctrl, schemaDef, "schema", compoundSchema );
}
pSvTemp = hv_fetch( schemaDef, "groupList", strlen("groupList") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
groupList = (ARPermissionList*) MALLOCNN( sizeof(ARPermissionList) );
rv += rev_ARPermissionList( ctrl, schemaDef, "groupList", groupList );
}
pSvTemp = hv_fetch( schemaDef, "adminList", strlen("adminList") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
admingrpList = (ARInternalIdList*) MALLOCNN( sizeof(ARInternalIdList) );
rv += rev_ARInternalIdList( ctrl, schemaDef, "adminList", admingrpList );
}
pSvTemp = hv_fetch( schemaDef, "getListFields", strlen("getListFields") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
getListFields = (AREntryListFieldList*) MALLOCNN( sizeof(AREntryListFieldList) );
rv += rev_AREntryListFieldList( ctrl, schemaDef, "getListFields", getListFields );
}
pSvTemp = hv_fetch( schemaDef, "sortList", strlen("sortList") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
sortList = (ARSortList*) MALLOCNN( sizeof(ARSortList) );
rv += rev_ARSortList( ctrl, schemaDef, "sortList", sortList );
}
pSvTemp = hv_fetch( schemaDef, "indexList", strlen("indexList") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
indexList = (ARIndexList*) MALLOCNN( sizeof(ARIndexList) );
rv += rev_ARIndexList( ctrl, schemaDef, "indexList", indexList );
}
#if AR_EXPORT_VERSION >= 8L
pSvTemp = hv_fetch( schemaDef, "archiveInfo", strlen("archiveInfo") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
archiveInfo = (ARArchiveInfoStruct*) MALLOCNN( sizeof(ARArchiveInfoStruct) );
rv += rev_ARArchiveInfoStruct( ctrl, schemaDef, "archiveInfo", archiveInfo );
}
#endif
FreeARCompoundSchema( compoundSchema, TRUE );
}
if( groupList != NULL ){
FreeARPermissionList( groupList, TRUE );
}
if( admingrpList != NULL ){
FreeARInternalIdList( admingrpList, TRUE );
}
if( getListFields != NULL ){
FreeAREntryListFieldList( getListFields, TRUE );
}
if( sortList != NULL ){
FreeARSortList( sortList, TRUE );
}
if( indexList != NULL ){
FreeARIndexList( indexList, TRUE );
}
#if AR_EXPORT_VERSION >= 8L
if( archiveInfo != NULL ){
FreeARArchiveInfoStruct( archiveInfo, TRUE );
}
#endif
if( objPropList != NULL ){
FreeARPropList( objPropList, TRUE );
}
#else /* < 5.0 */
XPUSHs(sv_2mortal(newSViv(0))); /* ERR */
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_DEPRECATED,
"ARSperl supports SetSchema() only for ARSystem >= 5.0");
RETVAL = AR_RETURN_ERROR;
#endif
}
OUTPUT:
RETVAL
int
ars_CreateVUI( ctrl, schemaName, vuiDefRef )
ARControlStruct * ctrl
ARNameType schemaName
SV * vuiDefRef
CODE:
{
#if AR_EXPORT_VERSION >= 6L
int ret = 0, rv = 0;
ARInternalId vuiId = 0;
ARNameType vuiName;
ARLocaleType locale;
unsigned int vuiType;
ARPropList dPropList;
char *helpText = NULL;
ARAccessNameType owner;
char *changeDiary = NULL;
ARPropList objPropList;
ARStatusList status;
HV *vuiDef = NULL;
SV **pSvTemp;
RETVAL = 0; /* assume error */
(void) ARError_reset();
Zero(vuiName, 1,ARNameType);
Zero(locale, 1,ARLocaleType);
Zero(&dPropList, 1,ARPropList);
Zero(&objPropList, 1,ARPropList);
Zero(owner, 1,ARAccessNameType);
Zero(&status, 1,ARStatusList);
if( SvROK(vuiDefRef) && SvTYPE(SvRV(vuiDefRef)) == SVt_PVHV ){
vuiDef = (HV*) SvRV(vuiDefRef);
}else{
croak("usage: ars_CreateVUI(...)");
}
rv += ulongcpyHVal( vuiDef, "vuiId", &vuiId );
rv += strcpyHVal( vuiDef, "vuiName", vuiName, AR_MAX_NAME_SIZE );
#if AR_CURRENT_API_VERSION >= 11
rv += strcpyHVal( vuiDef, "locale", locale, AR_MAX_LOCALE_SIZE );
#else
rv += strcpyHVal( vuiDef, "locale", locale, AR_MAX_LANG_SIZE );
#endif
rv += uintcpyHVal( vuiDef, "vuiType", &vuiType );
dPropList.numItems = 0;
dPropList.props = NULL;
pSvTemp = hv_fetch( vuiDef, "props", strlen("props") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
/* dPropList.props = (ARPropStruct*) MALLOCNN( sizeof(ARPropStruct) ); */
rv += rev_ARPropList( ctrl, vuiDef, "props", &dPropList );
}
#if AR_CURRENT_API_VERSION >= 17
objPropList.numItems = 0;
objPropList.props = NULL;
pSvTemp = hv_fetch( vuiDef, "objPropList", strlen("objPropList") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
/* objPropList.props = (ARPropStruct*) MALLOCNN( sizeof(ARPropStruct) ); */
rv += rev_ARPropList( ctrl, vuiDef, "objPropList", &objPropList );
}
#endif
if( hv_exists(vuiDef,"helpText",8) ){
rv += strmakHVal( vuiDef, "helpText", &helpText );
}
if( hv_exists(vuiDef,"owner",5) ){
rv += strcpyHVal( vuiDef, "owner", owner, AR_MAX_ACCESS_NAME_SIZE );
}
if( hv_exists(vuiDef,"changeDiary",11) ){
rv += strmakHVal( vuiDef, "changeDiary", &changeDiary );
}
if( rv == 0 ){
ret = ARCreateVUI( ctrl,
schemaName,
&vuiId,
vuiName,
locale,
vuiType,
&dPropList,
helpText,
owner,
changeDiary,
#if AR_CURRENT_API_VERSION >= 17
&objPropList,
#endif
&status );
RETVAL = ARError(ret,status) ? 0 : 1;
}else{
ARError_add( AR_RETURN_ERROR, AP_ERR_PREREVFAIL);
RETVAL = 0;
}
if( helpText != NULL ){
AP_FREE( helpText );
}
if( changeDiary != NULL ){
AP_FREE( changeDiary );
}
FreeARPropList( &dPropList, FALSE );
FreeARPropList( &objPropList, FALSE );
#else /* < 5.0 */
XPUSHs(sv_2mortal(newSViv(0))); /* ERR */
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_DEPRECATED,
"ARSperl supports CreateVUI() only for ARSystem >= 5.0");
RETVAL = AR_RETURN_ERROR;
#endif
}
OUTPUT:
RETVAL
int
ars_SetVUI( ctrl, schemaName, vuiId, vuiDefRef )
ARControlStruct * ctrl
ARNameType schemaName
ARInternalId vuiId
SV * vuiDefRef
CODE:
{
#if AR_EXPORT_VERSION >= 6L
int ret = 0, rv = 0;
ARNameType vuiName;
char *vuiNamePtr = NULL;
ARLocaleType locale;
char *localePtr = NULL;
unsigned int vuiType;
unsigned int *vuiTypePtr = NULL;
ARPropList *dPropList = NULL;
char *helpText = NULL;
ARAccessNameType owner;
char *ownerPtr = NULL;
char *changeDiary = NULL;
ARPropList *objPropList = NULL;
ARStatusList status;
HV *vuiDef = NULL;
SV **pSvTemp;
RETVAL = 0; /* assume error */
(void) ARError_reset();
Zero(vuiName, 1,ARNameType);
Zero(locale, 1,ARLocaleType);
Zero(owner, 1,ARAccessNameType);
Zero(&status, 1,ARStatusList);
if( SvROK(vuiDefRef) && SvTYPE(SvRV(vuiDefRef)) == SVt_PVHV ){
vuiDef = (HV*) SvRV(vuiDefRef);
}else{
croak("usage: ars_SetVUI(...)");
}
/* rv += ulongcpyHVal( vuiDef, "vuiId", &vuiId ); */
if( hv_exists(vuiDef,"vuiName",7) ){
rv += strcpyHVal( vuiDef, "vuiName", vuiName, AR_MAX_NAME_SIZE );
vuiNamePtr = vuiName;
}
if( hv_exists(vuiDef,"locale",6) ){
#if AR_CURRENT_API_VERSION >= 11
rv += strcpyHVal( vuiDef, "locale", locale, AR_MAX_LOCALE_SIZE );
#else
rv += strcpyHVal( vuiDef, "locale", locale, AR_MAX_LANG_SIZE );
#endif
localePtr = locale;
}
if( hv_exists(vuiDef,"vuiType",7) ){
rv += uintcpyHVal( vuiDef, "vuiType", &vuiType );
vuiTypePtr = &vuiType;
}
pSvTemp = hv_fetch( vuiDef, "props", strlen("props") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
dPropList = (ARPropList*) MALLOCNN( sizeof(ARPropList) );
rv += rev_ARPropList( ctrl, vuiDef, "props", dPropList );
}
#if AR_CURRENT_API_VERSION >= 17
pSvTemp = hv_fetch( vuiDef, "objPropList", strlen("objPropList") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
objPropList = (ARPropList*) MALLOCNN( sizeof(ARPropList) );
rv += rev_ARPropList( ctrl, vuiDef, "objPropList", objPropList );
}
#endif
if( hv_exists(vuiDef,"helpText",8) ){
rv += strmakHVal( vuiDef, "helpText", &helpText );
}
if( hv_exists(vuiDef,"owner",5) ){
rv += strcpyHVal( vuiDef, "owner", owner, AR_MAX_ACCESS_NAME_SIZE );
ownerPtr = owner;
}
if( hv_exists(vuiDef,"changeDiary",11) ){
rv += strmakHVal( vuiDef, "changeDiary", &changeDiary );
}
objPropList,
#endif
&status );
RETVAL = ARError(ret,status) ? 0 : 1;
}else{
ARError_add( AR_RETURN_ERROR, AP_ERR_PREREVFAIL);
RETVAL = 0;
}
if( helpText != NULL ){
AP_FREE( helpText );
}
if( changeDiary != NULL ){
AP_FREE( changeDiary );
}
FreeARPropList( dPropList, TRUE );
FreeARPropList( objPropList, TRUE );
#else /* < 5.0 */
XPUSHs(sv_2mortal(newSViv(0))); /* ERR */
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_DEPRECATED,
"ARSperl supports SetVUI() only for ARSystem >= 5.0");
RETVAL = AR_RETURN_ERROR;
#endif
}
OUTPUT:
RETVAL
int
ars_CreateContainer( ctrl, containerDefRef, removeFlag=TRUE )
ARControlStruct * ctrl
SV * containerDefRef
ARBoolean removeFlag;
CODE:
{
#if AR_EXPORT_VERSION >= 6L
int ret = 0, rv = 0;
ARNameType name;
ARPermissionList groupList;
ARInternalIdList admingrpList;
ARContainerOwnerObjList ownerObjList;
char *label = NULL;
char *description = NULL;
char *typeStr = NULL;
unsigned int type;
ARReferenceList references;
char *helpText = NULL;
ARAccessNameType owner;
char *changeDiary = NULL;
ARPropList objPropList;
char *objectModificationLogLabel = NULL;
ARStatusList status;
HV *containerDef = NULL;
SV **pSvTemp;
RETVAL = 0; /* assume error */
(void) ARError_reset();
Zero(name, 1,ARNameType);
Zero(&groupList, 1,ARPermissionList);
Zero(&admingrpList, 1,ARInternalIdList);
Zero(&ownerObjList, 1,ARContainerOwnerObjList);
Zero(&references, 1,ARReferenceList);
Zero(owner, 1,ARAccessNameType);
Zero(&objPropList, 1,ARPropList);
Zero(&status, 1,ARStatusList);
if( SvROK(containerDefRef) && SvTYPE(SvRV(containerDefRef)) == SVt_PVHV ){
containerDef = (HV*) SvRV(containerDefRef);
}else{
croak("usage: ars_CreateContainer(...)");
}
rv += strcpyHVal( containerDef, "name", name, AR_MAX_NAME_SIZE );
/* rv += uintcpyHVal( containerDef, "type", &type ); */
rv += strmakHVal( containerDef, "type", &typeStr );
type = revTypeName( (TypeMapStruct*)ContainerTypeMap, typeStr );
if( type == TYPEMAP_LAST ){
ARError_add(AR_RETURN_ERROR, AP_ERR_GENERAL,
"ars_CreateContainer: type key invalid. key follows:");
ARError_add(AR_RETURN_WARNING, AP_ERR_CONTINUE,
typeStr ? typeStr : "[key null]" );
}
if( typeStr != NULL ){ AP_FREE(typeStr); }
groupList.numItems = 0;
groupList.permissionList = NULL;
pSvTemp = hv_fetch( containerDef, "groupList", strlen("groupList") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
rv += rev_ARPermissionList( ctrl, containerDef, "groupList", &groupList );
}
admingrpList.numItems = 0;
admingrpList.internalIdList = NULL;
pSvTemp = hv_fetch( containerDef, "adminList", strlen("adminList") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
rv += rev_ARInternalIdList( ctrl, containerDef, "adminList", &admingrpList );
}
ownerObjList.numItems = 0;
ownerObjList.ownerObjList = NULL;
pSvTemp = hv_fetch( containerDef, "ownerObjList", strlen("ownerObjList") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
rv += rev_ARContainerOwnerObjList( ctrl, containerDef, "ownerObjList", &ownerObjList );
}
objPropList.numItems = 0;
objPropList.props = NULL;
pSvTemp = hv_fetch( containerDef, "objPropList", strlen("objPropList") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
rv += rev_ARPropList( ctrl, containerDef, "objPropList", &objPropList );
}
references.numItems = 0;
references.referenceList = NULL;
pSvTemp = hv_fetch( containerDef, "referenceList", strlen("referenceList") , 0 );
}
if( description != NULL ){
AP_FREE( description );
}
if( helpText != NULL ){
AP_FREE( helpText );
}
if( changeDiary != NULL ){
AP_FREE( changeDiary );
}
FreeARPermissionList( &groupList, FALSE );
FreeARInternalIdList( &admingrpList, FALSE );
FreeARContainerOwnerObjList( &ownerObjList, FALSE );
FreeARReferenceList( &references, FALSE );
FreeARPropList( &objPropList, FALSE );
#else /* < 5.0 */
XPUSHs(sv_2mortal(newSViv(0))); /* ERR */
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_DEPRECATED,
"ARSperl supports CreateContainer() only for ARSystem >= 5.0");
RETVAL = AR_RETURN_ERROR;
#endif
}
OUTPUT:
RETVAL
int
ars_SetContainer( ctrl, name, containerDefRef, removeFlag=TRUE )
ARControlStruct * ctrl
ARNameType name
SV * containerDefRef
ARBoolean removeFlag;
CODE:
{
#if AR_EXPORT_VERSION >= 6L
int ret = 0, rv = 0;
ARNameType newName;
char *newNamePtr = NULL;
ARPermissionList *groupList = NULL;
ARInternalIdList *admingrpList = NULL;
ARContainerOwnerObjList *ownerObjList = NULL;
char *label = NULL;
char *description = NULL;
char *typeStr = NULL;
unsigned int type;
unsigned int *typePtr = NULL;
ARReferenceList *references = NULL;
char *helpText = NULL;
ARAccessNameType owner;
char *changeDiary = NULL;
ARPropList *objPropList = NULL;
char *objectModificationLogLabel = NULL;
ARStatusList status;
HV *containerDef = NULL;
SV **pSvTemp;
RETVAL = 0; /* assume error */
(void) ARError_reset();
Zero(newName, 1,ARNameType);
Zero(owner, 1,ARAccessNameType);
Zero(&status, 1,ARStatusList);
if( SvROK(containerDefRef) && SvTYPE(SvRV(containerDefRef)) == SVt_PVHV ){
containerDef = (HV*) SvRV(containerDefRef);
}else{
croak("usage: ars_SetContainer(...)");
}
if( hv_exists(containerDef,"name",4) ){
rv += strcpyHVal( containerDef, "name", newName, AR_MAX_NAME_SIZE );
newNamePtr = newName;
}
if( hv_exists(containerDef,"type",4) ){
/* rv += uintcpyHVal( containerDef, "type", &type ); */
rv += strmakHVal( containerDef, "type", &typeStr );
type = revTypeName( (TypeMapStruct*)ContainerTypeMap, typeStr );
if( type == TYPEMAP_LAST ){
ARError_add(AR_RETURN_ERROR, AP_ERR_GENERAL,
"ars_CreateContainer: type key invalid. key follows:");
ARError_add(AR_RETURN_WARNING, AP_ERR_CONTINUE,
typeStr ? typeStr : "[key null]" );
}
if( typeStr != NULL ){ AP_FREE(typeStr); }
typePtr = &type;
}
pSvTemp = hv_fetch( containerDef, "groupList", strlen("groupList") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
groupList = (ARPermissionList*) MALLOCNN( sizeof(ARPermissionList) );
rv += rev_ARPermissionList( ctrl, containerDef, "groupList", groupList );
}
pSvTemp = hv_fetch( containerDef, "adminList", strlen("adminList") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
admingrpList = (ARInternalIdList*) MALLOCNN( sizeof(ARInternalIdList) );
rv += rev_ARInternalIdList( ctrl, containerDef, "adminList", admingrpList );
}
pSvTemp = hv_fetch( containerDef, "ownerObjList", strlen("ownerObjList") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
ownerObjList = (ARContainerOwnerObjList*) MALLOCNN( sizeof(ARContainerOwnerObjList) );
rv += rev_ARContainerOwnerObjList( ctrl, containerDef, "ownerObjList", ownerObjList );
}
pSvTemp = hv_fetch( containerDef, "objPropList", strlen("objPropList") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
objPropList = (ARPropList*) MALLOCNN( sizeof(ARPropList) );
rv += rev_ARPropList( ctrl, containerDef, "objPropList", objPropList );
}
pSvTemp = hv_fetch( containerDef, "referenceList", strlen("referenceList") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
references = (ARReferenceList*) MALLOCNN( sizeof(ARReferenceList) );
rv += rev_ARReferenceList( ctrl, containerDef, "referenceList", references );
FreeARPermissionList( groupList, TRUE );
}
if( admingrpList != NULL ){
FreeARInternalIdList( admingrpList, TRUE );
}
if( ownerObjList != NULL ){
FreeARContainerOwnerObjList( ownerObjList, TRUE );
}
if( references != NULL ){
FreeARReferenceList( references, TRUE );
}
if( objPropList != NULL ){
FreeARPropList( objPropList, TRUE );
}
#else /* < 5.0 */
XPUSHs(sv_2mortal(newSViv(0))); /* ERR */
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_DEPRECATED,
"ARSperl supports SetContainer() only for ARSystem >= 5.0");
RETVAL = AR_RETURN_ERROR;
#endif
}
OUTPUT:
RETVAL
int
ars_CreateActiveLink(ctrl, alDefRef)
ARControlStruct * ctrl
SV * alDefRef
CODE:
{
int ret = 0, rv = 0;
ARNameType schema, name;
ARInternalIdList groupList;
unsigned int executeMask, order;
#if AR_EXPORT_VERSION >= 3
ARInternalId controlField = 0;
ARInternalId focusField = 0;
#else /* 2.x */
ARInternalId field = 0;
ARDisplayList displayList;
#endif
unsigned int enable = 0;
ARQualifierStruct *query;
ARActiveLinkActionList actionList;
#if AR_EXPORT_VERSION >= 3
ARActiveLinkActionList elseList;
#endif
char *helpText = CPNULL;
ARAccessNameType owner;
char *changeDiary = CPNULL;
char *objectModificationLogLabel = NULL;
ARStatusList status;
#if AR_EXPORT_VERSION >= 5
ARNameList schemaNameList;
ARWorkflowConnectStruct schemaList;
ARPropList objPropList;
#endif
RETVAL = 0; /* assume error */
(void) ARError_reset();
Zero(&status, 1,ARStatusList);
Zero(schema, 1, ARNameType);
Zero(name, 1, ARNameType);
Zero(&groupList, 1,ARInternalIdList);
Zero(&actionList, 1,ARActiveLinkActionList);
Zero(owner, 1, ARAccessNameType);
#if AR_EXPORT_VERSION >= 3
Zero(&elseList, 1,ARActiveLinkActionList);
#else
Zero(&displayList, 1,ARDisplayList);
#endif
#if AR_EXPORT_VERSION >= 5
Zero(&objPropList, 1, ARPropList);
Zero(&schemaList, 1, ARWorkflowConnectStruct);
Zero(&schemaNameList, 1, ARNameList);
schemaList.type = AR_WORKFLOW_CONN_SCHEMA_LIST;
schemaList.u.schemaList = &schemaNameList;
#endif
if(SvTYPE((SV *)SvRV(alDefRef)) != SVt_PVHV) {
ARError_add( AR_RETURN_ERROR, AP_ERR_EXPECT_PVHV);
} else {
HV *alDef = (HV *)SvRV(alDefRef);
SV **qhv = hv_fetch(alDef, "query", strlen("query") , 0);
/* dereference the qual pointer */
if(qhv && *qhv && SvROK(*qhv)) {
query = (ARQualifierStruct *)SvIV((SV *)SvRV(*qhv));
/* query = (ARQualifierStruct*) MALLOCNN( sizeof(ARQualifierStruct) );
rv += rev_ARQualifierStruct( ctrl, alDef, "query", query ); */
} else {
query = (ARQualifierStruct *)NULL;
}
/* copy the various hash entries into the appropriate
* data structure. if any are missing, we fail.
*/
rv = 0;
rv += strcpyHVal( alDef, "name", name, AR_MAX_NAME_SIZE);
#if AR_EXPORT_VERSION >= 5
rv += rev_ARNameList( ctrl, alDef, "schemaList", schemaList.u.schemaList );
#else
rv += strcpyHVal( alDef, "schema", schema, AR_MAX_NAME_SIZE);
#endif
rv += uintcpyHVal( alDef, "order", &order);
rv += rev_ARInternalIdList(ctrl, alDef, "groupList", &groupList);
rv += uintcpyHVal( alDef, "executeMask", &executeMask);
rv += uintcpyHVal( alDef, "enable", &enable);
if(hv_exists(alDef, "owner", strlen("owner") ))
rv += strcpyHVal( alDef, "owner", owner, AR_MAX_ACCESS_NAME_SIZE);
else
strncpy(owner, ctrl->user, sizeof(ARAccessNameType));
/* these two are optional, so if the calls return warnings
* it probably indicates that the hash keys don't exist and
* we'll ignore it unless an actual failure code is returned.
*/
if(hv_exists(alDef, "changeDiary", strlen("changeDiary") ))
rv += strmakHVal( alDef, "changeDiary", &changeDiary);
if(hv_exists(alDef, "helpText", strlen("helpText") ))
rv += strmakHVal( alDef, "helpText", &helpText);
/* now handle the action & else (3.x) lists */
rv += rev_ARActiveLinkActionList(ctrl, alDef, "actionList",
&actionList);
#if AR_EXPORT_VERSION >= 3
rv += rev_ARActiveLinkActionList(ctrl, alDef, "elseList",
&elseList);
if((executeMask & AR_EXECUTE_ON_RETURN)
|| (executeMask & AR_EXECUTE_ON_MENU_CHOICE)
#if AR_EXPORT_VERSION >= 4
|| (executeMask & AR_EXECUTE_ON_GAIN_FOCUS)
|| (executeMask & AR_EXECUTE_ON_LOSE_FOCUS)
#endif
)
rv += ulongcpyHVal( alDef, "focusField",
&focusField);
if(executeMask & AR_EXECUTE_ON_BUTTON)
rv += ulongcpyHVal( alDef, "controlField",
&controlField);
#else /* 2.x */
if((executeMask & AR_EXECUTE_ON_RETURN) ||
(executeMask & AR_EXECUTE_ON_MENU_CHOICE))
rv += ulongcpyHVal( alDef, "field", &field);
if(executeMask & AR_EXECUTE_ON_BUTTON)
rv += rev_ARDisplayList(ctrl, alDef, "displayList",
&displayList);
#endif
#if AR_EXPORT_VERSION >= 5
if(hv_exists(alDef, "objPropList", strlen("objPropList") ))
rv += rev_ARPropList(ctrl, alDef, "objPropList",
&objPropList);
#endif
/* at this point all datastructures (hopefully) are
* built. we can call the api routine to create the
* active link.
*/
if(rv == 0) {
#if AR_EXPORT_VERSION >= 5
ret = ARCreateActiveLink(ctrl, name, order, &schemaList,
&groupList, executeMask,
&controlField, &focusField,
enable, query,
&actionList, &elseList,
helpText, owner, changeDiary,
&objPropList,
#if AR_CURRENT_API_VERSION >= 14
0, /* errorActlinkOptions, reserved for future use */
NULL, /* errorActlinkName, reserved for future use */
#endif
#if AR_CURRENT_API_VERSION >= 17
objectModificationLogLabel,
#endif
&status);
#elif AR_EXPORT_VERSION >= 3
ret = ARCreateActiveLink(ctrl, name, order, schema,
&groupList, executeMask,
&controlField, &focusField,
enable, query,
&actionList, &elseList,
helpText, owner, changeDiary,
&status);
#else /* 2.x */
#endif
if(!ARError( ret, status))
RETVAL = 1;
} else
ARError_add( AR_RETURN_ERROR, AP_ERR_PREREVFAIL);
}
if (helpText) {
AP_FREE(helpText);
}
if (changeDiary) {
AP_FREE(changeDiary);
}
FreeARInternalIdList(&groupList, FALSE);
FreeARActiveLinkActionList(&actionList, FALSE);
#if AR_EXPORT_VERSION >= 3
FreeARActiveLinkActionList(&elseList, FALSE);
#else /* 2.x */
FreeARDisplayList(&displayList, FALSE);
#endif
#if AR_EXPORT_VERSION >= 5
FreeARPropList(&objPropList, FALSE);
FreeARNameList(&schemaNameList, FALSE);
#endif
}
OUTPUT:
RETVAL
int
ars_SetActiveLink(ctrl, name, objDefRef)
ARControlStruct * ctrl
ARNameType name
SV * objDefRef
CODE:
{
#if AR_EXPORT_VERSION >= 5
int ret = 0, rv = 0;
ARNameType newName;
char *newNamePtr = NULL;
ARInternalIdList *groupList = NULL;
unsigned int *executeMask = NULL;
unsigned int *order = NULL;
ARInternalId *controlField = NULL;
ARInternalId *focusField = NULL;
unsigned int *enable = NULL;
ARQualifierStruct *query = NULL;
ARActiveLinkActionList *actionList = NULL;
ARActiveLinkActionList *elseList = NULL;
char *helpText = CPNULL;
ARAccessNameType owner;
char *ownerPtr = NULL;
char *changeDiary = CPNULL;
char *objectModificationLogLabel = NULL;
ARStatusList status;
ARWorkflowConnectStruct *schemaList = NULL;
ARPropList *objPropList = NULL;
RETVAL = 0; /* assume error */
(void) ARError_reset();
Zero(&status, 1,ARStatusList);
Zero(newName, 1, ARNameType);
Zero(owner, 1, ARAccessNameType);
if(SvTYPE((SV *)SvRV(objDefRef)) != SVt_PVHV) {
ARError_add( AR_RETURN_ERROR, AP_ERR_EXPECT_PVHV);
} else {
HV *objDef = (HV *)SvRV(objDefRef);
SV **qhv = hv_fetch(objDef, "query", strlen("query") , 0);
/* dereference the qual pointer */
if( qhv && *qhv && SvROK(*qhv) ){
query = (ARQualifierStruct *)SvIV((SV *)SvRV(*qhv));
/* query = (ARQualifierStruct*) MALLOCNN( sizeof(ARQualifierStruct) );
rv += rev_ARQualifierStruct( ctrl, objDef, "query", query ); */
}
/* copy the various hash entries into the appropriate
* data structure. if any are missing, we fail.
*/
rv = 0;
if( hv_exists(objDef,"name",4) ){
rv += strcpyHVal( objDef, "name", newName, AR_MAX_NAME_SIZE );
newNamePtr = newName;
}
if( hv_exists(objDef,"schemaList",10) ){
schemaList = (ARWorkflowConnectStruct*) MALLOCNN(sizeof(ARWorkflowConnectStruct));
schemaList->type = AR_WORKFLOW_CONN_SCHEMA_LIST;
schemaList->u.schemaList = (ARNameList*) MALLOCNN( sizeof(ARNameList) );
rv += rev_ARNameList( ctrl, objDef, "schemaList", schemaList->u.schemaList );
}
if( hv_exists(objDef,"order",5) ){
order = (unsigned int*) MALLOCNN(sizeof(unsigned int));
rv += uintcpyHVal( objDef, "order", order );
}
if( hv_exists(objDef,"groupList",9) ){
groupList = (ARInternalIdList*) MALLOCNN(sizeof(ARInternalIdList));
rv += rev_ARInternalIdList(ctrl, objDef, "groupList", groupList);
}
if( hv_exists(objDef,"executeMask",11) ){
executeMask = (unsigned int*) MALLOCNN(sizeof(unsigned int));
rv += uintcpyHVal( objDef, "executeMask", executeMask);
}
if( hv_exists(objDef,"enable",6) ){
enable = (unsigned int*) MALLOCNN(sizeof(unsigned int));
rv += uintcpyHVal( objDef, "enable", enable);
}
if(hv_exists(objDef, "owner", strlen("owner") )){
rv += strcpyHVal( objDef, "owner", owner, AR_MAX_ACCESS_NAME_SIZE);
ownerPtr = owner;
}
/* these two are optional, so if the calls return warnings
* it probably indicates that the hash keys don't exist and
* we'll ignore it unless an actual failure code is returned.
*/
if(hv_exists(objDef, "changeDiary", strlen("changeDiary") ))
rv += strmakHVal( objDef, "changeDiary", &changeDiary);
if(hv_exists(objDef, "helpText", strlen("helpText") ))
rv += strmakHVal( objDef, "helpText", &helpText);
/* now handle the action & else (3.x) lists */
if(hv_exists(objDef, "actionList", strlen("actionList") )){
actionList = (ARActiveLinkActionList*) MALLOCNN(sizeof(ARActiveLinkActionList));
rv += rev_ARActiveLinkActionList(ctrl, objDef, "actionList", actionList);
}
if(hv_exists(objDef, "elseList", strlen("elseList") )){
elseList = (ARActiveLinkActionList*) MALLOCNN(sizeof(ARActiveLinkActionList));
rv += rev_ARActiveLinkActionList(ctrl, objDef, "elseList", elseList);
}
if(hv_exists(objDef, "objPropList", strlen("objPropList") )){
objPropList = (ARPropList*) MALLOCNN(sizeof(ARPropList));
rv += rev_ARPropList(ctrl, objDef, "objPropList", objPropList);
}
if( executeMask != NULL ){
if((*executeMask & AR_EXECUTE_ON_RETURN) ||
(*executeMask & AR_EXECUTE_ON_MENU_CHOICE)) {
focusField = (ARInternalId*) MALLOCNN(sizeof(ARInternalId));
rv += ulongcpyHVal( objDef, "focusField", focusField);
}
if(*executeMask & AR_EXECUTE_ON_BUTTON) {
controlField = (ARInternalId*) MALLOCNN(sizeof(ARInternalId));
rv += ulongcpyHVal( objDef, "controlField", controlField);
}
}
/* at this point all datastructures (hopefully) are
* built. we can call the api routine to modify the workflow object
*/
if(rv == 0) {
ret = ARSetActiveLink(ctrl, name, newNamePtr, order, schemaList,
groupList, executeMask,
controlField, focusField,
enable, query,
actionList, elseList,
helpText, ownerPtr, changeDiary,
objPropList,
#if AR_CURRENT_API_VERSION >= 14
NULL, /* errorActlinkOptions, reserved for future use */
NULL, /* errorActlinkName, reserved for future use */
#endif
#if AR_CURRENT_API_VERSION >= 17
objectModificationLogLabel,
#endif
&status);
if(!ARError( ret, status))
RETVAL = 1;
} else
ARError_add( AR_RETURN_ERROR, AP_ERR_PREREVFAIL);
}
if (helpText) {
AP_FREE(helpText);
}
if (changeDiary) {
AP_FREE(changeDiary);
}
if( order != NULL ) { AP_FREE(order); }
if( executeMask != NULL ) { AP_FREE(executeMask); }
if( enable != NULL ) { AP_FREE(enable); }
if( focusField != NULL ) { AP_FREE(focusField); }
if( controlField != NULL ) { AP_FREE(controlField); }
/* if( query != NULL ) { FreeARARQualifierStruct( query, TRUE ); } */
if( schemaList != NULL ) { FreeARWorkflowConnectStruct( schemaList, TRUE ); }
if( groupList != NULL ) { FreeARInternalIdList( groupList, TRUE ); }
if( actionList != NULL ) { FreeARActiveLinkActionList( actionList, TRUE ); }
if( elseList != NULL ) { FreeARActiveLinkActionList( elseList, TRUE ); }
if( objPropList != NULL ) { FreeARPropList( objPropList, TRUE ); }
#else /* < 5.0 */
XPUSHs(sv_2mortal(newSViv(0))); /* ERR */
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_DEPRECATED,
"ARSperl supports CreateContainer() only for ARSystem >= 5.0");
RETVAL = AR_RETURN_ERROR;
#endif
}
OUTPUT:
RETVAL
int
ars_CreateFilter(ctrl, objDefRef)
ARControlStruct * ctrl
SV * objDefRef
CODE:
{
#if AR_EXPORT_VERSION >= 5
int ret = 0, rv = 0;
ARNameType schema, name;
unsigned int opSet, order;
unsigned int enable = 0;
ARQualifierStruct *query;
ARFilterActionList actionList;
ARFilterActionList elseList;
char *helpText = CPNULL;
ARAccessNameType owner;
char *changeDiary = CPNULL;
char *objectModificationLogLabel = NULL;
ARStatusList status;
ARNameList schemaNameList;
ARWorkflowConnectStruct schemaList;
ARPropList objPropList;
#if AR_CURRENT_API_VERSION >= 13
unsigned int errorFilterOptions = 0;
ARNameType errorFilterName;
#endif
RETVAL = 0; /* assume error */
(void) ARError_reset();
Zero(&status, 1,ARStatusList);
Zero(schema, 1, ARNameType);
Zero(name, 1, ARNameType);
Zero(&actionList, 1,ARFilterActionList);
Zero(&elseList, 1,ARFilterActionList);
Zero(owner, 1, ARAccessNameType);
Zero(&objPropList, 1, ARPropList);
Zero(&schemaList, 1, ARWorkflowConnectStruct);
Zero(&schemaNameList, 1, ARNameList);
#if AR_CURRENT_API_VERSION >= 13
Zero(errorFilterName, 1, ARNameType);
#endif
schemaList.type = AR_WORKFLOW_CONN_SCHEMA_LIST;
schemaList.u.schemaList = &schemaNameList;
if(SvTYPE((SV *)SvRV(objDefRef)) != SVt_PVHV) {
ARError_add( AR_RETURN_ERROR, AP_ERR_EXPECT_PVHV);
} else {
HV *objDef = (HV *)SvRV(objDefRef);
SV **qhv = hv_fetch(objDef, "query", strlen("query") , 0);
/* dereference the qual pointer */
if(qhv && *qhv && SvROK(*qhv)) {
query = (ARQualifierStruct *)SvIV((SV *)SvRV(*qhv));
/* query = (ARQualifierStruct*) MALLOCNN( sizeof(ARQualifierStruct) );
rv += rev_ARQualifierStruct( ctrl, objDef, "query", query ); */
} else {
query = (ARQualifierStruct *)NULL;
}
/* copy the various hash entries into the appropriate
* data structure. if any are missing, we fail.
*/
rv = 0;
rv += strcpyHVal( objDef, "name", name, AR_MAX_NAME_SIZE);
rv += rev_ARNameList( ctrl, objDef, "schemaList", schemaList.u.schemaList );
rv += uintcpyHVal( objDef, "order", &order);
rv += uintcpyHVal( objDef, "opSet", &opSet);
rv += uintcpyHVal( objDef, "enable", &enable);
if(hv_exists(objDef, "owner", strlen("owner") ))
rv += strcpyHVal( objDef, "owner", owner, AR_MAX_ACCESS_NAME_SIZE);
else
strncpy(owner, ctrl->user, sizeof(ARAccessNameType));
/* these two are optional, so if the calls return warnings
* it probably indicates that the hash keys don't exist and
* we'll ignore it unless an actual failure code is returned.
*/
if(hv_exists(objDef, "changeDiary", strlen("changeDiary") ))
rv += strmakHVal( objDef, "changeDiary", &changeDiary);
if(hv_exists(objDef, "helpText", strlen("helpText") ))
rv += strmakHVal( objDef, "helpText", &helpText);
/* now handle the action & else (3.x) lists */
rv += rev_ARFilterActionList(ctrl, objDef, "actionList",
&actionList);
rv += rev_ARFilterActionList(ctrl, objDef, "elseList",
&elseList);
if(hv_exists(objDef, "objPropList", strlen("objPropList") ))
rv += rev_ARPropList(ctrl, objDef, "objPropList",
&objPropList);
#if AR_CURRENT_API_VERSION >= 13
if( hv_exists(objDef, "errorFilterOptions", strlen("errorFilterOptions")) )
rv += uintcpyHVal( objDef, "errorFilterOptions", &errorFilterOptions );
if( hv_exists(objDef, "errorFilterName", strlen("errorFilterName")) )
rv += strcpyHVal( objDef, "errorFilterName", errorFilterName, AR_MAX_NAME_SIZE );
#endif
/* at this point all datastructures (hopefully) are
* built. we can call the api routine to create the
* filter.
*/
if(rv == 0) {
ret = ARCreateFilter(ctrl, name, order, &schemaList,
opSet,
enable, query,
&actionList, &elseList,
helpText, owner, changeDiary,
&objPropList,
#if AR_CURRENT_API_VERSION >= 13
errorFilterOptions,
errorFilterName,
#endif
#if AR_CURRENT_API_VERSION >= 17
objectModificationLogLabel,
#endif
&status);
if(!ARError( ret, status))
RETVAL = 1;
} else
ARError_add( AR_RETURN_ERROR, AP_ERR_PREREVFAIL);
}
if (helpText) {
AP_FREE(helpText);
}
if (changeDiary) {
AP_FREE(changeDiary);
}
FreeARFilterActionList(&actionList, FALSE);
FreeARFilterActionList(&elseList, FALSE);
FreeARPropList(&objPropList, FALSE);
FreeARNameList(&schemaNameList, FALSE);
#else /* < 5.0 */
XPUSHs(sv_2mortal(newSViv(0))); /* ERR */
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_DEPRECATED,
"ARSperl supports CreateContainer() only for ARSystem >= 5.0");
RETVAL = AR_RETURN_ERROR;
#endif
}
OUTPUT:
RETVAL
int
ars_SetFilter(ctrl, name, objDefRef)
ARControlStruct * ctrl
ARNameType name
SV * objDefRef
CODE:
{
#if AR_EXPORT_VERSION >= 5
int ret = 0, rv = 0;
ARNameType newName;
char *newNamePtr = NULL;
unsigned int *opSet = NULL;
unsigned int *order = NULL;
unsigned int *enable = NULL;
ARQualifierStruct *query = NULL;
ARFilterActionList *actionList = NULL;
ARFilterActionList *elseList = NULL;
char *helpText = CPNULL;
ARAccessNameType owner;
char *ownerPtr = NULL;
char *changeDiary = CPNULL;
char *objectModificationLogLabel = NULL;
ARStatusList status;
ARWorkflowConnectStruct *schemaList = NULL;
ARPropList *objPropList = NULL;
#if AR_CURRENT_API_VERSION >= 13
unsigned int *errorFilterOptions = NULL;
ARNameType errorFilterName;
char *errorFilterNamePtr = NULL;
#endif
RETVAL = 0; /* assume error */
(void) ARError_reset();
Zero(&status, 1,ARStatusList);
Zero(newName, 1, ARNameType);
Zero(owner, 1, ARAccessNameType);
#if AR_CURRENT_API_VERSION >= 13
Zero(errorFilterName, 1, ARNameType);
#endif
if(SvTYPE((SV *)SvRV(objDefRef)) != SVt_PVHV) {
ARError_add( AR_RETURN_ERROR, AP_ERR_EXPECT_PVHV);
} else {
HV *objDef = (HV *)SvRV(objDefRef);
SV **qhv = hv_fetch(objDef, "query", strlen("query") , 0);
/* dereference the qual pointer */
if( qhv && *qhv && SvROK(*qhv) ){
query = (ARQualifierStruct *)SvIV((SV *)SvRV(*qhv));
/* query = (ARQualifierStruct*) MALLOCNN( sizeof(ARQualifierStruct) );
rv += rev_ARQualifierStruct( ctrl, objDef, "query", query ); */
}
/* copy the various hash entries into the appropriate
* data structure. if any are missing, we fail.
*/
rv = 0;
if( hv_exists(objDef,"name",4) ){
rv += strcpyHVal( objDef, "name", newName, AR_MAX_NAME_SIZE );
newNamePtr = newName;
}
if( hv_exists(objDef,"schemaList",10) ){
schemaList = (ARWorkflowConnectStruct*) MALLOCNN(sizeof(ARWorkflowConnectStruct));
schemaList->type = AR_WORKFLOW_CONN_SCHEMA_LIST;
schemaList->u.schemaList = (ARNameList*) MALLOCNN( sizeof(ARNameList) );
rv += rev_ARNameList( ctrl, objDef, "schemaList", schemaList->u.schemaList );
}
if( hv_exists(objDef,"order",5) ){
order = (unsigned int*) MALLOCNN(sizeof(unsigned int));
rv += uintcpyHVal( objDef, "order", order );
}
if( hv_exists(objDef,"opSet",5) ){
opSet = (unsigned int*) MALLOCNN(sizeof(unsigned int));
rv += uintcpyHVal( objDef, "opSet", opSet);
}
if( hv_exists(objDef,"enable",6) ){
enable = (unsigned int*) MALLOCNN(sizeof(unsigned int));
rv += uintcpyHVal( objDef, "enable", enable);
}
if(hv_exists(objDef, "owner", strlen("owner") )){
rv += strcpyHVal( objDef, "owner", owner, AR_MAX_ACCESS_NAME_SIZE);
ownerPtr = owner;
}
/* these two are optional, so if the calls return warnings
* it probably indicates that the hash keys don't exist and
* we'll ignore it unless an actual failure code is returned.
*/
if(hv_exists(objDef, "changeDiary", strlen("changeDiary") ))
rv += strmakHVal( objDef, "changeDiary", &changeDiary);
if(hv_exists(objDef, "helpText", strlen("helpText") ))
rv += strmakHVal( objDef, "helpText", &helpText);
/* now handle the action & else (3.x) lists */
if(hv_exists(objDef, "actionList", strlen("actionList") )){
actionList = (ARFilterActionList*) MALLOCNN(sizeof(ARFilterActionList));
rv += rev_ARFilterActionList(ctrl, objDef, "actionList", actionList);
}
if(hv_exists(objDef, "elseList", strlen("elseList") )){
elseList = (ARFilterActionList*) MALLOCNN(sizeof(ARFilterActionList));
rv += rev_ARFilterActionList(ctrl, objDef, "elseList", elseList);
}
if(hv_exists(objDef, "objPropList", strlen("objPropList") )){
objPropList = (ARPropList*) MALLOCNN(sizeof(ARPropList));
rv += rev_ARPropList(ctrl, objDef, "objPropList", objPropList);
}
#if AR_CURRENT_API_VERSION >= 13
if( hv_exists(objDef,"errorFilterOptions",18) ){
errorFilterOptions = (unsigned int*) MALLOCNN(sizeof(unsigned int));
rv += uintcpyHVal( objDef, "errorFilterOptions", errorFilterOptions);
}
if(hv_exists(objDef, "errorFilterName", strlen("errorFilterName") )){
rv += strcpyHVal( objDef, "errorFilterName", errorFilterName, AR_MAX_NAME_SIZE);
errorFilterNamePtr = errorFilterName;
}
#endif
/* at this point all datastructures (hopefully) are
* built. we can call the api routine to modify the workflow object
*/
if(rv == 0) {
ret = ARSetFilter(ctrl, name, newNamePtr, order, schemaList,
opSet,
enable, query,
actionList, elseList,
helpText, ownerPtr, changeDiary,
objPropList,
#if AR_CURRENT_API_VERSION >= 13
errorFilterOptions,
errorFilterNamePtr,
#endif
#if AR_CURRENT_API_VERSION >= 17
objectModificationLogLabel,
#endif
&status);
if(!ARError( ret, status))
RETVAL = 1;
} else
ARError_add( AR_RETURN_ERROR, AP_ERR_PREREVFAIL);
}
if (helpText) {
AP_FREE(helpText);
}
if (changeDiary) {
AP_FREE(changeDiary);
}
if( order != NULL ) { AP_FREE(order); }
if( enable != NULL ) { AP_FREE(enable); }
/* if( query != NULL ) { FreeARARQualifierStruct( query, TRUE ); } */
if( schemaList != NULL ) { FreeARWorkflowConnectStruct( schemaList, TRUE ); }
if( actionList != NULL ) { FreeARFilterActionList( actionList, TRUE ); }
if( elseList != NULL ) { FreeARFilterActionList( elseList, TRUE ); }
if( objPropList != NULL ) { FreeARPropList( objPropList, TRUE ); }
#else /* < 5.0 */
XPUSHs(sv_2mortal(newSViv(0))); /* ERR */
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_DEPRECATED,
"ARSperl supports CreateContainer() only for ARSystem >= 5.0");
RETVAL = AR_RETURN_ERROR;
#endif
}
OUTPUT:
RETVAL
int
ars_CreateEscalation(ctrl, objDefRef)
ARControlStruct * ctrl
SV * objDefRef
CODE:
{
#if AR_EXPORT_VERSION >= 5
int ret = 0, rv = 0;
ARNameType name;
unsigned int enable = 0;
AREscalationTmStruct escalationTm;
ARQualifierStruct *query;
ARFilterActionList actionList;
ARFilterActionList elseList;
char *helpText = CPNULL;
ARAccessNameType owner;
char *changeDiary = CPNULL;
char *objectModificationLogLabel = NULL;
ARStatusList status;
ARNameList schemaNameList;
ARWorkflowConnectStruct schemaList;
ARPropList objPropList;
RETVAL = 0; /* assume error */
(void) ARError_reset();
Zero(&status, 1,ARStatusList);
Zero(name, 1, ARNameType);
Zero(&actionList, 1,ARFilterActionList);
Zero(&elseList, 1,ARFilterActionList);
Zero(owner, 1, ARAccessNameType);
Zero(&objPropList, 1, ARPropList);
Zero(&schemaList, 1, ARWorkflowConnectStruct);
Zero(&schemaNameList, 1, ARNameList);
Zero(&escalationTm, 1, AREscalationTmStruct);
schemaList.type = AR_WORKFLOW_CONN_SCHEMA_LIST;
schemaList.u.schemaList = &schemaNameList;
if(SvTYPE((SV *)SvRV(objDefRef)) != SVt_PVHV) {
ARError_add( AR_RETURN_ERROR, AP_ERR_EXPECT_PVHV);
} else {
HV *objDef = (HV *)SvRV(objDefRef);
SV **qhv = hv_fetch(objDef, "query", strlen("query") , 0);
/* dereference the qual pointer */
if(qhv && *qhv && SvROK(*qhv)) {
query = (ARQualifierStruct *)SvIV((SV *)SvRV(*qhv));
/* query = (ARQualifierStruct*) MALLOCNN( sizeof(ARQualifierStruct) );
rv += rev_ARQualifierStruct( ctrl, objDef, "query", query ); */
} else {
query = (ARQualifierStruct *)NULL;
}
/* copy the various hash entries into the appropriate
* data structure. if any are missing, we fail.
*/
rv = 0;
rv += strcpyHVal( objDef, "name", name, AR_MAX_NAME_SIZE);
rv += rev_ARNameList( ctrl, objDef, "schemaList", schemaList.u.schemaList );
rv += uintcpyHVal( objDef, "enable", &enable);
/* rv += rev_AREscalationTmStruct( ctrl, objDef, "escalationTm", &escalationTm ); */
rv += uintcpyHVal( objDef, "TmType", &(escalationTm.escalationTmType) );
switch( escalationTm.escalationTmType ){
case AR_ESCALATION_TYPE_INTERVAL:
rv += longcpyHVal( objDef, "TmInterval", &(escalationTm.u.interval) );
break;
case AR_ESCALATION_TYPE_TIMEMARK:
rv += longcpyHVal( objDef, "TmMonthDayMask", &(escalationTm.u.date.monthday) );
rv += longcpyHVal( objDef, "TmWeekDayMask", &(escalationTm.u.date.weekday) );
rv += longcpyHVal( objDef, "TmHourMask", &(escalationTm.u.date.hourmask) );
rv += uintcpyHVal( objDef, "TmMinute", &(escalationTm.u.date.minute) );
break;
default:
rv += (-1);
}
if(hv_exists(objDef, "owner", strlen("owner") ))
rv += strcpyHVal( objDef, "owner", owner, AR_MAX_ACCESS_NAME_SIZE);
else
strncpy(owner, ctrl->user, sizeof(ARAccessNameType));
/* these two are optional, so if the calls return warnings
&schemaList,
enable, query,
&actionList, &elseList,
helpText, owner, changeDiary,
&objPropList,
#if AR_CURRENT_API_VERSION >= 17
objectModificationLogLabel,
#endif
&status);
if(!ARError( ret, status))
RETVAL = 1;
} else
ARError_add( AR_RETURN_ERROR, AP_ERR_PREREVFAIL);
}
if (helpText) {
AP_FREE(helpText);
}
if (changeDiary) {
AP_FREE(changeDiary);
}
FreeARFilterActionList(&actionList, FALSE);
FreeARFilterActionList(&elseList, FALSE);
FreeARPropList(&objPropList, FALSE);
FreeARNameList(&schemaNameList, FALSE);
#else /* < 5.0 */
XPUSHs(sv_2mortal(newSViv(0))); /* ERR */
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_DEPRECATED,
"ARSperl supports CreateContainer() only for ARSystem >= 5.0");
RETVAL = AR_RETURN_ERROR;
#endif
}
OUTPUT:
RETVAL
int
ars_SetEscalation(ctrl, name, objDefRef)
ARControlStruct * ctrl
ARNameType name
SV * objDefRef
CODE:
{
#if AR_EXPORT_VERSION >= 5
int ret = 0, rv = 0;
ARNameType newName;
char *newNamePtr = NULL;
AREscalationTmStruct *escalationTm = NULL;
unsigned int *enable = NULL;
ARQualifierStruct *query = NULL;
ARFilterActionList *actionList = NULL;
ARFilterActionList *elseList = NULL;
char *helpText = CPNULL;
ARAccessNameType owner;
char *ownerPtr = NULL;
char *changeDiary = CPNULL;
char *objectModificationLogLabel = NULL;
ARStatusList status;
ARWorkflowConnectStruct *schemaList = NULL;
ARPropList *objPropList = NULL;
RETVAL = 0; /* assume error */
(void) ARError_reset();
Zero(&status, 1,ARStatusList);
Zero(newName, 1, ARNameType);
Zero(owner, 1, ARAccessNameType);
if(SvTYPE((SV *)SvRV(objDefRef)) != SVt_PVHV) {
ARError_add( AR_RETURN_ERROR, AP_ERR_EXPECT_PVHV);
} else {
HV *objDef = (HV *)SvRV(objDefRef);
SV **qhv = hv_fetch(objDef, "query", strlen("query") , 0);
/* dereference the qual pointer */
if( qhv && *qhv && SvROK(*qhv) ){
query = (ARQualifierStruct *)SvIV((SV *)SvRV(*qhv));
/* query = (ARQualifierStruct*) MALLOCNN( sizeof(ARQualifierStruct) );
rv += rev_ARQualifierStruct( ctrl, objDef, "query", query ); */
}
/* copy the various hash entries into the appropriate
* data structure. if any are missing, we fail.
*/
rv = 0;
if( hv_exists(objDef,"name",4) ){
rv += strcpyHVal( objDef, "name", newName, AR_MAX_NAME_SIZE );
newNamePtr = newName;
}
if( hv_exists(objDef,"schemaList",10) ){
schemaList = (ARWorkflowConnectStruct*) MALLOCNN(sizeof(ARWorkflowConnectStruct));
schemaList->type = AR_WORKFLOW_CONN_SCHEMA_LIST;
schemaList->u.schemaList = (ARNameList*) MALLOCNN( sizeof(ARNameList) );
rv += rev_ARNameList( ctrl, objDef, "schemaList", schemaList->u.schemaList );
}
if( hv_exists(objDef,"enable",6) ){
enable = (unsigned int*) MALLOCNN(sizeof(unsigned int));
rv += uintcpyHVal( objDef, "enable", enable);
}
if( hv_exists(objDef,"TmInterval",10) ){
escalationTm = (AREscalationTmStruct*) MALLOCNN(sizeof(AREscalationTmStruct));
escalationTm->escalationTmType = AR_ESCALATION_TYPE_INTERVAL;
rv += longcpyHVal( objDef, "TmInterval", &(escalationTm->u.interval) );
}else if( hv_exists(objDef,"TmHourMask",10) ){
escalationTm = (AREscalationTmStruct*) MALLOCNN(sizeof(AREscalationTmStruct));
escalationTm->escalationTmType = AR_ESCALATION_TYPE_TIMEMARK;
rv += longcpyHVal( objDef, "TmMonthDayMask", &(escalationTm->u.date.monthday) );
rv += longcpyHVal( objDef, "TmWeekDayMask", &(escalationTm->u.date.weekday) );
rv += longcpyHVal( objDef, "TmHourMask", &(escalationTm->u.date.hourmask) );
rv += uintcpyHVal( objDef, "TmMinute", &(escalationTm->u.date.minute) );
}
if(hv_exists(objDef, "owner", strlen("owner") )){
rv += strcpyHVal( objDef, "owner", owner, AR_MAX_ACCESS_NAME_SIZE);
ownerPtr = owner;
}
/* these two are optional, so if the calls return warnings
* it probably indicates that the hash keys don't exist and
* we'll ignore it unless an actual failure code is returned.
ret = ARSetEscalation(ctrl, name, newNamePtr,
escalationTm,
schemaList,
enable, query,
actionList, elseList,
helpText, ownerPtr, changeDiary,
objPropList,
#if AR_CURRENT_API_VERSION >= 17
objectModificationLogLabel,
#endif
&status);
if(!ARError( ret, status))
RETVAL = 1;
} else
ARError_add( AR_RETURN_ERROR, AP_ERR_PREREVFAIL);
}
if (helpText) {
AP_FREE(helpText);
}
if (changeDiary) {
AP_FREE(changeDiary);
}
if( enable != NULL ) { AP_FREE(enable); }
/* if( query != NULL ) { FreeARARQualifierStruct( query, TRUE ); } */
if( schemaList != NULL ) { FreeARWorkflowConnectStruct( schemaList, TRUE ); }
if( actionList != NULL ) { FreeARFilterActionList( actionList, TRUE ); }
if( elseList != NULL ) { FreeARFilterActionList( elseList, TRUE ); }
if( objPropList != NULL ) { FreeARPropList( objPropList, TRUE ); }
#else /* < 5.0 */
XPUSHs(sv_2mortal(newSViv(0))); /* ERR */
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_DEPRECATED,
"ARSperl supports CreateContainer() only for ARSystem >= 5.0");
RETVAL = AR_RETURN_ERROR;
#endif
}
OUTPUT:
RETVAL
int
ars_CreateImage(ctrl, objDefRef)
ARControlStruct * ctrl
SV * objDefRef
CODE:
{
ARStatusList status;
#if AR_CURRENT_API_VERSION >= 14
int ret = 0, rv = 0;
ARNameType name;
ARImageDataStruct imageBuf;
char *imageType = CPNULL;
char *description = CPNULL;
char *helpText = CPNULL;
ARAccessNameType owner;
char *changeDiary = CPNULL;
ARPropList objPropList;
char *objectModificationLogLabel = NULL;
RETVAL = 0; /* assume error */
(void) ARError_reset();
Zero(&status, 1,ARStatusList);
Zero(name, 1, ARNameType);
Zero(&imageBuf, 1,ARImageDataStruct);
Zero(owner, 1, ARAccessNameType);
Zero(&objPropList, 1, ARPropList);
if(SvTYPE((SV *)SvRV(objDefRef)) != SVt_PVHV) {
ARError_add( AR_RETURN_ERROR, AP_ERR_EXPECT_PVHV);
} else {
HV *objDef = (HV *)SvRV(objDefRef);
/* copy the various hash entries into the appropriate
* data structure. if any are missing, we fail.
*/
rv = 0;
rv += strcpyHVal( objDef, "name", name, AR_MAX_NAME_SIZE);
rv += rev_ARImageDataStruct( ctrl, objDef, "imageData", &imageBuf );
rv += strmakHVal( objDef, "imageType", &imageType);
if(hv_exists(objDef, "description", strlen("description") ))
rv += strmakHVal( objDef, "description", &description);
if(hv_exists(objDef, "owner", strlen("owner") ))
rv += strcpyHVal( objDef, "owner", owner, AR_MAX_ACCESS_NAME_SIZE);
else
strncpy(owner, ctrl->user, sizeof(ARAccessNameType));
/* these two are optional, so if the calls return warnings
* it probably indicates that the hash keys don't exist and
* we'll ignore it unless an actual failure code is returned.
*/
if(hv_exists(objDef, "changeDiary", strlen("changeDiary") ))
rv += strmakHVal( objDef, "changeDiary", &changeDiary);
if(hv_exists(objDef, "helpText", strlen("helpText") ))
rv += strmakHVal( objDef, "helpText", &helpText);
if(hv_exists(objDef, "objPropList", strlen("objPropList") ))
rv += rev_ARPropList(ctrl, objDef, "objPropList",
&objPropList);
/* at this point all datastructures (hopefully) are
* built. we can call the api routine to create the
* image.
*/
if( rv == 0 ){
ret = ARCreateImage( ctrl, name,
&imageBuf,
imageType,
description,
helpText, owner, changeDiary,
&objPropList,
#if AR_CURRENT_API_VERSION >= 17
objectModificationLogLabel,
#endif
&status);
if(!ARError( ret, status))
RETVAL = 1;
}else{
ARError_add( AR_RETURN_ERROR, AP_ERR_PREREVFAIL);
}
}
if (helpText) {
AP_FREE(helpText);
}
if (changeDiary) {
AP_FREE(changeDiary);
}
if (description) {
AP_FREE(description);
}
if (imageType) {
AP_FREE(description);
}
FreeARImageDataStruct(&imageBuf, FALSE);
FreeARPropList(&objPropList, FALSE);
#else /* prior to ARS 7.5 */
(void) ARError_reset();
Zero(&status, 1, ARStatusList);
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_DEPRECATED,
"ars_CreateImage() is only available in ARS >= 7.5");
XSRETURN_UNDEF;
#endif
}
OUTPUT:
RETVAL
int
ars_SetImage(ctrl, name, objDefRef)
ARControlStruct * ctrl
ARNameType name
SV * objDefRef
CODE:
{
ARStatusList status;
#if AR_CURRENT_API_VERSION >= 14
int ret = 0, rv = 0;
ARNameType newName;
char *newNamePtr = NULL;
ARImageDataStruct *imageBuf = NULL;
char *imageType = CPNULL;
char *description = CPNULL;
char *helpText = CPNULL;
ARAccessNameType owner;
char *ownerPtr = NULL;
char *changeDiary = CPNULL;
ARPropList *objPropList = NULL;
char *objectModificationLogLabel = NULL;
RETVAL = 0; /* assume error */
(void) ARError_reset();
Zero(&status, 1,ARStatusList);
Zero(newName, 1, ARNameType);
Zero(owner, 1, ARAccessNameType);
if(SvTYPE((SV *)SvRV(objDefRef)) != SVt_PVHV) {
ARError_add( AR_RETURN_ERROR, AP_ERR_EXPECT_PVHV);
} else {
HV *objDef = (HV *)SvRV(objDefRef);
/* copy the various hash entries into the appropriate
* data structure. if any are missing, we fail.
*/
rv = 0;
if( hv_exists(objDef,"name",4) ){
rv += strcpyHVal( objDef, "name", newName, AR_MAX_NAME_SIZE );
newNamePtr = newName;
}
if(hv_exists(objDef, "owner", strlen("owner") )){
rv += strcpyHVal( objDef, "owner", owner, AR_MAX_ACCESS_NAME_SIZE);
ownerPtr = owner;
}
if(hv_exists(objDef, "changeDiary", strlen("changeDiary") ))
rv += strmakHVal( objDef, "changeDiary", &changeDiary);
if(hv_exists(objDef, "helpText", strlen("helpText") ))
rv += strmakHVal( objDef, "helpText", &helpText);
if(hv_exists(objDef, "imageType", strlen("imageType") ))
rv += strmakHVal( objDef, "imageType", &imageType);
if(hv_exists(objDef, "imageData", strlen("imageData") )){
imageBuf = (ARImageDataStruct*) MALLOCNN(sizeof(ARImageDataStruct));
rv += rev_ARImageDataStruct(ctrl, objDef, "imageData", imageBuf);
}
if(hv_exists(objDef, "description", strlen("description") ))
rv += strmakHVal( objDef, "description", &description);
if(hv_exists(objDef, "objPropList", strlen("objPropList") )){
objPropList = (ARPropList*) MALLOCNN(sizeof(ARPropList));
rv += rev_ARPropList(ctrl, objDef, "objPropList", objPropList);
}
/* at this point all datastructures (hopefully) are
* built. we can call the api routine to create the
* image.
*/
if( rv == 0 ){
ret = ARSetImage( ctrl, name,
newNamePtr,
imageBuf,
imageType,
description,
helpText, owner, changeDiary,
objPropList,
#if AR_CURRENT_API_VERSION >= 17
objectModificationLogLabel,
#endif
( run in 0.969 second using v1.01-cache-2.11-cpan-39bf76dae61 )