Overriding Validation Through Constraint [message #1733594] |
Mon, 30 May 2016 11:04  |
Eclipse User |
|
|
|
Hi,
I created an extension of the Task and ManualTask using my own model.
I added my customized validation adding the
<extension
point="org.eclipse.emf.validation.constraintProviders">
<category
name="Core Validation Overrides"
id="org.eclipse.bpmn2.modeler.core.validation.category.override"/>
<constraintProvider cache="true">
<package namespaceUri="http://www.omg.org/spec/BPMN/20100524/MODEL-XMI"/>
<constraints categories="com.opentext.bpmn2.modeler.core.validation.category">
<constraint
class="com.opentext.bpmn2.validation.WemValidationConstraint"
id="com.opentext.bpmn2.modeler.core.live.validation.error"
isEnabledByDefault="false"
lang="Java"
mode="Live"
name="Task Element"
severity="ERROR"
statusCode="3">
<message>Test Task Element</message>
<target class="Task" />
</constraint>
<!-- Batch validation constraints -->
<constraint
class="com.opentext.bpmn2.validation.WemValidationConstraint"
id="com.opentext.bpmn2.modeler.core.validation.error"
isEnabledByDefault="true"
lang="Java"
mode="Batch"
name="Base Element"
severity="ERROR"
statusCode="0"
>
<description>Wem Validation on the extension of model.</description>
<message>My Message</message>
<target class="Task"/>
</constraint>
</constraints>
</constraintProvider>
</extension>
I am getting call back in my code for all Task object related validation call. But It is not showing my messages. It shows only BPMN2.0 core model messages. I want to override this behaviour and want to suppress the BPMN2.0 messages.
Following method I override to manage my extension model and hooked up my validator.
protected boolean doValidation(IValidationContext ctx, EObject eObj) {
System.out.println("eObj :"+eObj.getClass().getSimpleName());
String object = getWemType(eObj);
for (String wemType : wemTypes) {
if (object.equals(wemType))
return true;
}
return false;
}
Please let me know if there is a way to override the bpmn core validation.
|
|
|
|
Powered by
FUDForum. Page generated in 0.04302 seconds