summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/reference/lasso/lasso-sections.txt1
-rw-r--r--lasso/id-wsf-2.0/data_service.c43
-rw-r--r--lasso/id-wsf-2.0/data_service.h4
3 files changed, 45 insertions, 3 deletions
diff --git a/docs/reference/lasso/lasso-sections.txt b/docs/reference/lasso/lasso-sections.txt
index 9c91d374..af4eb130 100644
--- a/docs/reference/lasso/lasso-sections.txt
+++ b/docs/reference/lasso/lasso-sections.txt
@@ -5822,6 +5822,7 @@ lasso_idwsf2_data_service_get_service_type_prefix
lasso_idwsf2_data_service_process_request_msg
lasso_idwsf2_data_service_process_response_msg
lasso_idwsf2_data_service_set_query_item_result
+lasso_idwsf2_data_service_get_query_item_result_content
lasso_idwsf2_data_service_set_service_type
lasso_idwsf2_data_service_set_status_code
lasso_idwsf2_data_service_get_item_ids
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
*
diff --git a/lasso/id-wsf-2.0/data_service.h b/lasso/id-wsf-2.0/data_service.h
index 9a0f5861..b90c8d2a 100644
--- a/lasso/id-wsf-2.0/data_service.h
+++ b/lasso/id-wsf-2.0/data_service.h
@@ -114,7 +114,7 @@ LASSO_EXPORT LassoNode* lasso_idwsf2_data_service_get_item(LassoIdWsf2DataServic
const char *item_id);
/* Reponse initialization */
-LASSO_EXPORT gint lasso_idwsf2_data_service_init_response(LassoIdWsf2DataService *service);
+LASSO_EXPORT gint lasso_idwsf2_data_service_validate_request(LassoIdWsf2DataService *service);
LASSO_EXPORT gint lasso_idwsf2_data_service_set_status_code(LassoIdWsf2DataService *service,
const char *status_code, const char *status_code2);
@@ -133,6 +133,8 @@ LASSO_EXPORT LassoIdWsf2UtilStatus *lasso_idwsf2_data_service_get_response_statu
LassoIdWsf2DataService *service);
LASSO_EXPORT LassoIdWsf2DstRefData* lasso_idwsf2_data_service_get_query_item_result(
LassoIdWsf2DataService *service, const char *item_id);
+LASSO_EXPORT char* lasso_idwsf2_data_service_get_query_item_result_content(
+ LassoIdWsf2DataService *service, const char *item_id);
LASSO_EXPORT GList* lasso_idwsf2_data_service_get_query_item_results(
LassoIdWsf2DataService *service);