Commit a34be802 authored by Chen Wenwen's avatar Chen Wenwen
Browse files

YELLOW

refs 1057
parent 02c81866
......@@ -44,6 +44,14 @@
<eTypeArguments eClassifier="#//requirementSource/RequirementSource"/>
</eGenericType>
</eOperations>
<eOperations name="getRequirementsContainersList">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return AnalysisStaticImpl.getRequirementsContainersList(this);"/>
</eAnnotations>
<eGenericType eClassifier="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EEList">
<eTypeArguments eClassifier="#//RequirementsContainer"/>
</eGenericType>
</eOperations>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Requirement" eSuperTypes="platform:/plugin/org.fortiss.tooling.kernel/model/kernel.ecore#//INamedCommentedElement platform:/plugin/org.fortiss.tooling.base/model/base.ecore#//element/IHierarchicElement #//IImageContainer">
<eOperations name="getAnalysis" eType="#//Analysis">
......@@ -80,6 +88,16 @@
<eTypeArguments eClassifier="#//functional/FormalSpecification"/>
</eGenericType>
</eOperations>
<eOperations name="getRequirementsContainer" eType="#//RequirementsContainer">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return RequirementStaticImpl.getRequirementsContainer(this);"/>
</eAnnotations>
</eOperations>
<eOperations name="getRequirementsPackage" eType="#//RequirementsPackage">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return RequirementStaticImpl.getRequirementsPackage(this);"/>
</eAnnotations>
</eOperations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="description" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="rationale" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="author" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
......@@ -153,6 +171,52 @@
</eOperations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="text" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="RequirementsPackage" eSuperTypes="platform:/plugin/org.fortiss.tooling.kernel/model/kernel.ecore#//INamedCommentedElement platform:/plugin/org.fortiss.tooling.base/model/base.ecore#//element/IHierarchicElement">
<eOperations name="getRequirementsList">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return RequirementsPackageStaticImpl.getRequirementsList(this);"/>
</eAnnotations>
<eGenericType eClassifier="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EEList">
<eTypeArguments eClassifier="#//Requirement"/>
</eGenericType>
</eOperations>
<eOperations name="getRequirementsContainer" eType="#//RequirementsContainer">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return RequirementsPackageStaticImpl.getRequirementsContainer(this);"/>
</eAnnotations>
</eOperations>
<eOperations name="getSubPackage">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return RequirementsPackageStaticImpl.getSubPackage(this);"/>
</eAnnotations>
<eGenericType eClassifier="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EEList">
<eTypeArguments eClassifier="#//RequirementsPackage"/>
</eGenericType>
</eOperations>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="RequirementsContainer" eSuperTypes="platform:/plugin/org.fortiss.tooling.kernel/model/kernel.ecore#//INamedCommentedElement platform:/plugin/org.fortiss.tooling.base/model/base.ecore#//element/IHierarchicElement">
<eOperations name="getRequirementsPackagesList">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return RequirementsContainerStaticImpl.getRequirementsPackagesList(this);"/>
</eAnnotations>
<eGenericType eClassifier="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EEList">
<eTypeArguments eClassifier="#//RequirementsPackage"/>
</eGenericType>
</eOperations>
<eOperations name="getAnalysis" eType="#//Analysis">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return RequirementsContainerStaticImpl.getAnalysis(this);"/>
</eAnnotations>
</eOperations>
<eOperations name="getRequirementsList">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return RequirementsContainerStaticImpl.getRequirementsList(this);"/>
</eAnnotations>
<eGenericType eClassifier="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EEList">
<eTypeArguments eClassifier="#//Requirement"/>
</eGenericType>
</eOperations>
</eClassifiers>
<eSubpackages name="usecase" nsURI="http://www.fortiss.org/af3/mira/usecase" nsPrefix="org-fortiss-af3-mira-usecase">
<eClassifiers xsi:type="ecore:EClass" name="UseCase" eSuperTypes="#//Requirement platform:/plugin/org.fortiss.tooling.base/model/base.ecore#//element/IHierarchicElementContainer">
<eOperations name="getScenariosList">
......
......@@ -33,6 +33,7 @@
<genOperations ecoreOperation="mira.ecore#//Analysis/getGlossariesList"/>
<genOperations ecoreOperation="mira.ecore#//Analysis/getUseCaseList"/>
<genOperations ecoreOperation="mira.ecore#//Analysis/getRequirementSourceList"/>
<genOperations ecoreOperation="mira.ecore#//Analysis/getRequirementsContainersList"/>
</genClasses>
<genClasses ecoreClass="mira.ecore#//Requirement">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute mira.ecore#//Requirement/description"/>
......@@ -48,6 +49,8 @@
<genOperations ecoreOperation="mira.ecore#//Requirement/getIncomingRelationsList"/>
<genOperations ecoreOperation="mira.ecore#//Requirement/getOutgoingRelationsList"/>
<genOperations ecoreOperation="mira.ecore#//Requirement/getFormalSpecifications"/>
<genOperations ecoreOperation="mira.ecore#//Requirement/getRequirementsContainer"/>
<genOperations ecoreOperation="mira.ecore#//Requirement/getRequirementsPackage"/>
</genClasses>
<genClasses ecoreClass="mira.ecore#//RequirementRelation">
<genOperations ecoreOperation="mira.ecore#//RequirementRelation/getSourceRequirement"/>
......@@ -73,6 +76,16 @@
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute mira.ecore#//WordElement/text"/>
<genOperations ecoreOperation="mira.ecore#//WordElement/toString"/>
</genClasses>
<genClasses ecoreClass="mira.ecore#//RequirementsPackage">
<genOperations ecoreOperation="mira.ecore#//RequirementsPackage/getRequirementsList"/>
<genOperations ecoreOperation="mira.ecore#//RequirementsPackage/getRequirementsContainer"/>
<genOperations ecoreOperation="mira.ecore#//RequirementsPackage/getSubPackage"/>
</genClasses>
<genClasses ecoreClass="mira.ecore#//RequirementsContainer">
<genOperations ecoreOperation="mira.ecore#//RequirementsContainer/getRequirementsPackagesList"/>
<genOperations ecoreOperation="mira.ecore#//RequirementsContainer/getAnalysis"/>
<genOperations ecoreOperation="mira.ecore#//RequirementsContainer/getRequirementsList"/>
</genClasses>
<nestedGenPackages prefix="Usecase" basePackage="org.fortiss.af3.mira.model" disposableProviderFactory="true"
ecorePackage="mira.ecore#//usecase">
<genEnums typeSafeEnumCompatible="false" ecoreEnum="mira.ecore#//usecase/ScenarioStepActionType">
......
......@@ -59,7 +59,19 @@
modelElementClass="org.fortiss.af3.mira.model.Analysis">
</modelElementClass>
</modelElementCompositor>
<modelElementCompositor
<modelElementCompositor
compositor="org.fortiss.af3.mira.compose.RequirementsContainerCompositor">
<modelElementClass
modelElementClass="org.fortiss.af3.mira.model.RequirementsContainer">
</modelElementClass>
</modelElementCompositor>
<modelElementCompositor
compositor="org.fortiss.af3.mira.compose.RequirementsPackageCompositor">
<modelElementClass
modelElementClass="org.fortiss.af3.mira.model.RequirementsPackage">
</modelElementClass>
</modelElementCompositor>
<modelElementCompositor
compositor="org.fortiss.af3.mira.compose.RequirementCompositor">
<modelElementClass
modelElementClass="org.fortiss.af3.mira.model.Requirement">
......
......@@ -19,12 +19,14 @@ package org.fortiss.af3.mira.model.impl;
import static org.eclipse.emf.common.util.ECollections.unmodifiableEList;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.convertList;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getChildrenWithType;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.pickInstanceOf;
import org.eclipse.emf.common.util.EList;
import org.fortiss.af3.mira.model.Analysis;
import org.fortiss.af3.mira.model.Requirement;
import org.fortiss.af3.mira.model.RequirementRelation;
import org.fortiss.af3.mira.model.RequirementsContainer;
import org.fortiss.af3.mira.model.glossary.Glossary;
import org.fortiss.af3.mira.model.requirementSource.RequirementSource;
import org.fortiss.af3.mira.model.usecase.UseCase;
......@@ -35,18 +37,18 @@ import org.fortiss.af3.mira.model.usecase.UseCase;
* @author mou
* @author $Author$
* @version $Rev$
* @ConQAT.Rating GREEN Hash: D2FD88C0BF9515306968EC5EDFB1A816
* @ConQAT.Rating YELLOW Hash: 08006C01CFE62E463BF6CBCA8F9B7AC8
*/
public class AnalysisStaticImpl {
/** Return {@link Requirement} list */
/** Return all contained {@link Requirement} list */
public static EList<Requirement> getRequirementsList(Analysis analysis) {
return pickInstanceOf(Requirement.class, analysis.getContainedElementsList());
return getChildrenWithType(analysis, Requirement.class);
}
/** Return {@link Glossary} list */
public static EList<Glossary> getGlossariesList(Analysis analysis) {
return pickInstanceOf(Glossary.class, analysis.getContainedElementsList());
/** Return all contained {@link UseCase} list */
public static EList<UseCase> getUseCaseList(Analysis analysis) {
return getChildrenWithType(analysis, UseCase.class);
}
/** Return {@link RequirementRelation} list */
......@@ -55,9 +57,9 @@ public class AnalysisStaticImpl {
analysis.getConnectionsList()));
}
/** Return {@link UseCase} list */
public static EList<UseCase> getUseCaseList(Analysis analysis) {
return pickInstanceOf(UseCase.class, analysis.getContainedElementsList());
/** Return {@link Glossary} list */
public static EList<Glossary> getGlossariesList(Analysis analysis) {
return pickInstanceOf(Glossary.class, analysis.getContainedElementsList());
}
/** Return {@link RequirementSource} list */
......@@ -65,4 +67,9 @@ public class AnalysisStaticImpl {
return pickInstanceOf(RequirementSource.class, analysis.getContainedElementsList());
}
/** Return {@link RequirementsContainer} */
public static EList<RequirementsContainer> getRequirementsContainersList(Analysis analysis) {
return pickInstanceOf(RequirementsContainer.class, analysis.getContainedElementsList());
}
}
......@@ -26,7 +26,7 @@ import org.fortiss.af3.mira.model.RequirementRelation;
* @author mou
* @author $Author$
* @version $Rev$
* @ConQAT.Rating GREEN Hash: EC25F0A963FCB25682AE785C177CF0D2
* @ConQAT.Rating YELLOW Hash: F72D376F38CC42CA771479E3F8DFC25F
*/
public class RequirementRelationStaticImpl {
......
......@@ -26,7 +26,7 @@ import org.fortiss.af3.mira.model.RequirementSpecification;
* @author rosenberger
* @author $Author$
* @version $Rev$
* @ConQAT.Rating GREEN Hash: 7B77BD804CEF2C9793E4D174338644F5
* @ConQAT.Rating YELLOW Hash: 639150961F0E6E4B3F414B8A70340DAA
*/
public class RequirementSpecificationStaticImpl {
......
......@@ -13,6 +13,8 @@ import org.fortiss.af3.mira.model.Analysis;
import org.fortiss.af3.mira.model.Requirement;
import org.fortiss.af3.mira.model.RequirementConnector;
import org.fortiss.af3.mira.model.RequirementRelation;
import org.fortiss.af3.mira.model.RequirementsContainer;
import org.fortiss.af3.mira.model.RequirementsPackage;
import org.fortiss.af3.mira.model.functional.FormalSpecification;
/**
......@@ -22,13 +24,13 @@ import org.fortiss.af3.mira.model.functional.FormalSpecification;
* @author mou
* @author $Author$
* @version $Rev$
* @ConQAT.Rating GREEN Hash: 29FD9EF1F517BF15D6FF316E6329EAE6
* @ConQAT.Rating YELLOW Hash: 00D4FA5205496B769D157321C19F7B15
*/
class RequirementStaticImpl {
/** Return the {@link Analysis} of the {@link Requirement} */
public static Analysis getAnalysis(Requirement requirement) {
return (Analysis)requirement.getContainer();
return requirement.getRequirementsContainer().getAnalysis();
}
/**
......@@ -54,4 +56,14 @@ class RequirementStaticImpl {
public static EList<FormalSpecification> getFormalSpecifications(Requirement requirement) {
return pickInstanceOf(FormalSpecification.class, requirement.getContainedElementsList());
}
/** Return {@link RequirementsContainer}, which contains the given {@link Requirement} */
public static RequirementsContainer getRequirementsContainer(Requirement requirement) {
return requirement.getRequirementsPackage().getRequirementsContainer();
}
/** Return {@link RequirementsPackage}, which immediately contains the given {@link Requirement} */
public static RequirementsPackage getRequirementsPackage(Requirement requirement) {
return (RequirementsPackage)requirement.getContainer();
}
}
/*--------------------------------------------------------------------------+
$Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $
| |
| Copyright 2013 ForTISS GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.mira.model.impl;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getChildrenWithType;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.pickInstanceOf;
import org.eclipse.emf.common.util.EList;
import org.fortiss.af3.mira.model.Analysis;
import org.fortiss.af3.mira.model.Requirement;
import org.fortiss.af3.mira.model.RequirementsContainer;
import org.fortiss.af3.mira.model.RequirementsPackage;
/**
* Static implementations for {@link RequirementsContainer}.
*
* @author wenwenchen
* @author $Author: hoelzl $
* @version $Rev: 18709 $
* @ConQAT.Rating YELLOW Hash: 045E91E4A79556F9018A8A1840B473F4
*/
public class RequirementsContainerStaticImpl {
/** Return immediately contained {@link RequirementsPackage} list */
public static EList<RequirementsPackage> getRequirementsPackagesList(
RequirementsContainer requirementsContainer) {
return pickInstanceOf(RequirementsPackage.class,
requirementsContainer.getContainedElementsList());
}
/** Return the {@link Analysis} of the {@link RequirementsContainer} */
public static Analysis getAnalysis(RequirementsContainer requirementsContainer) {
return (Analysis)requirementsContainer.getContainer();
}
/** Return all contained {@link Requirement} List */
public static EList<Requirement>
getRequirementsList(RequirementsContainer requirementsContainer) {
return getChildrenWithType(requirementsContainer, Requirement.class);
}
}
/*--------------------------------------------------------------------------+
$Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $
| |
| Copyright 2013 ForTISS GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.mira.model.impl;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.pickInstanceOf;
import org.eclipse.emf.common.util.EList;
import org.fortiss.af3.mira.model.Requirement;
import org.fortiss.af3.mira.model.RequirementsContainer;
import org.fortiss.af3.mira.model.RequirementsPackage;
import org.fortiss.tooling.base.model.element.IHierarchicElement;
/**
* Static implementations for {@link RequirementsContainer}.
*
* @author wenwenchen
* @author $Author: hoelzl $
* @version $Rev: 18709 $
* @ConQAT.Rating YELLOW Hash: 41600AE2F2B6D11D2F2875E120970304
*/
public class RequirementsPackageStaticImpl {
/** Return the {@link RequirementsContainer} of the given {@link RequirementsPackage} */
public static RequirementsContainer getRequirementsContainer(
RequirementsPackage requirementsPackage) {
IHierarchicElement currElement = (IHierarchicElement)requirementsPackage.getContainer();
while(!(currElement instanceof RequirementsContainer)) {
currElement = (IHierarchicElement)currElement.getContainer();
}
return (RequirementsContainer)currElement;
}
/** Return immediately contained {@link Requirement} list */
public static EList<Requirement> getRequirementsList(RequirementsPackage requirementsPackage) {
return pickInstanceOf(Requirement.class, requirementsPackage.getContainedElementsList());
}
/** Return immediately contained {@link RequirementsPackage} list */
public static EList<RequirementsPackage> getSubPackage(RequirementsPackage requirementsPackage) {
return pickInstanceOf(RequirementsPackage.class,
requirementsPackage.getContainedElementsList());
}
}
......@@ -25,7 +25,7 @@ import org.fortiss.af3.mira.model.WordElement;
* @author mou
* @author $Author: hoelzl $
* @version $Rev: 4247 $
* @ConQAT.Rating GREEN Hash: AF7532BA6BD3C53B5A25E0EA88F1196A
* @ConQAT.Rating YELLOW Hash: 5C55C2774B1DDEFEEAF25D0F8B820A3E
*/
public class WordElementStaticImpl {
......
<!--
$Id: package.html 2233 2011-12-13 10:36:13Z ratiu $
@version $Rev: 2233 $
@ConQAT.Rating GREEN Hash: 7485BD417B81001726848C9422898B65
@ConQAT.Rating YELLOW Hash: 52C80FC4307BF5B1E55EFEE9A16338DC
-->
<body>
This package contains the implementation for advanced access methods from the
......
......@@ -25,14 +25,18 @@ import static org.fortiss.af3.mira.utils.MiraModelElementFactory.createGlossaryE
import static org.fortiss.af3.mira.utils.MiraModelElementFactory.createRequirement;
import static org.fortiss.af3.mira.utils.MiraModelElementFactory.createRequirementDocument;
import static org.fortiss.af3.mira.utils.MiraModelElementFactory.createRequirementSource;
import static org.fortiss.af3.mira.utils.MiraModelElementFactory.createRequirementsContainer;
import static org.fortiss.af3.mira.utils.MiraModelElementFactory.createRequirementsPackage;
import static org.fortiss.af3.mira.utils.MiraModelElementFactory.createScenario;
import static org.fortiss.af3.mira.utils.MiraModelElementFactory.createStakeholder;
import static org.fortiss.af3.mira.utils.MiraModelElementFactory.createUseCase;
import org.fortiss.af3.mira.model.Requirement;
import org.fortiss.af3.mira.model.RequirementsContainer;
import org.fortiss.af3.mira.model.RequirementsPackage;
import org.fortiss.af3.mira.model.glossary.Glossary;
import org.fortiss.af3.mira.model.requirementSource.RequirementSource;
import org.fortiss.af3.mira.model.usecase.UseCase;
import org.fortiss.af3.mira.utils.MiraModelElementFactory;
import org.fortiss.tooling.kernel.extension.IPrototypeProvider;
import org.fortiss.tooling.kernel.extension.base.PrototypeProviderBase;
......@@ -41,7 +45,7 @@ import org.fortiss.tooling.kernel.extension.base.PrototypeProviderBase;
*
* @author mou
* @version $Rev: 18709 $
* @ConQAT.Rating GREEN Hash: 9CF013E040EAA39757DC3908DCF93D47
* @ConQAT.Rating YELLOW Hash: 67E6F2AB9CBB7514F815A17E409474C3
*/
public class PrototypeProvider extends PrototypeProviderBase {
......@@ -53,24 +57,28 @@ public class PrototypeProvider extends PrototypeProviderBase {
protected void registerPrototypes() {
registerPrimaryPrototype("Requirements Analysis", createAnalysis(), CATEGORY_NAME);
Requirement req = createRequirement();
registerPrimaryPrototype("Requirement", req, CATEGORY_NAME);
registerPrimaryPrototype("Formal Specification",
createFunctionalSpecification("Formal Specification"), CATEGORY_NAME);
UseCase uc = createUseCase();
registerPrimaryPrototype("Use Case", uc, CATEGORY_NAME);
registerPrimaryPrototype("Scenario", createScenario("", "", false), CATEGORY_NAME);
Glossary glossary = createGlossary("Glossary", "");
registerPrimaryPrototype("Glossary", glossary, CATEGORY_NAME);
registerPrimaryPrototype("Entry", createGlossaryEntry("", "", ""), CATEGORY_NAME);
RequirementSource requirementSource = createRequirementSource("Requirement Sources", "");
registerPrimaryPrototype("Requirement Sources", requirementSource, CATEGORY_NAME);
registerPrimaryPrototype("Stakeholder",
MiraModelElementFactory.createStakeholder("", "", ""), CATEGORY_NAME);
registerPrimaryPrototype("Stakeholder", createStakeholder("", "", ""), CATEGORY_NAME);
registerPrimaryPrototype("Document", createRequirementDocument("", "", ""), CATEGORY_NAME);
registerPrimaryPrototype("External System", createExternalSystem("", "", ""), CATEGORY_NAME);
RequirementsContainer reContainer = createRequirementsContainer("Requirements", "");
registerPrimaryPrototype("Requirements", reContainer, CATEGORY_NAME);
RequirementsPackage rePackage = createRequirementsPackage("Requirements Package", "");
registerPrimaryPrototype("Requirements Package", rePackage, CATEGORY_NAME);
Requirement req = createRequirement();
registerPrimaryPrototype("Requirement", req, CATEGORY_NAME);
registerPrimaryPrototype("Formal Specification",
createFunctionalSpecification("Formal Specification"), CATEGORY_NAME);
UseCase uc = createUseCase();
registerPrimaryPrototype("Use Case", uc, CATEGORY_NAME);
registerPrimaryPrototype("Scenario", createScenario("", "", false), CATEGORY_NAME);
}
}
......@@ -27,6 +27,7 @@ import static org.fortiss.af3.mira.utils.MiraUtils.getProjectName;
import static org.fortiss.af3.mira.utils.MiraUtils.getRequirementComparator;
import static org.fortiss.af3.mira.utils.MiraUtils.getRequirementShortInfo;
import static org.fortiss.af3.mira.utils.MiraUtils.getRequirementSourceComparator;
import static org.fortiss.af3.mira.utils.MiraUtils.getRequirementsPackageFor;
import static org.fortiss.af3.mode.utils.ModeAutomatonUtils.getModeAutomaton;
import static org.fortiss.af3.state.utils.StateAutomatonUtils.getStateAutomaton;
import static org.fortiss.af3.state.utils.StateAutomatonUtils.hasStateAutomaton;
......@@ -43,6 +44,8 @@ import org.fortiss.af3.mira.model.Analysis;
import org.fortiss.af3.mira.model.ImageItem;
import org.fortiss.af3.mira.model.Requirement;
import org.fortiss.af3.mira.model.RequirementRelation;
import org.fortiss.af3.mira.model.RequirementsContainer;
import org.fortiss.af3.mira.model.RequirementsPackage;
import org.fortiss.af3.mira.model.WordElement;
import org.fortiss.af3.mira.model.functional.FormalSpecification;
import org.fortiss.af3.mira.model.glossary.Glossary;
......@@ -86,7 +89,7 @@ import org.fortiss.tooling.kernel.utils.EcoreUtils;
* @author mou
* @author $Author$
* @version $Rev$
* @ConQAT.Rating GREEN Hash: B5101C327AD7AD521E1FE060BC858001
* @ConQAT.Rating YELLOW Hash: 1EFDCF599C71FD5847787A9280D4A16D
*/
public class ContextFactory {
......@@ -96,6 +99,10 @@ public class ContextFactory {
if(obj instanceof Analysis) {
context = getContextFor((Analysis)obj);
} else if(obj instanceof RequirementsContainer) {
context = getContextFor((RequirementsContainer)obj);
} else if(obj instanceof RequirementsPackage) {
context = getContextFor((RequirementsPackage)obj);
} else if(obj instanceof Requirement) {
context = getContextFor((Requirement)obj);
} else if(obj instanceof Scenario) {
......@@ -148,14 +155,42 @@ public class ContextFactory {
ctx.addContext("reqSource", getContextFor(reqSource));
}
ctx.defineContextList("requirements");
ctx.defineContextList("requirementsContainer");
ArrayList<RequirementsContainer> requirementsList =
new ArrayList<RequirementsContainer>(a.getRequirementsContainersList());
Collections.sort(requirementsList, getAnalysisComparator());
for(RequirementsContainer container : requirementsList) {
ctx.addContext("requirementsContainer", getContextFor(container));
}
ArrayList<Requirement> reqList = new ArrayList<Requirement>(a.getRequirementsList());
Collections.sort(reqList, getRequirementComparator());
for(Requirement r : reqList) {
return ctx;
}
/** Return the {@link EvaluationContext} for the {@link RequirementsContainer} */
private static EvaluationContext getContextFor(RequirementsContainer container) {
EvaluationContext ctx = new EvaluationContext();
ctx.set("requirementsContainerName", container.getName());
ctx.set("requirementsContainerComment", container.getComment());
ctx.defineContextList("requirements");
ArrayList<Requirement> list = new ArrayList<Requirement>(container.getRequirementsList());
Collections.sort(list, getRequirementComparator());
for(Requirement r : list) {
ctx.addContext("requirements", getContextFor(r));
}
return ctx;
}
/** Return the {@link EvaluationContext} for the {@link RequirementsPackage} */
private static EvaluationContext getContextFor(RequirementsPackage pacakge) {
EvaluationContext ctx = new EvaluationContext();
ctx.set("requirementsPackageName", pacakge.getName());
ctx.set("requirementsPackageComment", pacakge.getComment());
ctx.defineContextList("requirements");
ArrayList<Requirement> list = new ArrayList<Requirement>(pacakge.getRequirementsList());
Collections.sort(list, getRequirementComparator());
for(Requirement r : list) {
ctx.addContext("requirements", getContextFor(r));
}
return ctx;
}
......@@ -164,7 +199,7 @@ public class ContextFactory {
EvaluationContext ctx = new EvaluationContext();
handleGeneralInformation(ctx, r);
ctx.set("package", getRequirementsPackageFor(r));
// evaluate images
ctx.defineContextList("images");
for(ImageItem imageItem : r.getImages()) {
......@@ -555,6 +590,7 @@ public class ContextFactory {
public static EvaluationContext getContextFor(Glossary glossary) {
EvaluationContext ctx = new EvaluationContext();
ctx.set("glossaryName", glossary.getName());
ctx.set("glossaryComment", glossary.getComment());