Skip to content

Instantly share code, notes, and snippets.

@rich-biker
Last active April 22, 2020 14:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rich-biker/406743381cfc987a3f9b721a68284540 to your computer and use it in GitHub Desktop.
Save rich-biker/406743381cfc987a3f9b721a68284540 to your computer and use it in GitHub Desktop.
/*
Script: Reverse Access
A jArchi script for use on an Archi repository
Purpose: Reverse all selected access relationships Access Type direction (e.g. read -> write / write -> read)
Useful as the default access type for an access relationship is 'write'. This allows several to be reversed.
Author: Richard Heward - Tame Blue Lion
Date: 28-Feb-2019
*/
console.clear();
console.log("Reversing Access Relationships");
var revCount = 0;
var objList = $(selection).filter('access-relationship');
objList.each(function (accessRel) {
if (accessRel.concept.accessType === 'read') {
revCount++;
accessRel.concept.accessType = 'write';
}
if (accessRel.concept.accessType === 'write') {
revCount++;
accessRel.concept.accessType = 'read';
}
});
console.log("Num relationships reversed: ", revCount);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment