Problem when adding Operators in code
Imbafestor
New Altair Community Member
Hey,
i am writing an extension in which i implement a own super operator. Now i want to fill a subprocess with an operator in code, but the problem is, that the operator keeps getting added two times (Even the constructor of my superoperator is called several times when adding only one instance in rm).
Here is my code:
Best regards
i am writing an extension in which i implement a own super operator. Now i want to fill a subprocess with an operator in code, but the problem is, that the operator keeps getting added two times (Even the constructor of my superoperator is called several times when adding only one instance in rm).
Here is my code:
I found a topic with the same problem (https://rapid-i.com/rapidforum/index.php/topic,3549.0.html) but no answers. Is it a bug or am I missing something?
public MySuperOperator(OperatorDescription description)
{
super(description, "SubProcess 0", "SubProcess 1");
createSubProcess();
}
private void createSubProcess()
{
ExecutionUnit sub = getSubprocess(0);
try {
if(sub.getOperators().size() < 1) // doesn't prevent adding two operators
{
sub.addOperator(OperatorService.createOperator(MultiplyLabelBy.class));
}
} catch (OperatorCreationException e) {
e.printStackTrace();
}
}
Best regards
0
Answers
-
No one has a clue?0