atlas-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yhema...@apache.org
Subject [1/2] incubator-atlas git commit: ATLAS-794 Business Catalog Update (jspeidel via yhemanth)
Date Tue, 14 Jun 2016 05:07:05 GMT
Repository: incubator-atlas
Updated Branches:
  refs/heads/master 5b627b5a1 -> 056044a9f


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/056044a9/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index 8cbdecc..1698b47 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -22,6 +22,7 @@ ATLAS-409 Atlas will not import avro tables with schema read from a file
(dosset
 ATLAS-379 Create sqoop and falcon metadata addons (venkatnrangan,bvellanki,sowmyaramesh via
shwethags)
 
 ALL CHANGES:
+ATLAS-794 Business Catalog Update (jspeidel via yhemanth)
 ATLAS-837 Enhance Sqoop addon to handle export operation (venkatnrangan via shwethags)
 ATLAS-869 Make LDAP/AD properties to be configurable. (nixonrodrigues via yhemanth)
 ATLAS-730 Change titan hbase table name (svimal2106 via sumasai )

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/056044a9/webapp/src/main/java/org/apache/atlas/web/resources/BaseService.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/resources/BaseService.java b/webapp/src/main/java/org/apache/atlas/web/resources/BaseService.java
index 2a65538..d43c8cc 100644
--- a/webapp/src/main/java/org/apache/atlas/web/resources/BaseService.java
+++ b/webapp/src/main/java/org/apache/atlas/web/resources/BaseService.java
@@ -73,6 +73,15 @@ public abstract class BaseService {
         }
     }
 
+    protected void updateResource(ResourceProvider provider, Request request) throws CatalogException
{
+        initializeGraphTransaction();
+        try {
+            provider.updateResourceById(request);
+        } catch (RuntimeException e) {
+            throw wrapRuntimeException(e);
+        }
+    }
+
     protected void deleteResource(ResourceProvider provider, Request request) throws CatalogException
{
         initializeGraphTransaction();
         try {

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/056044a9/webapp/src/main/java/org/apache/atlas/web/resources/TaxonomyService.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/resources/TaxonomyService.java b/webapp/src/main/java/org/apache/atlas/web/resources/TaxonomyService.java
index f995198..d84f8a2 100644
--- a/webapp/src/main/java/org/apache/atlas/web/resources/TaxonomyService.java
+++ b/webapp/src/main/java/org/apache/atlas/web/resources/TaxonomyService.java
@@ -90,6 +90,23 @@ public class TaxonomyService extends BaseService {
                 new Results(ui.getRequestUri().toString(), 201)).build();
     }
 
+    @PUT
+    @Path("{taxonomyName}")
+    @Produces(Servlets.JSON_MEDIA_TYPE)
+    public Response updateTaxonomy(String body,
+                                   @Context HttpHeaders headers,
+                                   @Context UriInfo ui,
+                                   @PathParam("taxonomyName") String taxonomyName) throws
CatalogException {
+
+        Map<String, Object> queryProperties = new HashMap<>();
+        queryProperties.put("name", taxonomyName);
+        Map<String, Object> updateProperties = parsePayload(body);
+        updateResource(taxonomyResourceProvider, new InstanceRequest(queryProperties, updateProperties));
+
+        return Response.status(Response.Status.OK).entity(
+                new Results(ui.getRequestUri().toString(), 200)).build();
+    }
+
     @DELETE
     @Path("{taxonomyName}")
     @Produces(Servlets.JSON_MEDIA_TYPE)
@@ -207,6 +224,46 @@ public class TaxonomyService extends BaseService {
                 new Results(ui.getRequestUri().toString(), 201)).build();
     }
 
