You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@atlas.apache.org by Vimal Sharma <vi...@hortonworks.com> on 2016/09/12 11:09:32 UTC
Review Request 51800: Support getTrait() API
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/51800/
-----------------------------------------------------------
Review request for atlas.
Repository: atlas
Description
-------
Given entity id and trait name, support rest API that returns the trait instance for the entity. Currently, the other way of getting it is getEntity() which returns full entity with all trait instances
Diffs
-----
webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java 82016d0
webapp/src/test/java/org/apache/atlas/web/resources/EntityJerseyResourceIT.java a1988ef
Diff: https://reviews.apache.org/r/51800/diff/
Testing
-------
Thanks,
Vimal Sharma
Re: Review Request 51800: Support getTrait() API
Posted by Vimal Sharma <vi...@hortonworks.com>.
> On Sept. 12, 2016, 2:07 p.m., David Radley wrote:
> > I am was thinking that a more intuitive API would be to follow the pattern used in the REST API for entities. So for entities with have .../entities/{entityguid}. So for consistancy we could have
> > .../entities/{entityguid}/traitnames which would return all the traitnames for the entity.
> > .../entities/{entityguid}/traitnames/{traitname} which would return the specified traitname for the entity.
It makes sense to have separate endpoints for all trait definitions and individual trait definition. I have made this change in the new patch.
- Vimal
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/51800/#review148487
-----------------------------------------------------------
On Sept. 12, 2016, 11:09 a.m., Vimal Sharma wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/51800/
> -----------------------------------------------------------
>
> (Updated Sept. 12, 2016, 11:09 a.m.)
>
>
> Review request for atlas.
>
>
> Repository: atlas
>
>
> Description
> -------
>
> Given entity id and trait name, support rest API that returns the trait instance for the entity. Currently, the other way of getting it is getEntity() which returns full entity with all trait instances
>
>
> Diffs
> -----
>
> webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java 82016d0
> webapp/src/test/java/org/apache/atlas/web/resources/EntityJerseyResourceIT.java a1988ef
>
> Diff: https://reviews.apache.org/r/51800/diff/
>
>
> Testing
> -------
>
>
> Thanks,
>
> Vimal Sharma
>
>
Re: Review Request 51800: Support getTrait() API
Posted by David Radley <da...@uk.ibm.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/51800/#review148487
-----------------------------------------------------------
I am was thinking that a more intuitive API would be to follow the pattern used in the REST API for entities. So for entities with have .../entities/{entityguid}. So for consistancy we could have
.../entities/{entityguid}/traitnames which would return all the traitnames for the entity.
.../entities/{entityguid}/traitnames/{traitname} which would return the specified traitname for the entity.
- David Radley
On Sept. 12, 2016, 11:09 a.m., Vimal Sharma wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/51800/
> -----------------------------------------------------------
>
> (Updated Sept. 12, 2016, 11:09 a.m.)
>
>
> Review request for atlas.
>
>
> Repository: atlas
>
>
> Description
> -------
>
> Given entity id and trait name, support rest API that returns the trait instance for the entity. Currently, the other way of getting it is getEntity() which returns full entity with all trait instances
>
>
> Diffs
> -----
>
> webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java 82016d0
> webapp/src/test/java/org/apache/atlas/web/resources/EntityJerseyResourceIT.java a1988ef
>
> Diff: https://reviews.apache.org/r/51800/diff/
>
>
> Testing
> -------
>
>
> Thanks,
>
> Vimal Sharma
>
>
Re: Review Request 51800: Support getTrait() API
Posted by Shwetha GS <ss...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/51800/#review149034
-----------------------------------------------------------
client/src/main/java/org/apache/atlas/AtlasClient.java (line 1000)
<https://reviews.apache.org/r/51800/#comment216570>
Return list<org.apache.atlas.typesystem.Struct>
client/src/main/java/org/apache/atlas/AtlasClient.java (line 1012)
<https://reviews.apache.org/r/51800/#comment216571>
Return org.apache.atlas.typesystem.Struct
webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java (line 658)
<https://reviews.apache.org/r/51800/#comment216572>
metadataService.getTraitDefinition() loads the whole entity everytime for every trait of the entity. This is in-efficient. Use getEntityDefinition() once and read all the traits from entity definition
You can also change metadataService.getTraitDefinition() to return org.apache.atlas.typesystem.Struct
- Shwetha GS
On Sept. 15, 2016, 6:53 a.m., Vimal Sharma wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/51800/
> -----------------------------------------------------------
>
> (Updated Sept. 15, 2016, 6:53 a.m.)
>
>
> Review request for atlas.
>
>
> Repository: atlas
>
>
> Description
> -------
>
> Given entity id and trait name, support rest API that returns the trait instance for the entity. Currently, the other way of getting it is getEntity() which returns full entity with all trait instances
>
>
> Diffs
> -----
>
> client/src/main/java/org/apache/atlas/AtlasClient.java 5ed79bc
> webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java 82016d0
> webapp/src/test/java/org/apache/atlas/web/resources/EntityJerseyResourceIT.java a1988ef
>
> Diff: https://reviews.apache.org/r/51800/diff/
>
>
> Testing
> -------
>
>
> File Attachments
> ----------------
>
> ATLAS-712-v2.patch
> https://reviews.apache.org/media/uploaded/files/2016/09/13/b5079426-19d0-48f2-88f7-08e4e645bb32__ATLAS-712-v2.patch
>
>
> Thanks,
>
> Vimal Sharma
>
>
Re: Review Request 51800: Support getTrait() API
Posted by Shwetha GS <ss...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/51800/#review149429
-----------------------------------------------------------
Fix it, then Ship it!
webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java (line 657)
<https://reviews.apache.org/r/51800/#comment217047>
Should be:
Referenceable entity = InstanceSerialization.fromJsonReferenceable(entityDefinition, true);
JSONArray traits = new JSONArray();
for (String traitName : entity.getTraits()) {
IStruct trait = entity.getTrait(traitName);
traits.put(new JSONObject(InstanceSerialization.toJson(trait, true)));
}
- Shwetha GS
On Sept. 16, 2016, 8:49 a.m., Vimal Sharma wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/51800/
> -----------------------------------------------------------
>
> (Updated Sept. 16, 2016, 8:49 a.m.)
>
>
> Review request for atlas.
>
>
> Repository: atlas
>
>
> Description
> -------
>
> Given entity id and trait name, support rest API that returns the trait instance for the entity. Currently, the other way of getting it is getEntity() which returns full entity with all trait instances
>
>
> Diffs
> -----
>
> client/src/main/java/org/apache/atlas/AtlasClient.java 5ed79bc
> repository/src/main/java/org/apache/atlas/services/DefaultMetadataService.java 6a937f4
> repository/src/test/java/org/apache/atlas/service/DefaultMetadataServiceTest.java 52dcfde
> server-api/src/main/java/org/apache/atlas/services/MetadataService.java 60d8790
> webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java 82016d0
> webapp/src/test/java/org/apache/atlas/web/resources/EntityJerseyResourceIT.java a1988ef
>
> Diff: https://reviews.apache.org/r/51800/diff/
>
>
> Testing
> -------
>
>
> File Attachments
> ----------------
>
> ATLAS-712-v2.patch
> https://reviews.apache.org/media/uploaded/files/2016/09/13/b5079426-19d0-48f2-88f7-08e4e645bb32__ATLAS-712-v2.patch
>
>
> Thanks,
>
> Vimal Sharma
>
>
Re: Review Request 51800: Support getTrait() API
Posted by Vimal Sharma <vi...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/51800/
-----------------------------------------------------------
(Updated Sept. 16, 2016, 8:49 a.m.)
Review request for atlas.
Repository: atlas
Description
-------
Given entity id and trait name, support rest API that returns the trait instance for the entity. Currently, the other way of getting it is getEntity() which returns full entity with all trait instances
Diffs (updated)
-----
client/src/main/java/org/apache/atlas/AtlasClient.java 5ed79bc
repository/src/main/java/org/apache/atlas/services/DefaultMetadataService.java 6a937f4
repository/src/test/java/org/apache/atlas/service/DefaultMetadataServiceTest.java 52dcfde
server-api/src/main/java/org/apache/atlas/services/MetadataService.java 60d8790
webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java 82016d0
webapp/src/test/java/org/apache/atlas/web/resources/EntityJerseyResourceIT.java a1988ef
Diff: https://reviews.apache.org/r/51800/diff/
Testing
-------
File Attachments
----------------
ATLAS-712-v2.patch
https://reviews.apache.org/media/uploaded/files/2016/09/13/b5079426-19d0-48f2-88f7-08e4e645bb32__ATLAS-712-v2.patch
Thanks,
Vimal Sharma
Re: Review Request 51800: Support getTrait() API
Posted by Vimal Sharma <vi...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/51800/
-----------------------------------------------------------
(Updated Sept. 15, 2016, 6:53 a.m.)
Review request for atlas.
Repository: atlas
Description
-------
Given entity id and trait name, support rest API that returns the trait instance for the entity. Currently, the other way of getting it is getEntity() which returns full entity with all trait instances
Diffs (updated)
-----
client/src/main/java/org/apache/atlas/AtlasClient.java 5ed79bc
webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java 82016d0
webapp/src/test/java/org/apache/atlas/web/resources/EntityJerseyResourceIT.java a1988ef
Diff: https://reviews.apache.org/r/51800/diff/
Testing
-------
File Attachments
----------------
ATLAS-712-v2.patch
https://reviews.apache.org/media/uploaded/files/2016/09/13/b5079426-19d0-48f2-88f7-08e4e645bb32__ATLAS-712-v2.patch
Thanks,
Vimal Sharma
Re: Review Request 51800: Support getTrait() API
Posted by Vimal Sharma <vi...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/51800/
-----------------------------------------------------------
(Updated Sept. 15, 2016, 6:52 a.m.)
Review request for atlas.
Repository: atlas
Description
-------
Given entity id and trait name, support rest API that returns the trait instance for the entity. Currently, the other way of getting it is getEntity() which returns full entity with all trait instances
Diffs
-----
webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java 82016d0
webapp/src/test/java/org/apache/atlas/web/resources/EntityJerseyResourceIT.java a1988ef
Diff: https://reviews.apache.org/r/51800/diff/
Testing
-------
File Attachments (updated)
----------------
ATLAS-712-v2.patch
https://reviews.apache.org/media/uploaded/files/2016/09/13/b5079426-19d0-48f2-88f7-08e4e645bb32__ATLAS-712-v2.patch
Thanks,
Vimal Sharma
Re: Review Request 51800: Support getTrait() API
Posted by Vimal Sharma <vi...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/51800/
-----------------------------------------------------------
(Updated Sept. 14, 2016, 8:16 a.m.)
Review request for atlas.
Repository: atlas
Description
-------
Given entity id and trait name, support rest API that returns the trait instance for the entity. Currently, the other way of getting it is getEntity() which returns full entity with all trait instances
Diffs
-----
webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java 82016d0
webapp/src/test/java/org/apache/atlas/web/resources/EntityJerseyResourceIT.java a1988ef
Diff: https://reviews.apache.org/r/51800/diff/
Testing
-------
File Attachments (updated)
----------------
ATLAS-712-v2.patch
https://reviews.apache.org/media/uploaded/files/2016/09/13/b5079426-19d0-48f2-88f7-08e4e645bb32__ATLAS-712-v2.patch
ATLAS-712-v3.patch
https://reviews.apache.org/media/uploaded/files/2016/09/14/462d4e5c-276c-40a0-b709-c946373856f2__ATLAS-712-v3.patch
Thanks,
Vimal Sharma
Re: Review Request 51800: Support getTrait() API
Posted by Vimal Sharma <vi...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/51800/
-----------------------------------------------------------
(Updated Sept. 13, 2016, 11:12 a.m.)
Review request for atlas.
Repository: atlas
Description
-------
Given entity id and trait name, support rest API that returns the trait instance for the entity. Currently, the other way of getting it is getEntity() which returns full entity with all trait instances
Diffs
-----
webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java 82016d0
webapp/src/test/java/org/apache/atlas/web/resources/EntityJerseyResourceIT.java a1988ef
Diff: https://reviews.apache.org/r/51800/diff/
Testing
-------
File Attachments (updated)
----------------
ATLAS-712-v2.patch
https://reviews.apache.org/media/uploaded/files/2016/09/13/b5079426-19d0-48f2-88f7-08e4e645bb32__ATLAS-712-v2.patch
Thanks,
Vimal Sharma