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 3a5be0c + 8185bfe commit 268d456
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,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 REL_ATTR_GOVERNED_ASSET = "dataContractAsset";
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_PREVIOUS_VERSION = "dataContractPreviousVersion";
public static final String ASSET_ATTR_HAS_CONTRACT = "hasContract";
Expand Down Expand Up @@ -127,7 +128,7 @@ private void processCreateContract(AtlasEntity entity, EntityMutationContext con
} else if (isEqualContract(contractString, (String) currentVersionEntity.getAttribute(ATTR_CONTRACT))) {
// No change in contract, metadata changed
updateExistingVersion(context, entity, currentVersionEntity);
return;
newVersionNumber = currentVersionNumber;
} else {
// contract changed (metadata might/not changed). Create new version.
newVersionNumber = currentVersionNumber + 1;
Expand All @@ -142,6 +143,7 @@ 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()));
Expand Down

0 comments on commit 268d456

Please sign in to comment.