Commit cae6522d by Sarath Subramanian Committed by Madhan Neethiraj

ATLAS-1428: Create of entityDef type fails with type already exists exception

parent e5b6438f
......@@ -9,6 +9,7 @@ ATLAS-1060 Add composite indexes for exact match performance improvements for al
ATLAS-1127 Modify creation and modification timestamps to Date instead of Long(sumasai)
ALL CHANGES:
ATLAS-1428 Create of entityDef type fails with type already exists exception (sarath.kum4r@gmail.com via mneethiraj)
ATLAS-1421 Regression : HTML is displayed for deleted entities in search-result and entity-details pages (Kalyanikashikar via mneethiraj)
ATLAS-1417 HIveHook: synchronous execution fails to notify (sumasai via mneethiraj)
ATLAS-1391 Add exclusion mechanism for Atlas audit (guptaneeru via mneethiraj)
......
......@@ -165,10 +165,7 @@ public class TypesResource {
response.put(AtlasClient.REQUEST_ID, Servlets.getRequestId());
response.put(AtlasClient.TYPES, typesResponse);
return Response.ok().entity(response).build();
} catch (TypeExistsException e) {
LOG.error("Type already exists", e);
throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.CONFLICT));
} catch (AtlasException | IllegalArgumentException e) {
} catch (AtlasBaseException | IllegalArgumentException e) {
LOG.error("Unable to persist types", e);
throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
} catch (WebApplicationException e) {
......
......@@ -305,12 +305,7 @@ public class TypesREST {
public AtlasEntityDef createEntityDef(AtlasEntityDef entityDef) throws AtlasBaseException {
AtlasEntityDef ret = typeDefStore.createEntityDef(entityDef);
try {
ret = typeDefStore.createEntityDef(entityDef);
return ret;
} catch (AtlasBaseException ex) {
throw new WebApplicationException(Servlets.getErrorResponse(ex, Response.Status.BAD_REQUEST));
}
return ret;
}
@GET
......@@ -336,10 +331,8 @@ public class TypesREST {
@Consumes(Servlets.JSON_MEDIA_TYPE)
@Produces(Servlets.JSON_MEDIA_TYPE)
@Experimental
public AtlasEntityDef updateEntityDefByName(@PathParam("name") String name, AtlasEntityDef entityDef) throws Exception {
AtlasEntityDef ret = null;
ret = typeDefStore.updateEntityDefByName(name, entityDef);
public AtlasEntityDef updateEntityDefByName(@PathParam("name") String name, AtlasEntityDef entityDef) throws AtlasBaseException {
AtlasEntityDef ret = typeDefStore.updateEntityDefByName(name, entityDef);
return ret;
}
......@@ -349,10 +342,8 @@ public class TypesREST {
@Consumes(Servlets.JSON_MEDIA_TYPE)
@Produces(Servlets.JSON_MEDIA_TYPE)
@Experimental
public AtlasEntityDef updateEntityDefByGuid(@PathParam("guid") String guid, AtlasEntityDef entityDef) throws Exception {
AtlasEntityDef ret = null;
ret = typeDefStore.updateEntityDefByGuid(guid, entityDef);
public AtlasEntityDef updateEntityDefByGuid(@PathParam("guid") String guid, AtlasEntityDef entityDef) throws AtlasBaseException {
AtlasEntityDef ret = typeDefStore.updateEntityDefByGuid(guid, entityDef);
return ret;
}
......@@ -361,7 +352,7 @@ public class TypesREST {
@Path("/entitydef/name/{name}")
@Produces(Servlets.JSON_MEDIA_TYPE)
@Experimental
public void deleteEntityDef(@PathParam("name") String name) throws Exception {
public void deleteEntityDef(@PathParam("name") String name) throws AtlasBaseException {
typeDefStore.deleteEntityDefByName(name);
}
......@@ -369,7 +360,7 @@ public class TypesREST {
@Path("/entitydef/guid/{guid}")
@Produces(Servlets.JSON_MEDIA_TYPE)
@Experimental
public void deleteEntityDefByGuid(@PathParam("guid") String guid) throws Exception {
public void deleteEntityDefByGuid(@PathParam("guid") String guid) throws AtlasBaseException {
typeDefStore.deleteEntityDefByGuid(guid);
}
......@@ -448,14 +439,8 @@ public class TypesREST {
@Consumes(Servlets.JSON_MEDIA_TYPE)
@Produces(Servlets.JSON_MEDIA_TYPE)
@Experimental
public AtlasTypesDef updateAtlasTypeDefs(final AtlasTypesDef typesDef) throws Exception {
AtlasTypesDef ret = null;
try {
ret = typeDefStore.updateTypesDef(typesDef);
} catch (AtlasBaseException ex) {
throw new WebApplicationException(Servlets.getErrorResponse(ex, ex.getAtlasErrorCode().getHttpCode()));
}
public AtlasTypesDef updateAtlasTypeDefs(final AtlasTypesDef typesDef) throws AtlasBaseException {
AtlasTypesDef ret = typeDefStore.updateTypesDef(typesDef);
return ret;
}
......@@ -470,12 +455,8 @@ public class TypesREST {
@Consumes(Servlets.JSON_MEDIA_TYPE)
@Produces(Servlets.JSON_MEDIA_TYPE)
@Experimental
public void deleteAtlasTypeDefs(final AtlasTypesDef typesDef) {
try {
typeDefStore.deleteTypesDef(typesDef);
} catch (AtlasBaseException ex) {
throw new WebApplicationException(Servlets.getErrorResponse(ex, Response.Status.NOT_MODIFIED));
}
public void deleteAtlasTypeDefs(final AtlasTypesDef typesDef) throws AtlasBaseException {
typeDefStore.deleteTypesDef(typesDef);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment