IRelationship.setFrom() - BPProcess

Hello,

I try to create IRelationship and set ‘From’ and ‘To’ elements:

public static void addReqModelBackReference(IRequirementModel model, IModelElement element) {
		IRelationship rel = IModelElementFactory.instance().createGenericConnector();
		rel.setName("model-backreference");
		rel.setFrom(element);
		rel.setTo(model);
}

It works well for element’s type, like Class, UseCase, but there are problems with BPProcess: java.lang.ClassCastException.
Any help is appreciated.

Best regards,
anita

1 Like

Hi Anita,

Thanks for your post. I’m sorry that I don’t quite understand what do you mean by “BPProcess”, could you please clarify whether you mean BPTask, BPSubprocess, or other business process models? Thanks!

Best regards,
Lilian Wong

Hi,
Thanks for replying. “BPProcess” - is a Process I defined in Pool Specification.

Best regards,
anita

Hi Anita,

Thanks for replying. Would you mind to capture a screenshot of “BPProcess” you mean so I can confirm your meaning? I’m wondering if you mean the “Process” field in Pool Specification dialog (see my attached image). Thanks in advance!

Best regards,
Lilian Wong

process_field_of_pool.png

Hi,
Yes: “Process” - field in Pool Specification dialog,
programatically: element.getModelType() = BPProcess.

Best regards,
anita

Hi Anita,

Thanks for replying. BPProcess is not allowed to connect to any connector, and it’s meaningless to connect the BPProcess with generic connector. We would suggest to reference Requirement to BPProcess.

Our engineers are working on the application UI so you can reference Requirement to BPProcess, and I’ll keep you posted for any news on this issue.

Best regards,
Lilian Wong

Hi Anita,

Sorry for my late response. Enhancement for referencing requirement to BPProcess, please update your product to latest patch (2010012a or later) first. After that, you can add reference by the following code:

        IRequirement lRequirement = ...;
        IBPProcess lProcess = ...;

        // create Reference
        IReference lReference = IModelElementFactory.instance().createReference();
        lReference.setType(IReference.TYPE_MODEL_ELEMENT);
        lReference.setUrlAsModel(lProcess);

        // add Reference into Requirement
        lRequirement.addReference(lReference);

For your information, details about updating to latest patch can be found from the link below. Feel free to contact me if you need further information.

Best regards,
Lilian Wong

1 Like