Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/947 v2 entities #958

Merged
merged 20 commits into from
Jun 9, 2015
Merged

Feature/947 v2 entities #958

merged 20 commits into from
Jun 9, 2015

Conversation

kzangeli
Copy link
Member

@kzangeli kzangeli commented Jun 7, 2015

Implements #947

This PR implements most if not all of "GET /v2/entities", including the addition of two new directories/libraries for types and service routines for version 2.

One almost complete functional test is present, one more is no its way (test for local pagination).

@kzangeli kzangeli added this to the 0.23.0 milestone Jun 7, 2015
@@ -158,10 +158,12 @@ if (error EQUAL 0)
ADD_SUBDIRECTORY(src/lib/orionTypes)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CHANGES_NEXT_RELEASE entry is missing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 7bb8611

@kzangeli
Copy link
Member Author

kzangeli commented Jun 8, 2015

New functest (pagination for GET /v2/entities) in commit 7bb8611

@@ -1 +1,2 @@
Fix: Fixed a bug about pagination problem due to missing ErrorCode with details in the case of queries with forwarding to context providers. (Issue #945)
Add: New convop "GET /v2/entities" (Issue #947)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was my understanding that in v2 we are no longer using the term convop, aren't we?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point... I'd suggest to be neutral and just say:

Add: New operation "GET /v2/entities" (Issue #947)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I wasn't aware of that ...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in bb66c46

// /v2 conv-ops
//
#define ENT EntitiesRequest
#define ENT_COMPS_V2 2, { "v2", "entities" }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably we can define a constant for 'entities' and use it as well in the entryPoints operation as well, WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do we win with a change like that?
[ Except that the code gets more difficult to read ... ]

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NTC

if (strstr(details.c_str(), "\"") != NULL)
{
int len = details.length() * 2;
char* s2 = (char*) calloc(1, len + 1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that we are using s2 here because s is already taken... However, I don't find any s...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't say I remember exactly why I chose that name.
s2 is twice as long as the original string, that is probably the reason.
This is a copy from REALLY old stuff.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

's2' changed to 's' in 5c5e28d

{
if (qcrsP->errorCode.code == SccContextElementNotFound)
{
errorCode.fill(SccOk);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I undertand that this "transformation" from SccContextElementNotFound to SccOk is related with the GET /v2/entities operation returns an empty arrayt [] in this case and not an error. I'd suggest to add a comment about it... it could be complex to understand in the future.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 0bc1f01

@fgalan fgalan mentioned this pull request Jun 8, 2015
else if (qcrsP->errorCode.code != SccOk)
{
//
// If any other error - use the error for the response
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add also something like this:

"Taking into account that this way of working avoids that the errorCode generated by API v1 logic for count be included in the response to the user of the API v2 operation"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know where exactly this piece of comment fits in ...
The phrase is true, but ... where do I put it?

Perhaps in the "Non-existing else" ...
that would capture (qcrsP->errorCode.code == SccOk) ...

Is that what was meant for this comment ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in d24d235

@jmcanterafonseca
Copy link
Contributor

congrats @kzangeli good work!

@fgalan
Copy link
Member

fgalan commented Jun 9, 2015

LGTM

fgalan pushed a commit that referenced this pull request Jun 9, 2015
@fgalan fgalan merged commit b6c2b3f into develop Jun 9, 2015
@fgalan fgalan deleted the feature/947_v2_entities branch June 9, 2015 18:44
fisuda pushed a commit to fisuda/fiware-orion that referenced this pull request Feb 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants