Skip to content

Commit

Permalink
[1673] Add query for AbstractCapabilityGeneralization.super
Browse files Browse the repository at this point in the history
The super query delegates to existing queries for
AbstractCapability_InheritedCapability. Also refactor some class names
and make sure to use the right query feature.

Change-Id: Ica0cbaf0aae1377cbfcb170d69bd99edd0a6474a
Signed-off-by: Felix Dorner <felix.dorner@gmail.com>
  • Loading branch information
felixdo committed Mar 21, 2018
1 parent c96690c commit 1d11baf
Show file tree
Hide file tree
Showing 12 changed files with 100 additions and 36 deletions.
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<!--
Copyright (c) 2006, 2017 THALES GLOBAL SERVICES.
Copyright (c) 2006, 2018 THALES GLOBAL SERVICES.
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
Expand Down Expand Up @@ -237,6 +237,7 @@
<MDEBusinessQueries class="org.polarsys.capella.core.business.queries.interaction.Scenario_RealizedScenario" id="org.polarsys.capella.core.business.queries.interaction.Scenario_RealizedScenario" />
<MDEBusinessQueries class="org.polarsys.capella.core.business.queries.interaction.AbstractCapabilityInclude_Included" id="org.polarsys.capella.core.business.queries.interaction.AbstractCapabilityInclude_Included" />
<MDEBusinessQueries class="org.polarsys.capella.core.business.queries.interaction.AbstractCapabilityExtend_Extended" id="org.polarsys.capella.core.business.queries.interaction.AbstractCapabilityExtend_Extended" />
<MDEBusinessQueries class="org.polarsys.capella.core.business.queries.interaction.AbstractCapabilityGeneralization_Super" id="org.polarsys.capella.core.business.queries.interaction.AbstractCapabilityGeneralization_Super" />
</extension>
<extension name="la" point="org.polarsys.capella.core.data.business.queries.MDEBusinessQueries">
<MDEBusinessQueries class="org.polarsys.capella.core.business.queries.la.CapabilityRealization_ActorCapabilityRealization" id="org.polarsys.capella.core.business.queries.la.CapabilityRealization_ActorCapabilityRealization" />
Expand Down Expand Up @@ -307,7 +308,7 @@
<MDEBusinessQueries class="org.polarsys.capella.core.business.queries.oa.CommunicationMean_FunctionalExchanges" id="org.polarsys.capella.core.business.queries.oa.CommunicationMenu_FunctionalExchanges" />
<MDEBusinessQueries class="org.polarsys.capella.core.business.queries.oa.OperationalActivity_AvailableInstates" id="org.polarsys.capella.core.business.queries.oa.OperationalActivity_AvailableInstates" />
<MDEBusinessQueries class="org.polarsys.capella.core.business.queries.oa.OperationalActor_AllocatedRoles" id="org.polarsys.capella.core.business.queries.oa.OperationalActor_AllocatedRoles" />
<MDEBusinessQueries class="org.polarsys.capella.core.business.queries.oa.OperationalCapability_InheritedClasses" id="org.polarsys.capella.core.business.queries.oa.OperationalCapability_InheritedClasses" />
<MDEBusinessQueries class="org.polarsys.capella.core.business.queries.oa.OperationalCapability_InheritedCapabilities" id="org.polarsys.capella.core.business.queries.oa.OperationalCapability_InheritedCapabilities" />
<MDEBusinessQueries class="org.polarsys.capella.core.business.queries.oa.OperationalCapability_InvolvedEntities" id="org.polarsys.capella.core.business.queries.oa.OperationalCapability_InvolvedEntities" />
<MDEBusinessQueries class="org.polarsys.capella.core.business.queries.oa.OperationalActor_AllocatedActivities" id="org.polarsys.capella.core.business.queries.oa.OperationalActor_AllocatedActivities" />
<MDEBusinessQueries class="org.polarsys.capella.core.business.queries.oa.OperationalProcess_AvailableInStates" id="org.polarsys.capella.core.business.queries.oa.OperationalProcess_AvailableInStates" />
Expand Down Expand Up @@ -1093,11 +1094,11 @@
<querySpecification queryIdentifier="GetCurrent_OperationalCapability_AvailableInStates">
<queryAlgorithm algorithm="org.polarsys.capella.core.business.queries.queries.oa.GetCurrent_OperationalCapability_AvailableInStates" />
</querySpecification>
<querySpecification queryIdentifier="GetAvailable_OperationalCapability_InheritedClasses">
<queryAlgorithm algorithm="org.polarsys.capella.core.business.queries.queries.oa.GetAvailable_OperationalCapability_InheritedClasses" />
<querySpecification queryIdentifier="GetAvailable_OperationalCapability_InheritedCapabilities">
<queryAlgorithm algorithm="org.polarsys.capella.core.business.queries.queries.oa.GetAvailable_OperationalCapability_InheritedCapabilities" />
</querySpecification>
<querySpecification queryIdentifier="GetCurrent_OperationalCapability_InheritedClasses">
<queryAlgorithm algorithm="org.polarsys.capella.core.business.queries.queries.oa.GetCurrent_OperationalCapability_InheritedClasses" />
<querySpecification queryIdentifier="GetCurrent_OperationalCapability_InheritedCapabilities">
<queryAlgorithm algorithm="org.polarsys.capella.core.business.queries.queries.oa.GetCurrent_OperationalCapability_InheritedCapabilities" />
</querySpecification>
<querySpecification queryIdentifier="GetAvailable_OperationalCapability_InvolvedActivity">
<queryAlgorithm algorithm="org.polarsys.capella.core.business.queries.queries.oa.GetAvailable_OperationalCapability_InvolvedActivity" />
Expand Down
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
* Copyright (c) 2006, 2018 THALES GLOBAL SERVICES.
* 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
Expand Down Expand Up @@ -166,7 +166,7 @@ public class QueryConstants {
public static final String GET_AVAILABLE__NUMERIC_VALUE__UNIT___LIB = "GetAvailable_NumericValue_Unit__Lib"; //$NON-NLS-1$
public static final String GET_AVAILABLE__OPERATIONAL_ACTIVITY__AVAILABLE_INSTATES = "GetAvailable_OperationalActivity_AvailableInstates"; //$NON-NLS-1$
public static final String GET_AVAILABLE__OPERATIONAL_CAPABILITY__AVAILABLE_IN_STATES = "GetAvailable_OperationalCapability_AvailableInStates"; //$NON-NLS-1$
public static final String GET_AVAILABLE__OPERATIONAL_CAPABILITY__INHERITED_CLASSES = "GetAvailable_OperationalCapability_InheritedClasses"; //$NON-NLS-1$
public static final String GET_AVAILABLE__OPERATIONAL_CAPABILITY__INHERITED_CAPABILITIES = "GetAvailable_OperationalCapability_InheritedCapabilities"; //$NON-NLS-1$
public static final String GET_AVAILABLE__OPERATIONAL_CAPABILITY__INVOLVED_ACTIVITY = "GetAvailable_OperationalCapability_InvolvedActivity"; //$NON-NLS-1$
public static final String GET_AVAILABLE__OPERATIONAL_CAPABILITY__INVOLVED_ENTITIES = "GetAvailable_OperationalCapability_InvolvedEntities"; //$NON-NLS-1$
public static final String GET_AVAILABLE__OPERATIONAL_CAPABILITY__INVOLVED_OPERATIONAL_PROCESS = "GetAvailable_OperationalCapability_InvolvedOperationalProcess"; //$NON-NLS-1$
Expand Down Expand Up @@ -431,7 +431,7 @@ public class QueryConstants {
public static final String GET_CURRENT__NUMERIC_VALUE__TYPE = "GetCurrent_NumericValue_Type"; //$NON-NLS-1$
public static final String GET_CURRENT__OPERATIONAL_ACTIVITY__AVAILABLE_INSTATES = "GetCurrent_OperationalActivity_AvailableInstates"; //$NON-NLS-1$
public static final String GET_CURRENT__OPERATIONAL_CAPABILITY__AVAILABLE_IN_STATES = "GetCurrent_OperationalCapability_AvailableInStates"; //$NON-NLS-1$
public static final String GET_CURRENT__OPERATIONAL_CAPABILITY__INHERITED_CLASSES = "GetCurrent_OperationalCapability_InheritedClasses"; //$NON-NLS-1$
public static final String GET_CURRENT__OPERATIONAL_CAPABILITY__INHERITED_CAPABILITIES = "GetCurrent_OperationalCapability_InheritedCapabilities"; //$NON-NLS-1$
public static final String GET_CURRENT__OPERATIONAL_CAPABILITY__INVOLVED_ACTIVITY = "GetCurrent_OperationalCapability_InvolvedActivity"; //$NON-NLS-1$
public static final String GET_CURRENT__OPERATIONAL_CAPABILITY__INVOLVED_ENTITIES = "GetCurrent_OperationalCapability_InvolvedEntities"; //$NON-NLS-1$
public static final String GET_CURRENT__OPERATIONAL_CAPABILITY__INVOLVED_OPERATIONAL_PROCESS = "GetCurrent_OperationalCapability_InvolvedOperationalProcess"; //$NON-NLS-1$
Expand Down
@@ -1,10 +1,10 @@
/*******************************************************************************
* Copyright (c) 2006, 2016 THALES GLOBAL SERVICES.
* Copyright (c) 2006, 2018 THALES GLOBAL SERVICES.
* 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:
* Thales - initial API and implementation
*******************************************************************************/
Expand Down Expand Up @@ -35,7 +35,7 @@ public EClass getEClass() {

@Override
public List<EReference> getEStructuralFeatures() {
return Collections.singletonList(InteractionPackage.Literals.ABSTRACT_CAPABILITY__SUPER_GENERALIZATIONS);
return Collections.singletonList(InteractionPackage.Literals.ABSTRACT_CAPABILITY__SUPER);
}

@Override
Expand Down
@@ -0,0 +1,62 @@
/*******************************************************************************
* Copyright (c) 2018 THALES GLOBAL SERVICES.
* 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:
* Thales - initial API and implementation
*******************************************************************************/
package org.polarsys.capella.core.business.queries.interaction;

import java.util.Collections;
import java.util.List;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.polarsys.capella.core.business.queries.IBusinessQuery;
import org.polarsys.capella.core.business.queries.capellacore.BusinessQueriesProvider;
import org.polarsys.capella.core.data.interaction.AbstractCapability;
import org.polarsys.capella.core.data.interaction.AbstractCapabilityGeneralization;
import org.polarsys.capella.core.data.interaction.InteractionPackage;


public class AbstractCapabilityGeneralization_Super implements IBusinessQuery {

/**
* @see org.polarsys.capella.core.business.queries.core.business.queries.IBusinessQuery#getEClass()
*/
@Override
public EClass getEClass() {
return InteractionPackage.Literals.ABSTRACT_CAPABILITY_GENERALIZATION;
}

/**
* @see org.polarsys.capella.core.business.queries.core.business.queries.IBusinessQuery#getEStructuralFeatures()
*/
@Override
public List<EReference> getEStructuralFeatures() {
return Collections.singletonList(InteractionPackage.Literals.ABSTRACT_CAPABILITY_GENERALIZATION__SUPER);
}

@Override
public List<EObject> getAvailableElements(EObject element) {
AbstractCapabilityGeneralization acg = (AbstractCapabilityGeneralization) element;
AbstractCapability sub = acg.getSub();
if (sub != null) {
IBusinessQuery delegate = BusinessQueriesProvider.getInstance().getContribution(sub.eClass(), InteractionPackage.Literals.ABSTRACT_CAPABILITY__SUPER);
if (delegate != null) {
return delegate.getAvailableElements(sub);
}
}
return Collections.emptyList();
}

@Override
public List<EObject> getCurrentElements(EObject element, boolean onlyGenerated) {
return Collections.<EObject>singletonList(((AbstractCapabilityGeneralization) element).getSuper());
}

}
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2016 THALES GLOBAL SERVICES.
* Copyright (c) 2006, 2018 THALES GLOBAL SERVICES.
* 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
Expand Down Expand Up @@ -40,7 +40,7 @@ public EClass getEClass() {

@Override
public List<EReference> getEStructuralFeatures() {
return Collections.singletonList(InteractionPackage.Literals.ABSTRACT_CAPABILITY__SUPER_GENERALIZATIONS);
return Collections.singletonList(InteractionPackage.Literals.ABSTRACT_CAPABILITY__SUPER);
}

@Override
Expand Down
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2016 THALES GLOBAL SERVICES.
* Copyright (c) 2006, 2018 THALES GLOBAL SERVICES.
* 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
Expand All @@ -25,7 +25,7 @@

/**
*/
public class OperationalCapability_InheritedClasses implements IBusinessQuery {
public class OperationalCapability_InheritedCapabilities implements IBusinessQuery {

@Override
public EClass getEClass() {
Expand All @@ -34,21 +34,21 @@ public EClass getEClass() {

@Override
public List<EReference> getEStructuralFeatures() {
return Collections.singletonList(InteractionPackage.Literals.ABSTRACT_CAPABILITY__SUPER_GENERALIZATIONS);
return Collections.singletonList(InteractionPackage.Literals.ABSTRACT_CAPABILITY__SUPER);
}

@Override
public List<EObject> getAvailableElements(EObject element) {
QueryContext context = new QueryContext();
context.putValue(QueryConstants.ECLASS_PARAMETER, getEClass());
return QueryInterpretor.executeQuery(QueryConstants.GET_AVAILABLE__OPERATIONAL_CAPABILITY__INHERITED_CLASSES, element, context);
return QueryInterpretor.executeQuery(QueryConstants.GET_AVAILABLE__OPERATIONAL_CAPABILITY__INHERITED_CAPABILITIES, element, context);
}

@Override
public List<EObject> getCurrentElements(EObject element, boolean onlyGenerated) {
QueryContext context = new QueryContext();
context.putValue(QueryConstants.ECLASS_PARAMETER, getEClass());
return QueryInterpretor.executeQuery(QueryConstants.GET_CURRENT__OPERATIONAL_CAPABILITY__INHERITED_CLASSES, element, context);
return QueryInterpretor.executeQuery(QueryConstants.GET_CURRENT__OPERATIONAL_CAPABILITY__INHERITED_CAPABILITIES, element, context);
}

}
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2016 THALES GLOBAL SERVICES.
* Copyright (c) 2006, 2018 THALES GLOBAL SERVICES.
* 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
Expand Down Expand Up @@ -28,7 +28,7 @@
import org.polarsys.capella.core.model.helpers.query.CapellaQueries;
import org.polarsys.capella.core.model.utils.ListExt;

public class GetAvailable_OperationalCapability_InheritedClasses extends AbstractQuery {
public class GetAvailable_OperationalCapability_InheritedCapabilities extends AbstractQuery {

@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
Expand Down
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2016 THALES GLOBAL SERVICES.
* Copyright (c) 2006, 2018 THALES GLOBAL SERVICES.
* 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
Expand All @@ -22,7 +22,7 @@
import org.polarsys.capella.core.model.helpers.query.CapellaQueries;
import org.polarsys.capella.core.model.utils.ListExt;

public class GetCurrent_OperationalCapability_InheritedClasses extends AbstractQuery {
public class GetCurrent_OperationalCapability_InheritedCapabilities extends AbstractQuery {

@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
Expand Down
@@ -1,10 +1,10 @@
/*******************************************************************************
* Copyright (c) 2006, 2016 THALES GLOBAL SERVICES.
* Copyright (c) 2006, 2018 THALES GLOBAL SERVICES.
* 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:
* Thales - initial API and implementation
*******************************************************************************/
Expand All @@ -28,7 +28,7 @@ public class AbstractCapability_SuperController extends AbstractMultipleSemantic
@Override
protected IBusinessQuery getReadOpenValuesQuery(EObject semanticElement) {
return BusinessQueriesProvider.getInstance().getContribution(semanticElement.eClass(),
InteractionPackage.Literals.ABSTRACT_CAPABILITY__SUPER_GENERALIZATIONS);
InteractionPackage.Literals.ABSTRACT_CAPABILITY__SUPER);
}

/**
Expand Down
@@ -1,10 +1,10 @@
/*******************************************************************************
* Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
* Copyright (c) 2006, 2018 THALES GLOBAL SERVICES.
* 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:
* Thales - initial API and implementation
*******************************************************************************/
Expand All @@ -15,12 +15,13 @@
/**
* @generated
*/
public class OperationalCapability_InheritedClasses extends BQTestCase {
public class OperationalCapability_InheritedCapabilities extends BQTestCase {

/**
* @generated
*/
public String getProjectForTest() {
@Override
public String getProjectForTest() {
return "sysmodel"; //$NON-NLS-1$
}

Expand All @@ -29,7 +30,7 @@ public String getProjectForTest() {
*/
@Override
public String getBQFullQualifiedName() {
return "org.polarsys.capella.core.business.queries.oa.OperationalCapability_InheritedClasses"; //$NON-NLS-1$
return "org.polarsys.capella.core.business.queries.oa.OperationalCapability_InheritedCapabilities"; //$NON-NLS-1$
}

}
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
* Copyright (c) 2006, 2018 THALES GLOBAL SERVICES.
* 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
Expand All @@ -24,7 +24,7 @@
import org.polarsys.capella.test.business.queries.ju.testcases.sysmodel.oa.OperationalActor_AllocatedActivities;
import org.polarsys.capella.test.business.queries.ju.testcases.sysmodel.oa.OperationalActor_AllocatedRoles;
import org.polarsys.capella.test.business.queries.ju.testcases.sysmodel.oa.OperationalCapability_AvailableInStates;
import org.polarsys.capella.test.business.queries.ju.testcases.sysmodel.oa.OperationalCapability_InheritedClasses;
import org.polarsys.capella.test.business.queries.ju.testcases.sysmodel.oa.OperationalCapability_InheritedCapabilities;
import org.polarsys.capella.test.business.queries.ju.testcases.sysmodel.oa.OperationalCapability_InvolvedActivity;
import org.polarsys.capella.test.business.queries.ju.testcases.sysmodel.oa.OperationalCapability_InvolvedEntities;
import org.polarsys.capella.test.business.queries.ju.testcases.sysmodel.oa.OperationalCapability_InvolvedOperationalProcess;
Expand Down Expand Up @@ -56,7 +56,7 @@ protected List<BasicTestArtefact> getTests() {
tests.add(new OperationalActor_AllocatedActivities());
tests.add(new OperationalActor_AllocatedRoles());
tests.add(new OperationalCapability_AvailableInStates());
tests.add(new OperationalCapability_InheritedClasses());
tests.add(new OperationalCapability_InheritedCapabilities());
tests.add(new OperationalCapability_InvolvedActivity());
tests.add(new OperationalCapability_InvolvedEntities());
tests.add(new OperationalCapability_InvolvedOperationalProcess());
Expand Down

0 comments on commit 1d11baf

Please sign in to comment.