Commit 0e947170 by Madhan Neethiraj

ATLAS-3653: rename Namespace to BusinessMetadata

parent e5037282
...@@ -29,7 +29,7 @@ public class AtlasEntityAccessRequest extends AtlasAccessRequest { ...@@ -29,7 +29,7 @@ public class AtlasEntityAccessRequest extends AtlasAccessRequest {
private final String entityId; private final String entityId;
private final AtlasClassification classification; private final AtlasClassification classification;
private final String label; private final String label;
private final String namespaceName; private final String businessMetadata;
private final String attributeName; private final String attributeName;
private final AtlasTypeRegistry typeRegistry; private final AtlasTypeRegistry typeRegistry;
private final Set<String> entityClassifications; private final Set<String> entityClassifications;
...@@ -67,14 +67,14 @@ public class AtlasEntityAccessRequest extends AtlasAccessRequest { ...@@ -67,14 +67,14 @@ public class AtlasEntityAccessRequest extends AtlasAccessRequest {
this(typeRegistry, action, entity, classification, attributeName, null, null, userName, userGroups); this(typeRegistry, action, entity, classification, attributeName, null, null, userName, userGroups);
} }
public AtlasEntityAccessRequest(AtlasTypeRegistry typeRegistry, AtlasPrivilege action, AtlasEntityHeader entity, AtlasClassification classification, String attributeName, String label, String namespaceName, String userName, Set<String> userGroups) { public AtlasEntityAccessRequest(AtlasTypeRegistry typeRegistry, AtlasPrivilege action, AtlasEntityHeader entity, AtlasClassification classification, String attributeName, String label, String businessMetadata, String userName, Set<String> userGroups) {
super(action, userName, userGroups); super(action, userName, userGroups);
this.entity = entity; this.entity = entity;
this.entityId = super.getEntityId(entity, typeRegistry); this.entityId = super.getEntityId(entity, typeRegistry);
this.classification = classification; this.classification = classification;
this.label = label; this.label = label;
this.namespaceName = namespaceName; this.businessMetadata = businessMetadata;
this.attributeName = attributeName; this.attributeName = attributeName;
this.typeRegistry = typeRegistry; this.typeRegistry = typeRegistry;
this.entityClassifications = super.getClassificationNames(entity); this.entityClassifications = super.getClassificationNames(entity);
...@@ -96,8 +96,8 @@ public class AtlasEntityAccessRequest extends AtlasAccessRequest { ...@@ -96,8 +96,8 @@ public class AtlasEntityAccessRequest extends AtlasAccessRequest {
return label; return label;
} }
public String getNamespaceName() { public String getBusinessMetadata() {
return namespaceName; return businessMetadata;
} }
public String getAttributeName() { public String getAttributeName() {
...@@ -122,7 +122,7 @@ public class AtlasEntityAccessRequest extends AtlasAccessRequest { ...@@ -122,7 +122,7 @@ public class AtlasEntityAccessRequest extends AtlasAccessRequest {
@Override @Override
public String toString() { public String toString() {
return "AtlasEntityAccessRequest[entity=" + entity + ", classification=" + classification + ", label=" + label + ", namespaceName=" + namespaceName + ", attributeName=" + attributeName + return "AtlasEntityAccessRequest[entity=" + entity + ", classification=" + classification + ", label=" + label + ", businessMetadata=" + businessMetadata + ", attributeName=" + attributeName +
", action=" + getAction() + ", accessTime=" + getAccessTime() + ", user=" + getUser() + ", action=" + getAction() + ", accessTime=" + getAccessTime() + ", user=" + getUser() +
", userGroups=" + getUserGroups() + ", clientIPAddress=" + getClientIPAddress() + ", userGroups=" + getUserGroups() + ", clientIPAddress=" + getClientIPAddress() +
", forwardedAddresses=" + getForwardedAddresses() + ", remoteIPAddress=" + getRemoteIPAddress() + "]"; ", forwardedAddresses=" + getForwardedAddresses() + ", remoteIPAddress=" + getRemoteIPAddress() + "]";
...@@ -136,7 +136,7 @@ public class AtlasEntityAccessRequest extends AtlasAccessRequest { ...@@ -136,7 +136,7 @@ public class AtlasEntityAccessRequest extends AtlasAccessRequest {
private AtlasEntityHeader entity; private AtlasEntityHeader entity;
private AtlasClassification classification; private AtlasClassification classification;
private String label; private String label;
private String namespaceName; private String businessMetadata;
private String attributeName; private String attributeName;
public AtlasEntityAccessRequestBuilder(AtlasTypeRegistry typeRegistry, AtlasPrivilege action) { public AtlasEntityAccessRequestBuilder(AtlasTypeRegistry typeRegistry, AtlasPrivilege action) {
...@@ -180,8 +180,8 @@ public class AtlasEntityAccessRequest extends AtlasAccessRequest { ...@@ -180,8 +180,8 @@ public class AtlasEntityAccessRequest extends AtlasAccessRequest {
return this; return this;
} }
public AtlasEntityAccessRequestBuilder setNamespaceName(String namespaceName) { public AtlasEntityAccessRequestBuilder setBusinessMetadata(String businessMetadata) {
this.namespaceName = namespaceName; this.businessMetadata = businessMetadata;
return this; return this;
} }
...@@ -193,7 +193,7 @@ public class AtlasEntityAccessRequest extends AtlasAccessRequest { ...@@ -193,7 +193,7 @@ public class AtlasEntityAccessRequest extends AtlasAccessRequest {
} }
public AtlasEntityAccessRequest build() { public AtlasEntityAccessRequest build() {
return new AtlasEntityAccessRequest(typeRegistry, action, entity, classification, attributeName, label, namespaceName, userName, userGroups); return new AtlasEntityAccessRequest(typeRegistry, action, entity, classification, attributeName, label, businessMetadata, userName, userGroups);
} }
} }
} }
......
...@@ -42,7 +42,7 @@ public enum AtlasPrivilege { ...@@ -42,7 +42,7 @@ public enum AtlasPrivilege {
ENTITY_ADD_LABEL("entity-add-label"), ENTITY_ADD_LABEL("entity-add-label"),
ENTITY_REMOVE_LABEL("entity-remove-label"), ENTITY_REMOVE_LABEL("entity-remove-label"),
ENTITY_UPDATE_NAMESPACE("entity-update-namespace"); ENTITY_UPDATE_BUSINESS_METADATA("entity-update-business-metadata");
private final String type; private final String type;
......
...@@ -238,9 +238,9 @@ public final class AtlasSimpleAuthorizer implements AtlasAuthorizer { ...@@ -238,9 +238,9 @@ public final class AtlasSimpleAuthorizer implements AtlasAuthorizer {
if (permissions != null) { if (permissions != null) {
for (AtlasEntityPermission permission : permissions) { for (AtlasEntityPermission permission : permissions) {
// match entity-type/entity-id/lable/namespace/attribute // match entity-type/entity-id/label/business-metadata/attribute
if (isMatchAny(entityTypes, permission.getEntityTypes()) && isMatch(entityId, permission.getEntityIds()) && isMatch(attribute, permission.getAttributes()) if (isMatchAny(entityTypes, permission.getEntityTypes()) && isMatch(entityId, permission.getEntityIds()) && isMatch(attribute, permission.getAttributes())
&& isLabelMatch(request, permission) && isNamespaceMatch(request, permission)) { && isLabelMatch(request, permission) && isBusinessMetadataMatch(request, permission)) {
// match permission/classification // match permission/classification
if (!hasEntityAccess) { if (!hasEntityAccess) {
if (isMatch(action, permission.getPrivileges()) && isMatch(classification, permission.getClassifications())) { if (isMatch(action, permission.getPrivileges()) && isMatch(classification, permission.getClassifications())) {
...@@ -464,8 +464,8 @@ public final class AtlasSimpleAuthorizer implements AtlasAuthorizer { ...@@ -464,8 +464,8 @@ public final class AtlasSimpleAuthorizer implements AtlasAuthorizer {
return (AtlasPrivilege.ENTITY_ADD_LABEL.equals(request.getAction()) || AtlasPrivilege.ENTITY_REMOVE_LABEL.equals(request.getAction())) ? isMatch(request.getLabel(), permission.getLabels()) : true; return (AtlasPrivilege.ENTITY_ADD_LABEL.equals(request.getAction()) || AtlasPrivilege.ENTITY_REMOVE_LABEL.equals(request.getAction())) ? isMatch(request.getLabel(), permission.getLabels()) : true;
} }
private boolean isNamespaceMatch(AtlasEntityAccessRequest request, AtlasEntityPermission permission) { private boolean isBusinessMetadataMatch(AtlasEntityAccessRequest request, AtlasEntityPermission permission) {
return AtlasPrivilege.ENTITY_UPDATE_NAMESPACE.equals(request.getAction()) ? isMatch(request.getNamespaceName(), permission.getNamespaces()) : true; return AtlasPrivilege.ENTITY_UPDATE_BUSINESS_METADATA.equals(request.getAction()) ? isMatch(request.getBusinessMetadata(), permission.getBusinessMetadata()) : true;
} }
} }
......
...@@ -210,7 +210,7 @@ public class AtlasSimpleAuthzPolicy implements Serializable { ...@@ -210,7 +210,7 @@ public class AtlasSimpleAuthzPolicy implements Serializable {
private List<String> entityIds; // value of entity-unique attribute, wildcards supported private List<String> entityIds; // value of entity-unique attribute, wildcards supported
private List<String> classifications; // name of classification-type, wildcards supported private List<String> classifications; // name of classification-type, wildcards supported
private List<String> labels; // labels, wildcards supported private List<String> labels; // labels, wildcards supported
private List<String> namespaces; // name of namespace-type, wildcards supported private List<String> businessMetadata; // name of business-metadata, wildcards supported
private List<String> attributes; // name of entity-attribute, wildcards supported private List<String> attributes; // name of entity-attribute, wildcards supported
public AtlasEntityPermission() { public AtlasEntityPermission() {
...@@ -220,13 +220,13 @@ public class AtlasSimpleAuthzPolicy implements Serializable { ...@@ -220,13 +220,13 @@ public class AtlasSimpleAuthzPolicy implements Serializable {
this(privileges, entityTypes, entityIds, classifications, attributes, null, null); this(privileges, entityTypes, entityIds, classifications, attributes, null, null);
} }
public AtlasEntityPermission(List<String> privileges, List<String> entityTypes, List<String> entityIds, List<String> classifications, List<String> labels, List<String> namespaces, List<String> attributes) { public AtlasEntityPermission(List<String> privileges, List<String> entityTypes, List<String> entityIds, List<String> classifications, List<String> labels, List<String> businessMetadata, List<String> attributes) {
this.privileges = privileges; this.privileges = privileges;
this.entityTypes = entityTypes; this.entityTypes = entityTypes;
this.entityIds = entityIds; this.entityIds = entityIds;
this.classifications = classifications; this.classifications = classifications;
this.labels = labels; this.labels = labels;
this.namespaces = namespaces; this.businessMetadata = businessMetadata;
this.attributes = attributes; this.attributes = attributes;
} }
...@@ -270,12 +270,12 @@ public class AtlasSimpleAuthzPolicy implements Serializable { ...@@ -270,12 +270,12 @@ public class AtlasSimpleAuthzPolicy implements Serializable {
this.labels = labels; this.labels = labels;
} }
public List<String> getNamespaces() { public List<String> getBusinessMetadata() {
return namespaces; return businessMetadata;
} }
public void setNamespaces(List<String> namespaces) { public void setBusinessMetadata(List<String> businessMetadata) {
this.namespaces = namespaces; this.businessMetadata = businessMetadata;
} }
public List<String> getAttributes() { public List<String> getAttributes() {
......
...@@ -150,21 +150,21 @@ public class AtlasSimpleAuthorizerTest { ...@@ -150,21 +150,21 @@ public class AtlasSimpleAuthorizerTest {
} }
@Test(enabled = true) @Test(enabled = true)
public void testNamespaces() { public void testBusinessMetadata() {
try { try {
AtlasEntityAccessRequest request = new AtlasEntityAccessRequest(null, AtlasPrivilege.ENTITY_UPDATE_NAMESPACE); AtlasEntityAccessRequest request = new AtlasEntityAccessRequest(null, AtlasPrivilege.ENTITY_UPDATE_BUSINESS_METADATA);
request.setUser(USER_DATA_SCIENTIST, Collections.emptySet()); request.setUser(USER_DATA_SCIENTIST, Collections.emptySet());
boolean isAccessAllowed = authorizer.isAccessAllowed(request); boolean isAccessAllowed = authorizer.isAccessAllowed(request);
AssertJUnit.assertEquals("user " + USER_DATA_SCIENTIST + " shouldn't be allowed to update namespace", false, isAccessAllowed); AssertJUnit.assertEquals("user " + USER_DATA_SCIENTIST + " shouldn't be allowed to update business-metadata", false, isAccessAllowed);
request.setUser(USER_DATA_STEWARD, Collections.emptySet()); request.setUser(USER_DATA_STEWARD, Collections.emptySet());
isAccessAllowed = authorizer.isAccessAllowed(request); isAccessAllowed = authorizer.isAccessAllowed(request);
AssertJUnit.assertEquals("user " + USER_DATA_STEWARD + " should be allowed to update namespace", true, isAccessAllowed); AssertJUnit.assertEquals("user " + USER_DATA_STEWARD + " should be allowed to update business-metadata", true, isAccessAllowed);
} catch (AtlasAuthorizationException e) { } catch (AtlasAuthorizationException e) {
LOG.error("Exception in AtlasSimpleAuthorizerTest", e); LOG.error("Exception in AtlasSimpleAuthorizerTest", e);
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
"entityIds": [ ".*" ], "entityIds": [ ".*" ],
"classifications": [ ".*" ], "classifications": [ ".*" ],
"labels": [ ".*" ], "labels": [ ".*" ],
"namespaces": [ ".*" ] "businessMetadata": [ ".*" ]
} }
] ]
}, },
...@@ -53,12 +53,12 @@ ...@@ -53,12 +53,12 @@
"DATA_STEWARD": { "DATA_STEWARD": {
"entityPermissions": [ "entityPermissions": [
{ {
"privileges": [ "entity-read", "entity-create", "entity-update", "entity-read-classification", "entity-add-classification", "entity-update-classification", "entity-remove-classification", "entity-add-label", "entity-remove-label", "entity-update-namespace" ], "privileges": [ "entity-read", "entity-create", "entity-update", "entity-read-classification", "entity-add-classification", "entity-update-classification", "entity-remove-classification", "entity-add-label", "entity-remove-label", "entity-update-business-metadata" ],
"entityTypes": [ ".*" ], "entityTypes": [ ".*" ],
"entityIds": [ ".*" ], "entityIds": [ ".*" ],
"classifications": [ ".*" ], "classifications": [ ".*" ],
"labels": [ ".*" ], "labels": [ ".*" ],
"namespaces": [ ".*" ] "businessMetadata": [ ".*" ]
} }
] ]
} }
......
...@@ -161,12 +161,12 @@ public enum AtlasErrorCode { ...@@ -161,12 +161,12 @@ public enum AtlasErrorCode {
INVALID_LABEL_LENGTH(400, "ATLAS-400-00-08F", "Invalid label: {0}, label size should not be greater than {1}"), INVALID_LABEL_LENGTH(400, "ATLAS-400-00-08F", "Invalid label: {0}, label size should not be greater than {1}"),
INVALID_LABEL_CHARACTERS(400, "ATLAS-400-00-090", "Invalid label: {0}, label should contain alphanumeric characters, '_' or '-'"), INVALID_LABEL_CHARACTERS(400, "ATLAS-400-00-090", "Invalid label: {0}, label should contain alphanumeric characters, '_' or '-'"),
INVALID_PROPAGATION_TYPE(400, "ATLAS-400-00-091", "Invalid propagation {0} for relationship-type={1}. Default value is {2}"), INVALID_PROPAGATION_TYPE(400, "ATLAS-400-00-091", "Invalid propagation {0} for relationship-type={1}. Default value is {2}"),
DUPLICATE_NAMESPACE_ATTRIBUTE(400, "ATLAS-400-00-092", "Duplicate Namespace Attributes: {0} not allowed within the same namespace: {1}"), DUPLICATE_BUSINESS_METADATA_ATTRIBUTE(400, "ATLAS-400-00-092", "Duplicate business-metadata attributes: {0} not allowed within the same business-metadata: {1}"),
APPLICABLE_ENTITY_TYPES_DELETION_NOT_SUPPORTED(400, "ATLAS-400-00-093", "Cannot remove applicableEntityTypes in Attribute Def: {0}, defined in namespace: {1}"), APPLICABLE_ENTITY_TYPES_DELETION_NOT_SUPPORTED(400, "ATLAS-400-00-093", "Cannot remove applicableEntityTypes in Attribute Def: {0}, defined in business-metadata: {1}"),
NAMESPACE_DEF_ATTRIBUTE_TYPE_INVALID(400, "ATLAS-400-00-094", "{0}.{1}: invalid attribute type. Namespace attribute cannot be of type entity/classification/struct/namespace"), BUSINESS_METADATA_DEF_ATTRIBUTE_TYPE_INVALID(400, "ATLAS-400-00-094", "{0}.{1}: invalid attribute type. Business-metadata attribute cannot be of type entity/classification/struct/business-metadata"),
INVALID_NAMESPACE_NAME_FOR_ENTITY_TYPE(400, "ATLAS-400-00-095", "Invalid Namespace: {0} specified for entity, applicable namespaces: {1}"), INVALID_BUSINESS_METADATA_NAME_FOR_ENTITY_TYPE(400, "ATLAS-400-00-095", "Invalid business-metadata: {0} specified for entity, applicable business-metadata: {1}"),
NAMESPACE_ATTRIBUTE_DOES_NOT_EXIST(400, "ATLAS-400-00-096", "Namespace attribute does not exist in entity: {0}"), BUSINESS_METADATA_ATTRIBUTE_DOES_NOT_EXIST(400, "ATLAS-400-00-096", "Business-metadata attribute does not exist in entity: {0}"),
NAMESPACE_ATTRIBUTE_ALREADY_EXISTS(400, "ATLAS-400-00-097", "Namespace attribute already exists in entity: {0}"), BUSINESS_METADATA_ATTRIBUTE_ALREADY_EXISTS(400, "ATLAS-400-00-097", "Business-metadata attribute already exists in entity: {0}"),
UNAUTHORIZED_ACCESS(403, "ATLAS-403-00-001", "{0} is not authorized to perform {1}"), UNAUTHORIZED_ACCESS(403, "ATLAS-403-00-001", "{0} is not authorized to perform {1}"),
......
...@@ -18,5 +18,5 @@ ...@@ -18,5 +18,5 @@
package org.apache.atlas.model; package org.apache.atlas.model;
public enum TypeCategory { public enum TypeCategory {
PRIMITIVE, OBJECT_ID_TYPE, ENUM, STRUCT, CLASSIFICATION, ENTITY, ARRAY, MAP, RELATIONSHIP, NAMESPACE PRIMITIVE, OBJECT_ID_TYPE, ENUM, STRUCT, CLASSIFICATION, ENTITY, ARRAY, MAP, RELATIONSHIP, BUSINESS_METADATA
} }
...@@ -93,7 +93,7 @@ public class AtlasEntity extends AtlasStruct implements Serializable { ...@@ -93,7 +93,7 @@ public class AtlasEntity extends AtlasStruct implements Serializable {
private List<AtlasClassification> classifications; private List<AtlasClassification> classifications;
private List<AtlasTermAssignmentHeader> meanings; private List<AtlasTermAssignmentHeader> meanings;
private Map<String, String> customAttributes; private Map<String, String> customAttributes;
private Map<String, Map<String, Object>> namespaceAttributes; private Map<String, Map<String, Object>> businessAttributes;
private Set<String> labels; private Set<String> labels;
@JsonIgnore @JsonIgnore
...@@ -218,7 +218,7 @@ public class AtlasEntity extends AtlasStruct implements Serializable { ...@@ -218,7 +218,7 @@ public class AtlasEntity extends AtlasStruct implements Serializable {
setRelationshipAttributes(other.getRelationshipAttributes()); setRelationshipAttributes(other.getRelationshipAttributes());
setMeanings(other.getMeanings()); setMeanings(other.getMeanings());
setCustomAttributes(other.getCustomAttributes()); setCustomAttributes(other.getCustomAttributes());
setNamespaceAttributes(other.getNamespaceAttributes()); setBusinessAttributes(other.getBusinessAttributes());
setLabels(other.getLabels()); setLabels(other.getLabels());
} }
} }
...@@ -350,39 +350,39 @@ public class AtlasEntity extends AtlasStruct implements Serializable { ...@@ -350,39 +350,39 @@ public class AtlasEntity extends AtlasStruct implements Serializable {
this.customAttributes = customAttributes; this.customAttributes = customAttributes;
} }
public Map<String, Map<String, Object>> getNamespaceAttributes() { public Map<String, Map<String, Object>> getBusinessAttributes() {
return namespaceAttributes; return businessAttributes;
} }
public void setNamespaceAttributes(Map<String, Map<String, Object>> namespaceAttributes) { public void setBusinessAttributes(Map<String, Map<String, Object>> businessAttributes) {
this.namespaceAttributes = namespaceAttributes; this.businessAttributes = businessAttributes;
} }
public void setNamespaceAttribute(String nsName, String nsAttrName, Object nsValue) { public void setBusinessAttribute(String nsName, String nsAttrName, Object nsValue) {
Map<String, Map<String, Object>> namespaceAttributes = this.namespaceAttributes; Map<String, Map<String, Object>> businessAttributes = this.businessAttributes;
if (namespaceAttributes == null) { if (businessAttributes == null) {
namespaceAttributes = new HashMap<>(); businessAttributes = new HashMap<>();
this.namespaceAttributes = namespaceAttributes; this.businessAttributes = businessAttributes;
} }
Map<String, Object> namespaceAttributeMap = namespaceAttributes.get(nsName); Map<String, Object> businessAttributeMap = businessAttributes.get(nsName);
if (namespaceAttributeMap == null) { if (businessAttributeMap == null) {
namespaceAttributeMap = new HashMap<>(); businessAttributeMap = new HashMap<>();
namespaceAttributes.put(nsName, namespaceAttributeMap); businessAttributes.put(nsName, businessAttributeMap);
} }
namespaceAttributeMap.put(nsAttrName, nsValue); businessAttributeMap.put(nsAttrName, nsValue);
} }
public Object getNamespaceAttribute(String nsName, String nsAttrName) { public Object getBusinessAttribute(String bmName, String bmAttrName) {
Map<String, Map<String, Object>> namespaceAttributes = this.namespaceAttributes; Map<String, Map<String, Object>> businessAttributes = this.businessAttributes;
Map<String, Object> namespaceAttributeMap = namespaceAttributes == null ? null : namespaceAttributes.get(nsName); Map<String, Object> businessAttributeMap = businessAttributes == null ? null : businessAttributes.get(bmName);
return namespaceAttributeMap == null ? null : namespaceAttributeMap.get(nsAttrName); return businessAttributeMap == null ? null : businessAttributeMap.get(bmAttrName);
} }
public Set<String> getLabels() { public Set<String> getLabels() {
...@@ -441,7 +441,7 @@ public class AtlasEntity extends AtlasStruct implements Serializable { ...@@ -441,7 +441,7 @@ public class AtlasEntity extends AtlasStruct implements Serializable {
setClassifications(null); setClassifications(null);
setMeanings(null); setMeanings(null);
setCustomAttributes(null); setCustomAttributes(null);
setNamespaceAttributes(null); setBusinessAttributes(null);
setLabels(null); setLabels(null);
} }
...@@ -480,8 +480,8 @@ public class AtlasEntity extends AtlasStruct implements Serializable { ...@@ -480,8 +480,8 @@ public class AtlasEntity extends AtlasStruct implements Serializable {
sb.append(", customAttributes=["); sb.append(", customAttributes=[");
dumpObjects(customAttributes, sb); dumpObjects(customAttributes, sb);
sb.append("]"); sb.append("]");
sb.append(", namespaceAttributes=["); sb.append(", businessAttributes=[");
dumpObjects(namespaceAttributes, sb); dumpObjects(businessAttributes, sb);
sb.append("]"); sb.append("]");
sb.append(", labels=["); sb.append(", labels=[");
dumpObjects(labels, sb); dumpObjects(labels, sb);
...@@ -511,7 +511,7 @@ public class AtlasEntity extends AtlasStruct implements Serializable { ...@@ -511,7 +511,7 @@ public class AtlasEntity extends AtlasStruct implements Serializable {
Objects.equals(version, that.version) && Objects.equals(version, that.version) &&
Objects.equals(relationshipAttributes, that.relationshipAttributes) && Objects.equals(relationshipAttributes, that.relationshipAttributes) &&
Objects.equals(customAttributes, that.customAttributes) && Objects.equals(customAttributes, that.customAttributes) &&
Objects.equals(namespaceAttributes, that.namespaceAttributes) && Objects.equals(businessAttributes, that.businessAttributes) &&
Objects.equals(labels, that.labels) && Objects.equals(labels, that.labels) &&
Objects.equals(classifications, that.classifications); Objects.equals(classifications, that.classifications);
} }
...@@ -519,7 +519,7 @@ public class AtlasEntity extends AtlasStruct implements Serializable { ...@@ -519,7 +519,7 @@ public class AtlasEntity extends AtlasStruct implements Serializable {
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(super.hashCode(), guid, homeId, isProxy, isIncomplete, provenanceType, status, createdBy, updatedBy, return Objects.hash(super.hashCode(), guid, homeId, isProxy, isIncomplete, provenanceType, status, createdBy, updatedBy,
createTime, updateTime, version, relationshipAttributes, classifications, customAttributes, namespaceAttributes, labels); createTime, updateTime, version, relationshipAttributes, classifications, customAttributes, businessAttributes, labels);
} }
@Override @Override
......
...@@ -37,34 +37,34 @@ import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ ...@@ -37,34 +37,34 @@ import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_
@JsonIgnoreProperties(ignoreUnknown=true) @JsonIgnoreProperties(ignoreUnknown=true)
@XmlRootElement @XmlRootElement
@XmlAccessorType(XmlAccessType.PROPERTY) @XmlAccessorType(XmlAccessType.PROPERTY)
public class AtlasNamespaceDef extends AtlasStructDef implements Serializable { public class AtlasBusinessMetadataDef extends AtlasStructDef implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public static final String ATTR_OPTION_APPLICABLE_ENTITY_TYPES = "applicableEntityTypes"; public static final String ATTR_OPTION_APPLICABLE_ENTITY_TYPES = "applicableEntityTypes";
public static final String ATTR_MAX_STRING_LENGTH = "maxStrLength"; public static final String ATTR_MAX_STRING_LENGTH = "maxStrLength";
public static final String ATTR_VALID_PATTERN = "validPattern"; public static final String ATTR_VALID_PATTERN = "validPattern";
public AtlasNamespaceDef() { public AtlasBusinessMetadataDef() {
this(null, null, null, null); this(null, null, null, null);
} }
public AtlasNamespaceDef(String name, String description) { public AtlasBusinessMetadataDef(String name, String description) {
this(name, description, null, null, null); this(name, description, null, null, null);
} }
public AtlasNamespaceDef(String name, String description, String typeVersion) { public AtlasBusinessMetadataDef(String name, String description, String typeVersion) {
this(name, description, typeVersion, null, null); this(name, description, typeVersion, null, null);
} }
public AtlasNamespaceDef(String name, String description, String typeVersion, List<AtlasAttributeDef> attributeDefs) { public AtlasBusinessMetadataDef(String name, String description, String typeVersion, List<AtlasAttributeDef> attributeDefs) {
this(name, description, typeVersion, attributeDefs, null); this(name, description, typeVersion, attributeDefs, null);
} }
public AtlasNamespaceDef(String name, String description, String typeVersion, List<AtlasAttributeDef> attributeDefs, Map<String, String> options) { public AtlasBusinessMetadataDef(String name, String description, String typeVersion, List<AtlasAttributeDef> attributeDefs, Map<String, String> options) {
super(TypeCategory.NAMESPACE, name, description, typeVersion, attributeDefs, options); super(TypeCategory.BUSINESS_METADATA, name, description, typeVersion, attributeDefs, options);
} }
public AtlasNamespaceDef(AtlasNamespaceDef other) { public AtlasBusinessMetadataDef(AtlasBusinessMetadataDef other) {
super(other); super(other);
} }
...@@ -79,7 +79,7 @@ public class AtlasNamespaceDef extends AtlasStructDef implements Serializable { ...@@ -79,7 +79,7 @@ public class AtlasNamespaceDef extends AtlasStructDef implements Serializable {
sb = new StringBuilder(); sb = new StringBuilder();
} }
sb.append("AtlasNamespaceDef{"); sb.append("AtlasBusinessMetadataDef{");
super.toString(sb); super.toString(sb);
sb.append('}'); sb.append('}');
......
...@@ -66,8 +66,8 @@ public class AtlasEntityDef extends AtlasStructDef implements java.io.Serializab ...@@ -66,8 +66,8 @@ public class AtlasEntityDef extends AtlasStructDef implements java.io.Serializab
private List<AtlasRelationshipAttributeDef> relationshipAttributeDefs; private List<AtlasRelationshipAttributeDef> relationshipAttributeDefs;
// this is a read-only field, any value provided during create & update operation is ignored // this is a read-only field, any value provided during create & update operation is ignored
// the value of this field is derived from all the namespaceDefs this entityType is referenced in // the value of this field is derived from all the businessMetadataDefs this entityType is referenced in
private Map<String, List<AtlasAttributeDef>> namespaceAttributeDefs; private Map<String, List<AtlasAttributeDef>> businessAttributeDefs;
public AtlasEntityDef() { public AtlasEntityDef() {
...@@ -132,7 +132,7 @@ public class AtlasEntityDef extends AtlasStructDef implements java.io.Serializab ...@@ -132,7 +132,7 @@ public class AtlasEntityDef extends AtlasStructDef implements java.io.Serializab
setSuperTypes(other.getSuperTypes()); setSuperTypes(other.getSuperTypes());
setSubTypes(other.getSubTypes()); setSubTypes(other.getSubTypes());
setRelationshipAttributeDefs(other.getRelationshipAttributeDefs()); setRelationshipAttributeDefs(other.getRelationshipAttributeDefs());
setNamespaceAttributeDefs(other.getNamespaceAttributeDefs()); setBusinessAttributeDefs(other.getBusinessAttributeDefs());
} }
} }
...@@ -170,12 +170,12 @@ public class AtlasEntityDef extends AtlasStructDef implements java.io.Serializab ...@@ -170,12 +170,12 @@ public class AtlasEntityDef extends AtlasStructDef implements java.io.Serializab
this.relationshipAttributeDefs = relationshipAttributeDefs; this.relationshipAttributeDefs = relationshipAttributeDefs;
} }
public Map<String, List<AtlasAttributeDef>> getNamespaceAttributeDefs() { public Map<String, List<AtlasAttributeDef>> getBusinessAttributeDefs() {
return namespaceAttributeDefs; return businessAttributeDefs;
} }
public void setNamespaceAttributeDefs(Map<String, List<AtlasAttributeDef>> namespaceAttributeDefs) { public void setBusinessAttributeDefs(Map<String, List<AtlasAttributeDef>> businessAttributeDefs) {
this.namespaceAttributeDefs = namespaceAttributeDefs; this.businessAttributeDefs = businessAttributeDefs;
} }
public boolean hasSuperType(String typeName) { public boolean hasSuperType(String typeName) {
...@@ -235,11 +235,11 @@ public class AtlasEntityDef extends AtlasStructDef implements java.io.Serializab ...@@ -235,11 +235,11 @@ public class AtlasEntityDef extends AtlasStructDef implements java.io.Serializab
} }
} }
sb.append(']'); sb.append(']');
sb.append(", namespaceAttributeDefs={"); sb.append(", businessAttributeDefs={");
if (MapUtils.isNotEmpty(namespaceAttributeDefs)) { if (MapUtils.isNotEmpty(businessAttributeDefs)) {
int nsIdx = 0; int nsIdx = 0;
for (Map.Entry<String, List<AtlasAttributeDef>> entry : namespaceAttributeDefs.entrySet()) { for (Map.Entry<String, List<AtlasAttributeDef>> entry : businessAttributeDefs.entrySet()) {
String nsName = entry.getKey(); String nsName = entry.getKey();
List<AtlasAttributeDef> nsAttrs = entry.getValue(); List<AtlasAttributeDef> nsAttrs = entry.getValue();
......
...@@ -47,7 +47,7 @@ public class AtlasTypesDef { ...@@ -47,7 +47,7 @@ public class AtlasTypesDef {
private List<AtlasClassificationDef> classificationDefs; private List<AtlasClassificationDef> classificationDefs;
private List<AtlasEntityDef> entityDefs; private List<AtlasEntityDef> entityDefs;
private List<AtlasRelationshipDef> relationshipDefs; private List<AtlasRelationshipDef> relationshipDefs;
private List<AtlasNamespaceDef> namespaceDefs; private List<AtlasBusinessMetadataDef> businessMetadataDefs;
public AtlasTypesDef() { public AtlasTypesDef() {
enumDefs = new ArrayList<>(); enumDefs = new ArrayList<>();
...@@ -55,7 +55,7 @@ public class AtlasTypesDef { ...@@ -55,7 +55,7 @@ public class AtlasTypesDef {
classificationDefs = new ArrayList<>(); classificationDefs = new ArrayList<>();
entityDefs = new ArrayList<>(); entityDefs = new ArrayList<>();
relationshipDefs = new ArrayList<>(); relationshipDefs = new ArrayList<>();
namespaceDefs = new ArrayList<>(); businessMetadataDefs = new ArrayList<>();
} }
/** /**
...@@ -91,13 +91,13 @@ public class AtlasTypesDef { ...@@ -91,13 +91,13 @@ public class AtlasTypesDef {
List<AtlasClassificationDef> classificationDefs, List<AtlasClassificationDef> classificationDefs,
List<AtlasEntityDef> entityDefs, List<AtlasEntityDef> entityDefs,
List<AtlasRelationshipDef> relationshipDefs, List<AtlasRelationshipDef> relationshipDefs,
List<AtlasNamespaceDef> namespaceDefs) { List<AtlasBusinessMetadataDef> businessMetadataDefs) {
this.enumDefs = enumDefs; this.enumDefs = enumDefs;
this.structDefs = structDefs; this.structDefs = structDefs;
this.classificationDefs = classificationDefs; this.classificationDefs = classificationDefs;
this.entityDefs = entityDefs; this.entityDefs = entityDefs;
this.relationshipDefs = relationshipDefs; this.relationshipDefs = relationshipDefs;
this.namespaceDefs = namespaceDefs; this.businessMetadataDefs = businessMetadataDefs;
} }
public List<AtlasEnumDef> getEnumDefs() { public List<AtlasEnumDef> getEnumDefs() {
...@@ -138,12 +138,12 @@ public class AtlasTypesDef { ...@@ -138,12 +138,12 @@ public class AtlasTypesDef {
this.relationshipDefs = relationshipDefs; this.relationshipDefs = relationshipDefs;
} }
public void setNamespaceDefs(List<AtlasNamespaceDef> namespaceDefs) { public void setBusinessMetadataDefs(List<AtlasBusinessMetadataDef> businessMetadataDefs) {
this.namespaceDefs = namespaceDefs; this.businessMetadataDefs = businessMetadataDefs;
} }
public List<AtlasNamespaceDef> getNamespaceDefs() { public List<AtlasBusinessMetadataDef> getBusinessMetadataDefs() {
return namespaceDefs; return businessMetadataDefs;
} }
public boolean hasClassificationDef(String name) { public boolean hasClassificationDef(String name) {
...@@ -165,8 +165,8 @@ public class AtlasTypesDef { ...@@ -165,8 +165,8 @@ public class AtlasTypesDef {
return hasTypeDef(relationshipDefs, name); return hasTypeDef(relationshipDefs, name);
} }
public boolean hasNamespaceDef(String name) { public boolean hasBusinessMetadataDef(String name) {
return hasTypeDef(namespaceDefs, name); return hasTypeDef(businessMetadataDefs, name);
} }
private <T extends AtlasBaseTypeDef> boolean hasTypeDef(Collection<T> typeDefs, String name) { private <T extends AtlasBaseTypeDef> boolean hasTypeDef(Collection<T> typeDefs, String name) {
...@@ -188,7 +188,7 @@ public class AtlasTypesDef { ...@@ -188,7 +188,7 @@ public class AtlasTypesDef {
CollectionUtils.isEmpty(classificationDefs) && CollectionUtils.isEmpty(classificationDefs) &&
CollectionUtils.isEmpty(entityDefs) && CollectionUtils.isEmpty(entityDefs) &&
CollectionUtils.isEmpty(relationshipDefs) && CollectionUtils.isEmpty(relationshipDefs) &&
CollectionUtils.isEmpty(namespaceDefs); CollectionUtils.isEmpty(businessMetadataDefs);
} }
public void clear() { public void clear() {
...@@ -211,8 +211,8 @@ public class AtlasTypesDef { ...@@ -211,8 +211,8 @@ public class AtlasTypesDef {
relationshipDefs.clear(); relationshipDefs.clear();
} }
if (namespaceDefs != null) { if (businessMetadataDefs != null) {
namespaceDefs.clear(); businessMetadataDefs.clear();
} }
} }
public StringBuilder toString(StringBuilder sb) { public StringBuilder toString(StringBuilder sb) {
...@@ -235,8 +235,8 @@ public class AtlasTypesDef { ...@@ -235,8 +235,8 @@ public class AtlasTypesDef {
sb.append("}"); sb.append("}");
sb.append("relationshipDefs={"); sb.append("relationshipDefs={");
AtlasBaseTypeDef.dumpObjects(relationshipDefs, sb); AtlasBaseTypeDef.dumpObjects(relationshipDefs, sb);
sb.append("namespaceDefs={"); sb.append("businessMetadataDefs={");
AtlasBaseTypeDef.dumpObjects(namespaceDefs, sb); AtlasBaseTypeDef.dumpObjects(businessMetadataDefs, sb);
sb.append("}"); sb.append("}");
return sb; return sb;
......
...@@ -20,10 +20,10 @@ package org.apache.atlas.store; ...@@ -20,10 +20,10 @@ package org.apache.atlas.store;
import org.apache.atlas.exception.AtlasBaseException; import org.apache.atlas.exception.AtlasBaseException;
import org.apache.atlas.model.SearchFilter; import org.apache.atlas.model.SearchFilter;
import org.apache.atlas.model.typedef.AtlasBaseTypeDef; import org.apache.atlas.model.typedef.AtlasBaseTypeDef;
import org.apache.atlas.model.typedef.AtlasBusinessMetadataDef;
import org.apache.atlas.model.typedef.AtlasClassificationDef; import org.apache.atlas.model.typedef.AtlasClassificationDef;
import org.apache.atlas.model.typedef.AtlasEntityDef; import org.apache.atlas.model.typedef.AtlasEntityDef;
import org.apache.atlas.model.typedef.AtlasEnumDef; import org.apache.atlas.model.typedef.AtlasEnumDef;
import org.apache.atlas.model.typedef.AtlasNamespaceDef;
import org.apache.atlas.model.typedef.AtlasRelationshipDef; import org.apache.atlas.model.typedef.AtlasRelationshipDef;
import org.apache.atlas.model.typedef.AtlasStructDef; import org.apache.atlas.model.typedef.AtlasStructDef;
import org.apache.atlas.model.typedef.AtlasTypesDef; import org.apache.atlas.model.typedef.AtlasTypesDef;
...@@ -82,26 +82,26 @@ public interface AtlasTypeDefStore { ...@@ -82,26 +82,26 @@ public interface AtlasTypeDefStore {
AtlasRelationshipDef getRelationshipDefByGuid(String guid) throws AtlasBaseException; AtlasRelationshipDef getRelationshipDefByGuid(String guid) throws AtlasBaseException;
AtlasRelationshipDef updateRelationshipDefByName(String name, AtlasRelationshipDef structDef) throws AtlasBaseException; AtlasRelationshipDef updateRelationshipDefByName(String name, AtlasRelationshipDef relationshipDef) throws AtlasBaseException;
AtlasRelationshipDef updateRelationshipDefByGuid(String guid, AtlasRelationshipDef structDef) throws AtlasBaseException; AtlasRelationshipDef updateRelationshipDefByGuid(String guid, AtlasRelationshipDef relationshipDef) throws AtlasBaseException;
/* Namespace Def operations */ /* business-metadata Def operations */
AtlasNamespaceDef getNamespaceDefByName(String name) throws AtlasBaseException; AtlasBusinessMetadataDef getBusinessMetadataDefByName(String name) throws AtlasBaseException;
AtlasNamespaceDef getNamespaceDefByGuid(String guid) throws AtlasBaseException; AtlasBusinessMetadataDef getBusinessMetadataDefByGuid(String guid) throws AtlasBaseException;
/* Bulk Operations */ /* Bulk Operations */
AtlasTypesDef createTypesDef(AtlasTypesDef atlasTypesDef) throws AtlasBaseException; AtlasTypesDef createTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException;
AtlasTypesDef updateTypesDef(AtlasTypesDef atlasTypesDef) throws AtlasBaseException; AtlasTypesDef updateTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException;
AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesToCreateUpdate) throws AtlasBaseException; AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesToCreateUpdate) throws AtlasBaseException;
AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesToCreate, AtlasTypesDef typesToUpdate) throws AtlasBaseException; AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesToCreate, AtlasTypesDef typesToUpdate) throws AtlasBaseException;
void deleteTypesDef(AtlasTypesDef atlasTypesDef) throws AtlasBaseException; void deleteTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException;
AtlasTypesDef searchTypesDef(SearchFilter searchFilter) throws AtlasBaseException; AtlasTypesDef searchTypesDef(SearchFilter searchFilter) throws AtlasBaseException;
......
...@@ -20,7 +20,7 @@ package org.apache.atlas.type; ...@@ -20,7 +20,7 @@ package org.apache.atlas.type;
import org.apache.atlas.AtlasErrorCode; import org.apache.atlas.AtlasErrorCode;
import org.apache.atlas.exception.AtlasBaseException; import org.apache.atlas.exception.AtlasBaseException;
import org.apache.atlas.model.instance.AtlasStruct; import org.apache.atlas.model.instance.AtlasStruct;
import org.apache.atlas.model.typedef.AtlasNamespaceDef; import org.apache.atlas.model.typedef.AtlasBusinessMetadataDef;
import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef; import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -28,45 +28,45 @@ import org.slf4j.LoggerFactory; ...@@ -28,45 +28,45 @@ import org.slf4j.LoggerFactory;
import java.util.*; import java.util.*;
import static org.apache.atlas.model.typedef.AtlasNamespaceDef.*; import static org.apache.atlas.model.typedef.AtlasBusinessMetadataDef.*;
public class AtlasNamespaceType extends AtlasStructType { public class AtlasBusinessMetadataType extends AtlasStructType {
private static final Logger LOG = LoggerFactory.getLogger(AtlasNamespaceType.class); private static final Logger LOG = LoggerFactory.getLogger(AtlasBusinessMetadataType.class);
private final AtlasNamespaceDef namespaceDef; private final AtlasBusinessMetadataDef businessMetadataDef;
public AtlasNamespaceType(AtlasNamespaceDef namespaceDef) { public AtlasBusinessMetadataType(AtlasBusinessMetadataDef businessMetadataDef) {
super(namespaceDef); super(businessMetadataDef);
this.namespaceDef = namespaceDef; this.businessMetadataDef = businessMetadataDef;
} }
@Override @Override
public boolean isValidValue(Object o) { public boolean isValidValue(Object o) {
return true; // there is no runtime instance for Namespaces, so return true return true; // there is no runtime instance for businessMetadataDef, so return true
} }
@Override @Override
public AtlasStruct createDefaultValue() { public AtlasStruct createDefaultValue() {
return null; // there is no runtime instance for Namespaces, so return null return null; // there is no runtime instance for businessMetadataDef, so return null
} }
@Override @Override
public Object getNormalizedValue(Object a) { public Object getNormalizedValue(Object a) {
return null; // there is no runtime instance for Namespaces, so return null return null; // there is no runtime instance for businessMetadataDef, so return null
} }
public AtlasNamespaceDef getNamespaceDef() { public AtlasBusinessMetadataDef getBusinessMetadataDef() {
return namespaceDef; return businessMetadataDef;
} }
@Override @Override
void resolveReferences(AtlasTypeRegistry typeRegistry) throws AtlasBaseException { void resolveReferences(AtlasTypeRegistry typeRegistry) throws AtlasBaseException {
super.resolveReferences(typeRegistry); super.resolveReferences(typeRegistry);
Map<String, AtlasNamespaceAttribute> a = new HashMap<>(); Map<String, AtlasBusinessAttribute> a = new HashMap<>();
for (AtlasAttribute attribute : super.allAttributes.values()) { for (AtlasAttribute attribute : super.allAttributes.values()) {
AtlasAttributeDef attributeDef = attribute.getAttributeDef(); AtlasAttributeDef attributeDef = attribute.getAttributeDef();
...@@ -79,9 +79,9 @@ public class AtlasNamespaceType extends AtlasStructType { ...@@ -79,9 +79,9 @@ public class AtlasNamespaceType extends AtlasStructType {
attrType = ((AtlasMapType) attrType).getValueType(); attrType = ((AtlasMapType) attrType).getValueType();
} }
// check if attribute type is not struct/classification/entity/namespace // check if attribute type is not struct/classification/entity/business-metadata
if (attrType instanceof AtlasStructType) { if (attrType instanceof AtlasStructType) {
throw new AtlasBaseException(AtlasErrorCode.NAMESPACE_DEF_ATTRIBUTE_TYPE_INVALID, getTypeName(), attrName); throw new AtlasBaseException(AtlasErrorCode.BUSINESS_METADATA_DEF_ATTRIBUTE_TYPE_INVALID, getTypeName(), attrName);
} }
Set<String> entityTypeNames = attribute.getOptionSet(ATTR_OPTION_APPLICABLE_ENTITY_TYPES); Set<String> entityTypeNames = attribute.getOptionSet(ATTR_OPTION_APPLICABLE_ENTITY_TYPES);
...@@ -99,7 +99,7 @@ public class AtlasNamespaceType extends AtlasStructType { ...@@ -99,7 +99,7 @@ public class AtlasNamespaceType extends AtlasStructType {
} }
} }
AtlasNamespaceAttribute nsAttribute; AtlasBusinessAttribute bmAttribute;
if (attribute.getAttributeType() instanceof AtlasBuiltInTypes.AtlasStringType) { if (attribute.getAttributeType() instanceof AtlasBuiltInTypes.AtlasStringType) {
Integer maxStringLength = attribute.getOptionInt(ATTR_MAX_STRING_LENGTH); Integer maxStringLength = attribute.getOptionInt(ATTR_MAX_STRING_LENGTH);
if (maxStringLength == null) { if (maxStringLength == null) {
...@@ -107,12 +107,12 @@ public class AtlasNamespaceType extends AtlasStructType { ...@@ -107,12 +107,12 @@ public class AtlasNamespaceType extends AtlasStructType {
} }
String validPattern = attribute.getOptionString(ATTR_VALID_PATTERN); String validPattern = attribute.getOptionString(ATTR_VALID_PATTERN);
nsAttribute = new AtlasNamespaceAttribute(attribute, entityTypes, maxStringLength, validPattern); bmAttribute = new AtlasBusinessAttribute(attribute, entityTypes, maxStringLength, validPattern);
} else { } else {
nsAttribute = new AtlasNamespaceAttribute(attribute, entityTypes); bmAttribute = new AtlasBusinessAttribute(attribute, entityTypes);
} }
a.put(attrName, nsAttribute); a.put(attrName, bmAttribute);
} }
super.allAttributes = Collections.unmodifiableMap(a); super.allAttributes = Collections.unmodifiableMap(a);
...@@ -123,23 +123,23 @@ public class AtlasNamespaceType extends AtlasStructType { ...@@ -123,23 +123,23 @@ public class AtlasNamespaceType extends AtlasStructType {
super.resolveReferencesPhase2(typeRegistry); super.resolveReferencesPhase2(typeRegistry);
for (AtlasAttribute attribute : super.allAttributes.values()) { for (AtlasAttribute attribute : super.allAttributes.values()) {
AtlasNamespaceAttribute nsAttribute = (AtlasNamespaceAttribute) attribute; AtlasBusinessAttribute bmAttribute = (AtlasBusinessAttribute) attribute;
Set<AtlasEntityType> entityTypes = nsAttribute.getApplicableEntityTypes(); Set<AtlasEntityType> entityTypes = bmAttribute.getApplicableEntityTypes();
if (CollectionUtils.isNotEmpty(entityTypes)) { if (CollectionUtils.isNotEmpty(entityTypes)) {
for (AtlasEntityType entityType : entityTypes) { for (AtlasEntityType entityType : entityTypes) {
entityType.addNamespaceAttribute(nsAttribute); entityType.addBusinessAttribute(bmAttribute);
} }
} }
} }
} }
public static class AtlasNamespaceAttribute extends AtlasAttribute { public static class AtlasBusinessAttribute extends AtlasAttribute {
private final Set<AtlasEntityType> applicableEntityTypes; private final Set<AtlasEntityType> applicableEntityTypes;
private final int maxStringLength; private final int maxStringLength;
private final String validPattern; private final String validPattern;
public AtlasNamespaceAttribute(AtlasAttribute attribute, Set<AtlasEntityType> applicableEntityTypes) { public AtlasBusinessAttribute(AtlasAttribute attribute, Set<AtlasEntityType> applicableEntityTypes) {
super(attribute); super(attribute);
this.maxStringLength = 0; this.maxStringLength = 0;
...@@ -147,7 +147,7 @@ public class AtlasNamespaceType extends AtlasStructType { ...@@ -147,7 +147,7 @@ public class AtlasNamespaceType extends AtlasStructType {
this.applicableEntityTypes = applicableEntityTypes; this.applicableEntityTypes = applicableEntityTypes;
} }
public AtlasNamespaceAttribute(AtlasAttribute attribute, Set<AtlasEntityType> applicableEntityTypes, int maxStringLength, String validPattern) { public AtlasBusinessAttribute(AtlasAttribute attribute, Set<AtlasEntityType> applicableEntityTypes, int maxStringLength, String validPattern) {
super(attribute); super(attribute);
this.maxStringLength = maxStringLength; this.maxStringLength = maxStringLength;
...@@ -156,8 +156,8 @@ public class AtlasNamespaceType extends AtlasStructType { ...@@ -156,8 +156,8 @@ public class AtlasNamespaceType extends AtlasStructType {
} }
@Override @Override
public AtlasNamespaceType getDefinedInType() { public AtlasBusinessMetadataType getDefinedInType() {
return (AtlasNamespaceType) super.getDefinedInType(); return (AtlasBusinessMetadataType) super.getDefinedInType();
} }
public Set<AtlasEntityType> getApplicableEntityTypes() { public Set<AtlasEntityType> getApplicableEntityTypes() {
......
...@@ -112,7 +112,7 @@ public class AtlasStructType extends AtlasType { ...@@ -112,7 +112,7 @@ public class AtlasStructType extends AtlasType {
throw new AtlasBaseException(AtlasErrorCode.ATTRIBUTE_TYPE_INVALID, getTypeName(), attributeDef.getName()); throw new AtlasBaseException(AtlasErrorCode.ATTRIBUTE_TYPE_INVALID, getTypeName(), attributeDef.getName());
} }
if (attrType instanceof AtlasNamespaceType) { if (attrType instanceof AtlasBusinessMetadataType) {
throw new AtlasBaseException(AtlasErrorCode.ATTRIBUTE_TYPE_INVALID, getTypeName(), attributeDef.getName()); throw new AtlasBaseException(AtlasErrorCode.ATTRIBUTE_TYPE_INVALID, getTypeName(), attributeDef.getName());
} }
...@@ -227,7 +227,7 @@ public class AtlasStructType extends AtlasType { ...@@ -227,7 +227,7 @@ public class AtlasStructType extends AtlasType {
} }
if (ret == null) { if (ret == null) {
ret = getNamespaceAttribute(attributeName); ret = getBusinesAAttribute(attributeName);
} }
return ret; return ret;
...@@ -237,7 +237,7 @@ public class AtlasStructType extends AtlasType { ...@@ -237,7 +237,7 @@ public class AtlasStructType extends AtlasType {
return null; return null;
} }
public AtlasAttribute getNamespaceAttribute(String attributeName) { public AtlasAttribute getBusinesAAttribute(String attributeName) {
return null; return null;
} }
......
...@@ -28,7 +28,7 @@ import org.apache.atlas.model.typedef.AtlasClassificationDef; ...@@ -28,7 +28,7 @@ import org.apache.atlas.model.typedef.AtlasClassificationDef;
import org.apache.atlas.model.typedef.AtlasEntityDef; import org.apache.atlas.model.typedef.AtlasEntityDef;
import org.apache.atlas.model.typedef.AtlasEnumDef; import org.apache.atlas.model.typedef.AtlasEnumDef;
import org.apache.atlas.model.typedef.AtlasEnumDef.AtlasEnumElementDef; import org.apache.atlas.model.typedef.AtlasEnumDef.AtlasEnumElementDef;
import org.apache.atlas.model.typedef.AtlasNamespaceDef; import org.apache.atlas.model.typedef.AtlasBusinessMetadataDef;
import org.apache.atlas.model.typedef.AtlasRelationshipDef; import org.apache.atlas.model.typedef.AtlasRelationshipDef;
import org.apache.atlas.model.typedef.AtlasRelationshipDef.PropagateTags; import org.apache.atlas.model.typedef.AtlasRelationshipDef.PropagateTags;
import org.apache.atlas.model.typedef.AtlasRelationshipDef.RelationshipCategory; import org.apache.atlas.model.typedef.AtlasRelationshipDef.RelationshipCategory;
...@@ -321,8 +321,8 @@ public class AtlasTypeUtil { ...@@ -321,8 +321,8 @@ public class AtlasTypeUtil {
List<AtlasClassificationDef> traits, List<AtlasClassificationDef> traits,
List<AtlasEntityDef> classes, List<AtlasEntityDef> classes,
List<AtlasRelationshipDef> relations, List<AtlasRelationshipDef> relations,
List<AtlasNamespaceDef> namespaces) { List<AtlasBusinessMetadataDef> businessMetadataDefs) {
return new AtlasTypesDef(enums, structs, traits, classes, relations, namespaces); return new AtlasTypesDef(enums, structs, traits, classes, relations, businessMetadataDefs);
} }
public static List<AtlasTypeDefHeader> toTypeDefHeader(AtlasTypesDef typesDef) { public static List<AtlasTypeDefHeader> toTypeDefHeader(AtlasTypesDef typesDef) {
......
...@@ -31,6 +31,6 @@ public class DataTypes { ...@@ -31,6 +31,6 @@ public class DataTypes {
TRAIT, TRAIT,
CLASS, CLASS,
RELATIONSHIP, RELATIONSHIP,
NAMESPACE BUSINESS_METADATA
} }
} }
\ No newline at end of file
...@@ -23,11 +23,11 @@ import org.apache.atlas.model.instance.AtlasEntity; ...@@ -23,11 +23,11 @@ import org.apache.atlas.model.instance.AtlasEntity;
import org.apache.atlas.model.instance.AtlasEntity.AtlasEntitiesWithExtInfo; import org.apache.atlas.model.instance.AtlasEntity.AtlasEntitiesWithExtInfo;
import org.apache.atlas.model.instance.AtlasObjectId; import org.apache.atlas.model.instance.AtlasObjectId;
import org.apache.atlas.model.instance.AtlasStruct; import org.apache.atlas.model.instance.AtlasStruct;
import org.apache.atlas.model.typedef.AtlasBusinessMetadataDef;
import org.apache.atlas.model.typedef.AtlasClassificationDef; import org.apache.atlas.model.typedef.AtlasClassificationDef;
import org.apache.atlas.model.typedef.AtlasEntityDef; import org.apache.atlas.model.typedef.AtlasEntityDef;
import org.apache.atlas.model.typedef.AtlasEnumDef; import org.apache.atlas.model.typedef.AtlasEnumDef;
import org.apache.atlas.model.typedef.AtlasEnumDef.AtlasEnumElementDef; import org.apache.atlas.model.typedef.AtlasEnumDef.AtlasEnumElementDef;
import org.apache.atlas.model.typedef.AtlasNamespaceDef;
import org.apache.atlas.model.typedef.AtlasRelationshipDef; import org.apache.atlas.model.typedef.AtlasRelationshipDef;
import org.apache.atlas.model.typedef.AtlasRelationshipEndDef; import org.apache.atlas.model.typedef.AtlasRelationshipEndDef;
import org.apache.atlas.model.typedef.AtlasStructDef; import org.apache.atlas.model.typedef.AtlasStructDef;
...@@ -40,7 +40,7 @@ import java.math.BigDecimal; ...@@ -40,7 +40,7 @@ import java.math.BigDecimal;
import java.math.BigInteger; import java.math.BigInteger;
import java.util.*; import java.util.*;
import static org.apache.atlas.model.typedef.AtlasNamespaceDef.ATTR_OPTION_APPLICABLE_ENTITY_TYPES; import static org.apache.atlas.model.typedef.AtlasBusinessMetadataDef.ATTR_OPTION_APPLICABLE_ENTITY_TYPES;
import static org.apache.atlas.model.typedef.AtlasRelationshipDef.PropagateTags.BOTH; import static org.apache.atlas.model.typedef.AtlasRelationshipDef.PropagateTags.BOTH;
import static org.apache.atlas.model.typedef.AtlasRelationshipDef.PropagateTags.ONE_TO_TWO; import static org.apache.atlas.model.typedef.AtlasRelationshipDef.PropagateTags.ONE_TO_TWO;
import static org.apache.atlas.model.typedef.AtlasRelationshipDef.RelationshipCategory.AGGREGATION; import static org.apache.atlas.model.typedef.AtlasRelationshipDef.RelationshipCategory.AGGREGATION;
...@@ -155,14 +155,14 @@ public final class TestRelationshipUtilsV2 { ...@@ -155,14 +155,14 @@ public final class TestRelationshipUtilsV2 {
nsAttr2.setIsOptional(true); nsAttr2.setIsOptional(true);
nsAttr2.setIsUnique(false); nsAttr2.setIsUnique(false);
AtlasNamespaceDef namespaceDef = new AtlasNamespaceDef("test_namespace", "test_description", DEFAULT_VERSION, Arrays.asList(nsAttr1, nsAttr2)); AtlasBusinessMetadataDef businessMetadataDef = new AtlasBusinessMetadataDef("test_businessMetadata", "test_description", DEFAULT_VERSION, Arrays.asList(nsAttr1, nsAttr2));
return new AtlasTypesDef(Collections.singletonList(orgLevelType), return new AtlasTypesDef(Collections.singletonList(orgLevelType),
Collections.singletonList(addressType), Collections.singletonList(addressType),
Collections.singletonList(securityClearanceType), Collections.singletonList(securityClearanceType),
Arrays.asList(personType, employeeType, departmentType, managerType), Arrays.asList(personType, employeeType, departmentType, managerType),
Arrays.asList(employeeDepartmentType, employeeManagerType, employeeMentorsType, employeeFriendsType, personSiblingType), Arrays.asList(employeeDepartmentType, employeeManagerType, employeeMentorsType, employeeFriendsType, personSiblingType),
Collections.singletonList(namespaceDef)); Collections.singletonList(businessMetadataDef));
} }
public static AtlasEntitiesWithExtInfo getDepartmentEmployeeInstances() { public static AtlasEntitiesWithExtInfo getDepartmentEmployeeInstances() {
...@@ -295,7 +295,7 @@ public final class TestRelationshipUtilsV2 { ...@@ -295,7 +295,7 @@ public final class TestRelationshipUtilsV2 {
new AtlasRelationshipEndDef(TYPE_A, "mapToB", SET)); new AtlasRelationshipEndDef(TYPE_A, "mapToB", SET));
return new AtlasTypesDef(Collections.<AtlasEnumDef>emptyList(), Collections.<AtlasStructDef>emptyList(), Collections.<AtlasClassificationDef>emptyList(), Arrays.asList(aType, bType), return new AtlasTypesDef(Collections.<AtlasEnumDef>emptyList(), Collections.<AtlasStructDef>emptyList(), Collections.<AtlasClassificationDef>emptyList(), Arrays.asList(aType, bType),
Arrays.asList(relationshipType1, relationshipType2, relationshipType3, relationshipType4), Collections.<AtlasNamespaceDef>emptyList()); Arrays.asList(relationshipType1, relationshipType2, relationshipType3, relationshipType4), Collections.<AtlasBusinessMetadataDef>emptyList());
} }
private static List<AtlasEnumElementDef> getOrgLevelElements() { private static List<AtlasEnumElementDef> getOrgLevelElements() {
......
...@@ -23,54 +23,54 @@ import org.testng.annotations.Test; ...@@ -23,54 +23,54 @@ import org.testng.annotations.Test;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import static org.apache.atlas.model.typedef.AtlasNamespaceDef.ATTR_OPTION_APPLICABLE_ENTITY_TYPES; import static org.apache.atlas.model.typedef.AtlasBusinessMetadataDef.ATTR_OPTION_APPLICABLE_ENTITY_TYPES;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotEquals; import static org.testng.Assert.assertNotEquals;
public class TestAtlasNamespaceDef { public class TestAtlasBusinessMetadataDef {
@Test @Test
public void namespaceDefSerDes() { public void businessMetadataDefSerDes() {
AtlasNamespaceDef namespaceDef = new AtlasNamespaceDef("test_namespace", "test_description", null); AtlasBusinessMetadataDef businessMetadataDef = new AtlasBusinessMetadataDef("test_businessMetadata", "test_description", null);
String jsonString = AtlasType.toJson(namespaceDef); String jsonString = AtlasType.toJson(businessMetadataDef);
AtlasNamespaceDef namespaceDef1 = AtlasType.fromJson(jsonString, AtlasNamespaceDef.class); AtlasBusinessMetadataDef businessMetadataDef1 = AtlasType.fromJson(jsonString, AtlasBusinessMetadataDef.class);
assertEquals(namespaceDef, namespaceDef1, assertEquals(businessMetadataDef, businessMetadataDef1,
"Incorrect serialization/deserialization of AtlasNamespaceDef"); "Incorrect serialization/deserialization of AtlasBusinessMetadataDef");
} }
@Test @Test
public void namespaceDefEquality() { public void businessMetadataDefEquality() {
AtlasNamespaceDef namespaceDef1 = new AtlasNamespaceDef("test_namespace", "test_description", null); AtlasBusinessMetadataDef businessMetadataDef1 = new AtlasBusinessMetadataDef("test_businessMetadata", "test_description", null);
AtlasNamespaceDef namespaceDef2 = new AtlasNamespaceDef("test_namespace", "test_description", null); AtlasBusinessMetadataDef businessMetadataDef2 = new AtlasBusinessMetadataDef("test_businessMetadata", "test_description", null);
assertEquals(namespaceDef1, namespaceDef2, "Namespaces should be equal because the name of the" + assertEquals(businessMetadataDef1, businessMetadataDef2, "businessMetadatas should be equal because the name of the" +
"namespace is same"); "businessMetadata is same");
} }
@Test @Test
public void namespaceDefUnequality() { public void businessMetadataDefUnequality() {
AtlasNamespaceDef namespaceDef1 = new AtlasNamespaceDef("test_namespace", "test_description", null); AtlasBusinessMetadataDef businessMetadataDef1 = new AtlasBusinessMetadataDef("test_businessMetadata", "test_description", null);
AtlasNamespaceDef namespaceDef2 = new AtlasNamespaceDef("test_namespace1", "test_description", null); AtlasBusinessMetadataDef businessMetadataDef2 = new AtlasBusinessMetadataDef("test_businessMetadata1", "test_description", null);
assertNotEquals(namespaceDef1, namespaceDef2, "Namespaces should not be equal since they have a" + assertNotEquals(businessMetadataDef1, businessMetadataDef2, "businessMetadatas should not be equal since they have a" +
"different name"); "different name");
} }
@Test @Test
public void namespaceDefWithNamespaceAttributes() { public void businessMetadataDefWithAttributes() {
AtlasNamespaceDef namespaceDef1 = new AtlasNamespaceDef("test_namespace", "test_description", null); AtlasBusinessMetadataDef businessMetadataDef1 = new AtlasBusinessMetadataDef("test_businessMetadata", "test_description", null);
AtlasStructDef.AtlasAttributeDef nsAttr1 = new AtlasStructDef.AtlasAttributeDef("attr1", "int"); AtlasStructDef.AtlasAttributeDef nsAttr1 = new AtlasStructDef.AtlasAttributeDef("attr1", "int");
AtlasStructDef.AtlasAttributeDef nsAttr2 = new AtlasStructDef.AtlasAttributeDef("attr2", "int"); AtlasStructDef.AtlasAttributeDef nsAttr2 = new AtlasStructDef.AtlasAttributeDef("attr2", "int");
nsAttr1.setOption(ATTR_OPTION_APPLICABLE_ENTITY_TYPES, AtlasType.toJson(Collections.singleton("hive_table"))); nsAttr1.setOption(ATTR_OPTION_APPLICABLE_ENTITY_TYPES, AtlasType.toJson(Collections.singleton("hive_table")));
nsAttr2.setOption(ATTR_OPTION_APPLICABLE_ENTITY_TYPES, AtlasType.toJson(Collections.singleton("hive_table"))); nsAttr2.setOption(ATTR_OPTION_APPLICABLE_ENTITY_TYPES, AtlasType.toJson(Collections.singleton("hive_table")));
namespaceDef1.setAttributeDefs(Arrays.asList(nsAttr1, nsAttr2)); businessMetadataDef1.setAttributeDefs(Arrays.asList(nsAttr1, nsAttr2));
assertEquals(namespaceDef1.getAttributeDefs().size(), 2); assertEquals(businessMetadataDef1.getAttributeDefs().size(), 2);
} }
@Test @Test
public void namespaceDefWithNamespaceAttributesHavingCardinality() { public void businessMetadataDefWithAttributesHavingCardinality() {
AtlasNamespaceDef namespaceDef1 = new AtlasNamespaceDef("test_namespace", "test_description", null); AtlasBusinessMetadataDef businessMetadataDef1 = new AtlasBusinessMetadataDef("test_businessMetadata", "test_description", null);
AtlasStructDef.AtlasAttributeDef nsAttr1 = new AtlasStructDef.AtlasAttributeDef("attr1", "int"); AtlasStructDef.AtlasAttributeDef nsAttr1 = new AtlasStructDef.AtlasAttributeDef("attr1", "int");
AtlasStructDef.AtlasAttributeDef nsAttr2 = new AtlasStructDef.AtlasAttributeDef("attr2", "int"); AtlasStructDef.AtlasAttributeDef nsAttr2 = new AtlasStructDef.AtlasAttributeDef("attr2", "int");
...@@ -78,7 +78,7 @@ public class TestAtlasNamespaceDef { ...@@ -78,7 +78,7 @@ public class TestAtlasNamespaceDef {
nsAttr2.setOption(ATTR_OPTION_APPLICABLE_ENTITY_TYPES, AtlasType.toJson(Collections.singleton("hive_table"))); nsAttr2.setOption(ATTR_OPTION_APPLICABLE_ENTITY_TYPES, AtlasType.toJson(Collections.singleton("hive_table")));
nsAttr2.setCardinality(AtlasStructDef.AtlasAttributeDef.Cardinality.SET); nsAttr2.setCardinality(AtlasStructDef.AtlasAttributeDef.Cardinality.SET);
namespaceDef1.setAttributeDefs(Arrays.asList(nsAttr1, nsAttr2)); businessMetadataDef1.setAttributeDefs(Arrays.asList(nsAttr1, nsAttr2));
assertEquals(namespaceDef1.getAttributeDefs().size(), 2); assertEquals(businessMetadataDef1.getAttributeDefs().size(), 2);
} }
} }
\ No newline at end of file
...@@ -20,7 +20,7 @@ package org.apache.atlas.query; ...@@ -20,7 +20,7 @@ package org.apache.atlas.query;
import org.apache.atlas.AtlasErrorCode; import org.apache.atlas.AtlasErrorCode;
import org.apache.atlas.exception.AtlasBaseException; import org.apache.atlas.exception.AtlasBaseException;
import org.apache.atlas.type.AtlasNamespaceType; import org.apache.atlas.type.AtlasBusinessMetadataType;
import org.apache.atlas.type.AtlasType; import org.apache.atlas.type.AtlasType;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
...@@ -186,12 +186,12 @@ public class IdentifierHelper { ...@@ -186,12 +186,12 @@ public class IdentifierHelper {
private void updateTypeInfo(org.apache.atlas.query.Lookup lookup, GremlinQueryComposer.Context context) { private void updateTypeInfo(org.apache.atlas.query.Lookup lookup, GremlinQueryComposer.Context context) {
parts = StringUtils.split(raw, "."); parts = StringUtils.split(raw, ".");
// check if this is a namespace attribute // check if this is a business attribute
if (parts.length == 2) { if (parts.length == 2) {
try { try {
AtlasType type = lookup.getType(parts[0]); AtlasType type = lookup.getType(parts[0]);
if (type instanceof AtlasNamespaceType) { if (type instanceof AtlasBusinessMetadataType) {
parts = new String[1]; parts = new String[1];
parts[0] = raw; parts[0] = raw;
} }
......
...@@ -33,7 +33,6 @@ import org.apache.atlas.model.TypeCategory; ...@@ -33,7 +33,6 @@ import org.apache.atlas.model.TypeCategory;
import org.apache.atlas.model.typedef.AtlasBaseTypeDef; import org.apache.atlas.model.typedef.AtlasBaseTypeDef;
import org.apache.atlas.model.typedef.AtlasEntityDef; import org.apache.atlas.model.typedef.AtlasEntityDef;
import org.apache.atlas.model.typedef.AtlasEnumDef; import org.apache.atlas.model.typedef.AtlasEnumDef;
import org.apache.atlas.model.typedef.AtlasNamespaceDef;
import org.apache.atlas.model.typedef.AtlasStructDef; import org.apache.atlas.model.typedef.AtlasStructDef;
import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef; import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef;
import org.apache.atlas.repository.Constants; import org.apache.atlas.repository.Constants;
......
...@@ -347,7 +347,7 @@ public class ExportService { ...@@ -347,7 +347,7 @@ public class ExportService {
final Set<String> structTypes = new HashSet<>(); final Set<String> structTypes = new HashSet<>();
final Set<String> enumTypes = new HashSet<>(); final Set<String> enumTypes = new HashSet<>();
final Set<String> relationshipTypes = new HashSet<>(); final Set<String> relationshipTypes = new HashSet<>();
final Set<String> namespaceTypes = new HashSet<>(); final Set<String> businessMetadataTypes = new HashSet<>();
final AtlasExportResult result; final AtlasExportResult result;
private final ZipSink sink; private final ZipSink sink;
......
...@@ -24,11 +24,11 @@ import org.apache.atlas.model.instance.AtlasClassification; ...@@ -24,11 +24,11 @@ import org.apache.atlas.model.instance.AtlasClassification;
import org.apache.atlas.model.instance.AtlasEntity; import org.apache.atlas.model.instance.AtlasEntity;
import org.apache.atlas.model.typedef.AtlasStructDef; import org.apache.atlas.model.typedef.AtlasStructDef;
import org.apache.atlas.type.AtlasArrayType; import org.apache.atlas.type.AtlasArrayType;
import org.apache.atlas.type.AtlasBusinessMetadataType;
import org.apache.atlas.type.AtlasClassificationType; import org.apache.atlas.type.AtlasClassificationType;
import org.apache.atlas.type.AtlasEntityType; import org.apache.atlas.type.AtlasEntityType;
import org.apache.atlas.type.AtlasEnumType; import org.apache.atlas.type.AtlasEnumType;
import org.apache.atlas.type.AtlasMapType; import org.apache.atlas.type.AtlasMapType;
import org.apache.atlas.type.AtlasNamespaceType;
import org.apache.atlas.type.AtlasRelationshipType; import org.apache.atlas.type.AtlasRelationshipType;
import org.apache.atlas.type.AtlasStructType; import org.apache.atlas.type.AtlasStructType;
import org.apache.atlas.type.AtlasType; import org.apache.atlas.type.AtlasType;
...@@ -106,8 +106,8 @@ class ExportTypeProcessor { ...@@ -106,8 +106,8 @@ class ExportTypeProcessor {
addClassificationType((AtlasClassificationType)type, context); addClassificationType((AtlasClassificationType)type, context);
} else if (type instanceof AtlasRelationshipType) { } else if (type instanceof AtlasRelationshipType) {
addRelationshipType(type.getTypeName(), context); addRelationshipType(type.getTypeName(), context);
} else if (type instanceof AtlasNamespaceType) { } else if (type instanceof AtlasBusinessMetadataType) {
addNamespaceType((AtlasNamespaceType) type, context); addBusinessMetadataType((AtlasBusinessMetadataType) type, context);
} else if (type instanceof AtlasStructType) { } else if (type instanceof AtlasStructType) {
addStructType((AtlasStructType)type, context); addStructType((AtlasStructType)type, context);
} else if (type instanceof AtlasEnumType) { } else if (type instanceof AtlasEnumType) {
...@@ -172,11 +172,11 @@ class ExportTypeProcessor { ...@@ -172,11 +172,11 @@ class ExportTypeProcessor {
} }
} }
private void addNamespaceType(AtlasNamespaceType namespaceType, ExportService.ExportContext context) { private void addBusinessMetadataType(AtlasBusinessMetadataType businessMetadataType, ExportService.ExportContext context) {
if (!context.namespaceTypes.contains(namespaceType.getTypeName())) { if (!context.businessMetadataTypes.contains(businessMetadataType.getTypeName())) {
context.namespaceTypes.add(namespaceType.getTypeName()); context.businessMetadataTypes.add(businessMetadataType.getTypeName());
addAttributeTypes(namespaceType, context); addAttributeTypes(businessMetadataType, context);
} }
} }
......
...@@ -30,11 +30,11 @@ import org.apache.atlas.ha.HAConfiguration; ...@@ -30,11 +30,11 @@ import org.apache.atlas.ha.HAConfiguration;
import org.apache.atlas.listener.ActiveStateChangeHandler; import org.apache.atlas.listener.ActiveStateChangeHandler;
import org.apache.atlas.model.patches.AtlasPatch.PatchStatus; import org.apache.atlas.model.patches.AtlasPatch.PatchStatus;
import org.apache.atlas.model.typedef.AtlasBaseTypeDef; import org.apache.atlas.model.typedef.AtlasBaseTypeDef;
import org.apache.atlas.model.typedef.AtlasBusinessMetadataDef;
import org.apache.atlas.model.typedef.AtlasClassificationDef; import org.apache.atlas.model.typedef.AtlasClassificationDef;
import org.apache.atlas.model.typedef.AtlasEntityDef; import org.apache.atlas.model.typedef.AtlasEntityDef;
import org.apache.atlas.model.typedef.AtlasEnumDef; import org.apache.atlas.model.typedef.AtlasEnumDef;
import org.apache.atlas.model.typedef.AtlasEnumDef.AtlasEnumElementDef; import org.apache.atlas.model.typedef.AtlasEnumDef.AtlasEnumElementDef;
import org.apache.atlas.model.typedef.AtlasNamespaceDef;
import org.apache.atlas.model.typedef.AtlasRelationshipDef; import org.apache.atlas.model.typedef.AtlasRelationshipDef;
import org.apache.atlas.model.typedef.AtlasRelationshipDef.RelationshipCategory; import org.apache.atlas.model.typedef.AtlasRelationshipDef.RelationshipCategory;
import org.apache.atlas.model.typedef.AtlasRelationshipEndDef; import org.apache.atlas.model.typedef.AtlasRelationshipEndDef;
...@@ -252,10 +252,10 @@ public class AtlasTypeDefStoreInitializer implements ActiveStateChangeHandler { ...@@ -252,10 +252,10 @@ public class AtlasTypeDefStoreInitializer implements ActiveStateChangeHandler {
} }
} }
if (CollectionUtils.isNotEmpty(typesDef.getNamespaceDefs())) { if (CollectionUtils.isNotEmpty(typesDef.getBusinessMetadataDefs())) {
for (AtlasNamespaceDef namespaceDef : typesDef.getNamespaceDefs()) { for (AtlasBusinessMetadataDef businessMetadataDef : typesDef.getBusinessMetadataDefs()) {
if (!typeRegistry.isRegisteredType(namespaceDef.getName())) { if (!typeRegistry.isRegisteredType(businessMetadataDef.getName())) {
typesToCreate.getNamespaceDefs().add(namespaceDef); typesToCreate.getBusinessMetadataDefs().add(businessMetadataDef);
} }
} }
} }
...@@ -344,16 +344,16 @@ public class AtlasTypeDefStoreInitializer implements ActiveStateChangeHandler { ...@@ -344,16 +344,16 @@ public class AtlasTypeDefStoreInitializer implements ActiveStateChangeHandler {
} }
} }
if (CollectionUtils.isNotEmpty(typesDef.getNamespaceDefs())) { if (CollectionUtils.isNotEmpty(typesDef.getBusinessMetadataDefs())) {
for (AtlasNamespaceDef namespaceDef : typesDef.getNamespaceDefs()) { for (AtlasBusinessMetadataDef businessMetadataDef : typesDef.getBusinessMetadataDefs()) {
AtlasNamespaceDef oldNamespaceDef = typeRegistry.getNamespaceDefByName(namespaceDef.getName()); AtlasBusinessMetadataDef oldDef = typeRegistry.getBusinessMetadataDefByName(businessMetadataDef.getName());
if (oldNamespaceDef == null) { if (oldDef == null) {
continue; continue;
} }
if (updateTypeAttributes(oldNamespaceDef, namespaceDef, checkTypeVersion)) { if (updateTypeAttributes(oldDef, businessMetadataDef, checkTypeVersion)) {
typesToUpdate.getNamespaceDefs().add(namespaceDef); typesToUpdate.getBusinessMetadataDefs().add(businessMetadataDef);
} }
} }
} }
......
...@@ -250,19 +250,19 @@ public interface AtlasEntityStore { ...@@ -250,19 +250,19 @@ public interface AtlasEntityStore {
/** /**
* *
* @param guid * @param guid
* @param namespaceAttributes * @param businessAttrbutes
* @param isOverwrite * @param isOverwrite
* @throws AtlasBaseException * @throws AtlasBaseException
*/ */
void addOrUpdateNamespaceAttributes(String guid, Map<String, Map<String, Object>> namespaceAttributes, boolean isOverwrite) throws AtlasBaseException; void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite) throws AtlasBaseException;
/** /**
* *
* @param guid * @param guid
* @param namespaceAttributes * @param businessAttributes
* @throws AtlasBaseException * @throws AtlasBaseException
*/ */
void removeNamespaceAttributes(String guid, Map<String, Map<String, Object>> namespaceAttributes) throws AtlasBaseException; void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes) throws AtlasBaseException;
/** /**
* Remove given labels, if labels is null/empty, no labels will be removed. If any labels in * Remove given labels, if labels is null/empty, no labels will be removed. If any labels in
......
...@@ -101,8 +101,8 @@ public class AtlasTypeDefGraphStoreV2 extends AtlasTypeDefGraphStore { ...@@ -101,8 +101,8 @@ public class AtlasTypeDefGraphStoreV2 extends AtlasTypeDefGraphStore {
} }
@Override @Override
protected AtlasDefStore<AtlasNamespaceDef> getNamespaceDefStore(AtlasTypeRegistry typeRegistry) { protected AtlasDefStore<AtlasBusinessMetadataDef> getBusinessMetadataDefStore(AtlasTypeRegistry typeRegistry) {
return new AtlasNamespaceDefStoreV2(this, typeRegistry); return new AtlasBusinessMetadataDefStoreV2(this, typeRegistry);
} }
@Override @Override
...@@ -498,8 +498,8 @@ public class AtlasTypeDefGraphStoreV2 extends AtlasTypeDefGraphStore { ...@@ -498,8 +498,8 @@ public class AtlasTypeDefGraphStoreV2 extends AtlasTypeDefGraphStore {
case RELATIONSHIP: case RELATIONSHIP:
return TypeCategory.RELATIONSHIP; return TypeCategory.RELATIONSHIP;
case NAMESPACE: case BUSINESS_METADATA:
return TypeCategory.NAMESPACE; return TypeCategory.BUSINESS_METADATA;
} }
return null; return null;
......
...@@ -48,7 +48,7 @@ import org.apache.atlas.type.AtlasArrayType; ...@@ -48,7 +48,7 @@ import org.apache.atlas.type.AtlasArrayType;
import org.apache.atlas.type.AtlasBuiltInTypes.AtlasObjectIdType; import org.apache.atlas.type.AtlasBuiltInTypes.AtlasObjectIdType;
import org.apache.atlas.type.AtlasEntityType; import org.apache.atlas.type.AtlasEntityType;
import org.apache.atlas.type.AtlasMapType; import org.apache.atlas.type.AtlasMapType;
import org.apache.atlas.type.AtlasNamespaceType.AtlasNamespaceAttribute; import org.apache.atlas.type.AtlasBusinessMetadataType.AtlasBusinessAttribute;
import org.apache.atlas.type.AtlasRelationshipType; import org.apache.atlas.type.AtlasRelationshipType;
import org.apache.atlas.type.AtlasStructType; import org.apache.atlas.type.AtlasStructType;
import org.apache.atlas.type.AtlasStructType.AtlasAttribute; import org.apache.atlas.type.AtlasStructType.AtlasAttribute;
...@@ -221,33 +221,33 @@ public class EntityGraphRetriever { ...@@ -221,33 +221,33 @@ public class EntityGraphRetriever {
return ret; return ret;
} }
public Map<String, Map<String, Object>> getEntityNamespaces(AtlasVertex entityVertex) throws AtlasBaseException { public Map<String, Map<String, Object>> getBusinessMetadata(AtlasVertex entityVertex) throws AtlasBaseException {
Map<String, Map<String, Object>> ret = null; Map<String, Map<String, Object>> ret = null;
String entityTypeName = getTypeName(entityVertex); String entityTypeName = getTypeName(entityVertex);
AtlasEntityType entityType = typeRegistry.getEntityTypeByName(entityTypeName); AtlasEntityType entityType = typeRegistry.getEntityTypeByName(entityTypeName);
Map<String, Map<String, AtlasNamespaceAttribute>> entityTypeNamespaces = entityType != null ? entityType.getNamespaceAttributes() : null; Map<String, Map<String, AtlasBusinessAttribute>> entityTypeBm = entityType != null ? entityType.getBusinessAttributes() : null;
if (MapUtils.isNotEmpty(entityTypeNamespaces)) { if (MapUtils.isNotEmpty(entityTypeBm)) {
for (Map.Entry<String, Map<String, AtlasNamespaceAttribute>> entry : entityTypeNamespaces.entrySet()) { for (Map.Entry<String, Map<String, AtlasBusinessAttribute>> entry : entityTypeBm.entrySet()) {
String nsName = entry.getKey(); String bmName = entry.getKey();
Map<String, AtlasNamespaceAttribute> nsAttributes = entry.getValue(); Map<String, AtlasBusinessAttribute> bmAttributes = entry.getValue();
Map<String, Object> entityNsAttrs = null; Map<String, Object> entityBmAttrs = null;
for (AtlasNamespaceAttribute nsAttribute : nsAttributes.values()) { for (AtlasBusinessAttribute bmAttribute : bmAttributes.values()) {
Object nsAttrValue = mapVertexToAttribute(entityVertex, nsAttribute, null, false, false); Object bmAttrValue = mapVertexToAttribute(entityVertex, bmAttribute, null, false, false);
if (nsAttrValue != null) { if (bmAttrValue != null) {
if (ret == null) { if (ret == null) {
ret = new HashMap<>(); ret = new HashMap<>();
} }
if (entityNsAttrs == null) { if (entityBmAttrs == null) {
entityNsAttrs = new HashMap<>(); entityBmAttrs = new HashMap<>();
ret.put(nsName, entityNsAttrs); ret.put(bmName, entityBmAttrs);
} }
entityNsAttrs.put(nsAttribute.getName(), nsAttrValue); entityBmAttrs.put(bmAttribute.getName(), bmAttrValue);
} }
} }
} }
...@@ -622,7 +622,7 @@ public class EntityGraphRetriever { ...@@ -622,7 +622,7 @@ public class EntityGraphRetriever {
mapSystemAttributes(entityVertex, entity); mapSystemAttributes(entityVertex, entity);
mapNamespaceAttributes(entityVertex, entity); mapBusinessAttributes(entityVertex, entity);
mapAttributes(entityVertex, entity, entityExtInfo, isMinExtInfo, includeReferences); mapAttributes(entityVertex, entity, entityExtInfo, isMinExtInfo, includeReferences);
...@@ -804,8 +804,8 @@ public class EntityGraphRetriever { ...@@ -804,8 +804,8 @@ public class EntityGraphRetriever {
} }
} }
private void mapNamespaceAttributes(AtlasVertex entityVertex, AtlasEntity entity) throws AtlasBaseException { private void mapBusinessAttributes(AtlasVertex entityVertex, AtlasEntity entity) throws AtlasBaseException {
entity.setNamespaceAttributes(getEntityNamespaces(entityVertex)); entity.setBusinessAttributes(getBusinessMetadata(entityVertex));
} }
public List<AtlasClassification> getAllClassifications(AtlasVertex entityVertex) throws AtlasBaseException { public List<AtlasClassification> getAllClassifications(AtlasVertex entityVertex) throws AtlasBaseException {
......
...@@ -154,8 +154,8 @@ public class FilterUtil { ...@@ -154,8 +154,8 @@ public class FilterUtil {
return atlasType.getTypeCategory() == TypeCategory.ENUM; return atlasType.getTypeCategory() == TypeCategory.ENUM;
case "RELATIONSHIP": case "RELATIONSHIP":
return atlasType.getTypeCategory() == TypeCategory.RELATIONSHIP; return atlasType.getTypeCategory() == TypeCategory.RELATIONSHIP;
case "NAMESPACE": case "BUSINESS_METADATA":
return atlasType.getTypeCategory() == TypeCategory.NAMESPACE; return atlasType.getTypeCategory() == TypeCategory.BUSINESS_METADATA;
default: default:
// This shouldn't have happened // This shouldn't have happened
return false; return false;
......
...@@ -37,13 +37,13 @@ import org.apache.atlas.model.instance.EntityMutations.EntityOperation; ...@@ -37,13 +37,13 @@ import org.apache.atlas.model.instance.EntityMutations.EntityOperation;
import org.apache.atlas.model.lineage.AtlasLineageInfo; import org.apache.atlas.model.lineage.AtlasLineageInfo;
import org.apache.atlas.model.lineage.AtlasLineageInfo.LineageDirection; import org.apache.atlas.model.lineage.AtlasLineageInfo.LineageDirection;
import org.apache.atlas.model.lineage.AtlasLineageInfo.LineageRelation; import org.apache.atlas.model.lineage.AtlasLineageInfo.LineageRelation;
import org.apache.atlas.model.typedef.AtlasBusinessMetadataDef;
import org.apache.atlas.model.typedef.AtlasClassificationDef; import org.apache.atlas.model.typedef.AtlasClassificationDef;
import org.apache.atlas.model.typedef.AtlasEntityDef; import org.apache.atlas.model.typedef.AtlasEntityDef;
import org.apache.atlas.model.typedef.AtlasNamespaceDef;
import org.apache.atlas.model.typedef.AtlasRelationshipDef; import org.apache.atlas.model.typedef.AtlasRelationshipDef;
import org.apache.atlas.model.typedef.AtlasRelationshipDef.PropagateTags;
import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef; import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef;
import org.apache.atlas.model.typedef.AtlasTypesDef; import org.apache.atlas.model.typedef.AtlasTypesDef;
import org.apache.atlas.model.typedef.AtlasRelationshipDef.PropagateTags;
import org.apache.atlas.type.AtlasType; import org.apache.atlas.type.AtlasType;
import org.apache.atlas.type.AtlasTypeUtil; import org.apache.atlas.type.AtlasTypeUtil;
import org.apache.atlas.utils.AuthenticationUtil; import org.apache.atlas.utils.AuthenticationUtil;
...@@ -56,7 +56,7 @@ import java.util.*; ...@@ -56,7 +56,7 @@ import java.util.*;
import static java.util.Arrays.asList; import static java.util.Arrays.asList;
import static org.apache.atlas.AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME; import static org.apache.atlas.AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME;
import static org.apache.atlas.model.typedef.AtlasNamespaceDef.ATTR_OPTION_APPLICABLE_ENTITY_TYPES; import static org.apache.atlas.model.typedef.AtlasBusinessMetadataDef.ATTR_OPTION_APPLICABLE_ENTITY_TYPES;
import static org.apache.atlas.model.typedef.AtlasRelationshipDef.RelationshipCategory.AGGREGATION; import static org.apache.atlas.model.typedef.AtlasRelationshipDef.RelationshipCategory.AGGREGATION;
import static org.apache.atlas.model.typedef.AtlasRelationshipDef.RelationshipCategory.COMPOSITION; import static org.apache.atlas.model.typedef.AtlasRelationshipDef.RelationshipCategory.COMPOSITION;
import static org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef.Cardinality.SET; import static org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef.Cardinality.SET;
...@@ -318,25 +318,25 @@ public class QuickStartV2 { ...@@ -318,25 +318,25 @@ public class QuickStartV2 {
List<AtlasRelationshipDef> relationshipDefs = asList(tableDatabaseTypeDef, viewDatabaseTypeDef, viewTablesTypeDef, tableColumnsTypeDef, tableStorageDescTypeDef, processProcessExecutionTypeDef); List<AtlasRelationshipDef> relationshipDefs = asList(tableDatabaseTypeDef, viewDatabaseTypeDef, viewTablesTypeDef, tableColumnsTypeDef, tableStorageDescTypeDef, processProcessExecutionTypeDef);
List<AtlasClassificationDef> classificationDefs = asList(dimClassifDef, factClassifDef, piiClassifDef, metricClassifDef, etlClassifDef, jdbcClassifDef, logClassifDef); List<AtlasClassificationDef> classificationDefs = asList(dimClassifDef, factClassifDef, piiClassifDef, metricClassifDef, etlClassifDef, jdbcClassifDef, logClassifDef);
// Namespace definitions // BusinessMetadata definitions
AtlasAttributeDef nsAttrDef1 = new AtlasAttributeDef("attr1", "int"); AtlasAttributeDef bmAttrDef1 = new AtlasAttributeDef("attr1", "int");
AtlasAttributeDef nsAttrDef2 = new AtlasAttributeDef("attr2", "int"); AtlasAttributeDef bmAttrDef2 = new AtlasAttributeDef("attr2", "int");
nsAttrDef1.setOption(ATTR_OPTION_APPLICABLE_ENTITY_TYPES, AtlasType.toJson(Collections.singleton(TABLE_TYPE))); bmAttrDef1.setOption(ATTR_OPTION_APPLICABLE_ENTITY_TYPES, AtlasType.toJson(Collections.singleton(TABLE_TYPE)));
nsAttrDef1.setIsOptional(true); bmAttrDef1.setIsOptional(true);
nsAttrDef1.setIsUnique(false); bmAttrDef1.setIsUnique(false);
nsAttrDef2.setOption(ATTR_OPTION_APPLICABLE_ENTITY_TYPES, AtlasType.toJson(Collections.singleton(TABLE_TYPE))); bmAttrDef2.setOption(ATTR_OPTION_APPLICABLE_ENTITY_TYPES, AtlasType.toJson(Collections.singleton(TABLE_TYPE)));
nsAttrDef2.setIsOptional(true); bmAttrDef2.setIsOptional(true);
nsAttrDef2.setIsUnique(false); bmAttrDef2.setIsUnique(false);
AtlasNamespaceDef testNamespaceDef = new AtlasNamespaceDef("test_namespace", "test_description", VERSION_1); AtlasBusinessMetadataDef testBusinessMetadataDef = new AtlasBusinessMetadataDef("test_businessMetadata", "test_description", VERSION_1);
testNamespaceDef.setAttributeDefs(Arrays.asList(nsAttrDef1, nsAttrDef2)); testBusinessMetadataDef.setAttributeDefs(Arrays.asList(bmAttrDef1, bmAttrDef2));
List<AtlasNamespaceDef> namespaceDefs = asList(testNamespaceDef); List<AtlasBusinessMetadataDef> businessMetadataDefs = asList(testBusinessMetadataDef);
return new AtlasTypesDef(Collections.emptyList(), Collections.emptyList(), classificationDefs, entityDefs, relationshipDefs, namespaceDefs); return new AtlasTypesDef(Collections.emptyList(), Collections.emptyList(), classificationDefs, entityDefs, relationshipDefs, businessMetadataDefs);
} }
void createEntities() throws Exception { void createEntities() throws Exception {
......
...@@ -857,72 +857,72 @@ public class EntityREST { ...@@ -857,72 +857,72 @@ public class EntityREST {
} }
@POST @POST
@Path("/guid/{guid}/namespaces") @Path("/guid/{guid}/businessmetata")
@Produces(Servlets.JSON_MEDIA_TYPE) @Produces(Servlets.JSON_MEDIA_TYPE)
@Consumes(Servlets.JSON_MEDIA_TYPE) @Consumes(Servlets.JSON_MEDIA_TYPE)
public void addOrUpdateNamespaceAttributes(@PathParam("guid") final String guid, @QueryParam("isOverwrite") @DefaultValue("false") boolean isOverwrite, Map<String, Map<String, Object>> entityNamespaces) throws AtlasBaseException { public void addOrUpdateBusinessAttributes(@PathParam("guid") final String guid, @QueryParam("isOverwrite") @DefaultValue("false") boolean isOverwrite, Map<String, Map<String, Object>> businessAttributes) throws AtlasBaseException {
AtlasPerfTracer perf = null; AtlasPerfTracer perf = null;
try { try {
if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) { if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "EntityREST.addOrUpdateNamespaceAttributes(" + guid + ", isOverwrite=" + isOverwrite + ")"); perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "EntityREST.addOrUpdateBusinessAttributes(" + guid + ", isOverwrite=" + isOverwrite + ")");
} }
entitiesStore.addOrUpdateNamespaceAttributes(guid, entityNamespaces, isOverwrite); entitiesStore.addOrUpdateBusinessAttributes(guid, businessAttributes, isOverwrite);
} finally { } finally {
AtlasPerfTracer.log(perf); AtlasPerfTracer.log(perf);
} }
} }
@DELETE @DELETE
@Path("/guid/{guid}/namespaces") @Path("/guid/{guid}/businessmetata")
@Produces(Servlets.JSON_MEDIA_TYPE) @Produces(Servlets.JSON_MEDIA_TYPE)
@Consumes(Servlets.JSON_MEDIA_TYPE) @Consumes(Servlets.JSON_MEDIA_TYPE)
public void removeNamespaceAttributes(@PathParam("guid") final String guid, Map<String, Map<String, Object>> entityNamespaces) throws AtlasBaseException { public void removeBusinessAttributes(@PathParam("guid") final String guid, Map<String, Map<String, Object>> businessAttributes) throws AtlasBaseException {
AtlasPerfTracer perf = null; AtlasPerfTracer perf = null;
try { try {
if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) { if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "EntityREST.removeNamespaceAttributes(" + guid + ")"); perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "EntityREST.removeBusinessAttributes(" + guid + ")");
} }
entitiesStore.removeNamespaceAttributes(guid, entityNamespaces); entitiesStore.removeBusinessAttributes(guid, businessAttributes);
} finally { } finally {
AtlasPerfTracer.log(perf); AtlasPerfTracer.log(perf);
} }
} }
@POST @POST
@Path("/guid/{guid}/namespace/{namespace}") @Path("/guid/{guid}/businessmetata/{bmName}")
@Produces(Servlets.JSON_MEDIA_TYPE) @Produces(Servlets.JSON_MEDIA_TYPE)
@Consumes(Servlets.JSON_MEDIA_TYPE) @Consumes(Servlets.JSON_MEDIA_TYPE)
public void addOrUpdateNamespaceAttributes(@PathParam("guid") final String guid, @PathParam("namespace") final String namespace, Map<String, Object> entityNsAttributes) throws AtlasBaseException { public void addOrUpdateBusinessAttributes(@PathParam("guid") final String guid, @PathParam("bmName") final String bmName, Map<String, Object> businessAttributes) throws AtlasBaseException {
AtlasPerfTracer perf = null; AtlasPerfTracer perf = null;
try { try {
if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) { if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "EntityREST.addOrUpdateNamespaceAttributes(" + guid + ", " + namespace + ")"); perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "EntityREST.addOrUpdateBusinessAttributes(" + guid + ", " + bmName + ")");
} }
entitiesStore.addOrUpdateNamespaceAttributes(guid, Collections.singletonMap(namespace, entityNsAttributes), false); entitiesStore.addOrUpdateBusinessAttributes(guid, Collections.singletonMap(bmName, businessAttributes), false);
} finally { } finally {
AtlasPerfTracer.log(perf); AtlasPerfTracer.log(perf);
} }
} }
@DELETE @DELETE
@Path("/guid/{guid}/namespace/{namespace}") @Path("/guid/{guid}/businessmetata/{bmName}")
@Produces(Servlets.JSON_MEDIA_TYPE) @Produces(Servlets.JSON_MEDIA_TYPE)
@Consumes(Servlets.JSON_MEDIA_TYPE) @Consumes(Servlets.JSON_MEDIA_TYPE)
public void removeNamespaceAttributes(@PathParam("guid") final String guid, @PathParam("namespace") final String namespace, Map<String, Object> entityNsAttributes) throws AtlasBaseException { public void removeBusinessAttributes(@PathParam("guid") final String guid, @PathParam("bmName") final String bmName, Map<String, Object> businessAttributes) throws AtlasBaseException {
AtlasPerfTracer perf = null; AtlasPerfTracer perf = null;
try { try {
if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) { if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "EntityREST.removeNamespaceAttributes(" + guid + ", " + namespace + ")"); perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "EntityREST.removeBusinessAttributes(" + guid + ", " + bmName + ")");
} }
entitiesStore.removeNamespaceAttributes(guid, Collections.singletonMap(namespace, entityNsAttributes)); entitiesStore.removeBusinessAttributes(guid, Collections.singletonMap(bmName, businessAttributes));
} finally { } finally {
AtlasPerfTracer.log(perf); AtlasPerfTracer.log(perf);
} }
......
...@@ -20,10 +20,10 @@ package org.apache.atlas.web.rest; ...@@ -20,10 +20,10 @@ package org.apache.atlas.web.rest;
import org.apache.atlas.exception.AtlasBaseException; import org.apache.atlas.exception.AtlasBaseException;
import org.apache.atlas.model.SearchFilter; import org.apache.atlas.model.SearchFilter;
import org.apache.atlas.model.typedef.AtlasBaseTypeDef; import org.apache.atlas.model.typedef.AtlasBaseTypeDef;
import org.apache.atlas.model.typedef.AtlasBusinessMetadataDef;
import org.apache.atlas.model.typedef.AtlasClassificationDef; import org.apache.atlas.model.typedef.AtlasClassificationDef;
import org.apache.atlas.model.typedef.AtlasEntityDef; import org.apache.atlas.model.typedef.AtlasEntityDef;
import org.apache.atlas.model.typedef.AtlasEnumDef; import org.apache.atlas.model.typedef.AtlasEnumDef;
import org.apache.atlas.model.typedef.AtlasNamespaceDef;
import org.apache.atlas.model.typedef.AtlasRelationshipDef; import org.apache.atlas.model.typedef.AtlasRelationshipDef;
import org.apache.atlas.model.typedef.AtlasStructDef; import org.apache.atlas.model.typedef.AtlasStructDef;
import org.apache.atlas.model.typedef.AtlasTypeDefHeader; import org.apache.atlas.model.typedef.AtlasTypeDefHeader;
...@@ -320,37 +320,37 @@ public class TypesREST { ...@@ -320,37 +320,37 @@ public class TypesREST {
} }
/** /**
* Get the namespace definition for the given guid * Get the businessMetadata definition for the given guid
* @param guid namespace guid * @param guid businessMetadata guid
* @return namespace definition * @return businessMetadata definition
* @throws AtlasBaseException * @throws AtlasBaseException
* @HTTP 200 On successful lookup of the the namespace definition by it's guid * @HTTP 200 On successful lookup of the the businessMetadata definition by it's guid
* @HTTP 404 On Failed lookup for the given guid * @HTTP 404 On Failed lookup for the given guid
*/ */
@GET @GET
@Path("/namespacedef/guid/{guid}") @Path("/businessmetadatadef/guid/{guid}")
public AtlasNamespaceDef getNamespaceDefByGuid(@PathParam("guid") String guid) throws AtlasBaseException { public AtlasBusinessMetadataDef getBusinessMetadataDefByGuid(@PathParam("guid") String guid) throws AtlasBaseException {
Servlets.validateQueryParamLength("guid", guid); Servlets.validateQueryParamLength("guid", guid);
AtlasNamespaceDef ret = typeDefStore.getNamespaceDefByGuid(guid); AtlasBusinessMetadataDef ret = typeDefStore.getBusinessMetadataDefByGuid(guid);
return ret; return ret;
} }
/** /**
* Get the namespace definition by it's name (unique) * Get the businessMetadata definition by it's name (unique)
* @param name namespace name * @param name businessMetadata name
* @return namespace definition * @return businessMetadata definition
* @throws AtlasBaseException * @throws AtlasBaseException
* @HTTP 200 On successful lookup of the the namespace definition by it's name * @HTTP 200 On successful lookup of the the businessMetadata definition by it's name
* @HTTP 404 On Failed lookup for the given name * @HTTP 404 On Failed lookup for the given name
*/ */
@GET @GET
@Path("/namespacedef/name/{name}") @Path("/businessmetadatadef/name/{name}")
public AtlasNamespaceDef getNamespaceDefByName(@PathParam("name") String name) throws AtlasBaseException { public AtlasBusinessMetadataDef getBusinessMetadataDefByName(@PathParam("name") String name) throws AtlasBaseException {
Servlets.validateQueryParamLength("name", name); Servlets.validateQueryParamLength("name", name);
AtlasNamespaceDef ret = typeDefStore.getNamespaceDefByName(name); AtlasBusinessMetadataDef ret = typeDefStore.getBusinessMetadataDefByName(name);
return ret; return ret;
} }
......
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