-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/62039/
-----------------------------------------------------------
(Updated Sept. 13, 2017, 9:32 p.m.)
Review request for atlas, Apoorv Naik, keval bhatt, Madhan Neethiraj, Nixon
Rodrigues, and Sarath Subramanian.
Changes
-------
Updates include:
- Internal types are now renamed to start with 2 underscores. Appropriate
changes are made to handle name validation.
- Internal entities are excluded from being full text search indexed.
- Internal entities are excluded from Kafka notification on _ATLAS_ENTITIES_
topic.
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 (updated)
-----
addons/models/0010-base_model.json 9ab4c44
common/src/main/java/org/apache/atlas/repository/Constants.java 62d74f8
intg/src/main/java/org/apache/atlas/AtlasErrorCode.java b20f586
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/graph/GraphHelper.java
ca7fad0
repository/src/main/java/org/apache/atlas/repository/orm/AbstractDataTransferObject.java
PRE-CREATION
repository/src/main/java/org/apache/atlas/repository/orm/DTORegistry.java
PRE-CREATION
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/orm/DataTransfer.java
PRE-CREATION
repository/src/main/java/org/apache/atlas/repository/orm/DataTransferObject.java
PRE-CREATION
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasAbstractDefStoreV1.java
2bf53a1
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityChangeNotifier.java
6423aea
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/orm/DataAccessHelperTest.java
PRE-CREATION
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/notification/NotificationEntityChangeListener.java
6eadc96
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/4/
Changes: https://reviews.apache.org/r/62039/diff/3-4/
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