blob: 50799e47157576cac9601c7440446fd6c335ba4a [file] [log] [blame]
/**
* Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
*
*
* This copyright notice shows up in the generated Java code
*/
package org.eclipse.osbp.xtext.blip.scoping;
import com.google.common.base.Objects;
import com.google.inject.Inject;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.bpmn2.CallActivity;
import org.eclipse.bpmn2.EndEvent;
import org.eclipse.bpmn2.ExclusiveGateway;
import org.eclipse.bpmn2.FlowElement;
import org.eclipse.bpmn2.Gateway;
import org.eclipse.bpmn2.GatewayDirection;
import org.eclipse.bpmn2.InclusiveGateway;
import org.eclipse.bpmn2.SequenceFlow;
import org.eclipse.bpmn2.StartEvent;
import org.eclipse.bpmn2.UserTask;
import org.eclipse.bpmn2.impl.ScriptTaskImpl;
import org.eclipse.bpmn2.impl.ServiceTaskImpl;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.osbp.xtext.blip.Blip;
import org.eclipse.osbp.xtext.blip.BlipCallActivity;
import org.eclipse.osbp.xtext.blip.BlipDSLPackage;
import org.eclipse.osbp.xtext.blip.BlipEndEvent;
import org.eclipse.osbp.xtext.blip.BlipExclusiveSplitGateway;
import org.eclipse.osbp.xtext.blip.BlipInclusiveSplitGateway;
import org.eclipse.osbp.xtext.blip.BlipItem;
import org.eclipse.osbp.xtext.blip.BlipOutGoing;
import org.eclipse.osbp.xtext.blip.BlipScript;
import org.eclipse.osbp.xtext.blip.BlipServiceTask;
import org.eclipse.osbp.xtext.blip.BlipSplitGateway;
import org.eclipse.osbp.xtext.blip.BlipStartEvent;
import org.eclipse.osbp.xtext.blip.BlipUserTask;
import org.eclipse.osbp.xtext.functionlibrarydsl.FunctionLibraryBlipGroup;
import org.eclipse.osbp.xtext.functionlibrarydsl.FunctionLibraryFunction;
import org.eclipse.osbp.xtext.functionlibrarydsl.FunctionLibraryTest;
import org.eclipse.xtext.resource.EObjectDescription;
import org.eclipse.xtext.resource.IEObjectDescription;
import org.eclipse.xtext.scoping.IScope;
import org.eclipse.xtext.scoping.impl.DefaultGlobalScopeProvider;
import org.eclipse.xtext.scoping.impl.MapBasedScope;
import org.eclipse.xtext.xbase.annotations.typesystem.XbaseWithAnnotationsBatchScopeProvider;
import org.eclipse.xtext.xbase.lib.CollectionLiterals;
@SuppressWarnings("all")
public class BlipDSLScopeProvider extends XbaseWithAnnotationsBatchScopeProvider {
@Inject
private DefaultGlobalScopeProvider globalScopeProvider;
public IScope getScope(final EObject context, final EReference reference) {
IScope _xblockexpression = null;
{
boolean _equals = Objects.equal(reference, BlipDSLPackage.Literals.BLIP_SCRIPT__TASK);
if (_equals) {
return this.getScope_BLIP_SCRIPT_TASK(((BlipScript) context));
}
boolean _equals_1 = Objects.equal(reference, BlipDSLPackage.Literals.BLIP_USER_TASK__TASK);
if (_equals_1) {
return this.getScope_BLIP_USER_TASK(((BlipUserTask) context));
}
boolean _equals_2 = Objects.equal(reference, BlipDSLPackage.Literals.BLIP_CALL_ACTIVITY__CALL_ACTIVITY);
if (_equals_2) {
return this.getScope_BLIP_CALL_ACTIVITY(((BlipCallActivity) context));
}
boolean _equals_3 = Objects.equal(reference, BlipDSLPackage.Literals.BLIP_SPLIT_GATEWAY__GATEWAY);
if (_equals_3) {
return this.getScope_BLIP_SPLIT_GATEWAY_GATEWAY(((BlipSplitGateway) context));
}
boolean _equals_4 = Objects.equal(reference, BlipDSLPackage.Literals.BLIP_OUT_GOING__SEQUENCE_FLOW);
if (_equals_4) {
return this.getScope_BLIP_OUTGOING_SEQUENCE(((BlipOutGoing) context));
}
boolean _equals_5 = Objects.equal(reference, BlipDSLPackage.Literals.BLIP_EVENT__EVENT);
if (_equals_5) {
boolean _matched = false;
if (!_matched) {
if (context instanceof BlipStartEvent) {
_matched=true;
return this.getScope_BLIP_START_EVENT__EVENT(((BlipStartEvent)context));
}
}
if (!_matched) {
if (context instanceof BlipEndEvent) {
_matched=true;
return this.getScope_BLIP_END_EVENT__EVENT(((BlipEndEvent)context));
}
}
}
boolean _equals_6 = Objects.equal(reference, BlipDSLPackage.Literals.BLIP_USER_TASK__ON_ENTRY);
if (_equals_6) {
return this.getScope_BLIP_ITEM__FUNCTION(((BlipItem) context));
}
boolean _equals_7 = Objects.equal(reference, BlipDSLPackage.Literals.BLIP_USER_TASK__ON_EXIT);
if (_equals_7) {
return this.getScope_BLIP_ITEM__FUNCTION(((BlipItem) context));
}
boolean _equals_8 = Objects.equal(reference, BlipDSLPackage.Literals.BLIP_CALL_ACTIVITY__ON_ENTRY);
if (_equals_8) {
return this.getScope_BLIP_ITEM__FUNCTION(((BlipItem) context));
}
boolean _equals_9 = Objects.equal(reference, BlipDSLPackage.Literals.BLIP_CALL_ACTIVITY__ON_EXIT);
if (_equals_9) {
return this.getScope_BLIP_ITEM__FUNCTION(((BlipItem) context));
}
boolean _equals_10 = Objects.equal(reference, BlipDSLPackage.Literals.BLIP_SCRIPT__FUNCTION);
if (_equals_10) {
return this.getScope_BLIP_ITEM__FUNCTION(((BlipItem) context));
}
boolean _equals_11 = Objects.equal(reference, BlipDSLPackage.Literals.BLIP_SERVICE_TASK__TASK);
if (_equals_11) {
return this.getScope_BLIP_SERVICE_TASK(((BlipServiceTask) context));
}
boolean _equals_12 = Objects.equal(reference, BlipDSLPackage.Literals.BLIP_SERVICE_TASK__ON_ENTRY);
if (_equals_12) {
return this.getScope_BLIP_ITEM__FUNCTION(((BlipItem) context));
}
boolean _equals_13 = Objects.equal(reference, BlipDSLPackage.Literals.BLIP_SERVICE_TASK__ON_EXIT);
if (_equals_13) {
return this.getScope_BLIP_ITEM__FUNCTION(((BlipItem) context));
}
boolean _equals_14 = Objects.equal(reference, BlipDSLPackage.Literals.BLIP_SERVICE_TASK__FUNCTION);
if (_equals_14) {
return this.getScope_BLIP_ITEM__FUNCTION(((BlipItem) context));
}
boolean _equals_15 = Objects.equal(reference, BlipDSLPackage.Literals.BLIP_OUT_GOING__CONSTRAINT);
if (_equals_15) {
return this.getScope_BLIP_ITEM__TEST(((BlipItem) context));
}
_xblockexpression = super.getScope(context, reference);
}
return _xblockexpression;
}
public IScope getScope_BLIP_ITEM__FUNCTION(final BlipItem blipItem) {
ArrayList<IEObjectDescription> result = CollectionLiterals.<IEObjectDescription>newArrayList();
EObject blip = ((EObject) blipItem);
while ((!(blip instanceof Blip))) {
EObject _eContainer = blip.eContainer();
blip = _eContainer;
}
boolean _and = false;
if (!(blip instanceof Blip)) {
_and = false;
} else {
FunctionLibraryBlipGroup _functionGroup = ((Blip) blip).getFunctionGroup();
boolean _notEquals = (!Objects.equal(_functionGroup, null));
_and = _notEquals;
}
if (_and) {
FunctionLibraryBlipGroup _functionGroup_1 = ((Blip) blip).getFunctionGroup();
EList<FunctionLibraryFunction> _functions = _functionGroup_1.getFunctions();
for (final FunctionLibraryFunction element : _functions) {
String _name = element.getName();
IEObjectDescription _create = EObjectDescription.create(_name, ((FunctionLibraryFunction) element));
result.add(_create);
}
}
return MapBasedScope.createScope(IScope.NULLSCOPE, result);
}
public IScope getScope_BLIP_ITEM__TEST(final BlipItem blipItem) {
ArrayList<IEObjectDescription> result = CollectionLiterals.<IEObjectDescription>newArrayList();
EObject blip = ((EObject) blipItem);
while ((!(blip instanceof Blip))) {
EObject _eContainer = blip.eContainer();
blip = _eContainer;
}
boolean _and = false;
if (!(blip instanceof Blip)) {
_and = false;
} else {
FunctionLibraryBlipGroup _functionGroup = ((Blip) blip).getFunctionGroup();
boolean _notEquals = (!Objects.equal(_functionGroup, null));
_and = _notEquals;
}
if (_and) {
FunctionLibraryBlipGroup _functionGroup_1 = ((Blip) blip).getFunctionGroup();
EList<FunctionLibraryTest> _tests = _functionGroup_1.getTests();
for (final FunctionLibraryTest element : _tests) {
String _name = element.getName();
IEObjectDescription _create = EObjectDescription.create(_name, ((FunctionLibraryTest) element));
result.add(_create);
}
}
return MapBasedScope.createScope(IScope.NULLSCOPE, result);
}
public IScope getScope_BLIP_SCRIPT_TASK(final BlipScript scriptTask) {
ArrayList<IEObjectDescription> result = CollectionLiterals.<IEObjectDescription>newArrayList();
EObject _eContainer = scriptTask.eContainer();
Blip blip = ((Blip) _eContainer);
boolean _and = false;
boolean _and_1 = false;
boolean _notEquals = (!Objects.equal(blip, null));
if (!_notEquals) {
_and_1 = false;
} else {
org.eclipse.bpmn2.Process _process = blip.getProcess();
boolean _notEquals_1 = (!Objects.equal(_process, null));
_and_1 = _notEquals_1;
}
if (!_and_1) {
_and = false;
} else {
org.eclipse.bpmn2.Process _process_1 = blip.getProcess();
List<FlowElement> _flowElements = _process_1.getFlowElements();
boolean _notEquals_2 = (!Objects.equal(_flowElements, null));
_and = _notEquals_2;
}
if (_and) {
org.eclipse.bpmn2.Process _process_2 = blip.getProcess();
List<FlowElement> _flowElements_1 = _process_2.getFlowElements();
for (final FlowElement element : _flowElements_1) {
if ((element instanceof ScriptTaskImpl)) {
String _id = ((ScriptTaskImpl)element).getId();
IEObjectDescription _create = EObjectDescription.create(_id, ((ScriptTaskImpl) element));
result.add(_create);
}
}
}
return MapBasedScope.createScope(IScope.NULLSCOPE, result);
}
public IScope getScope_BLIP_SERVICE_TASK(final BlipServiceTask serviceTask) {
ArrayList<IEObjectDescription> result = CollectionLiterals.<IEObjectDescription>newArrayList();
EObject _eContainer = serviceTask.eContainer();
Blip blip = ((Blip) _eContainer);
boolean _and = false;
boolean _and_1 = false;
boolean _notEquals = (!Objects.equal(blip, null));
if (!_notEquals) {
_and_1 = false;
} else {
org.eclipse.bpmn2.Process _process = blip.getProcess();
boolean _notEquals_1 = (!Objects.equal(_process, null));
_and_1 = _notEquals_1;
}
if (!_and_1) {
_and = false;
} else {
org.eclipse.bpmn2.Process _process_1 = blip.getProcess();
List<FlowElement> _flowElements = _process_1.getFlowElements();
boolean _notEquals_2 = (!Objects.equal(_flowElements, null));
_and = _notEquals_2;
}
if (_and) {
org.eclipse.bpmn2.Process _process_2 = blip.getProcess();
List<FlowElement> _flowElements_1 = _process_2.getFlowElements();
for (final FlowElement element : _flowElements_1) {
if ((element instanceof ServiceTaskImpl)) {
String _id = ((ServiceTaskImpl)element).getId();
IEObjectDescription _create = EObjectDescription.create(_id, ((ServiceTaskImpl) element));
result.add(_create);
}
}
}
return MapBasedScope.createScope(IScope.NULLSCOPE, result);
}
public IScope getScope_BLIP_USER_TASK(final BlipUserTask humanTask) {
ArrayList<IEObjectDescription> result = CollectionLiterals.<IEObjectDescription>newArrayList();
EObject _eContainer = humanTask.eContainer();
Blip blip = ((Blip) _eContainer);
boolean _and = false;
boolean _and_1 = false;
boolean _notEquals = (!Objects.equal(blip, null));
if (!_notEquals) {
_and_1 = false;
} else {
org.eclipse.bpmn2.Process _process = blip.getProcess();
boolean _notEquals_1 = (!Objects.equal(_process, null));
_and_1 = _notEquals_1;
}
if (!_and_1) {
_and = false;
} else {
org.eclipse.bpmn2.Process _process_1 = blip.getProcess();
List<FlowElement> _flowElements = _process_1.getFlowElements();
boolean _notEquals_2 = (!Objects.equal(_flowElements, null));
_and = _notEquals_2;
}
if (_and) {
org.eclipse.bpmn2.Process _process_2 = blip.getProcess();
List<FlowElement> _flowElements_1 = _process_2.getFlowElements();
for (final FlowElement element : _flowElements_1) {
if ((element instanceof UserTask)) {
String _id = ((UserTask)element).getId();
IEObjectDescription _create = EObjectDescription.create(_id, ((UserTask) element));
result.add(_create);
}
}
}
return MapBasedScope.createScope(IScope.NULLSCOPE, result);
}
public IScope getScope_BLIP_CALL_ACTIVITY(final BlipCallActivity callActivity) {
ArrayList<IEObjectDescription> result = CollectionLiterals.<IEObjectDescription>newArrayList();
EObject _eContainer = callActivity.eContainer();
Blip blip = ((Blip) _eContainer);
boolean _and = false;
boolean _and_1 = false;
boolean _notEquals = (!Objects.equal(blip, null));
if (!_notEquals) {
_and_1 = false;
} else {
org.eclipse.bpmn2.Process _process = blip.getProcess();
boolean _notEquals_1 = (!Objects.equal(_process, null));
_and_1 = _notEquals_1;
}
if (!_and_1) {
_and = false;
} else {
org.eclipse.bpmn2.Process _process_1 = blip.getProcess();
List<FlowElement> _flowElements = _process_1.getFlowElements();
boolean _notEquals_2 = (!Objects.equal(_flowElements, null));
_and = _notEquals_2;
}
if (_and) {
org.eclipse.bpmn2.Process _process_2 = blip.getProcess();
List<FlowElement> _flowElements_1 = _process_2.getFlowElements();
for (final FlowElement element : _flowElements_1) {
if ((element instanceof CallActivity)) {
String _id = ((CallActivity)element).getId();
IEObjectDescription _create = EObjectDescription.create(_id, ((CallActivity) element));
result.add(_create);
}
}
}
return MapBasedScope.createScope(IScope.NULLSCOPE, result);
}
public IScope getScope_BLIP_SPLIT_GATEWAY_GATEWAY(final BlipSplitGateway gateway) {
ArrayList<IEObjectDescription> result = CollectionLiterals.<IEObjectDescription>newArrayList();
EObject _eContainer = gateway.eContainer();
Blip blip = ((Blip) _eContainer);
boolean _and = false;
boolean _and_1 = false;
boolean _notEquals = (!Objects.equal(blip, null));
if (!_notEquals) {
_and_1 = false;
} else {
org.eclipse.bpmn2.Process _process = blip.getProcess();
boolean _notEquals_1 = (!Objects.equal(_process, null));
_and_1 = _notEquals_1;
}
if (!_and_1) {
_and = false;
} else {
org.eclipse.bpmn2.Process _process_1 = blip.getProcess();
List<FlowElement> _flowElements = _process_1.getFlowElements();
boolean _notEquals_2 = (!Objects.equal(_flowElements, null));
_and = _notEquals_2;
}
if (_and) {
org.eclipse.bpmn2.Process _process_2 = blip.getProcess();
List<FlowElement> _flowElements_1 = _process_2.getFlowElements();
for (final FlowElement element : _flowElements_1) {
if ((element instanceof Gateway)) {
GatewayDirection _gatewayDirection = ((Gateway)element).getGatewayDirection();
boolean _equals = Objects.equal(_gatewayDirection, GatewayDirection.DIVERGING);
if (_equals) {
boolean _and_2 = false;
if (!(gateway instanceof BlipExclusiveSplitGateway)) {
_and_2 = false;
} else {
_and_2 = (element instanceof ExclusiveGateway);
}
if (_and_2) {
String _id = ((Gateway)element).getId();
IEObjectDescription _create = EObjectDescription.create(_id, ((Gateway) element));
result.add(_create);
} else {
boolean _and_3 = false;
if (!(gateway instanceof BlipInclusiveSplitGateway)) {
_and_3 = false;
} else {
_and_3 = (element instanceof InclusiveGateway);
}
if (_and_3) {
String _id_1 = ((Gateway)element).getId();
IEObjectDescription _create_1 = EObjectDescription.create(_id_1, ((Gateway) element));
result.add(_create_1);
}
}
}
}
}
}
return MapBasedScope.createScope(IScope.NULLSCOPE, result);
}
public IScope getScope_BLIP_OUTGOING_SEQUENCE(final BlipOutGoing outgoing) {
ArrayList<IEObjectDescription> result = CollectionLiterals.<IEObjectDescription>newArrayList();
EObject _eContainer = outgoing.eContainer();
BlipSplitGateway gateway = ((BlipSplitGateway) _eContainer);
boolean _and = false;
boolean _and_1 = false;
boolean _notEquals = (!Objects.equal(gateway, null));
if (!_notEquals) {
_and_1 = false;
} else {
Gateway _gateway = gateway.getGateway();
boolean _notEquals_1 = (!Objects.equal(_gateway, null));
_and_1 = _notEquals_1;
}
if (!_and_1) {
_and = false;
} else {
Gateway _gateway_1 = gateway.getGateway();
List<SequenceFlow> _outgoing = _gateway_1.getOutgoing();
boolean _isEmpty = _outgoing.isEmpty();
boolean _not = (!_isEmpty);
_and = _not;
}
if (_and) {
Gateway _gateway_2 = gateway.getGateway();
List<SequenceFlow> _outgoing_1 = _gateway_2.getOutgoing();
for (final FlowElement element : _outgoing_1) {
if ((element instanceof SequenceFlow)) {
String _id = ((SequenceFlow)element).getId();
IEObjectDescription _create = EObjectDescription.create(_id, ((SequenceFlow) element));
result.add(_create);
}
}
}
return MapBasedScope.createScope(IScope.NULLSCOPE, result);
}
public IScope getScope_BLIP_START_EVENT__EVENT(final BlipStartEvent blipStartEvent) {
ArrayList<IEObjectDescription> result = CollectionLiterals.<IEObjectDescription>newArrayList();
EObject _eContainer = blipStartEvent.eContainer();
Blip blip = ((Blip) _eContainer);
boolean _and = false;
boolean _and_1 = false;
boolean _notEquals = (!Objects.equal(blip, null));
if (!_notEquals) {
_and_1 = false;
} else {
org.eclipse.bpmn2.Process _process = blip.getProcess();
boolean _notEquals_1 = (!Objects.equal(_process, null));
_and_1 = _notEquals_1;
}
if (!_and_1) {
_and = false;
} else {
org.eclipse.bpmn2.Process _process_1 = blip.getProcess();
List<FlowElement> _flowElements = _process_1.getFlowElements();
boolean _notEquals_2 = (!Objects.equal(_flowElements, null));
_and = _notEquals_2;
}
if (_and) {
org.eclipse.bpmn2.Process _process_2 = blip.getProcess();
List<FlowElement> _flowElements_1 = _process_2.getFlowElements();
for (final FlowElement element : _flowElements_1) {
if ((element instanceof StartEvent)) {
String _id = ((StartEvent)element).getId();
IEObjectDescription _create = EObjectDescription.create(_id, ((StartEvent) element));
result.add(_create);
}
}
}
return MapBasedScope.createScope(IScope.NULLSCOPE, result);
}
public IScope getScope_BLIP_END_EVENT__EVENT(final BlipEndEvent blipEndEvent) {
ArrayList<IEObjectDescription> result = CollectionLiterals.<IEObjectDescription>newArrayList();
EObject _eContainer = blipEndEvent.eContainer();
Blip blip = ((Blip) _eContainer);
boolean _and = false;
boolean _and_1 = false;
boolean _notEquals = (!Objects.equal(blip, null));
if (!_notEquals) {
_and_1 = false;
} else {
org.eclipse.bpmn2.Process _process = blip.getProcess();
boolean _notEquals_1 = (!Objects.equal(_process, null));
_and_1 = _notEquals_1;
}
if (!_and_1) {
_and = false;
} else {
org.eclipse.bpmn2.Process _process_1 = blip.getProcess();
List<FlowElement> _flowElements = _process_1.getFlowElements();
boolean _notEquals_2 = (!Objects.equal(_flowElements, null));
_and = _notEquals_2;
}
if (_and) {
org.eclipse.bpmn2.Process _process_2 = blip.getProcess();
List<FlowElement> _flowElements_1 = _process_2.getFlowElements();
for (final FlowElement element : _flowElements_1) {
if ((element instanceof EndEvent)) {
String _id = ((EndEvent)element).getId();
IEObjectDescription _create = EObjectDescription.create(_id, ((EndEvent) element));
result.add(_create);
}
}
}
return MapBasedScope.createScope(IScope.NULLSCOPE, result);
}
}