public static void preUpdateCheck ( AtlasRelationshipDef newRelationshipDef , AtlasRelationshipDef existingRelationshipDef ) throws AtlasBaseException { // do not allow renames of the Def. String existingName = existingRelationshipDef . getName ( ) ; String newName = newRelationshipDef . getName ( ) ; if ( ! existingName . equals ( newName ) ) { throw new AtlasBaseException ( AtlasErrorCode . RELATIONSHIPDEF_INVALID_NAME_UPDATE , newRelationshipDef . getGuid ( ) , existingName , newName ) ; } RelationshipCategory existingRelationshipCategory = existingRelationshipDef . getRelationshipCategory ( ) ; RelationshipCategory newRelationshipCategory = newRelationshipDef . getRelationshipCategory ( ) ; if ( ! existingRelationshipCategory . equals ( newRelationshipCategory ) ) { throw new AtlasBaseException ( AtlasErrorCode . RELATIONSHIPDEF_INVALID_CATEGORY_UPDATE , newRelationshipDef . getName ( ) , newRelationshipCategory . name ( ) , existingRelationshipCategory . name ( ) ) ; } AtlasRelationshipEndDef existingEnd1 = existingRelationshipDef . getEndDef1 ( ) ; AtlasRelationshipEndDef newEnd1 = newRelationshipDef . getEndDef1 ( ) ; if ( ! newEnd1 . equals ( existingEnd1 ) ) { throw new AtlasBaseException ( AtlasErrorCode . RELATIONSHIPDEF_INVALID_END1_UPDATE , newRelationshipDef . getName ( ) , newEnd1 . toString ( ) , existingEnd1 . toString ( ) ) ; } AtlasRelationshipEndDef existingEnd2 = existingRelationshipDef . getEndDef2 ( ) ; AtlasRelationshipEndDef newEnd2 = newRelationshipDef . getEndDef2 ( ) ; if ( ! newEnd2 . equals ( existingEnd2 ) ) { throw new AtlasBaseException ( AtlasErrorCode . RELATIONSHIPDEF_INVALID_END2_UPDATE , newRelationshipDef . getName ( ) , newEnd2 . toString ( ) , existingEnd2 . toString ( ) ) ; } }
Check ends are the same and relationshipCategory is the same .