Java Code Examples for org.apache.atlas.model.discovery.SearchParameters#setIncludeSubClassifications()
The following examples show how to use
org.apache.atlas.model.discovery.SearchParameters#setIncludeSubClassifications() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestEntitiesREST.java From atlas with Apache License 2.0 | 5 votes |
@Test public void testBasicSearch() throws Exception { // search entities with classification named classification searchParameters = new SearchParameters(); searchParameters.setIncludeSubClassifications(true); searchParameters.setClassification(TestUtilsV2.CLASSIFICATION); AtlasSearchResult res = discoveryREST.searchWithParameters(searchParameters); Assert.assertNotNull(res.getEntities()); Assert.assertEquals(res.getEntities().size(), 2); }
Example 2
Source File: TestEntitiesREST.java From atlas with Apache License 2.0 | 5 votes |
@Test(dependsOnMethods = "testBasicSearchWithAttr") public void testBasicSearchWithSubTypes() throws Exception{ // table - classification // column - phi searchParameters = new SearchParameters(); searchParameters.setClassification(TestUtilsV2.CLASSIFICATION); searchParameters.setIncludeSubClassifications(true); AtlasSearchResult res = discoveryREST.searchWithParameters(searchParameters); Assert.assertNotNull(res.getEntities()); Assert.assertEquals(res.getEntities().size(), 2); // table - classification // database - fetl_classification // column - phi addTagTo(FETL_CLASSIFICATION, DATABASE_TYPE); final AtlasClassification result_tag = entityREST.getClassification(createdGuids.get(DATABASE_TYPE).get(0), TestUtilsV2.FETL_CLASSIFICATION); Assert.assertNotNull(result_tag); Assert.assertEquals(result_tag.getTypeName(), FETL_CLASSIFICATION); // basic search with subtypes res = discoveryREST.searchWithParameters(searchParameters); Assert.assertNotNull(res.getEntities()); Assert.assertEquals(res.getEntities().size(), 3); // basic search without subtypes searchParameters.setIncludeSubClassifications(false); res = discoveryREST.searchWithParameters(searchParameters); Assert.assertNotNull(res.getEntities()); Assert.assertEquals(res.getEntities().size(), 2); }
Example 3
Source File: TestEntitiesREST.java From atlas with Apache License 2.0 | 5 votes |
@Test(dependsOnMethods = "testGraphQueryFilter") public void testSearchByMultiTags() throws Exception { addTagTo(PHI, DATABASE_TYPE); // database - phi, felt_classification // table1 - phi, classification, table2 - classification, // column - phi searchParameters = new SearchParameters(); searchParameters.setIncludeSubClassifications(false); searchParameters.setTypeName("_ALL_ENTITY_TYPES"); SearchParameters.FilterCriteria fc = new SearchParameters.FilterCriteria(); SearchParameters.FilterCriteria subFc1 = new SearchParameters.FilterCriteria(); SearchParameters.FilterCriteria subFc2 = new SearchParameters.FilterCriteria(); subFc1.setAttributeName(CLASSIFICATION_NAMES_KEY); subFc1.setOperator(SearchParameters.Operator.CONTAINS); subFc1.setAttributeValue(PHI); subFc2.setAttributeName(CLASSIFICATION_NAMES_KEY); subFc2.setOperator(SearchParameters.Operator.CONTAINS); subFc2.setAttributeValue(CLASSIFICATION); fc.setCriterion(Arrays.asList(subFc1, subFc2)); fc.setCondition(AND); searchParameters.setEntityFilters(fc); AtlasSearchResult res = discoveryREST.searchWithParameters(searchParameters); Assert.assertNotNull(res.getEntities()); Assert.assertEquals(res.getEntities().size(), 2); subFc2.setAttributeValue(FETL_CLASSIFICATION); res = discoveryREST.searchWithParameters(searchParameters); Assert.assertNotNull(res.getEntities()); Assert.assertEquals(res.getEntities().size(), 1); }
Example 4
Source File: TestEntitiesREST.java From atlas with Apache License 2.0 | 5 votes |
@Test(dependsOnMethods = "testSearchByOtherSystemAttributes") public void testBasicSearchWithFilter() throws Exception { // database - phi, felt_classification // table1 - phi, classification, table2 - classification, // col - phi searchParameters = new SearchParameters(); searchParameters.setIncludeSubClassifications(false); searchParameters.setClassification(TestUtilsV2.CLASSIFICATION); SearchParameters.FilterCriteria fc = new SearchParameters.FilterCriteria(); fc.setOperator(SearchParameters.Operator.CONTAINS); fc.setAttributeValue("new comments"); fc.setAttributeName("tag"); searchParameters.setTagFilters(fc); AtlasSearchResult res = discoveryREST.searchWithParameters(searchParameters); Assert.assertNull(res.getEntities()); fc.setOperator(SearchParameters.Operator.ENDS_WITH); res = discoveryREST.searchWithParameters(searchParameters); Assert.assertNull(res.getEntities()); fc.setOperator(SearchParameters.Operator.STARTS_WITH); res = discoveryREST.searchWithParameters(searchParameters); Assert.assertNull(res.getEntities()); }