@Andrey_Potapov
There was no need to send us the same solution with corrected assert statements.
First of all, we did it (corrected your solution) the moment you sent us the original form. If we hadn’t done that, we wouldn’t have had a basis to write everything that followed, and it would be totally unserious of us to waste your time and energy on that.
However, when it comes to the newly provided solution (last one, with corrected assert statements), the same as such is not executable, i.e. has syntax errors. In assert statements where you prove that the EffectiveData object is not null, you need to replace the places of parameters, because this way, as I said, there are the syntax errors, and the code as such is not executable.
Now the main thing, over and over again. The solution you provided us is not good and as such does not meet our needs.
Within the TextFrame object of a particular SmartArtNode object is a collection of Paragrapf objects, each of which contains a collection of Portion objects.
With the solution you provided, in a situation where we have multiple Paragraph/Portion objects in the TextFrame object of a SmartArtNode object, all nested (contained) objects are lost and only one is set in their place - the one for which you called the node.getTextFrame().setText(portionText)
syntax.
I really don’t know how to tell you this in a closer and clearer way, because who knows how many times I repeat in a loop the same story.
I am enclosing a piece of code that will, as an example, delete the first (and only) Portion object of the first (and at that moment also the only one) Paragraph object over the second SmartArtNode, then create a new Portion object and set it in the place of the just deleted one, and then, for the same Paragraph object, make a new Portion object (with some different properties - they can be the same, it doesn’t matter). Once this is done, a new Paragraph object is created (for that same SmartArtNode object, i.e. its TextFrame object), and then two new Portion objects are created and placed in it.
At the moment, the SmartArtNode object, i.e. its TextFrame object, contains two Paragraph objects with two Portion objects each, where for all four Portion objects you can access to their EffectiveData objects and read its (ED) properties values (as can be seen from the test).
What is shown here (in the attached test code) at the level of one SmartArtNode object (existence of EffectiveData object of one Portion object due to a change in the previous one, regardless of whether it is in the same or previous Paragraph object), should be provided on multiple SmartArtNode objects models (as reported at the beginning of whole this story - the current Portion object loses data about its EffectiveData object (it becomes null) if there is a change in the Portion object of the previous SmartArtNode object).
As proof of the fact that the solution you provided us is not good and does not meet our needs, at the end of the attached test code there is a commented part of the code, and if the mentioned part of the code remains commented, after the save operation, you will get a document (presentation) which, in the second diagram’s field (SmartArtNode/TextFrame), has two Paragraphs, with two Portions, where each Portion has its own text and EffectiveData properties - as it should be.
On the other hand, if you uncomment commented code lines and run the test, you will get a document which, in the second diagram’s field, has only the content defined using your approach (setting text over the TextFrame object of the given SmartArtNode object - node.getTextFrame().setText(portionText)
) - so there is a loss of all pre-existing data of the entire TextFrame object of a given SmartArtNode object (more precisely, data on all its Paragraph and Portion objects are lost).
This whole story has been screenshoted, which is also attached.
files.zip (28.8 KB)