-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/62039/#review184397
-----------------------------------------------------------




addons/models/0010-base_model.json
Lines 22 (patched)
<https://reviews.apache.org/r/62039/#comment260587>

    Good idea to use a marker interface to identify internal types. I think it 
will be helpful to use a prefix as well, like '__internal'.



addons/models/0011-user-profile_model.json
Lines 1 (patched)
<https://reviews.apache.org/r/62039/#comment260589>

    Consider adding these types to existing 0010-base_model.json, which has 
definitions for types that are essential for Atlas to function - like DataSet, 
Process.



addons/models/0011-user-profile_model.json
Lines 14 (patched)
<https://reviews.apache.org/r/62039/#comment260588>

    'name' attribute is missing?



addons/models/0011-user-profile_model.json
Lines 42 (patched)
<https://reviews.apache.org/r/62039/#comment260590>

    Is it necessary to have 'Referenceable' as a super-type for 
AtlasUserSavedSearch? The same for 'AtlasUserProfile' as well.



intg/src/main/java/org/apache/atlas/model/AtlasBaseModelObject.java
Lines 39 (patched)
<https://reviews.apache.org/r/62039/#comment260591>

    "AtlasBaseModelObject extends AtlasEntity"? This doesn't look right. Not 
all types derived from AtlasBaseModelObject will be an entity.



intg/src/main/java/org/apache/atlas/model/profile/AtlasUserProfile.java
Lines 56 (patched)
<https://reviews.apache.org/r/62039/#comment260592>

    This should be:
    
    Object objSavedSearches = 
entityWithExtInfo.getAttribute(PROPERTY_SAVED_SEARCHES);
    
    if (objSavedSearches instanceof Collection) {
      Collection collSavedSearches = (Collection)objSavedSearches;
      
      for (Object objSavedSearch : objSavedSearches) {
        if (objSavedSearch instanceof AtlasObjectId) {
          AtlasObjectId objId = (AtlasObjectId)objSavedSearch;
          
          AtlasEntity entSavedSearch = 
entityWithExtInfo.getReferredEntity(objId.getGuid());
          
          if (entSavedSearch != null) {
            this.savedSearches.add(new AtlasUserSavedSearch(savedSearch));
          }
        }
      }
    }


- Madhan Neethiraj