+    @PUT
+    @Path("{taxonomyName}/terms/{termName}")
+    @Produces(Servlets.JSON_MEDIA_TYPE)
+    public Response updateTerm(String body,
+                               @Context HttpHeaders headers,
+                               @Context UriInfo ui,
+                               @PathParam("taxonomyName") String taxonomyName,
+                               @PathParam("termName") String termName) throws CatalogException
{
+
+        Map<String, Object> queryProperties = new HashMap<>();
+        queryProperties.put("termPath", new TermPath(taxonomyName, termName));
+
+        Map<String, Object> updateProperties = parsePayload(body);
+        updateResource(termResourceProvider, new InstanceRequest(queryProperties, updateProperties));
+
+        return Response.status(Response.Status.OK).entity(
+                new Results(ui.getRequestUri().toString(), 200)).build();
+    }
+
+    @PUT
+    @Path("{taxonomyName}/terms/{termName}/{remainder:.*}")
+    @Produces(Servlets.JSON_MEDIA_TYPE)
+    public Response updateSubTerm(String body,
+                                  @Context HttpHeaders headers,
+                                  @Context UriInfo ui,
+                                  @PathParam("taxonomyName") String taxonomyName,
+                                  @PathParam("termName") String termName,
+                                  @PathParam("remainder") String remainder) throws CatalogException
{
+
+        Map<String, Object> queryProperties = new HashMap<>();
+        queryProperties.put("termPath", new TermPath(taxonomyName, String.format("%s%s",
termName,
+                remainder.replaceAll("/?terms/?([.]*)", "$1."))));
+
+        Map<String, Object> updateProperties = parsePayload(body);
+        updateResource(termResourceProvider, new InstanceRequest(queryProperties, updateProperties));
+
+        return Response.status(Response.Status.OK).entity(
+                new Results(ui.getRequestUri().toString(), 200)).build();
+    }
+
     @DELETE
     @Path("{taxonomyName}/terms/{termName}")
     @Produces(Servlets.JSON_MEDIA_TYPE)

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/056044a9/webapp/src/test/java/org/apache/atlas/web/resources/TaxonomyServiceTest.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/web/resources/TaxonomyServiceTest.java
b/webapp/src/test/java/org/apache/atlas/web/resources/TaxonomyServiceTest.java
index a967805..b2ff4cf 100644
--- a/webapp/src/test/java/org/apache/atlas/web/resources/TaxonomyServiceTest.java
+++ b/webapp/src/test/java/org/apache/atlas/web/resources/TaxonomyServiceTest.java
@@ -65,7 +65,7 @@ public class TaxonomyServiceTest {
         assertTrue(service.wasTransactionInitialized());
 
         Request request = requestCapture.getValue();
-        Map<String, Object> requestProperties = request.getProperties();
+        Map<String, Object> requestProperties = request.getQueryProperties();
         assertEquals(requestProperties.size(), 1);
         assertEquals(requestProperties.get("name"), taxonomyName);
 
@@ -105,7 +105,7 @@ public class TaxonomyServiceTest {
         assertTrue(service.wasTransactionInitialized());
 
         Request request = requestCapture.getValue();
-        assertTrue(request.getProperties().isEmpty());
+        assertTrue(request.getQueryProperties().isEmpty());
         assertEquals(request.getQueryString(), "name:testTaxonomy");
 
         assertEquals(response.getStatus(), 200);
@@ -137,9 +137,9 @@ public class TaxonomyServiceTest {
         assertTrue(service.wasTransactionInitialized());
 
         Request request = requestCapture.getValue();
-        assertEquals(request.getProperties().size(), 2);
-        assertEquals(request.getProperties().get("name"), "testTaxonomy");
-        assertEquals(request.getProperties().get("description"), "test description");
+        assertEquals(request.getQueryProperties().size(), 2);
+        assertEquals(request.getQueryProperties().get("name"), "testTaxonomy");
+        assertEquals(request.getQueryProperties().get("description"), "test description");
         assertNull(request.getQueryString());
 
         assertEquals(response.getStatus(), 201);
@@ -172,8 +172,8 @@ public class TaxonomyServiceTest {
         assertTrue(service.wasTransactionInitialized());
 
         Request request = requestCapture.getValue();
-        assertEquals(request.getProperties().size(), 1);
-        assertEquals(request.getProperties().get("name"), "testTaxonomy");
+        assertEquals(request.getQueryProperties().size(), 1);
+        assertEquals(request.getQueryProperties().get("name"), "testTaxonomy");
         assertNull(request.getQueryString());
 
         assertEquals(response.getStatus(), 200);
@@ -212,9 +212,9 @@ public class TaxonomyServiceTest {
         assertTrue(service.wasTransactionInitialized());
 
         Request request = requestCapture.getValue();
-        Map<String, Object> requestProperties = request.getProperties();
+        Map<String, Object> requestProperties = request.getQueryProperties();
         assertEquals(requestProperties.size(), 1);
-        TermPath termPath = (TermPath) request.getProperties().get("termPath");
+        TermPath termPath = (TermPath) request.getQueryProperties().get("termPath");
         assertEquals(termPath.getFullyQualifiedName(), "testTaxonomy.testTaxonomy.termName");
 
         assertEquals(response.getStatus(), 200);
@@ -253,8 +253,8 @@ public class TaxonomyServiceTest {
         assertTrue(service.wasTransactionInitialized());
 
         Request request = requestCapture.getValue();
-        assertEquals(request.getProperties().size(), 1);
-        TermPath termPath = (TermPath) request.getProperties().get("termPath");
+        assertEquals(request.getQueryProperties().size(), 1);
+        TermPath termPath = (TermPath) request.getQueryProperties().get("termPath");
         assertEquals(termPath.getFullyQualifiedName(), "testTaxonomy");
         assertEquals(request.getQueryString(), "name:testTaxonomy.testTerm");
 
@@ -301,8 +301,8 @@ public class TaxonomyServiceTest {
         assertTrue(service.wasTransactionInitialized());
 
         Request request = requestCapture.getValue();
-        assertEquals(request.getProperties().size(), 1);
-        TermPath termPath = (TermPath) request.getProperties().get("termPath");
+        assertEquals(request.getQueryProperties().size(), 1);
+        TermPath termPath = (TermPath) request.getQueryProperties().get("termPath");
         assertEquals(termPath.getFullyQualifiedName(), "testTaxonomy.testTerm.testTerm2");
         assertNull(request.getQueryString());
 
@@ -352,8 +352,8 @@ public class TaxonomyServiceTest {
         assertTrue(service.wasTransactionInitialized());
 
         Request request = requestCapture.getValue();
-        assertEquals(request.getProperties().size(), 1);
-        TermPath termPath = (TermPath) request.getProperties().get("termPath");
+        assertEquals(request.getQueryProperties().size(), 1);
+        TermPath termPath = (TermPath) request.getQueryProperties().get("termPath");
         assertEquals(termPath.getFullyQualifiedName(), "testTaxonomy.testTerm.testTerm2.");
         assertEquals(request.getQueryString(), "name:testTaxonomy.testTerm.testTerm2.testTerm3");
 
@@ -389,9 +389,9 @@ public class TaxonomyServiceTest {
         assertTrue(service.wasTransactionInitialized());
 
         Request request = requestCapture.getValue();
-        assertEquals(request.getProperties().size(), 2);
-        assertEquals(request.getProperties().get("description"), "test description");
-        TermPath termPath = (TermPath) request.getProperties().get("termPath");
+        assertEquals(request.getQueryProperties().size(), 2);
+        assertEquals(request.getQueryProperties().get("description"), "test description");
+        TermPath termPath = (TermPath) request.getQueryProperties().get("termPath");
         assertEquals(termPath.getFullyQualifiedName(), "testTaxonomy.testTerm");
         assertNull(request.getQueryString());
 
@@ -428,9 +428,9 @@ public class TaxonomyServiceTest {
         assertTrue(service.wasTransactionInitialized());
 
         Request request = requestCapture.getValue();
-        assertEquals(request.getProperties().size(), 2);
-        assertEquals(request.getProperties().get("description"), "test description");
-        TermPath termPath = (TermPath) request.getProperties().get("termPath");
+        assertEquals(request.getQueryProperties().size(), 2);
+        assertEquals(request.getQueryProperties().get("description"), "test description");
+        TermPath termPath = (TermPath) request.getQueryProperties().get("termPath");
         assertEquals(termPath.getFullyQualifiedName(), "testTaxonomy.testTerm.testTerm2");
         assertNull(request.getQueryString());
 
@@ -464,8 +464,8 @@ public class TaxonomyServiceTest {
         assertTrue(service.wasTransactionInitialized());
 
         Request request = requestCapture.getValue();
-        assertEquals(request.getProperties().size(), 1);
-        TermPath termPath = (TermPath) request.getProperties().get("termPath");
+        assertEquals(request.getQueryProperties().size(), 1);
+        TermPath termPath = (TermPath) request.getQueryProperties().get("termPath");
         assertEquals(termPath.getFullyQualifiedName(), "testTaxonomy.testTerm");
         assertNull(request.getQueryString());
 
@@ -499,8 +499,8 @@ public class TaxonomyServiceTest {
         assertTrue(service.wasTransactionInitialized());
 
         Request request = requestCapture.getValue();
-        assertEquals(request.getProperties().size(), 1);
-        TermPath termPath = (TermPath) request.getProperties().get("termPath");
+        assertEquals(request.getQueryProperties().size(), 1);
+        TermPath termPath = (TermPath) request.getQueryProperties().get("termPath");
         assertEquals(termPath.getFullyQualifiedName(), "testTaxonomy.testTerm.testTerm2");
         assertNull(request.getQueryString());
 


Mime
View raw message