/** * * <!-- begin-user-doc --> * <!-- end-user-doc --> * <!-- begin-model-doc --> * The trigger event must be a CallEvent. trigger.event.oclIsKindOf(CallEvent) * * @param acceptCallAction The receiving '<em><b>Accept Call Action</b></em>' model object. * @param diagnostics The chain of diagnostics to which problems are to be appended. * @param context The cache of context-specific information. * <!-- end-model-doc --> * @generated NOT */ public static boolean validateTriggerCallEvent( AcceptCallAction acceptCallAction, DiagnosticChain diagnostics, Map<Object, Object> context) { boolean result = true; for (Trigger trigger : acceptCallAction.getTriggers()) { if (!(trigger.getEvent() instanceof CallEvent)) { result = false; break; } } if (!result && diagnostics != null) { diagnostics.add( new BasicDiagnostic( Diagnostic.WARNING, UMLValidator.DIAGNOSTIC_SOURCE, UMLValidator.ACCEPT_CALL_ACTION__TRIGGER_CALL_EVENT, UMLPlugin.INSTANCE.getString( "_UI_AcceptCallAction_TriggerCallEvent_diagnostic", getMessageSubstitutions(context, acceptCallAction)), // $NON-NLS-1$ new Object[] {acceptCallAction})); } return result; }
/** * * <!-- begin-user-doc --> * <!-- end-user-doc --> * <!-- begin-model-doc --> * isUnmrashall must be true for an AcceptCallAction. isUnmarshall = true * * @param acceptCallAction The receiving '<em><b>Accept Call Action</b></em>' model object. * @param diagnostics The chain of diagnostics to which problems are to be appended. * @param context The cache of context-specific information. * <!-- end-model-doc --> * @generated NOT */ public static boolean validateUnmarshall( AcceptCallAction acceptCallAction, DiagnosticChain diagnostics, Map<Object, Object> context) { boolean result = acceptCallAction.isUnmarshall(); if (!result && diagnostics != null) { diagnostics.add( new BasicDiagnostic( Diagnostic.WARNING, UMLValidator.DIAGNOSTIC_SOURCE, UMLValidator.ACCEPT_CALL_ACTION__UNMARSHALL, UMLPlugin.INSTANCE.getString( "_UI_AcceptCallAction_Unmarshall_diagnostic", getMessageSubstitutions(context, acceptCallAction)), // $NON-NLS-1$ new Object[] {acceptCallAction})); } return result; }
@VisitBefore(matchSubclasses = true) public void visitActivity(Activity activity) { if (EmfBehaviorUtil.isProcess(activity)) { OJAnnotatedClass activityClass = findJavaClass(activity); super.implementEventConsumption(activityClass, activity, getEventActions(activity)); for (ActivityNode n : EmfActivityUtil.getActivityNodesRecursively(activity)) { if (n instanceof AcceptCallAction) { AcceptCallAction acc = (AcceptCallAction) n; Operation no = EmfActionUtil.getOperation(acc); OperationMap map = ojUtil.buildOperationMap(no); OJAnnotatedOperation oper = operationAnnotator.findOrCreateOperation(activity, activityClass, map, true); OJBlock mainBlock = oper.getBody(); if (EmfBehaviorUtil.hasExecutionInstance(no)) { PropertyMap actionMap = ojUtil.buildStructuralFeatureMap(acc); final String EXECUTE_STATEMENT = "executeStatement"; oper.getBody() .removeFromStatements(oper.getBody().findStatementRecursive(EXECUTE_STATEMENT)); mainBlock.addToStatements(actionMap.setter() + "(result)"); } else { for (OutputPin pin : acc.getResults()) { PropertyMap pinMap = ojUtil.buildStructuralFeatureMap(pin); PropertyMap parameterMap = ojUtil.buildStructuralFeatureMap(EmfActionUtil.getLinkedTypedElement(pin)); mainBlock.addToStatements(pinMap.setter() + "(" + parameterMap.fieldname() + ")"); } } if (!EmfBehaviorUtil.hasExecutionInstance(no)) { for (InputPin pin : EmfActionUtil.getReplyAction(acc).getReplyValues()) { if (((Parameter) EmfActionUtil.getLinkedTypedElement(pin)).getDirection() == ParameterDirectionKind.RETURN_LITERAL) { Jbpm5ObjectNodeExpressor expressor = new Jbpm5ObjectNodeExpressor(ojUtil); mainBlock.addToStatements( "result=" + expressor.expressInputPinOrOutParamOrExpansionNode(mainBlock, pin)); } } } if (!activity.conformsTo((Classifier) no.getOwner()) && activity.getContext() != null && activity.getContext().conformsTo((Classifier) no.getOwner())) { // TODO find the right activity and delegate to it } } else if (EmfActionUtil.isEmbeddedTask(n)) { Action t = (Action) n; String stereotypeName = n instanceof OpaqueAction ? StereotypeNames.EMBEDDED_SINGLE_SCREEN_TASK : StereotypeNames.EMBEDDED_SCREEN_FLOW_TASK; for (TimeEvent d : getLibrary().getResponsibilityDefinition(t, stereotypeName).getDeadlines()) { OJPathName date = ojUtil.classifierPathname(getLibrary().getDateType()); OJPathName task = ojUtil.classifierPathname(t); String consumerName = eventUtil.getEventConsumerName(d); OJOperation findOperation = activityClass.findOperation(consumerName, Arrays.asList(date, task)); if (findOperation == null) { findOperation = new OJAnnotatedOperation(consumerName, new OJPathName("boolean")); activityClass.addToOperations(findOperation); findOperation.addParam("date", date); findOperation.addParam("task", task); findOperation.getBody().addToStatements("return false"); } } } } } }