atlas-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shweth...@apache.org
Subject [2/5] incubator-atlas git commit: ATLAS-819 All user defined types should have a set of common attributes (shwethags)
Date Tue, 21 Jun 2016 05:41:37 GMT
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d838cf38/webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java b/webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java
index 0713d30..7646534 100755
--- a/webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java
+++ b/webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java
@@ -35,7 +35,6 @@ import org.apache.atlas.typesystem.types.ValueConversionException;
 import org.apache.atlas.utils.ParamChecker;
 import org.apache.atlas.web.util.Servlets;
 import org.apache.commons.lang.StringUtils;
-import org.apache.http.protocol.HTTP;
 import org.codehaus.jettison.json.JSONArray;
 import org.codehaus.jettison.json.JSONException;
 import org.codehaus.jettison.json.JSONObject;
@@ -121,9 +120,10 @@ public class EntityResource {
             }
 
             entityJson = AtlasClient.toString(new JSONArray(entities));
-            LOG.debug("submitting entities {} ", entityJson);
+            LOG.info("submitting entities {} ", entityJson);
 
             final List<String> guids = metadataService.createEntities(entities);
+            LOG.info("Created entities {}", guids);
             JSONObject response = getResponse(new AtlasClient.EntityResult(guids, null, null));
 
             URI locationURI = getLocationURI(guids);
@@ -189,9 +189,11 @@ public class EntityResource {
             final String entities = Servlets.getRequestPayload(request);
 
             entityJson = AtlasClient.toString(new JSONArray(entities));
-            LOG.debug("updating entities {} ", entityJson);
+            LOG.info("updating entities {} ", entityJson);
 
             AtlasClient.EntityResult entityResult = metadataService.updateEntities(entities);
+            LOG.info("Updated entities: {}", entityResult);
+
             JSONObject response = getResponse(entityResult);
             return Response.ok(response).build();
         } catch(EntityExistsException e) {
@@ -253,13 +255,14 @@ public class EntityResource {
         try {
             entityJson = Servlets.getRequestPayload(request);
 
-            LOG.debug("Partially updating entity by unique attribute {} {} {} {} ", entityType,
attribute, value, entityJson);
+            LOG.info("Partially updating entity by unique attribute {} {} {} {} ", entityType,
attribute, value, entityJson);
 
             Referenceable updatedEntity =
                 InstanceSerialization.fromJsonReferenceable(entityJson, true);
 
             AtlasClient.EntityResult entityResult =
                     metadataService.updateEntityByUniqueAttribute(entityType, attribute,
value, updatedEntity);
+            LOG.info("Updated entities: {}", entityResult);
 
             JSONObject response = getResponse(entityResult);
             return Response.ok(response).build();
@@ -308,11 +311,14 @@ public class EntityResource {
         try {
             ParamChecker.notEmpty(guid, "Guid property cannot be null");
             entityJson = Servlets.getRequestPayload(request);
-            LOG.debug("partially updating entity for guid {} : {} ", guid, entityJson);
+            LOG.info("partially updating entity for guid {} : {} ", guid, entityJson);
 
             Referenceable updatedEntity =
                     InstanceSerialization.fromJsonReferenceable(entityJson, true);
+
             AtlasClient.EntityResult entityResult = metadataService.updateEntityPartialByGuid(guid,
updatedEntity);
+            LOG.info("Updated entities: {}", entityResult);
+
             JSONObject response = getResponse(entityResult);
             return Response.ok(response).build();
         } catch (EntityNotFoundException e) {
@@ -344,7 +350,10 @@ public class EntityResource {
             value = Servlets.getRequestPayload(request);
             Preconditions.checkNotNull(value, "Entity value cannot be null");
 
+            LOG.info("Updating entity {} for property {} = {}", guid, property, value);
             AtlasClient.EntityResult entityResult = metadataService.updateEntityAttributeByGuid(guid,
property, value);
+            LOG.info("Updated entities: {}", entityResult);
+
             JSONObject response = getResponse(entityResult);
             return Response.ok(response).build();
         } catch (EntityNotFoundException e) {
@@ -381,10 +390,13 @@ public class EntityResource {
         try {
             AtlasClient.EntityResult entityResult;
             if (guids != null && !guids.isEmpty()) {
+                LOG.info("Deleting entities {}", guids);
                 entityResult = metadataService.deleteEntities(guids);
             } else {
+                LOG.info("Deleting entity type={} with property {}={}", entityType, attribute,
value);
                 entityResult = metadataService.deleteEntityByUniqueAttribute(entityType,
attribute, value);
             }
+            LOG.info("Deleted entity result: {}", entityResult);
             JSONObject response = getResponse(entityResult);
             return Response.ok(response).build();
         } catch (EntityNotFoundException e) {
@@ -579,7 +591,7 @@ public class EntityResource {
         String traitDefinition = null;
         try {
             traitDefinition = Servlets.getRequestPayload(request);
-            LOG.debug("Adding trait={} for entity={} ", traitDefinition, guid);
+            LOG.info("Adding trait={} for entity={} ", traitDefinition, guid);
             metadataService.addTrait(guid, traitDefinition);
 
             URI locationURI = getLocationURI(new ArrayList<String>() {{
@@ -614,7 +626,7 @@ public class EntityResource {
     @Produces(Servlets.JSON_MEDIA_TYPE)
     public Response deleteTrait(@Context HttpServletRequest request, @PathParam("guid") String
guid,
             @PathParam(TRAIT_NAME) String traitName) {
-        LOG.debug("Deleting trait={} from entity={} ", traitName, guid);
+        LOG.info("Deleting trait={} from entity={} ", traitName, guid);
         try {
             metadataService.deleteTrait(guid, traitName);
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d838cf38/webapp/src/main/java/org/apache/atlas/web/resources/TypesResource.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/resources/TypesResource.java b/webapp/src/main/java/org/apache/atlas/web/resources/TypesResource.java
index 74d89ce..d105c1e 100755
--- a/webapp/src/main/java/org/apache/atlas/web/resources/TypesResource.java
+++ b/webapp/src/main/java/org/apache/atlas/web/resources/TypesResource.java
@@ -82,7 +82,7 @@ public class TypesResource {
     public Response submit(@Context HttpServletRequest request) {
         try {
             final String typeDefinition = Servlets.getRequestPayload(request);
-            LOG.debug("Creating type with definition {} ", typeDefinition);
+            LOG.info("Creating type with definition {} ", typeDefinition);
 
             JSONObject typesJson = metadataService.createType(typeDefinition);
             final JSONArray typesJsonArray = typesJson.getJSONArray(AtlasClient.TYPES);
@@ -126,7 +126,7 @@ public class TypesResource {
     public Response update(@Context HttpServletRequest request) {
         try {
             final String typeDefinition = Servlets.getRequestPayload(request);
-            LOG.debug("Updating type with definition {} ", typeDefinition);
+            LOG.info("Updating type with definition {} ", typeDefinition);
 
             JSONObject typesJson = metadataService.updateType(typeDefinition);
             final JSONArray typesJsonArray = typesJson.getJSONArray(AtlasClient.TYPES);


Mime
View raw message