Example of creating and removing target assocations:

var sourceNode = userhome.createNode('testassocsfile.txt', 'cm:content');
sourceNode.content = 'the original text';
sourceNode.addAspect('cm:transformable');

var destNode = userhome.createNode('translation1.txt', 'cm:content');
destNode.content = 'the translation of the original text';
sourceNode.createAssociation(destNode, 'cm:formats');

var tempNode = userhome.createNode('dummy.txt', 'cm:content');
tempNode.content = 'dummy';
sourceNode.createAssociation(tempNode, 'cm:formats');

// get the nodes at the end of the 'cm:formats' association
var translations = sourceNode.assocs['cm:formats'];

sourceNode.removeAssociation(tempNode, 'cm:formats');
tempNode.remove();
文档更新时间: 2020-02-16 16:33   作者:凌云文档