diff options
author | Benjamin Dauvergne <bdauvergne@entrouvert.com> | 2010-04-06 13:11:14 +0000 |
---|---|---|
committer | Benjamin Dauvergne <bdauvergne@entrouvert.com> | 2010-04-06 13:11:14 +0000 |
commit | 7db0387f5aca39b4321535161947922b63d04295 (patch) | |
tree | 42dc96919885af6b3b3525eccc6109a7b2987a88 /lasso/id-wsf-2.0/data_service.c | |
parent | 43bb65157c7373d84c9498f72a26928b51dd36f3 (diff) | |
download | lasso-7db0387f5aca39b4321535161947922b63d04295.tar.gz lasso-7db0387f5aca39b4321535161947922b63d04295.tar.xz lasso-7db0387f5aca39b4321535161947922b63d04295.zip |
ID-WSF 2.0 Data Service: new accessor, fix use of build_unique_id, change init_response to validate_request
Diffstat (limited to 'lasso/id-wsf-2.0/data_service.c')
-rw-r--r-- | lasso/id-wsf-2.0/data_service.c | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/lasso/id-wsf-2.0/data_service.c b/lasso/id-wsf-2.0/data_service.c index 86ef4f9e..a305aca5 100644 --- a/lasso/id-wsf-2.0/data_service.c +++ b/lasso/id-wsf-2.0/data_service.c @@ -251,7 +251,7 @@ lasso_idwsf2_data_service_add_query_item(LassoIdWsf2DataService *service, const lasso_check_non_empty_string(item_query); if (item_id == NULL) { - item_id = lasso_build_unique_id(10); + item_id = lasso_build_unique_id(32); } /* Check duplicates */ lasso_foreach(i, service->private_data->query_items) { @@ -592,7 +592,7 @@ cleanup: * Return value: 0 if successful, or LASSO_PROFILE_ERROR_INVALID_REQUEST. */ gint -lasso_idwsf2_data_service_init_response(LassoIdWsf2DataService *service) +lasso_idwsf2_data_service_validate_request(LassoIdWsf2DataService *service) { LassoIdWsf2DstRefQueryResponse *query_response; LassoIdWsf2DstRefModifyResponse *modify_response; @@ -900,6 +900,45 @@ lasso_idwsf2_data_service_get_query_item_result(LassoIdWsf2DataService *service, } /** + * lasso_idwsf2_data_service_get_query_item_result_content: + * @service: a #LassoIdWsf2DataService object + * @item_id:(allow-none): the identifier of the result asked, if NULL and there is only one respone, + * returns it. + * + * Returns the text content of the query item result identified by @item_id or the only query item + * result if @item_id is NULL. + * <para>If @item_id is NULL and there is multiple results, returns NULL.</para> + * + * Return value:(transfer full): the text content of the query item result. + */ +char* +lasso_idwsf2_data_service_get_query_item_result_content(LassoIdWsf2DataService *service, + const char *item_id) +{ + LassoIdWsf2DstRefData *data = NULL; + LassoIdWsf2DstRefAppData *app_data = NULL; + GList *i = NULL; + GString *gstr = NULL; + char *result = NULL; + + data = lasso_idwsf2_data_service_get_query_item_result(service, item_id); + if (! data) + return NULL; + app_data = (LassoIdWsf2DstRefAppData*)data; + gstr = g_string_sized_new(128); + lasso_foreach(i, app_data->any) { + xmlNode *node = (xmlNode*)i->data; + xmlChar *content; + content = xmlNodeGetContent(node); + g_string_append(gstr, (char*)content); + xmlFree(content); + } + result = gstr->str; + g_string_free(gstr, FALSE); + return result; +} + +/** * lasso_idwsf2_data_service_get_query_item_results: * @service: a #LassoIdWsf2DataService object * |