Commit 0dad9529 by apoorvnaik Committed by Madhan Neethiraj

ATLAS-2534: Glossary REST API implementation

Change-Id: I47210446be9e38c274bae0ee4a688187ba6e4fd0 Signed-off-by: 's avatarMadhan Neethiraj <madhan@apache.org>
parent 15967a93
......@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
*
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
......@@ -126,6 +126,7 @@ public final class Constants {
public static final String CLASSIFICATION_EDGE_IS_PROPAGATED_PROPERTY_KEY = INTERNAL_PROPERTY_KEY_PREFIX + "isPropagated";
public static final String CLASSIFICATION_EDGE_STATE_PROPERTY_KEY = STATE_PROPERTY_KEY;
public static final String CLASSIFICATION_LABEL = "classifiedAs";
public static final String TERM_ASSIGNMENT_LABEL = "r:__AtlasGlossarySemanticAssignment";
public static final String VERTEX_ID_IN_IMPORT_KEY = "__vIdInImport";
public static final String EDGE_ID_IN_IMPORT_KEY = "__eIdInImport";
......
......@@ -128,9 +128,16 @@ public enum AtlasErrorCode {
NO_CLASSIFICATIONS_FOUND_FOR_ENTITY(400, "ATLAS-400-00-06E", "No classifications associated with entity: {0}"),
INVALID_CLASSIFICATION_PARAMS(400, "ATLAS-400-00-06F", "Invalid classification parameters passed for {0} operation for entity: {1}"),
PROPAGATED_CLASSIFICATION_NOT_ASSOCIATED_WITH_ENTITY(400, "ATLAS-400-00-070", "Propagated classification {0} is not associated with entity"),
INVALID_PARTIAL_UPDATE_ATTR_VAL(400, "ATLAS-400-00-071", "Invalid attrVal for partial update of {0}, expected = {1} found {2}"),
INVALID_BLOCKED_PROPAGATED_CLASSIFICATION(400, "ATLAS-400-00-071", "Invalid propagated classification: {0} with entityGuid: {1} added to blocked propagated classifications."),
MISSING_MANDATORY_ANCHOR(400, "ATLAS-400-00-072", "Mandatory anchor attribute is missing"),
INVALID_BLOCKED_PROPAGATED_CLASSIFICATION(400, "ATLAS-400-00-073", "Invalid propagated classification: {0} with entityGuid: {1} added to blocked propagated classifications."),
MISSING_MANDATORY_QUALIFIED_NAME(400, "ATLAS-400-00-073", "Mandatory qualifiedName attribute is missing"),
INVALID_PARTIAL_UPDATE_ATTR_VAL(400, "ATLAS-400-00-074", "Invalid attrVal for partial update of {0}, expected = {1} found {2}"),
MISSING_TERM_ID_FOR_CATEGORIZATION(400, "ATLAS-400-00-075", "Term guid can't be empty/null when adding to a category"),
INVALID_NEW_ANCHOR_GUID(400, "ATLAS-400-00-076", "New Anchor guid can't be empty/null"),
TERM_DISSOCIATION_MISSING_RELATION_GUID(400, "ATLAS-400-00-077", "Missing mandatory attribute, TermAssignment relationship guid"),
GLOSSARY_QUALIFIED_NAME_CANT_BE_DERIVED(400, "ATLAS-400-00-078", "Attributes qualifiedName and displayName are missing. Failed to derive a unique name for Glossary"),
GLOSSARY_TERM_QUALIFIED_NAME_CANT_BE_DERIVED(400, "ATLAS-400-00-079", "Attributes qualifiedName, displayName & glossary name are missing. Failed to derive a unique name for Glossary term"),
GLOSSARY_CATEGORY_QUALIFIED_NAME_CANT_BE_DERIVED(400, "ATLAS-400-00-07A", "Attributes qualifiedName, displayName & glossary name are missing. Failed to derive a unique name for Glossary category"),
UNAUTHORIZED_ACCESS(403, "ATLAS-403-00-001", "{0} is not authorized to perform {1}"),
......
......@@ -23,7 +23,7 @@ import org.apache.atlas.model.annotation.AtlasJSON;
import org.apache.atlas.model.glossary.relations.AtlasGlossaryHeader;
import org.apache.atlas.model.glossary.relations.AtlasRelatedTermHeader;
import org.apache.atlas.model.glossary.relations.AtlasTermCategorizationHeader;
import org.apache.atlas.model.instance.AtlasEntityHeader;
import org.apache.atlas.model.instance.AtlasRelatedObjectId;
import org.apache.commons.collections.CollectionUtils;
import java.util.HashMap;
......@@ -42,7 +42,7 @@ public class AtlasGlossaryTerm extends AtlasGlossaryBaseObject {
// Attributes derived from relationships
private AtlasGlossaryHeader anchor;
private Set<AtlasEntityHeader> assignedEntities;
private Set<AtlasRelatedObjectId> assignedEntities;
private Set<AtlasTermCategorizationHeader> categories;
// Related Terms
......@@ -128,21 +128,21 @@ public class AtlasGlossaryTerm extends AtlasGlossaryBaseObject {
setCategories(categories);
}
public Set<AtlasEntityHeader> getAssignedEntities() {
public Set<AtlasRelatedObjectId> getAssignedEntities() {
return assignedEntities;
}
public void setAssignedEntities(final Set<AtlasEntityHeader> assignedEntities) {
public void setAssignedEntities(final Set<AtlasRelatedObjectId> assignedEntities) {
this.assignedEntities = assignedEntities;
}
public void addAssignedEntity(final AtlasEntityHeader entityHeader) {
Set<AtlasEntityHeader> entityHeaders = this.assignedEntities;
if (entityHeaders == null) {
entityHeaders = new HashSet<>();
public void addAssignedEntity(final AtlasRelatedObjectId atlasObjectId) {
Set<AtlasRelatedObjectId> assignedEntities = this.assignedEntities;
if (assignedEntities == null) {
assignedEntities = new HashSet<>();
}
entityHeaders.add(entityHeader);
setAssignedEntities(entityHeaders);
assignedEntities.add(atlasObjectId);
setAssignedEntities(assignedEntities);
}
public Set<AtlasRelatedTermHeader> getSeeAlso() {
......
......@@ -24,6 +24,7 @@ import java.util.Objects;
@AtlasJSON
public class AtlasRelatedCategoryHeader {
private String categoryGuid;
private String parentCategoryGuid;
private String relationGuid;
private String displayText;
private String description;
......@@ -61,6 +62,7 @@ public class AtlasRelatedCategoryHeader {
if (!(o instanceof AtlasRelatedCategoryHeader)) return false;
final AtlasRelatedCategoryHeader that = (AtlasRelatedCategoryHeader) o;
return Objects.equals(categoryGuid, that.categoryGuid) &&
Objects.equals(parentCategoryGuid, that.parentCategoryGuid) &&
Objects.equals(displayText, that.displayText) &&
Objects.equals(description, that.description);
}
......@@ -68,13 +70,14 @@ public class AtlasRelatedCategoryHeader {
@Override
public int hashCode() {
return Objects.hash(categoryGuid, displayText, description);
return Objects.hash(categoryGuid, parentCategoryGuid, displayText, description);
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("AtlasRelatedCategoryId{");
sb.append("categoryGuid='").append(categoryGuid).append('\'');
sb.append(", parentCategoryGuid='").append(parentCategoryGuid).append('\'');
sb.append(", relationGuid='").append(relationGuid).append('\'');
sb.append(", displayText='").append(displayText).append('\'');
sb.append(", description='").append(description).append('\'');
......@@ -90,4 +93,12 @@ public class AtlasRelatedCategoryHeader {
public void setRelationGuid(final String relationGuid) {
this.relationGuid = relationGuid;
}
public String getParentCategoryGuid() {
return parentCategoryGuid;
}
public void setParentCategoryGuid(final String parentCategoryGuid) {
this.parentCategoryGuid = parentCategoryGuid;
}
}
......@@ -475,7 +475,7 @@ public class EntityDiscoveryService implements AtlasDiscoveryService {
AtlasObjectId objId = (AtlasObjectId) attrValue;
if (ret.getReferredEntities() == null) {
ret.setReferredEntities(new HashMap<String, AtlasEntityHeader>());
ret.setReferredEntities(new HashMap<>());
}
if (!ret.getReferredEntities().containsKey(objId.getGuid())) {
......@@ -489,7 +489,7 @@ public class EntityDiscoveryService implements AtlasDiscoveryService {
AtlasObjectId objId = (AtlasObjectId) obj;
if (ret.getReferredEntities() == null) {
ret.setReferredEntities(new HashMap<String, AtlasEntityHeader>());
ret.setReferredEntities(new HashMap<>());
}
if (!ret.getReferredEntities().containsKey(objId.getGuid())) {
......
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.atlas.glossary;
import org.apache.atlas.AtlasErrorCode;
import org.apache.atlas.exception.AtlasBaseException;
import org.apache.atlas.model.glossary.relations.AtlasRelatedTermHeader;
import org.apache.atlas.model.instance.AtlasRelationship;
import org.apache.atlas.repository.store.graph.AtlasRelationshipStore;
import org.apache.atlas.type.AtlasTypeRegistry;
import java.util.Objects;
public abstract class GlossaryUtils {
public static final String TERM_ASSIGNMENT_ATTR_DESCRIPTION = "description";
public static final String TERM_ASSIGNMENT_ATTR_EXPRESSION = "expression";
public static final String TERM_ASSIGNMENT_ATTR_STATUS = "status";
public static final String TERM_ASSIGNMENT_ATTR_CONFIDENCE = "confidence";
public static final String TERM_ASSIGNMENT_ATTR_CREATED_BY = "createdBy";
public static final String TERM_ASSIGNMENT_ATTR_STEWARD = "steward";
public static final String TERM_ASSIGNMENT_ATTR_SOURCE = "source";
static final String ATLAS_GLOSSARY_PREFIX = "__AtlasGlossary";
// Relation name constants
protected static final String TERM_ANCHOR = ATLAS_GLOSSARY_PREFIX + "TermAnchor";
protected static final String CATEGORY_ANCHOR = ATLAS_GLOSSARY_PREFIX + "CategoryAnchor";
protected static final String CATEGORY_HIERARCHY = ATLAS_GLOSSARY_PREFIX + "CategoryHierarchyLink";
protected static final String TERM_CATEGORIZATION = ATLAS_GLOSSARY_PREFIX + "TermCategorization";
protected static final String TERM_ASSIGNMENT = ATLAS_GLOSSARY_PREFIX + "SemanticAssignment";
protected static final String TERM_RELATION_ATTR_EXPRESSION = "expression";
protected static final String TERM_RELATION_ATTR_DESCRIPTION = "description";
protected static final String TERM_RELATION_ATTR_STEWARD = "steward";
protected static final String TERM_RELATION_ATTR_SOURCE = "source";
protected static final String TERM_RELATION_ATTR_STATUS = "status";
protected final AtlasRelationshipStore relationshipStore;
protected final AtlasTypeRegistry typeRegistry;
protected GlossaryUtils(final AtlasRelationshipStore relationshipStore, final AtlasTypeRegistry typeRegistry) {
this.relationshipStore = relationshipStore;
this.typeRegistry = typeRegistry;
}
protected void createRelationship(AtlasRelationship relationship) throws AtlasBaseException {
try {
relationshipStore.create(relationship);
} catch (AtlasBaseException e) {
if (!e.getAtlasErrorCode().equals(AtlasErrorCode.RELATIONSHIP_ALREADY_EXISTS)) {
throw e;
}
}
}
protected void updateRelationshipAttributes(AtlasRelationship relationship, AtlasRelatedTermHeader relatedTermHeader) {
if (Objects.nonNull(relationship)) {
relationship.setAttribute(TERM_RELATION_ATTR_EXPRESSION, relatedTermHeader.getExpression());
relationship.setAttribute(TERM_RELATION_ATTR_DESCRIPTION, relatedTermHeader.getDescription());
relationship.setAttribute(TERM_RELATION_ATTR_STEWARD, relatedTermHeader.getSteward());
relationship.setAttribute(TERM_RELATION_ATTR_SOURCE, relatedTermHeader.getSource());
if (Objects.nonNull(relatedTermHeader.getStatus())) {
relationship.setAttribute(TERM_RELATION_ATTR_STATUS, relatedTermHeader.getStatus().name());
}
}
}
enum RelationshipOperation {
CREATE, UPDATE, DELETE
}
}
......@@ -113,7 +113,13 @@ public class DataAccess {
List<AtlasBaseModelObject> ret = new ArrayList<>();
for (T object : objects) {
try {
ret.add(load(object));
} catch (AtlasBaseException e) {
// In case of bulk load, some entities might be in deleted state causing an exception to be thrown
// by the single load API call
LOG.warn("Bulk load encountered an error.", e);
}
}
return (Iterable<T>) ret;
......
......@@ -20,7 +20,6 @@ package org.apache.atlas.repository.ogm.glossary;
import org.apache.atlas.exception.AtlasBaseException;
import org.apache.atlas.model.glossary.AtlasGlossaryTerm;
import org.apache.atlas.model.instance.AtlasEntity;
import org.apache.atlas.model.instance.AtlasEntityHeader;
import org.apache.atlas.model.instance.AtlasRelatedObjectId;
import org.apache.atlas.model.instance.AtlasRelationship;
import org.apache.atlas.type.AtlasTypeRegistry;
......@@ -92,12 +91,7 @@ public class AtlasGlossaryTermDTO extends AbstractGlossaryDTO<AtlasGlossaryTerm>
if (assignedEntity instanceof AtlasRelatedObjectId) {
AtlasRelatedObjectId id = (AtlasRelatedObjectId) assignedEntity;
if (id.getRelationshipStatus() == AtlasRelationship.Status.ACTIVE) {
AtlasEntityHeader entityHeader = new AtlasEntityHeader(id.getTypeName(), id.getGuid(), id.getUniqueAttributes());
if (entityHeader.getAttributes() == null) {
entityHeader.setAttributes(new HashMap<>());
}
entityHeader.getAttributes().put("relationGuid", id.getRelationshipGuid());
ret.addAssignedEntity(entityHeader);
ret.addAssignedEntity(id);
}
}
}
......
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
......
......@@ -21,6 +21,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import org.apache.atlas.AtlasErrorCode;
import org.apache.atlas.exception.AtlasBaseException;
import org.apache.atlas.model.TimeBoundary;
import org.apache.atlas.model.glossary.enums.AtlasTermAssignmentStatus;
import org.apache.atlas.model.glossary.relations.AtlasTermAssignmentHeader;
import org.apache.atlas.model.instance.AtlasClassification;
import org.apache.atlas.model.instance.AtlasClassification.PropagationState;
......@@ -71,30 +72,16 @@ import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import static org.apache.atlas.glossary.GlossaryUtils.*;
import static org.apache.atlas.model.instance.AtlasClassification.PropagationState.ACTIVE;
import static org.apache.atlas.model.instance.AtlasClassification.PropagationState.DELETED;
import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.*;
import static org.apache.atlas.model.typedef.AtlasRelationshipDef.PropagateTags.ONE_TO_TWO;
import static org.apache.atlas.repository.Constants.*;
import static org.apache.atlas.repository.graph.GraphHelper.EDGE_LABEL_PREFIX;
import static org.apache.atlas.repository.graph.GraphHelper.addToPropagatedTraitNames;
import static org.apache.atlas.repository.graph.GraphHelper.getAdjacentEdgesByLabel;
import static org.apache.atlas.repository.graph.GraphHelper.getAllClassificationEdges;
import static org.apache.atlas.repository.graph.GraphHelper.getAllTraitNames;
import static org.apache.atlas.repository.graph.GraphHelper.getAssociatedEntityVertex;
import static org.apache.atlas.repository.graph.GraphHelper.getBlockedClassificationIds;
import static org.apache.atlas.repository.graph.GraphHelper.getClassificationEdge;
import static org.apache.atlas.repository.graph.GraphHelper.getClassificationEdgeState;
import static org.apache.atlas.repository.graph.GraphHelper.getGuid;
import static org.apache.atlas.repository.graph.GraphHelper.getIncomingEdgesByLabel;
import static org.apache.atlas.repository.graph.GraphHelper.getOutGoingEdgesByLabel;
import static org.apache.atlas.repository.graph.GraphHelper.getPropagateTags;
import static org.apache.atlas.repository.graph.GraphHelper.getPropagatedClassificationEdge;
import static org.apache.atlas.repository.graph.GraphHelper.getRelationshipGuid;
import static org.apache.atlas.repository.graph.GraphHelper.getTypeName;
import static org.apache.atlas.repository.graph.GraphHelper.isPropagatedClassificationEdge;
import static org.apache.atlas.repository.graph.GraphHelper.isPropagationEnabled;
import static org.apache.atlas.repository.graph.GraphHelper.removeFromPropagatedTraitNames;
import static org.apache.atlas.repository.Constants.CLASSIFICATION_ENTITY_GUID;
import static org.apache.atlas.repository.Constants.CLASSIFICATION_LABEL;
import static org.apache.atlas.repository.Constants.CLASSIFICATION_VALIDITY_PERIODS_KEY;
import static org.apache.atlas.repository.Constants.TERM_ASSIGNMENT_LABEL;
import static org.apache.atlas.repository.graph.GraphHelper.*;
import static org.apache.atlas.repository.store.graph.v1.AtlasGraphUtilsV1.getIdFromVertex;
import static org.apache.atlas.type.AtlasStructType.AtlasAttribute.AtlasRelationshipEdgeDirection;
import static org.apache.atlas.type.AtlasStructType.AtlasAttribute.AtlasRelationshipEdgeDirection.BOTH;
......@@ -105,7 +92,11 @@ import static org.apache.atlas.type.AtlasStructType.AtlasAttribute.AtlasRelation
public final class EntityGraphRetriever {
private static final Logger LOG = LoggerFactory.getLogger(EntityGraphRetriever.class);
private static final String TERM_RELATION_NAME = "__AtlasGlossarySemanticAssignment";
private static final String GLOSSARY_TERM_DISPLAY_NAME_ATTR = "__AtlasGlossaryTerm.displayName";
private final String NAME = "name";
private final String DISPLAY_NAME = "displayName";
private final String DESCRIPTION = "description";
private final String OWNER = "owner";
private final String CREATE_TIME = "createTime";
......@@ -368,7 +359,9 @@ public final class EntityGraphRetriever {
ret.setStatus(GraphHelper.getStatus(entityVertex));
ret.setClassificationNames(getAllTraitNames(entityVertex));
// TODO: Add the term mapping here
List<AtlasTermAssignmentHeader> termAssignmentHeaders = mapAssignedTerms(entityVertex);
ret.setMeanings(termAssignmentHeaders);
ret.setMeaningNames(termAssignmentHeaders.stream().map(AtlasTermAssignmentHeader::getDisplayText).collect(Collectors.toList()));
AtlasEntityType entityType = typeRegistry.getEntityTypeByName(typeName);
......@@ -410,6 +403,7 @@ public final class EntityGraphRetriever {
}
}
}
}
return ret;
......@@ -503,6 +497,85 @@ public final class EntityGraphRetriever {
return ret;
}
public List<AtlasTermAssignmentHeader> mapAssignedTerms(AtlasVertex entityVertex) throws AtlasBaseException {
List<AtlasTermAssignmentHeader> ret = new ArrayList<>();
Iterable edges = entityVertex.query().direction(AtlasEdgeDirection.IN).label(TERM_ASSIGNMENT_LABEL).edges();
if (edges != null) {
Iterator<AtlasEdge> iterator = edges.iterator();
while (iterator.hasNext()) {
AtlasEdge edge = iterator.next();
if (edge != null) {
ret.add(toTermAssignmentHeader(edge));
}
}
}
return ret;
}
private AtlasTermAssignmentHeader toTermAssignmentHeader(final AtlasEdge edge) {
AtlasTermAssignmentHeader ret = new AtlasTermAssignmentHeader();
AtlasVertex termVertex = edge.getOutVertex();
String guid = GraphHelper.getGuid(termVertex);
if (guid != null) {
ret.setTermGuid(guid);
}
String relationGuid = edge.getProperty(Constants.RELATIONSHIP_GUID_PROPERTY_KEY, String.class);
if (relationGuid != null) {
ret.setRelationGuid(relationGuid);
}
Object displayName = GraphHelper.getProperty(termVertex, GLOSSARY_TERM_DISPLAY_NAME_ATTR);
if (displayName instanceof String) {
ret.setDisplayText((String) displayName);
}
String description = edge.getProperty(TERM_ASSIGNMENT_ATTR_DESCRIPTION, String.class);
if (description != null) {
ret.setDescription(description);
}
String expression = edge.getProperty(TERM_ASSIGNMENT_ATTR_EXPRESSION, String.class);
if (expression != null) {
ret.setExpression(expression);
}
String status = edge.getProperty(TERM_ASSIGNMENT_ATTR_STATUS, String.class);
if (status != null) {
AtlasTermAssignmentStatus assignmentStatus = AtlasTermAssignmentStatus.valueOf(status);
ret.setStatus(assignmentStatus);
}
Integer confidence = edge.getProperty(TERM_ASSIGNMENT_ATTR_CONFIDENCE, Integer.class);
if (confidence != null) {
ret.setConfidence(confidence);
}
String createdBy = edge.getProperty(TERM_ASSIGNMENT_ATTR_CREATED_BY, String.class);
if (createdBy != null) {
ret.setCreatedBy(createdBy);
}
String steward = edge.getProperty(TERM_ASSIGNMENT_ATTR_STEWARD, String.class);
if (steward != null) {
ret.setSteward(steward);
}
String source = edge.getProperty(TERM_ASSIGNMENT_ATTR_SOURCE, String.class);
if (source != null) {
ret.setSource(source);
}
return ret;
}
private void mapClassifications(AtlasVertex entityVertex, AtlasEntity entity) throws AtlasBaseException {
List<AtlasEdge> edges = getAllClassificationEdges(entityVertex);
......@@ -881,6 +954,10 @@ public final class EntityGraphRetriever {
ret = getVertexAttribute(entityVertex, entityType.getAttribute(NAME));
if (ret == null) {
ret = getVertexAttribute(entityVertex, entityType.getAttribute(DISPLAY_NAME));
}
if (ret == null) {
ret = getVertexAttribute(entityVertex, entityType.getAttribute(QUALIFIED_NAME));
}
}
......
......@@ -26,7 +26,7 @@ import org.apache.atlas.model.glossary.AtlasGlossaryCategory;
import org.apache.atlas.model.glossary.AtlasGlossaryTerm;
import org.apache.atlas.model.glossary.relations.AtlasRelatedCategoryHeader;
import org.apache.atlas.model.glossary.relations.AtlasRelatedTermHeader;
import org.apache.atlas.model.instance.AtlasEntityHeader;
import org.apache.atlas.model.instance.AtlasRelatedObjectId;
import org.apache.atlas.utils.AtlasPerfTracer;
import org.apache.atlas.web.util.Servlets;
import org.apache.commons.collections.MapUtils;
......@@ -723,7 +723,7 @@ public class GlossaryREST {
*/
@GET
@Path("/terms/{termGuid}/assignedEntities")
public List<AtlasEntityHeader> getEntitiesAssignedWithTerm(@PathParam("termGuid") String termGuid,
public List<AtlasRelatedObjectId> getEntitiesAssignedWithTerm(@PathParam("termGuid") String termGuid,
@DefaultValue("-1") @QueryParam("limit") String limit,
@DefaultValue("0") @QueryParam("offset") String offset,
@DefaultValue("ASC") @QueryParam("sort") final String sort) throws AtlasBaseException {
......@@ -746,7 +746,7 @@ public class GlossaryREST {
/**
* Assign the given term to the provided list of entity headers
* @param termGuid Glossary term GUID
* @param entityHeaders Entity headers for which the term has to be associated
* @param relatedObjectIds Related Entity IDs to which the term has to be associated
* @throws AtlasBaseException
* @HTTP 204 If the term assignment was successful
* @HTTP 400 If ANY of the entity header is invalid
......@@ -754,7 +754,7 @@ public class GlossaryREST {
*/
@POST
@Path("/terms/{termGuid}/assignedEntities")
public void assignTermToEntities(@PathParam("termGuid") String termGuid, List<AtlasEntityHeader> entityHeaders) throws AtlasBaseException {
public void assignTermToEntities(@PathParam("termGuid") String termGuid, List<AtlasRelatedObjectId> relatedObjectIds) throws AtlasBaseException {
Servlets.validateQueryParamLength("termGuid", termGuid);
AtlasPerfTracer perf = null;
......@@ -763,7 +763,7 @@ public class GlossaryREST {
perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "GlossaryREST.assignTermToEntities(" + termGuid + ")");
}
glossaryService.assignTermToEntities(termGuid, entityHeaders);
glossaryService.assignTermToEntities(termGuid, relatedObjectIds);
} finally {
AtlasPerfTracer.log(perf);
}
......@@ -772,7 +772,7 @@ public class GlossaryREST {
/**
* Remove the term assignment for the given list of entity headers
* @param termGuid Glossary term GUID
* @param entityHeaders List of entity headers from which the term has to be dissociated
* @param relatedObjectIds List of related entity IDs from which the term has to be dissociated
* @throws AtlasBaseException
* @HTTP 204 If glossary term dissociation was successful
* @HTTP 400 If ANY of the entity header is invalid
......@@ -780,7 +780,7 @@ public class GlossaryREST {
*/
@DELETE
@Path("/terms/{termGuid}/assignedEntities")
public void removeTermAssignmentFromEntities(@PathParam("termGuid") String termGuid, List<AtlasEntityHeader> entityHeaders) throws AtlasBaseException {
public void removeTermAssignmentFromEntities(@PathParam("termGuid") String termGuid, List<AtlasRelatedObjectId> relatedObjectIds) throws AtlasBaseException {
Servlets.validateQueryParamLength("termGuid", termGuid);
AtlasPerfTracer perf = null;
......@@ -789,7 +789,7 @@ public class GlossaryREST {
perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "GlossaryREST.removeTermAssignmentFromEntities(" + termGuid + ")");
}
glossaryService.removeTermFromEntities(termGuid, entityHeaders);
glossaryService.removeTermFromEntities(termGuid, relatedObjectIds);
} finally {
AtlasPerfTracer.log(perf);
}
......
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