Commit 08f56903 by Madhan Neethiraj

ATLAS-1232: added preCreate(), preDelete() in typedef persistence, to enable…

ATLAS-1232: added preCreate(), preDelete() in typedef persistence, to enable edge creation for references in a later stage
parent b6acff6d
......@@ -43,8 +43,6 @@ public interface AtlasTypeDefStore {
AtlasEnumDef createEnumDef(AtlasEnumDef enumDef) throws AtlasBaseException;
List<AtlasEnumDef> createEnumDefs(List<AtlasEnumDef> atlasEnumDefs) throws AtlasBaseException;
List<AtlasEnumDef> getAllEnumDefs() throws AtlasBaseException;
AtlasEnumDef getEnumDefByName(String name) throws AtlasBaseException;
......@@ -66,8 +64,6 @@ public interface AtlasTypeDefStore {
/*************************/
AtlasStructDef createStructDef(AtlasStructDef structDef) throws AtlasBaseException;
List<AtlasStructDef> createStructDefs(List<AtlasStructDef> structDefs) throws AtlasBaseException;
List<AtlasStructDef> getAllStructDefs() throws AtlasBaseException;
AtlasStructDef getStructDefByName(String name) throws AtlasBaseException;
......@@ -90,8 +86,6 @@ public interface AtlasTypeDefStore {
/*********************************/
AtlasClassificationDef createClassificationDef(AtlasClassificationDef classificationDef) throws AtlasBaseException;
List<AtlasClassificationDef> createClassificationDefs(List<AtlasClassificationDef> classificationDefs) throws AtlasBaseException;
List<AtlasClassificationDef> getAllClassificationDefs() throws AtlasBaseException;
AtlasClassificationDef getClassificationDefByName(String name) throws AtlasBaseException;
......@@ -116,8 +110,6 @@ public interface AtlasTypeDefStore {
/*************************/
AtlasEntityDef createEntityDef(AtlasEntityDef entityDef) throws AtlasBaseException;
List<AtlasEntityDef> createEntityDefs(List<AtlasEntityDef> entityDefs) throws AtlasBaseException;
List<AtlasEntityDef> getAllEntityDefs() throws AtlasBaseException;
AtlasEntityDef getEntityDefByName(String name) throws AtlasBaseException;
......@@ -140,5 +132,7 @@ public interface AtlasTypeDefStore {
AtlasTypesDef updateTypesDef(AtlasTypesDef atlasTypesDef) throws AtlasBaseException;
void deleteTypesDef(AtlasTypesDef atlasTypesDef) throws AtlasBaseException;
AtlasTypesDef searchTypesDef(SearchFilter searchFilter) throws AtlasBaseException;
}
......@@ -357,16 +357,16 @@ public class AtlasStructType extends AtlasType {
*/
private void resolveForeignKeyConstraint(AtlasAttributeDef attribDef, AtlasConstraintDef constraintDef,
AtlasType attribType) throws AtlasBaseException {
if (!(this instanceof AtlasEntityType)) {
if (this.getTypeCategory() != TypeCategory.ENTITY) {
throw new AtlasBaseException(getTypeName() + "." + attribDef.getName() + ": "
+ AtlasStructDef.AtlasConstraintDef.CONSTRAINT_TYPE_FOREIGN_KEY + " constraint not supported");
}
if (attribType instanceof AtlasArrayType) {
if (attribType.getTypeCategory() == TypeCategory.ARRAY) {
attribType = ((AtlasArrayType)attribType).getElementType();
}
if (!(attribType instanceof AtlasEntityType)) {
if (attribType.getTypeCategory() != TypeCategory.ENTITY) {
throw new AtlasBaseException(getTypeName() + "." + attribDef.getName() + ": "
+ AtlasConstraintDef.CONSTRAINT_TYPE_FOREIGN_KEY + " incompatible attribute type "
+ attribType.getTypeName());
......@@ -383,16 +383,17 @@ public class AtlasStructType extends AtlasType {
*/
private void resolveMappedFromRefConstraint(AtlasAttributeDef attribDef, AtlasConstraintDef constraintDef,
AtlasType attribType) throws AtlasBaseException {
if (!(this instanceof AtlasEntityType)) {
if (this.getTypeCategory() != TypeCategory.ENTITY) {
throw new AtlasBaseException(getTypeName() + "." + attribDef.getName() + ": "
+ CONSTRAINT_TYPE_MAPPED_FROM_REF + " constraint not supported");
}
if (attribType instanceof AtlasArrayType) {
if (attribType.getTypeCategory() == TypeCategory.ARRAY) {
attribType = ((AtlasArrayType)attribType).getElementType();
}
if (!(attribType instanceof AtlasEntityType)) {
if (attribType.getTypeCategory() != TypeCategory.ENTITY) {
throw new AtlasBaseException(getTypeName() + "." + attribDef.getName() + ": "
+ CONSTRAINT_TYPE_MAPPED_FROM_REF + " incompatible attribute type "
+ attribType.getTypeName());
......@@ -421,7 +422,7 @@ public class AtlasStructType extends AtlasType {
+ " should be " + getTypeName() + ", but found " + refAttrib.getTypeName());
}
mappedFromRefAttributes.put(attribDef.getName(), new TypeAttributePair(refAttrib.getTypeName(), refAttribName));
mappedFromRefAttributes.put(attribDef.getName(), new TypeAttributePair(attribType.getTypeName(), refAttribName));
}
private class TypeAttributePair {
......
......@@ -40,7 +40,6 @@ import org.slf4j.LoggerFactory;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
/**
......@@ -197,6 +196,33 @@ public class AtlasTypeRegistry {
classificationDefs = new TypeDefCache<>(other.classificationDefs, allTypes);
entityDefs = new TypeDefCache<>(other.entityDefs, allTypes);
}
void updateGuid(String typeName, String guid) {
if (typeName != null) {
enumDefs.updateGuid(typeName, guid);
structDefs.updateGuid(typeName, guid);
classificationDefs.updateGuid(typeName, guid);
entityDefs.updateGuid(typeName, guid);
}
}
void removeByGuid(String guid) {
if (guid != null) {
enumDefs.removeTypeDefByGuid(guid);
structDefs.removeTypeDefByGuid(guid);
classificationDefs.removeTypeDefByGuid(guid);
entityDefs.removeTypeDefByGuid(guid);
}
}
void removeByName(String typeName) {
if (typeName != null) {
enumDefs.removeTypeDefByName(typeName);
structDefs.removeTypeDefByName(typeName);
classificationDefs.removeTypeDefByName(typeName);
entityDefs.removeTypeDefByName(typeName);
}
}
}
public static class AtlasTransientTypeRegistry extends AtlasTypeRegistry {
......@@ -227,6 +253,19 @@ public class AtlasTypeRegistry {
}
}
public void updateGuid(String typeName, String guid) {
if (LOG.isDebugEnabled()) {
LOG.debug("==> AtlasTypeRegistry.updateGuid({}, {})", typeName, guid);
}
registryData.updateGuid(typeName, guid);
if (LOG.isDebugEnabled()) {
LOG.debug("<== AtlasTypeRegistry.updateGuid({}, {})", typeName, guid);
}
}
public void addTypes(Collection<? extends AtlasBaseTypeDef> typeDefs) throws AtlasBaseException {
if (LOG.isDebugEnabled()) {
LOG.debug("==> AtlasTypeRegistry.addTypes(length={})", (typeDefs == null ? 0 : typeDefs.size()));
......@@ -351,10 +390,7 @@ public class AtlasTypeRegistry {
}
if (guid != null) {
registryData.enumDefs.removeTypeDefByGuid(guid);
registryData.structDefs.removeTypeDefByGuid(guid);
registryData.classificationDefs.removeTypeDefByGuid(guid);
registryData.entityDefs.removeTypeDefByGuid(guid);
registryData.removeByGuid(guid);
resolveReferences();
}
......@@ -370,10 +406,7 @@ public class AtlasTypeRegistry {
}
if (name != null) {
registryData.enumDefs.removeTypeDefByName(name);
registryData.structDefs.removeTypeDefByName(name);
registryData.classificationDefs.removeTypeDefByName(name);
registryData.entityDefs.removeTypeDefByName(name);
registryData.removeByName(name);
resolveReferences();
}
......@@ -390,10 +423,6 @@ public class AtlasTypeRegistry {
}
if (typeDef != null) {
if (StringUtils.isBlank(typeDef.getGuid())) {
typeDef.setGuid(UUID.randomUUID().toString());
}
if (typeDef.getClass().equals(AtlasEnumDef.class)) {
AtlasEnumDef enumDef = (AtlasEnumDef) typeDef;
......@@ -599,6 +628,20 @@ class TypeCache {
return ret;
}
public void updateGuid(String typeName, String currGuid, String newGuid) {
if (currGuid != null) {
typeGuidMap.remove(currGuid);
}
if (typeName != null && newGuid != null) {
AtlasType type = typeNameMap.get(typeName);
if (type != null) {
typeGuidMap.put(newGuid, type);
}
}
}
public void removeTypeByGuid(String guid) {
if (guid != null) {
typeGuidMap.remove(guid);
......@@ -659,6 +702,30 @@ class TypeDefCache<T extends AtlasBaseTypeDef> {
return ret;
}
public void updateGuid(String typeName, String newGuid) {
if (typeName != null) {
T typeDef = typeDefNameMap.get(typeName);
if (typeDef != null) {
String currGuid = typeDef.getGuid();
if (!StringUtils.equals(currGuid, newGuid)) {
if (currGuid != null) {
typeDefGuidMap.remove(currGuid);
}
typeDef.setGuid(newGuid);
if (newGuid != null) {
typeDefGuidMap.put(newGuid, typeDef);
}
typeCache.updateGuid(typeName, currGuid, newGuid);
}
}
}
}
public void removeTypeDefByGuid(String guid) {
if (guid != null) {
T typeDef = typeDefGuidMap.remove(guid);
......
......@@ -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-1232 added preCreate(), preDelete() in typedef persistence, to enable edge creation for references in a later stage (mneethiraj)
ATLAS-1183 UI: help link should point to atlas website (kevalbhatt via shwethags)
ATLAS-1182 Hive Column level lineage docs (svimal2106 via shwethags)
ATLAS-1230 updated AtlasTypeRegistry to support batch, atomic type updates (mneethiraj)
......
......@@ -28,9 +28,9 @@ import java.util.List;
* Interface for graph persistence store for AtlasClassificationDef
*/
public interface AtlasClassificationDefStore {
AtlasClassificationDef create(AtlasClassificationDef classificationDef) throws AtlasBaseException;
Object preCreate(AtlasClassificationDef classificationDef) throws AtlasBaseException;
List<AtlasClassificationDef> create(List<AtlasClassificationDef> classificationDefs) throws AtlasBaseException;
AtlasClassificationDef create(AtlasClassificationDef classifiDef, Object preCreateResult) throws AtlasBaseException;
List<AtlasClassificationDef> getAll() throws AtlasBaseException;
......@@ -38,19 +38,19 @@ public interface AtlasClassificationDefStore {
AtlasClassificationDef getByGuid(String guid) throws AtlasBaseException;
AtlasClassificationDef updateByName(String name, AtlasClassificationDef classificationDef) throws AtlasBaseException;
AtlasClassificationDef update(AtlasClassificationDef classifiDef) throws AtlasBaseException;
AtlasClassificationDef updateByGuid(String guid, AtlasClassificationDef classificationDef) throws AtlasBaseException;
AtlasClassificationDef updateByName(String name, AtlasClassificationDef classifiDef) throws AtlasBaseException;
List<AtlasClassificationDef> update(List<AtlasClassificationDef> classificationDefs) throws AtlasBaseException;
AtlasClassificationDef updateByGuid(String guid, AtlasClassificationDef classifiDef) throws AtlasBaseException;
void deleteByName(String name) throws AtlasBaseException;
Object preDeleteByName(String name) throws AtlasBaseException;
void deleteByNames(List<String> names) throws AtlasBaseException;
void deleteByName(String name, Object preDeleteResult) throws AtlasBaseException;
void deleteByGuid(String guid) throws AtlasBaseException;
Object preDeleteByGuid(String guid) throws AtlasBaseException;
void deleteByGuids(List<String> guids) throws AtlasBaseException;
void deleteByGuid(String guid, Object preDeleteResult) throws AtlasBaseException;
AtlasClassificationDefs search(SearchFilter filter) throws AtlasBaseException;
}
......@@ -19,6 +19,7 @@ package org.apache.atlas.repository.store.graph;
import org.apache.atlas.exception.AtlasBaseException;
import org.apache.atlas.model.SearchFilter;
import org.apache.atlas.model.typedef.AtlasClassificationDef;
import org.apache.atlas.model.typedef.AtlasEntityDef;
import org.apache.atlas.model.typedef.AtlasEntityDef.AtlasEntityDefs;
......@@ -28,9 +29,9 @@ import java.util.List;
* Interface for graph persistence store for AtlasEntityDef
*/
public interface AtlasEntityDefStore {
AtlasEntityDef create(AtlasEntityDef entityDef) throws AtlasBaseException;
Object preCreate(AtlasEntityDef entityDef) throws AtlasBaseException;
List<AtlasEntityDef> create(List<AtlasEntityDef> entityDefs) throws AtlasBaseException;
AtlasEntityDef create(AtlasEntityDef entityDef, Object preCreateResult) throws AtlasBaseException;
List<AtlasEntityDef> getAll() throws AtlasBaseException;
......@@ -38,19 +39,19 @@ public interface AtlasEntityDefStore {
AtlasEntityDef getByGuid(String guid) throws AtlasBaseException;
AtlasEntityDef update(AtlasEntityDef entityDef) throws AtlasBaseException;
AtlasEntityDef updateByName(String name, AtlasEntityDef entityDef) throws AtlasBaseException;
AtlasEntityDef updateByGuid(String guid, AtlasEntityDef entityDef) throws AtlasBaseException;
List<AtlasEntityDef> update(List<AtlasEntityDef> entityDefs) throws AtlasBaseException;
void deleteByName(String name) throws AtlasBaseException;
Object preDeleteByName(String name) throws AtlasBaseException;
void deleteByNames(List<String> names) throws AtlasBaseException;
void deleteByName(String name, Object preDeleteResult) throws AtlasBaseException;
void deleteByGuid(String guid) throws AtlasBaseException;
Object preDeleteByGuid(String guid) throws AtlasBaseException;
void deleteByGuids(List<String> guids) throws AtlasBaseException;
void deleteByGuid(String guid, Object preDeleteResult) throws AtlasBaseException;
AtlasEntityDefs search(SearchFilter filter) throws AtlasBaseException;
}
......@@ -30,27 +30,21 @@ import java.util.List;
public interface AtlasEnumDefStore {
AtlasEnumDef create(AtlasEnumDef enumDef) throws AtlasBaseException;
List<AtlasEnumDef> create(List<AtlasEnumDef> atlasEnumDefs) throws AtlasBaseException;
List<AtlasEnumDef> getAll() throws AtlasBaseException;
AtlasEnumDef getByName(String name) throws AtlasBaseException;
AtlasEnumDef getByGuid(String guid) throws AtlasBaseException;
AtlasEnumDef update(AtlasEnumDef enumDef) throws AtlasBaseException;
AtlasEnumDef updateByName(String name, AtlasEnumDef enumDef) throws AtlasBaseException;
AtlasEnumDef updateByGuid(String guid, AtlasEnumDef enumDef) throws AtlasBaseException;
List<AtlasEnumDef> update(List<AtlasEnumDef> enumDefs) throws AtlasBaseException;
void deleteByName(String name) throws AtlasBaseException;
void deleteByNames(List<String> names) throws AtlasBaseException;
void deleteByGuid(String guid) throws AtlasBaseException;
void deleteByGuids(List<String> guids) throws AtlasBaseException;
AtlasEnumDefs search(SearchFilter filter) throws AtlasBaseException;
}
......@@ -28,9 +28,9 @@ import java.util.List;
* Interface for graph persistence store for AtlasStructDef
*/
public interface AtlasStructDefStore {
AtlasStructDef create(AtlasStructDef structDef) throws AtlasBaseException;
Object preCreate(AtlasStructDef structDef) throws AtlasBaseException;
List<AtlasStructDef> create(List<AtlasStructDef> structDefs) throws AtlasBaseException;
AtlasStructDef create(AtlasStructDef structDef, Object preCreateResult) throws AtlasBaseException;
List<AtlasStructDef> getAll() throws AtlasBaseException;
......@@ -38,19 +38,19 @@ public interface AtlasStructDefStore {
AtlasStructDef getByGuid(String guid) throws AtlasBaseException;
AtlasStructDef update(AtlasStructDef structDef) throws AtlasBaseException;
AtlasStructDef updateByName(String name, AtlasStructDef structDef) throws AtlasBaseException;
AtlasStructDef updateByGuid(String guid, AtlasStructDef structDef) throws AtlasBaseException;
List<AtlasStructDef> update(List<AtlasStructDef> structDefs) throws AtlasBaseException;
void deleteByName(String name) throws AtlasBaseException;
Object preDeleteByName(String name) throws AtlasBaseException;
void deleteByNames(List<String> names) throws AtlasBaseException;
void deleteByName(String name, Object preDeleteResult) throws AtlasBaseException;
void deleteByGuid(String guid) throws AtlasBaseException;
Object preDeleteByGuid(String name) throws AtlasBaseException;
void deleteByGuids(List<String> guids) throws AtlasBaseException;
void deleteByGuid(String guid, Object preDeleteResult) throws AtlasBaseException;
AtlasStructDefs search(SearchFilter filter) throws AtlasBaseException;
}
......@@ -26,6 +26,7 @@ import org.apache.atlas.repository.Constants;
import org.apache.atlas.repository.graphdb.AtlasVertex;
import org.apache.atlas.repository.store.graph.AtlasEnumDefStore;
import org.apache.atlas.repository.util.FilterUtil;
import org.apache.atlas.type.AtlasType;
import org.apache.atlas.type.AtlasTypeRegistry;
import org.apache.atlas.typesystem.types.DataTypes.TypeCategory;
import org.apache.commons.collections.CollectionUtils;
......@@ -73,25 +74,6 @@ public class AtlasEnumDefStoreV1 extends AtlasAbstractDefStoreV1 implements Atla
}
@Override
public List<AtlasEnumDef> create(List<AtlasEnumDef> enumDefs) throws AtlasBaseException {
if (LOG.isDebugEnabled()) {
LOG.debug("==> AtlasEnumDefStoreV1.create({})", enumDefs);
}
List<AtlasEnumDef> ret = new ArrayList<>();
for (AtlasEnumDef enumDef : enumDefs) {
ret.add(create(enumDef));
}
if (LOG.isDebugEnabled()) {
LOG.debug("<== AtlasEnumDefStoreV1.create({}): {}", enumDefs, ret);
}
return ret;
}
@Override
public List<AtlasEnumDef> getAll() throws AtlasBaseException {
if (LOG.isDebugEnabled()) {
LOG.debug("==> AtlasEnumDefStoreV1.getAll()");
......@@ -156,6 +138,22 @@ public class AtlasEnumDefStoreV1 extends AtlasAbstractDefStoreV1 implements Atla
}
@Override
public AtlasEnumDef update(AtlasEnumDef enumDef) throws AtlasBaseException {
if (LOG.isDebugEnabled()) {
LOG.debug("==> AtlasEnumDefStoreV1.update({})", enumDef);
}
AtlasEnumDef ret = StringUtils.isNotBlank(enumDef.getGuid()) ? updateByGuid(enumDef.getGuid(), enumDef)
: updateByName(enumDef.getName(), enumDef);
if (LOG.isDebugEnabled()) {
LOG.debug("<== AtlasEnumDefStoreV1.update({}): {}", enumDef, ret);
}
return ret;
}
@Override
public AtlasEnumDef updateByName(String name, AtlasEnumDef enumDef) throws AtlasBaseException {
if (LOG.isDebugEnabled()) {
LOG.debug("==> AtlasEnumDefStoreV1.updateByName({}, {})", name, enumDef);
......@@ -202,25 +200,6 @@ public class AtlasEnumDefStoreV1 extends AtlasAbstractDefStoreV1 implements Atla
}
@Override
public List<AtlasEnumDef> update(List<AtlasEnumDef> enumDefs) throws AtlasBaseException {
if (LOG.isDebugEnabled()) {
LOG.debug("==> AtlasEnumDefStoreV1.update({})", enumDefs);
}
List<AtlasEnumDef> ret = new ArrayList<>();
for (AtlasEnumDef enumDef : enumDefs) {
ret.add(updateByName(enumDef.getName(), enumDef));
}
if (LOG.isDebugEnabled()) {
LOG.debug("<== AtlasEnumDefStoreV1.update({}): {}", enumDefs, ret);
}
return ret;
}
@Override
public void deleteByName(String name) throws AtlasBaseException {
if (LOG.isDebugEnabled()) {
LOG.debug("==> AtlasEnumDefStoreV1.deleteByName({})", name);
......@@ -240,21 +219,6 @@ public class AtlasEnumDefStoreV1 extends AtlasAbstractDefStoreV1 implements Atla
}
@Override
public void deleteByNames(List<String> names) throws AtlasBaseException {
if (LOG.isDebugEnabled()) {
LOG.debug("==> AtlasEnumDefStoreV1.deleteByNames({})", names);
}
for (String name : names) {
deleteByName(name);
}
if (LOG.isDebugEnabled()) {
LOG.debug("<== AtlasEnumDefStoreV1.deleteByName({})", names);
}
}
@Override
public void deleteByGuid(String guid) throws AtlasBaseException {
if (LOG.isDebugEnabled()) {
LOG.debug("==> AtlasEnumDefStoreV1.deleteByGuid({})", guid);
......@@ -274,27 +238,12 @@ public class AtlasEnumDefStoreV1 extends AtlasAbstractDefStoreV1 implements Atla
}
@Override
public void deleteByGuids(List<String> guids) throws AtlasBaseException {
if (LOG.isDebugEnabled()) {
LOG.debug("==> AtlasEnumDefStoreV1.deleteByGuids({})", guids);
}
for (String guid : guids) {
deleteByGuid(guid);
}
if (LOG.isDebugEnabled()) {
LOG.debug("<== AtlasEnumDefStoreV1.deleteByGuids({})", guids);
}
}
@Override
public AtlasEnumDefs search(SearchFilter filter) throws AtlasBaseException {
if (LOG.isDebugEnabled()) {
LOG.debug("==> AtlasEnumDefStoreV1.search({})", filter);
}
List<AtlasEnumDef> enumDefs = new ArrayList<AtlasEnumDef>();
List<AtlasEnumDef> enumDefs = new ArrayList<>();
Iterator<AtlasVertex> vertices = typeDefStore.findTypeVerticesByCategory(TypeCategory.ENUM);
while(vertices.hasNext()) {
......
......@@ -198,6 +198,14 @@ public class AtlasTypeDefGraphStoreV1 extends AtlasTypeDefGraphStore {
return ret;
}
public void deleteTypeVertexOutEdges(AtlasVertex vertex) throws AtlasBaseException {
Iterable<AtlasEdge> edges = vertex.getEdges(AtlasEdgeDirection.OUT);
for (AtlasEdge edge : edges) {
atlasGraph.removeEdge(edge);
}
}
public void deleteTypeVertex(AtlasVertex vertex) throws AtlasBaseException {
Iterator<AtlasEdge> inEdges = vertex.getEdges(AtlasEdgeDirection.IN).iterator();
......@@ -303,10 +311,10 @@ public class AtlasTypeDefGraphStoreV1 extends AtlasTypeDefGraphStore {
return ret;
}
public void createSuperTypeEdges(AtlasVertex vertex, Set<String> superTypes) {
public void createSuperTypeEdges(AtlasVertex vertex, Set<String> superTypes, TypeCategory typeCategory) {
if (CollectionUtils.isNotEmpty(superTypes)) {
for (String superType : superTypes) {
AtlasVertex superTypeVertex = findTypeVertexByNameAndCategory(superType, TypeCategory.CLASS);
AtlasVertex superTypeVertex = findTypeVertexByNameAndCategory(superType, typeCategory);
getOrCreateEdge(vertex, superTypeVertex, AtlasGraphUtilsV1.SUPERTYPE_EDGE_LABEL);
}
......
......@@ -33,6 +33,7 @@ import org.apache.atlas.model.typedef.AtlasTypesDef;
import org.apache.atlas.store.AtlasTypeDefStore;
import org.apache.atlas.type.AtlasTypeRegistry;
import org.apache.atlas.web.util.Servlets;
import org.apache.http.annotation.Experimental;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -383,6 +384,7 @@ public class TypesREST {
@Path("/entitydef/name/{name}")
@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;
......@@ -395,6 +397,7 @@ public class TypesREST {
@Path("/entitydef/guid/{guid}")
@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;
......@@ -406,6 +409,7 @@ public class TypesREST {
@DELETE
@Path("/entitydef/name/{name}")
@Produces(Servlets.JSON_MEDIA_TYPE)
@Experimental
public void deleteEntityDef(@PathParam("name") String name) throws Exception {
typeDefStore.deleteEntityDefByName(name);
}
......@@ -413,6 +417,7 @@ public class TypesREST {
@DELETE
@Path("/entitydef/guid/{guid}")
@Produces(Servlets.JSON_MEDIA_TYPE)
@Experimental
public void deleteEntityDefByGuid(@PathParam("guid") String guid) throws Exception {
typeDefStore.deleteEntityDefByGuid(guid);
}
......@@ -488,6 +493,7 @@ public class TypesREST {
@Path("/typedefs")
@Consumes(Servlets.JSON_MEDIA_TYPE)
@Produces(Servlets.JSON_MEDIA_TYPE)
@Experimental
public AtlasTypesDef updateAtlasTypeDefs(final AtlasTypesDef typesDef) throws Exception {
AtlasTypesDef ret = null;
......@@ -501,6 +507,24 @@ public class TypesREST {
}
/**
* Bulk delete API for all types
* @param typesDef A composite object that captures all types to be deleted
* @throws Exception
*/
@DELETE
@Path("/typedefs")
@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));
}
}
/**
* Populate a SearchFilter on the basis of the Query Parameters
* @return
*/
......
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