Skip to content

Commit

Permalink
Merge branch 'data-contract' into beta
Browse files Browse the repository at this point in the history
  • Loading branch information
bichitra95 committed Apr 24, 2024
2 parents 268d456 + e863c13 commit 319e19c
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public class ContractPreProcessor extends AbstractContractPreProcessor {
private static final Logger LOG = LoggerFactory.getLogger(ContractPreProcessor.class);
public static final String ATTR_VERSION = "dataContractVersion";
public static final String ATTR_ASSET_GUID = "dataContractAssetGuid";
public static final String REL_ATTR_GOVERNED_ASSET = "dataContractAssetLatest";
public static final String REL_ATTR_GOVERNED_ASSET_CERTIFIED = "dataContractAssetCertified";
public static final String REL_ATTR_LATEST_CONTRACT = "dataContractLatest";
public static final String REL_ATTR_GOVERNED_ASSET_CERTIFIED = "dataContractLatestCertified";
public static final String REL_ATTR_PREVIOUS_VERSION = "dataContractPreviousVersion";
public static final String ASSET_ATTR_HAS_CONTRACT = "hasContract";
public static final String ASSET_ATTR_DESCRIPTION = "description";
Expand Down Expand Up @@ -144,10 +144,6 @@ private void processCreateContract(AtlasEntity entity, EntityMutationContext con
entity.setAttribute(QUALIFIED_NAME, String.format("%s/V%s", contractQName, newVersionNumber));
entity.setAttribute(ATTR_VERSION, newVersionNumber);
entity.setAttribute(ATTR_ASSET_GUID, associatedAsset.getEntity().getGuid());
entity.setRelationshipAttribute(REL_ATTR_GOVERNED_ASSET, getAtlasObjectId(associatedAsset.getEntity()));
if (Objects.equals(entity.getAttribute(ATTR_CERTIFICATE_STATUS), DataContract.STATUS.VERIFIED.name()) ) {
entity.setRelationshipAttribute(REL_ATTR_GOVERNED_ASSET_CERTIFIED, getAtlasObjectId(associatedAsset.getEntity()));
}

datasetAttributeSync(context, associatedAsset.getEntity(), contract, entity);

Expand Down Expand Up @@ -244,6 +240,13 @@ private void datasetAttributeSync(EntityMutationContext context, AtlasEntity ass
if (associatedAsset.getAttribute(ASSET_ATTR_HAS_CONTRACT) == null || associatedAsset.getAttribute(ASSET_ATTR_HAS_CONTRACT).equals(false)) {
entity.setAttribute(ASSET_ATTR_HAS_CONTRACT, true);
}

// Update relationship with contract
entity.setRelationshipAttribute(REL_ATTR_LATEST_CONTRACT, getAtlasObjectId(contractAsset));
if (Objects.equals(contractAsset.getAttribute(ATTR_CERTIFICATE_STATUS), DataContract.STATUS.VERIFIED.name()) ) {
entity.setRelationshipAttribute(REL_ATTR_GOVERNED_ASSET_CERTIFIED, getAtlasObjectId(contractAsset));
}

AtlasVertex vertex = AtlasGraphUtilsV2.findByGuid(entity.getGuid());
AtlasEntityType entityType = ensureEntityType(entity.getTypeName());
AtlasEntityComparator entityComparator = new AtlasEntityComparator(typeRegistry, entityRetriever, context.getGuidAssignments(), true, true);
Expand Down

0 comments on commit 319e19c

Please sign in to comment.