On Sept. 1, 2017, 10:01 p.m., Ashutosh Mestry wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/62039/
> -----------------------------------------------------------
> 
> (Updated Sept. 1, 2017, 10:01 p.m.)
> 
> 
> Review request for atlas, Apoorv Naik, keval bhatt, Madhan Neethiraj, Nixon 
> Rodrigues, and Sarath Subramanian.
> 
> 
> Bugs: ATLAS-2100
>     https://issues.apache.org/jira/browse/ATLAS-2100
> 
> 
> Repository: atlas
> 
> 
> Description
> -------
> 
> **Background**
> - The new search implementation allows for creation of complex queries.
> - This sub-feature allows for logged in user to persist search definitions 
> created during a session.
> - These search definition once saved are available to the user on subsequent 
> login.
> 
> **Implementation**
> Following implementation approaches were attempted:
> - New types defined in the models json.
> - _Data Access Layer_: This is semi-generic approach that needs some code per 
> implementation.
> - _AtlasEntity_ adapters: This implementation leverages existing type system 
> to create new types. The model is a facade over _AtlasEntity_. 
> - Added REST-layer filtering for internal types.
> - Modified _SearchFilter_ more capable. 
> 
> **_New Entities_**
> - _AtlasUserProfile_
> - _AtlasSavedSearch_
> 
> **_UserProfileService_**
> - Interacts with the new entities and adds operations that are exposed by 
> REST APIs.
> 
> **_DiscoveryService_**
> - New methods added.
> 
> **Retrieve list of all Saved Searches**
> ```
> curl -g -X GET -u admin:admin -H "Content-Type: application/json" -H 
> "Cache-Control: no-cache"  "http://localhost:21000/api/atlas/v2/search/saved";
> ```
> 
> **Save Search**
> Save this to _savedSearch.json_:
> ```javascript
> {
>     "name": "my_search1",
>     "owerUserName": "admin",
>     "guid": "61613c37-cab8-4ee9-b3e7-590d0694f6e8",
>     "searchParameter": {
>         "typeName": "hive_table",
>         "excludeDeletedEntities": false,
>         "limit": 25,
>         "offset": 0,
>         "entityFilters": {
>             "condition": "AND",
>             "criterion": [
>                 {
>                     "attributeName": "retention",
>                     "operator": "=",
>                     "attributeValue": "10"
>                 },
>                 {
>                     "condition": "OR",
>                     "criterion": [
>                         {
>                             "attributeName": "createTime",
>                             "operator": ">",
>                             "attributeValue": "1111111111"
>                         },
>                         {
>                             "attributeName": "lastAccessTime",
>                             "operator": "<=",
>                             "attributeValue": "2222222222"
>                         }
>                     ]
>                 }
>             ]
>         }
>     }
> }
> ```
> 
> ```javascript
> curl -g -X POST -u admin:admin -H "Content-Type: application/json" -H 
> "Cache-Control: no-cache"  "http://localhost:21000/api/atlas/v2/search/save"; 
> -d @../docs/savedSearch.json
> ```
> 
> **Update Saved Search**
> This will work on existing saved search. Ensure that the parmeter has _guid_ 
> property set.
> 
> ```javascript
> curl -g -X PUT -u admin:admin -H "Content-Type: application/json" -H 
> "Cache-Control: no-cache"  "http://localhost:21000/api/atlas/v2/search/save"; 
> -d @../docs/savedSearch.json
> ```
> 
> **Retrieve Saved Search**
> All searches for the logged in user:
> ```javascript
> curl -g -X GET -u admin:admin -H "Content-Type: application/json" -H 
> "Cache-Control: no-cache"  "http://localhost:21000/api/atlas/v2/search/saved";
> ```
> 
> Specific search for logged in user:
> ```javascript
> curl -g -X GET -u admin:admin -H "Content-Type: application/json" -H 
> "Cache-Control: no-cache"  
> "http://localhost:21000/api/atlas/v2/search/saved/my_search2";
> ```
> 
> Specific search for a specific user:
> ```javascript
> curl -g -X GET -u admin:admin -H "Content-Type: application/json" -H 
> "Cache-Control: no-cache"  
> "http://localhost:21000/api/atlas/v2/search/saved/my_search2?user=admin";
> ```
> 
> **Delete Saved Search**
> ```javascript
> curl -g -X DELETE -u admin:admin -H "Content-Type: application/json" -H 
> "Cache-Control: no-cache"  
> "http://localhost:21000/api/atlas/v2/search/saved/0d0f75ef-b101-466f-843e-60196b81c98e";
> ```
> 
> **REST APIs**
> Irrespective of the plumbing, REST APIs will hide the underlying 
> implementation.
> 
> _AtlasUserProfile_
> 
> ```javascript
> {
> "username": "admin"
> "fullName" : "Admin Admin" 
> "savedSearchParameters": [
>      <array of _AtlasSavedSearch_>
>   ]
> }
> ```
> 
> _AtlasSavedSearch_
> 
> ```javascript
> {
>    "name": "my_search1",
>    "ownerUserName": "admin",
>    "searchParameters": <SearchParameter JSON here> 
> }
> ```
> 
> 
> Diffs
> -----
> 
>   addons/models/0010-base_model.json 7f64d85 
>   addons/models/0011-user-profile_model.json PRE-CREATION 
>   intg/src/main/java/org/apache/atlas/AtlasErrorCode.java aa8e3f4 
>   intg/src/main/java/org/apache/atlas/model/AtlasBaseModelObject.java 
> PRE-CREATION 
>   intg/src/main/java/org/apache/atlas/model/SearchFilter.java 7dccf5e 
>   intg/src/main/java/org/apache/atlas/model/profile/AtlasUserProfile.java 
> PRE-CREATION 
>   intg/src/main/java/org/apache/atlas/model/profile/AtlasUserSavedSearch.java 
> PRE-CREATION 
>   
> repository/src/main/java/org/apache/atlas/discovery/AtlasDiscoveryService.java
>  8196a67 
>   
> repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java
>  1e68835 
>   repository/src/main/java/org/apache/atlas/repository/orm/DataAccess.java 
> PRE-CREATION 
>   
> repository/src/main/java/org/apache/atlas/repository/orm/DataAccessHelper.java
>  PRE-CREATION 
>   
> repository/src/main/java/org/apache/atlas/repository/userprofile/UserProfileService.java
>  PRE-CREATION 
>   repository/src/main/java/org/apache/atlas/repository/util/FilterUtil.java 
> 54d6b40 
>   
> repository/src/test/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStoreTest.java
>  728d418 
>   
> repository/src/test/java/org/apache/atlas/repository/userprofile/UserProfileServiceTest.java
>  PRE-CREATION 
>   webapp/src/main/java/org/apache/atlas/web/rest/DiscoveryREST.java 52258e3 
>   webapp/src/main/java/org/apache/atlas/web/rest/TypesREST.java c32f36e 
>   webapp/src/main/java/org/apache/atlas/web/util/Servlets.java 4a92763 
> 
> 
> Diff: https://reviews.apache.org/r/62039/diff/2/
> 
> 
> Testing
> -------
> 
> **Deployment**
> - Copy _0010-base_model.json_ & _0011-user-profile_model.json_ to server 
> location: _/usr/hdp/current/atlas-server/models_
> - Deploy _atlas.war_
> 
> **Unit tests**
> Added unit tests for:
> - _UserProfileService_.
> 
> **Functional testing**
> - Verification using CURL calls.
> 
> 
> Thanks,
> 
> Ashutosh Mestry
> 
>

Reply via email to