atlas-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ashutosh Mestry <ames...@hortonworks.com>
Subject Re: Review Request 62039: ATLAS-2100: UserProfile & SavedSearch Implementation
Date Sat, 16 Sep 2017 20:52:31 GMT

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

(Updated Sept. 16, 2017, 8:52 p.m.)


Review request for atlas, Apoorv Naik, keval bhatt, Madhan Neethiraj, Nixon Rodrigues, and
Sarath Subramanian.


Changes
-------

Updates include:
- Addressed review comments (Thanks Madhan!)
- Additional unit tests.
- Minor refactoring.


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",
    "searchParameters": {
        "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 (updated)
-----

  addons/models/0010-base_model.json 9ab4c44f 
  common/src/main/java/org/apache/atlas/repository/Constants.java 62d74f8f 
  intg/src/main/java/org/apache/atlas/AtlasErrorCode.java b20f5865 
  intg/src/main/java/org/apache/atlas/model/AtlasBaseModelObject.java PRE-CREATION 
  intg/src/main/java/org/apache/atlas/model/SearchFilter.java 7dccf5ef 
  intg/src/main/java/org/apache/atlas/model/discovery/SearchParameters.java c79b5b90 
  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 8196a674

  repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java 1e688350

  repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java ca7fad06 
  repository/src/main/java/org/apache/atlas/repository/ogm/AbstractDataTransferObject.java
PRE-CREATION 
  repository/src/main/java/org/apache/atlas/repository/ogm/AtlasSavedSearchDTO.java PRE-CREATION

  repository/src/main/java/org/apache/atlas/repository/ogm/AtlasUserProfileDTO.java PRE-CREATION

  repository/src/main/java/org/apache/atlas/repository/ogm/DTORegistry.java PRE-CREATION 
  repository/src/main/java/org/apache/atlas/repository/ogm/DataAccess.java PRE-CREATION 
  repository/src/main/java/org/apache/atlas/repository/ogm/DataTransferObject.java PRE-CREATION

  repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasAbstractDefStoreV1.java
2bf53a1d 
  repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityChangeNotifier.java
6423aeab 
  repository/src/main/java/org/apache/atlas/repository/userprofile/UserProfileService.java
PRE-CREATION 
  repository/src/main/java/org/apache/atlas/repository/util/FilterUtil.java 54d6b405 
  repository/src/test/java/org/apache/atlas/TestModules.java af3189b9 
  repository/src/test/java/org/apache/atlas/repository/userprofile/UserProfileServiceTest.java
PRE-CREATION 
  webapp/src/main/java/org/apache/atlas/notification/NotificationEntityChangeListener.java
6eadc967 
  webapp/src/main/java/org/apache/atlas/web/rest/DiscoveryREST.java 52258e3c 
  webapp/src/main/java/org/apache/atlas/web/rest/TypesREST.java c32f36ea 
  webapp/src/main/java/org/apache/atlas/web/util/Servlets.java 4a92763a 


Diff: https://reviews.apache.org/r/62039/diff/7/

Changes: https://reviews.apache.org/r/62039/diff/6-7/


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.
- Verification via UI to ensure that internal entities do not show up.


File Attachments
----------------

Patch for Master
  https://reviews.apache.org/media/uploaded/files/2017/09/15/ba9b07c2-5868-4f79-ad51-7d7c9ee39c44__ATLAS-2100-Master-DataAccess.patch


Thanks,

Ashutosh Mestry


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message