{"action":"created","comment":{"url":"https://api.github.com/repos/telefonicaid/fiware-orion/pulls/comments/25852481","id":25852481,"diff_hunk":"@@ -38,6 +38,268 @@\n \n /* ****************************************************************************\n *\n+* someContextElementNotFound -\n+*\n+* Returns true if some attribut with 'found' set to 'false' is found in the CER vector passed\n+* as argument\n+*\n+*/\n+bool someContextElementNotFound(ContextElementResponseVector& cerV)\n+{\n+  for (unsigned int ix = 0; ix < cerV.size(); ++ix)\n+  {\n+    for (unsigned int jx = 0; jx < cerV.get(ix)->contextElement.contextAttributeVector.size(); ++jx)\n+    {\n+      if (!cerV.get(ix)->contextElement.contextAttributeVector.get(jx)->found)\n+      {\n+        return true;\n+      }\n+    }\n+  }\n+  return false;\n+}\n+\n+\n+/* ****************************************************************************\n+*\n+* searchCprForAttribute -\n+*\n+* Search the CPr, given the entity/attribute as argument. Actually, two CPrs can be returned\n+* the \"general\" one at entity level or the \"specific\" one at attribute level\n+*\n+*/\n+void searchCprForAttribute(EntityId& en, std::string attrName, ContextRegistrationResponseVector& crrV, std::string& perEntPa, std::string& perAttrPa)\n+{\n+  perEntPa  = \"\";\n+  perAttrPa = \"\";\n+  for (unsigned int ix = 0; ix < crrV.size(); ++ix)\n+  {\n+    ContextRegistrationResponse* crr = crrV.get(ix);\n+    /* Is there a matching entity in the CRR? */\n+    for (unsigned jx = 0; jx < crr->contextRegistration.entityIdVector.size(); ++jx)\n+    {\n+      EntityId* regEn = crr->contextRegistration.entityIdVector.get(jx);\n+      if (regEn->id == en.id && (regEn->type == en.type || regEn->type == \"\"))\n+      {\n+        if (crr->contextRegistration.contextRegistrationAttributeVector.size() == 0)\n+        {\n+          /* CRR without attributes (we need to keep searching in other CRR) */\n+          perEntPa = crr->contextRegistration.providingApplication.get();\n+          break; /* jx */\n+        }\n+        else\n+        {\n+          /* Is there a matching entity or the abcense of attributes? */\n+          for (unsigned kx = 0; kx < crr->contextRegistration.contextRegistrationAttributeVector.size(); ++kx)\n+          {\n+            std::string regAttrName = crr->contextRegistration.contextRegistrationAttributeVector.get(kx)->name;\n+            if (regAttrName == attrName)\n+            {\n+              /* We cannot \"improve\" this result keep searching in CRR vector, so we return */\n+              perAttrPa = crr->contextRegistration.providingApplication.get();\n+              return;\n+            }\n+          }\n+        }\n+      }\n+    }\n+  }\n+}","path":"src/lib/mongoBackend/mongoQueryContext.cpp","position":70,"original_position":70,"commit_id":"0e0e492f7946e6d170583bcc685c56f8d098f342","original_commit_id":"2e6534322958e2e8986a75e93a678b1f8423006e","user":{"login":"kzangeli","id":5338380,"avatar_url":"https://avatars.githubusercontent.com/u/5338380?v=3","gravatar_id":"","url":"https://api.github.com/users/kzangeli","html_url":"https://github.com/kzangeli","followers_url":"https://api.github.com/users/kzangeli/followers","following_url":"https://api.github.com/users/kzangeli/following{/other_user}","gists_url":"https://api.github.com/users/kzangeli/gists{/gist_id}","starred_url":"https://api.github.com/users/kzangeli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kzangeli/subscriptions","organizations_url":"https://api.github.com/users/kzangeli/orgs","repos_url":"https://api.github.com/users/kzangeli/repos","events_url":"https://api.github.com/users/kzangeli/events{/privacy}","received_events_url":"https://api.github.com/users/kzangeli/received_events","type":"User","site_admin":false},"body":"I see now that *perAttrPa* and *perEntPa* are returned from this function.\r\nTo make that clear (especially from the caller), these two variables should be passed by reference, I mean, as real pointers, using the '&' in the call, and received as real pointers in this function.","created_at":"2015-03-05T10:09:22Z","updated_at":"2015-03-05T10:09:22Z","html_url":"https://github.com/telefonicaid/fiware-orion/pull/808#discussion_r25852481","pull_request_url":"https://api.github.com/repos/telefonicaid/fiware-orion/pulls/808","_links":{"self":{"href":"https://api.github.com/repos/telefonicaid/fiware-orion/pulls/comments/25852481"},"html":{"href":"https://github.com/telefonicaid/fiware-orion/pull/808#discussion_r25852481"},"pull_request":{"href":"https://api.github.com/repos/telefonicaid/fiware-orion/pulls/808"}}},"pull_request":{"url":"https://api.github.com/repos/telefonicaid/fiware-orion/pulls/808","id":30483600,"html_url":"https://github.com/telefonicaid/fiware-orion/pull/808","diff_url":"https://github.com/telefonicaid/fiware-orion/pull/808.diff","patch_url":"https://github.com/telefonicaid/fiware-orion/pull/808.patch","issue_url":"https://api.github.com/repos/telefonicaid/fiware-orion/issues/808","number":808,"state":"open","locked":false,"title":"Task/787 mongobackend query","user":{"login":"fgalan","id":1534240,"avatar_url":"https://avatars.githubusercontent.com/u/1534240?v=3","gravatar_id":"","url":"https://api.github.com/users/fgalan","html_url":"https://github.com/fgalan","followers_url":"https://api.github.com/users/fgalan/followers","following_url":"https://api.github.com/users/fgalan/following{/other_user}","gists_url":"https://api.github.com/users/fgalan/gists{/gist_id}","starred_url":"https://api.github.com/users/fgalan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fgalan/subscriptions","organizations_url":"https://api.github.com/users/fgalan/orgs","repos_url":"https://api.github.com/users/fgalan/repos","events_url":"https://api.github.com/users/fgalan/events{/privacy}","received_events_url":"https://api.github.com/users/fgalan/received_events","type":"User","site_admin":false},"body":"Not all test work after merging this PR. The following unit test will fail (to be fixed with the updateContext functionality gets implemented in a further PR):\r\n\r\n```\r\nTEST(mongoContextProvidersUpdateRequest, severalCprs)\r\n```\r\n\r\nThe following test harness will fail (I guess that mostly of them related with CPr redirection fucntionalty, taking into account that mongoBacken is not returning the 302 Found that current serviceRoutines expect to work):\r\n\r\n*Edit:* change list of failing tets after 2e65343\r\n\r\n```\r\n----------- Failing tests ------------------\r\n  o  117_convop_using_standard_ops/postContextEntitiesByEntityId.test\r\n  o  117_convop_using_standard_ops/postContextEntityAttributes.test\r\n  o  117_convop_using_standard_ops/postEntityByIdAttributeByName.test\r\n  o  499_context_providers_basic/query_redirect_operation.test\r\n  o  499_context_providers_basic/query_redirect_three_providers.test\r\n  o  499_context_providers_basic/update_redirect_delete_operation.test\r\n  o  499_context_providers_basic/update_redirect_operation.test\r\n  o  714_propagate_service_path/no_propagation_of_service_path_when_not_present.test\r\n  o  715_forward_xauth_token_to_cprs/propagate_xauth_token_for_update_and_query_standard_ops.test\r\n  o  716_forward_registered_attributes/forward_attribute_query.test\r\n  o  719_servicepath_for_registrations/forward_attribute_with_servicePath.test\r\n  o  719_servicepath_for_registrations/forward_queries.test\r\n```","created_at":"2015-03-04T17:02:50Z","updated_at":"2015-03-05T10:09:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8214352922c0cec9cd392303e48262f7fec868c5","assignee":{"login":"kzangeli","id":5338380,"avatar_url":"https://avatars.githubusercontent.com/u/5338380?v=3","gravatar_id":"","url":"https://api.github.com/users/kzangeli","html_url":"https://github.com/kzangeli","followers_url":"https://api.github.com/users/kzangeli/followers","following_url":"https://api.github.com/users/kzangeli/following{/other_user}","gists_url":"https://api.github.com/users/kzangeli/gists{/gist_id}","starred_url":"https://api.github.com/users/kzangeli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kzangeli/subscriptions","organizations_url":"https://api.github.com/users/kzangeli/orgs","repos_url":"https://api.github.com/users/kzangeli/repos","events_url":"https://api.github.com/users/kzangeli/events{/privacy}","received_events_url":"https://api.github.com/users/kzangeli/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/telefonicaid/fiware-orion/pulls/808/commits","review_comments_url":"https://api.github.com/repos/telefonicaid/fiware-orion/pulls/808/comments","review_comment_url":"https://api.github.com/repos/telefonicaid/fiware-orion/pulls/comments{/number}","comments_url":"https://api.github.com/repos/telefonicaid/fiware-orion/issues/808/comments","statuses_url":"https://api.github.com/repos/telefonicaid/fiware-orion/statuses/0e0e492f7946e6d170583bcc685c56f8d098f342","head":{"label":"telefonicaid:task/787_mongobackend_query","ref":"task/787_mongobackend_query","sha":"0e0e492f7946e6d170583bcc685c56f8d098f342","user":{"login":"telefonicaid","id":968363,"avatar_url":"https://avatars.githubusercontent.com/u/968363?v=3","gravatar_id":"","url":"https://api.github.com/users/telefonicaid","html_url":"https://github.com/telefonicaid","followers_url":"https://api.github.com/users/telefonicaid/followers","following_url":"https://api.github.com/users/telefonicaid/following{/other_user}","gists_url":"https://api.github.com/users/telefonicaid/gists{/gist_id}","starred_url":"https://api.github.com/users/telefonicaid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/telefonicaid/subscriptions","organizations_url":"https://api.github.com/users/telefonicaid/orgs","repos_url":"https://api.github.com/users/telefonicaid/repos","events_url":"https://api.github.com/users/telefonicaid/events{/privacy}","received_events_url":"https://api.github.com/users/telefonicaid/received_events","type":"Organization","site_admin":false},"repo":{"id":12808420,"name":"fiware-orion","full_name":"telefonicaid/fiware-orion","owner":{"login":"telefonicaid","id":968363,"avatar_url":"https://avatars.githubusercontent.com/u/968363?v=3","gravatar_id":"","url":"https://api.github.com/users/telefonicaid","html_url":"https://github.com/telefonicaid","followers_url":"https://api.github.com/users/telefonicaid/followers","following_url":"https://api.github.com/users/telefonicaid/following{/other_user}","gists_url":"https://api.github.com/users/telefonicaid/gists{/gist_id}","starred_url":"https://api.github.com/users/telefonicaid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/telefonicaid/subscriptions","organizations_url":"https://api.github.com/users/telefonicaid/orgs","repos_url":"https://api.github.com/users/telefonicaid/repos","events_url":"https://api.github.com/users/telefonicaid/events{/privacy}","received_events_url":"https://api.github.com/users/telefonicaid/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/telefonicaid/fiware-orion","description":"FI-WARE Orion Context Broker","fork":false,"url":"https://api.github.com/repos/telefonicaid/fiware-orion","forks_url":"https://api.github.com/repos/telefonicaid/fiware-orion/forks","keys_url":"https://api.github.com/repos/telefonicaid/fiware-orion/keys{/key_id}","collaborators_url":"https://api.github.com/repos/telefonicaid/fiware-orion/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/telefonicaid/fiware-orion/teams","hooks_url":"https://api.github.com/repos/telefonicaid/fiware-orion/hooks","issue_events_url":"https://api.github.com/repos/telefonicaid/fiware-orion/issues/events{/number}","events_url":"https://api.github.com/repos/telefonicaid/fiware-orion/events","assignees_url":"https://api.github.com/repos/telefonicaid/fiware-orion/assignees{/user}","branches_url":"https://api.github.com/repos/telefonicaid/fiware-orion/branches{/branch}","tags_url":"https://api.github.com/repos/telefonicaid/fiware-orion/tags","blobs_url":"https://api.github.com/repos/telefonicaid/fiware-orion/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/telefonicaid/fiware-orion/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/telefonicaid/fiware-orion/git/refs{/sha}","trees_url":"https://api.github.com/repos/telefonicaid/fiware-orion/git/trees{/sha}","statuses_url":"https://api.github.com/repos/telefonicaid/fiware-orion/statuses/{sha}","languages_url":"https://api.github.com/repos/telefonicaid/fiware-orion/languages","stargazers_url":"https://api.github.com/repos/telefonicaid/fiware-orion/stargazers","contributors_url":"https://api.github.com/repos/telefonicaid/fiware-orion/contributors","subscribers_url":"https://api.github.com/repos/telefonicaid/fiware-orion/subscribers","subscription_url":"https://api.github.com/repos/telefonicaid/fiware-orion/subscription","commits_url":"https://api.github.com/repos/telefonicaid/fiware-orion/commits{/sha}","git_commits_url":"https://api.github.com/repos/telefonicaid/fiware-orion/git/commits{/sha}","comments_url":"https://api.github.com/repos/telefonicaid/fiware-orion/comments{/number}","issue_comment_url":"https://api.github.com/repos/telefonicaid/fiware-orion/issues/comments{/number}","contents_url":"https://api.github.com/repos/telefonicaid/fiware-orion/contents/{+path}","compare_url":"https://api.github.com/repos/telefonicaid/fiware-orion/compare/{base}...{head}","merges_url":"https://api.github.com/repos/telefonicaid/fiware-orion/merges","archive_url":"https://api.github.com/repos/telefonicaid/fiware-orion/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/telefonicaid/fiware-orion/downloads","issues_url":"https://api.github.com/repos/telefonicaid/fiware-orion/issues{/number}","pulls_url":"https://api.github.com/repos/telefonicaid/fiware-orion/pulls{/number}","milestones_url":"https://api.github.com/repos/telefonicaid/fiware-orion/milestones{/number}","notifications_url":"https://api.github.com/repos/telefonicaid/fiware-orion/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/telefonicaid/fiware-orion/labels{/name}","releases_url":"https://api.github.com/repos/telefonicaid/fiware-orion/releases{/id}","created_at":"2013-09-13T11:55:25Z","updated_at":"2015-03-04T20:20:00Z","pushed_at":"2015-03-05T09:48:09Z","git_url":"git://github.com/telefonicaid/fiware-orion.git","ssh_url":"git@github.com:telefonicaid/fiware-orion.git","clone_url":"https://github.com/telefonicaid/fiware-orion.git","svn_url":"https://github.com/telefonicaid/fiware-orion","homepage":"http://catalogue.fi-ware.eu/enablers/publishsubscribe-context-broker-orion-context-broker","size":20715,"stargazers_count":14,"watchers_count":14,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":13,"mirror_url":null,"open_issues_count":122,"forks":13,"open_issues":122,"watchers":14,"default_branch":"develop"}},"base":{"label":"telefonicaid:feature/787_cprs_full_functional","ref":"feature/787_cprs_full_functional","sha":"9da788983f83671aae39083e3f414b316afac130","user":{"login":"telefonicaid","id":968363,"avatar_url":"https://avatars.githubusercontent.com/u/968363?v=3","gravatar_id":"","url":"https://api.github.com/users/telefonicaid","html_url":"https://github.com/telefonicaid","followers_url":"https://api.github.com/users/telefonicaid/followers","following_url":"https://api.github.com/users/telefonicaid/following{/other_user}","gists_url":"https://api.github.com/users/telefonicaid/gists{/gist_id}","starred_url":"https://api.github.com/users/telefonicaid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/telefonicaid/subscriptions","organizations_url":"https://api.github.com/users/telefonicaid/orgs","repos_url":"https://api.github.com/users/telefonicaid/repos","events_url":"https://api.github.com/users/telefonicaid/events{/privacy}","received_events_url":"https://api.github.com/users/telefonicaid/received_events","type":"Organization","site_admin":false},"repo":{"id":12808420,"name":"fiware-orion","full_name":"telefonicaid/fiware-orion","owner":{"login":"telefonicaid","id":968363,"avatar_url":"https://avatars.githubusercontent.com/u/968363?v=3","gravatar_id":"","url":"https://api.github.com/users/telefonicaid","html_url":"https://github.com/telefonicaid","followers_url":"https://api.github.com/users/telefonicaid/followers","following_url":"https://api.github.com/users/telefonicaid/following{/other_user}","gists_url":"https://api.github.com/users/telefonicaid/gists{/gist_id}","starred_url":"https://api.github.com/users/telefonicaid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/telefonicaid/subscriptions","organizations_url":"https://api.github.com/users/telefonicaid/orgs","repos_url":"https://api.github.com/users/telefonicaid/repos","events_url":"https://api.github.com/users/telefonicaid/events{/privacy}","received_events_url":"https://api.github.com/users/telefonicaid/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/telefonicaid/fiware-orion","description":"FI-WARE Orion Context Broker","fork":false,"url":"https://api.github.com/repos/telefonicaid/fiware-orion","forks_url":"https://api.github.com/repos/telefonicaid/fiware-orion/forks","keys_url":"https://api.github.com/repos/telefonicaid/fiware-orion/keys{/key_id}","collaborators_url":"https://api.github.com/repos/telefonicaid/fiware-orion/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/telefonicaid/fiware-orion/teams","hooks_url":"https://api.github.com/repos/telefonicaid/fiware-orion/hooks","issue_events_url":"https://api.github.com/repos/telefonicaid/fiware-orion/issues/events{/number}","events_url":"https://api.github.com/repos/telefonicaid/fiware-orion/events","assignees_url":"https://api.github.com/repos/telefonicaid/fiware-orion/assignees{/user}","branches_url":"https://api.github.com/repos/telefonicaid/fiware-orion/branches{/branch}","tags_url":"https://api.github.com/repos/telefonicaid/fiware-orion/tags","blobs_url":"https://api.github.com/repos/telefonicaid/fiware-orion/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/telefonicaid/fiware-orion/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/telefonicaid/fiware-orion/git/refs{/sha}","trees_url":"https://api.github.com/repos/telefonicaid/fiware-orion/git/trees{/sha}","statuses_url":"https://api.github.com/repos/telefonicaid/fiware-orion/statuses/{sha}","languages_url":"https://api.github.com/repos/telefonicaid/fiware-orion/languages","stargazers_url":"https://api.github.com/repos/telefonicaid/fiware-orion/stargazers","contributors_url":"https://api.github.com/repos/telefonicaid/fiware-orion/contributors","subscribers_url":"https://api.github.com/repos/telefonicaid/fiware-orion/subscribers","subscription_url":"https://api.github.com/repos/telefonicaid/fiware-orion/subscription","commits_url":"https://api.github.com/repos/telefonicaid/fiware-orion/commits{/sha}","git_commits_url":"https://api.github.com/repos/telefonicaid/fiware-orion/git/commits{/sha}","comments_url":"https://api.github.com/repos/telefonicaid/fiware-orion/comments{/number}","issue_comment_url":"https://api.github.com/repos/telefonicaid/fiware-orion/issues/comments{/number}","contents_url":"https://api.github.com/repos/telefonicaid/fiware-orion/contents/{+path}","compare_url":"https://api.github.com/repos/telefonicaid/fiware-orion/compare/{base}...{head}","merges_url":"https://api.github.com/repos/telefonicaid/fiware-orion/merges","archive_url":"https://api.github.com/repos/telefonicaid/fiware-orion/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/telefonicaid/fiware-orion/downloads","issues_url":"https://api.github.com/repos/telefonicaid/fiware-orion/issues{/number}","pulls_url":"https://api.github.com/repos/telefonicaid/fiware-orion/pulls{/number}","milestones_url":"https://api.github.com/repos/telefonicaid/fiware-orion/milestones{/number}","notifications_url":"https://api.github.com/repos/telefonicaid/fiware-orion/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/telefonicaid/fiware-orion/labels{/name}","releases_url":"https://api.github.com/repos/telefonicaid/fiware-orion/releases{/id}","created_at":"2013-09-13T11:55:25Z","updated_at":"2015-03-04T20:20:00Z","pushed_at":"2015-03-05T09:48:09Z","git_url":"git://github.com/telefonicaid/fiware-orion.git","ssh_url":"git@github.com:telefonicaid/fiware-orion.git","clone_url":"https://github.com/telefonicaid/fiware-orion.git","svn_url":"https://github.com/telefonicaid/fiware-orion","homepage":"http://catalogue.fi-ware.eu/enablers/publishsubscribe-context-broker-orion-context-broker","size":20715,"stargazers_count":14,"watchers_count":14,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":13,"mirror_url":null,"open_issues_count":122,"forks":13,"open_issues":122,"watchers":14,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/telefonicaid/fiware-orion/pulls/808"},"html":{"href":"https://github.com/telefonicaid/fiware-orion/pull/808"},"issue":{"href":"https://api.github.com/repos/telefonicaid/fiware-orion/issues/808"},"comments":{"href":"https://api.github.com/repos/telefonicaid/fiware-orion/issues/808/comments"},"review_comments":{"href":"https://api.github.com/repos/telefonicaid/fiware-orion/pulls/808/comments"},"review_comment":{"href":"https://api.github.com/repos/telefonicaid/fiware-orion/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/telefonicaid/fiware-orion/pulls/808/commits"},"statuses":{"href":"https://api.github.com/repos/telefonicaid/fiware-orion/statuses/0e0e492f7946e6d170583bcc685c56f8d098f342"}}}}