Re: Review Request 51800: Support getTrait() API

2016-09-18 Thread Shwetha GS

---
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)


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

2016-09-16 Thread Vimal Sharma

---
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

2016-09-15 Thread Shwetha GS

---
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)


Return list



client/src/main/java/org/apache/atlas/AtlasClient.java (line 1012)


Return org.apache.atlas.typesystem.Struct



webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java (line 
658)


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

2016-09-14 Thread Vimal Sharma

---
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

2016-09-14 Thread Vimal Sharma

---
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

2016-09-14 Thread Vimal Sharma

---
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

2016-09-13 Thread Vimal Sharma

---
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



Re: Review Request 51800: Support getTrait() API

2016-09-13 Thread Vimal Sharma


> 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

2016-09-12 Thread David Radley

---
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
> 
>



Review Request 51800: Support getTrait() API

2016-09-12 Thread Vimal Sharma

---
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