-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pre Processors for Domain Move #2876
Conversation
...apache/atlas/repository/store/graph/v2/preprocessor/datamesh/AbstractDomainPreProcessor.java
Show resolved
Hide resolved
...rg/apache/atlas/repository/store/graph/v2/preprocessor/datamesh/DataProductPreProcessor.java
Outdated
Show resolved
Hide resolved
...rg/apache/atlas/repository/store/graph/v2/preprocessor/datamesh/DataProductPreProcessor.java
Outdated
Show resolved
Hide resolved
...rg/apache/atlas/repository/store/graph/v2/preprocessor/datamesh/DataProductPreProcessor.java
Outdated
Show resolved
Hide resolved
...ava/org/apache/atlas/repository/store/graph/v2/preprocessor/datamesh/DomainPreProcessor.java
Show resolved
Hide resolved
@@ -32,6 +32,12 @@ public class PreProcessorUtils { | |||
public static final String GLOSSARY_TERM_REL_TYPE = "AtlasGlossaryTermAnchor"; | |||
public static final String GLOSSARY_CATEGORY_REL_TYPE = "AtlasGlossaryCategoryAnchor"; | |||
|
|||
//DataMesh models constants | |||
public static final String DATA_PRODUCT_TYPE = "DataProduct"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think DATA_PRODUCT_TYPE from common/src/main/java/org/apache/atlas/repository/Constants.java can be reused
import static org.apache.atlas.repository.util.AtlasEntityUtils.mapOf; | ||
|
||
public class DataProductPreProcessor extends AbstractDomainPreProcessor { | ||
private static final Logger LOG = LoggerFactory.getLogger(DomainPreProcessor.class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DataProductPreProcessor.class
public void processAttributes(AtlasStruct entityStruct, EntityMutationContext context, | ||
EntityMutations.EntityOperation operation) throws AtlasBaseException { | ||
//Handle name & qualifiedName | ||
if (operation == EntityMutations.EntityOperation.UPDATE && LOG.isDebugEnabled()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove EntityOperation.UPDATE condition
} | ||
|
||
|
||
AtlasEntity entity = (AtlasEntity) entityStruct; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrap these statements as well inside if (operation == EntityMutations.EntityOperation.UPDATE)
these will no be called when not required
setParent(entity, context); | ||
|
||
if (operation == EntityMutations.EntityOperation.UPDATE) { | ||
processUpdateDomain(entity, vertex); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
processUpdateDomain -> processUpdateProduct
String currentDomainQualifiedName = (String) currentDomainHeader.getAttribute(QUALIFIED_NAME); | ||
|
||
String newDomainQualifiedName = (String) parentDomain.getAttribute(QUALIFIED_NAME); | ||
String superDomainQualifiedName = (String) parentDomain.getAttribute(SUPER_DOMAIN_QN); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
superDomainQualifiedName -> newSuperDomainQualifiedName
isAuthorized(currentDomainHeader, parentDomain); | ||
|
||
processMoveDataProductToAnotherDomain(entity, currentDomainQualifiedName, newDomainQualifiedName, vertexQnName, superDomainQualifiedName); | ||
entity.setAttribute(PARENT_DOMAIN_QN, newDomainQualifiedName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this line os redundant
boolean exists = false; | ||
try { | ||
List mustClauseList = new ArrayList(); | ||
mustClauseList.add(mapOf("term", mapOf("__typeName.keyword", DATA_DOMAIN_ENTITY_TYPE))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DATA_DOMAIN_ENTITY_TYPE -> I think it should be DATA_PRODUCT_ENTITY_TYPE
public void processAttributes(AtlasStruct entityStruct, EntityMutationContext context, | ||
EntityMutations.EntityOperation operation) throws AtlasBaseException { | ||
//Handle name & qualifiedName | ||
if (operation == EntityMutations.EntityOperation.UPDATE && LOG.isDebugEnabled()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
operation == EntityMutations.EntityOperation.UPDATE -> not needed
entityStruct.getAttribute(QUALIFIED_NAME), operation); | ||
} | ||
|
||
this.context = context; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enclose this within if (operation == EntityMutations.EntityOperation.UPDATE) {
Change description
Type of change
Related issues
Checklists
Development
Security
Code review