public code v1
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>flintstones.group</groupId>
|
||||
<artifactId>flintstones.bundles</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>flintstones.entity.sensitiveanalysisproblem</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
<name>[bundle] Sensitive analysis problem</name>
|
||||
<organization>
|
||||
<name>Sinbad2</name>
|
||||
</organization>
|
||||
</project>
|
||||
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>flintstones.entity.sensitiveanalysisproblem</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ds.core.builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
<filteredResources>
|
||||
<filter>
|
||||
<id>1779484362583</id>
|
||||
<name></name>
|
||||
<type>30</type>
|
||||
<matcher>
|
||||
<id>org.eclipse.core.resources.regexFilterMatcher</id>
|
||||
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
|
||||
</matcher>
|
||||
</filter>
|
||||
</filteredResources>
|
||||
</projectDescription>
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding/<project>=UTF-8
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
resolveWorkspaceProjects=true
|
||||
version=1
|
||||
@@ -0,0 +1,18 @@
|
||||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Sensitive analysis problem
|
||||
Bundle-SymbolicName: flintstones.entity.sensitiveanalysisproblem;singleton:=true
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Bundle-Vendor: Sinbad2
|
||||
Automatic-Module-Name: flintstones.entity.sensitiveanalysisproblem
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Require-Bundle: flintstones.entity.sensitiveanalysismodel,
|
||||
flintstones.model.sensitiveanalysismodel.service,
|
||||
flintstones.helper.extensionpoint,
|
||||
javax.inject,
|
||||
org.eclipse.e4.core.contexts,
|
||||
org.eclipse.e4.ui.model.workbench,
|
||||
javax.annotation
|
||||
Service-Component: component.xml
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Export-Package: flintstones.entity.sensitiveanalysisproblem.service
|
||||
@@ -0,0 +1,6 @@
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
component.xml,\
|
||||
plugin.xml
|
||||
source.. = src/
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="sensitive analysis problem context function">
|
||||
<implementation class="flintstones.entity.sensitiveanalysisproblem.provider.SensitiveAnalysisProblemServiceContextFunction"/>
|
||||
<property name="service.context.key" type="String" value="flintstones.entity.sensitiveanalysisproblem.service.ISensitiveAnalysisProblemService"/>
|
||||
<service>
|
||||
<provide interface="org.eclipse.e4.core.contexts.IContextFunction"/>
|
||||
</service>
|
||||
</scr:component>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?eclipse version="3.4"?>
|
||||
<plugin>
|
||||
<extension-point id="flintstones.entity.sensitiveanalysisproblem.extension" name="Senstive analysis problem extension point" schema="schema/flintstones.entity.sensitiveanalysisproblem.extension.exsd"/>
|
||||
</plugin>
|
||||
+127
@@ -0,0 +1,127 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- Schema file written by PDE -->
|
||||
<schema targetNamespace="flintstones.entity.sensitiveanalysisproblem" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.schema plugin="flintstones.entity.sensitiveanalysisproblem" id="flintstones.entity.sensitiveanalysisproblem.extension" name="Senstive analysis problem extension point"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter description of this extension point.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<element name="extension">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.element />
|
||||
</appinfo>
|
||||
</annotation>
|
||||
<complexType>
|
||||
<choice minOccurs="1" maxOccurs="unbounded">
|
||||
<element ref="problem"/>
|
||||
</choice>
|
||||
<attribute name="point" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="xid" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="name" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute translatable="true"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<element name="problem">
|
||||
<complexType>
|
||||
<choice>
|
||||
<element ref="model" minOccurs="1" maxOccurs="unbounded"/>
|
||||
</choice>
|
||||
<attribute name="uid" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="valuation" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute kind="identifier" basedOn="flintstones.valuation/valuation/@uid"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<element name="model">
|
||||
<complexType>
|
||||
<attribute name="uid" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute kind="identifier" basedOn="flintstones.entity.sensitiveanalysismodel.extension/model/@uid"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="since"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter the first release in which this extension point appears.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="examples"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter extension point usage example here.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="apiinfo"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter API information here.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="implementation"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter information about supplied implementation of this extension point.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
|
||||
</schema>
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
package flintstones.entity.sensitiveanalysisproblem;
|
||||
|
||||
import flintstones.entity.extensionenum.ExtensionEnum;
|
||||
import flintstones.entity.sensitiveanalysismodel.SensitiveAnalysisModel;
|
||||
|
||||
public class SensitiveAnalysisProblem {
|
||||
|
||||
protected String id;
|
||||
protected String valuationId;
|
||||
protected SensitiveAnalysisModel[] models;
|
||||
|
||||
/**
|
||||
* The Class Fields.
|
||||
*/
|
||||
public enum Fields implements ExtensionEnum {
|
||||
|
||||
/** The id. */
|
||||
uid,
|
||||
/** The valuation. */
|
||||
valuation,
|
||||
/** The model. */
|
||||
model,
|
||||
/** The implementation. */
|
||||
implementation
|
||||
}
|
||||
|
||||
public SensitiveAnalysisProblem() {
|
||||
}
|
||||
|
||||
public SensitiveAnalysisProblem(String id) {
|
||||
this.setId(id);
|
||||
}
|
||||
|
||||
public SensitiveAnalysisProblem(String id, String valuationId) {
|
||||
this.setId(id);
|
||||
this.setValuationId(valuationId);
|
||||
}
|
||||
|
||||
public SensitiveAnalysisProblem(String id, String valuationId, SensitiveAnalysisModel[] models) {
|
||||
this.setId(id);
|
||||
this.setValuationId(valuationId);
|
||||
this.setModels(models);
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getValuationId() {
|
||||
return valuationId;
|
||||
}
|
||||
|
||||
public void setValuationId(String valuationId) {
|
||||
this.valuationId = valuationId;
|
||||
}
|
||||
|
||||
public SensitiveAnalysisModel[] getModels() {
|
||||
return models;
|
||||
}
|
||||
|
||||
public void setModels(SensitiveAnalysisModel[] models) {
|
||||
this.models = models;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.id;
|
||||
}
|
||||
}
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
package flintstones.entity.sensitiveanalysisproblem.provider;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.eclipse.e4.core.contexts.IEclipseContext;
|
||||
|
||||
import flintstones.entity.sensitiveanalysismodel.SensitiveAnalysisModel;
|
||||
import flintstones.entity.sensitiveanalysisproblem.SensitiveAnalysisProblem;
|
||||
import flintstones.entity.sensitiveanalysisproblem.service.ISensitiveAnalysisProblemService;
|
||||
import flintstones.helper.data.Pair;
|
||||
import flintstones.helper.extensionpoint.BaseRegistry;
|
||||
import flintstones.helper.extensionpoint.ExtensionRegistry;
|
||||
import flintstones.model.sensitiveanalysismodel.service.ISensitiveAnalysisModelService;
|
||||
|
||||
public class SensitiveAnalysisProblemProvider implements ISensitiveAnalysisProblemService {
|
||||
|
||||
/** The Constant EXTENSION_POINT. */
|
||||
public final static String EXTENSION_POINT = "flintstones.entity.sensitiveanalysisproblem.extension"; //$NON-NLS-1$
|
||||
|
||||
@Inject
|
||||
IEclipseContext context;
|
||||
|
||||
@Inject
|
||||
ISensitiveAnalysisModelService saModelService;
|
||||
|
||||
private BaseRegistry reg;
|
||||
|
||||
private HashMap<Pair<String, String>, SensitiveAnalysisProblem> problems = new HashMap<>();
|
||||
|
||||
public SensitiveAnalysisProblemProvider() {}
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
this.reg = new BaseRegistry(EXTENSION_POINT);
|
||||
this.cacheAllProblems();
|
||||
}
|
||||
|
||||
public void cacheAllProblems() {
|
||||
|
||||
problems.clear();
|
||||
|
||||
ExtensionRegistry[] regProblems = reg.getAllRegistries();
|
||||
|
||||
for (ExtensionRegistry regProblem : regProblems) {
|
||||
SensitiveAnalysisProblem saProblem = new SensitiveAnalysisProblem();
|
||||
saProblem.setId(regProblem.getAttribute(SensitiveAnalysisProblem.Fields.uid));
|
||||
saProblem.setValuationId(regProblem.getAttribute(SensitiveAnalysisProblem.Fields.valuation));
|
||||
saProblem.setModels(loadModels(regProblem));
|
||||
problems.put(new Pair<String, String>(saProblem.getId(), saProblem.getValuationId()), saProblem);
|
||||
}
|
||||
}
|
||||
|
||||
private SensitiveAnalysisModel[] loadModels(ExtensionRegistry regProblem) {
|
||||
SensitiveAnalysisModel[] models = new SensitiveAnalysisModel[regProblem.getAttributeReferences(SensitiveAnalysisProblem.Fields.model).length];
|
||||
|
||||
int cont = 0;
|
||||
for (ExtensionRegistry regModel : regProblem.getAttributeReferences(SensitiveAnalysisProblem.Fields.model)) {
|
||||
String saModelId = regModel.getAttribute(SensitiveAnalysisProblem.Fields.uid);
|
||||
models[cont] = saModelService.getSensitiveAnalysisModel(saModelId);
|
||||
cont++;
|
||||
}
|
||||
return models;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SensitiveAnalysisProblem getSensitiveAnalysisProblem(String problemId, String valuationId) {
|
||||
return problems.get(new Pair<String, String>(problemId, valuationId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getSensitiveAnalysisProblemsIdsFor(String valuationId) {
|
||||
List<String> ids = new LinkedList<String>();
|
||||
for(Pair<String, String> pair: problems.keySet()) {
|
||||
if(pair.getRight().equals(valuationId))
|
||||
ids.add(pair.getLeft());
|
||||
}
|
||||
return ids.toArray(new String[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getSensitiveAnalysisModelsNamesFor(String problemId, String valuationId) {
|
||||
SensitiveAnalysisProblem saProblem = problems.get(new Pair<String, String>(problemId, valuationId));
|
||||
return getSensitiveAnalysisModelsNames(saProblem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getSensitiveAnalysisModelsNames(SensitiveAnalysisProblem sap) {
|
||||
String[] ids = new String[sap.getModels().length];
|
||||
int cont = 0;
|
||||
for(SensitiveAnalysisModel saModel: sap.getModels()) {
|
||||
ids[cont] = saModel.getName();
|
||||
cont++;
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SensitiveAnalysisModel getSensitiveAnalysisModel(SensitiveAnalysisProblem sap, String modelName) {
|
||||
for(SensitiveAnalysisModel saModel: sap.getModels()) {
|
||||
if(saModel.getName().equals(modelName))
|
||||
return saModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SensitiveAnalysisModel getSensitiveAnalysisModel(String problemId, String modelName, String valuationId) {
|
||||
SensitiveAnalysisProblem saProblem = getSensitiveAnalysisProblem(problemId, valuationId);
|
||||
return getSensitiveAnalysisModel(saProblem, modelName);
|
||||
}
|
||||
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package flintstones.entity.sensitiveanalysisproblem.provider;
|
||||
|
||||
import org.eclipse.e4.core.contexts.ContextFunction;
|
||||
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
|
||||
import org.eclipse.e4.core.contexts.IEclipseContext;
|
||||
import org.eclipse.e4.ui.model.application.MApplication;
|
||||
|
||||
import flintstones.entity.sensitiveanalysisproblem.service.ISensitiveAnalysisProblemService;
|
||||
|
||||
/**
|
||||
* The Class MostCriticalCriterionServiceContextFunction add the MostCriticalCriterion Service instance to global context.
|
||||
*/
|
||||
public class SensitiveAnalysisProblemServiceContextFunction extends ContextFunction {
|
||||
|
||||
/* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.e4.core.contexts.ContextFunction#compute(org.eclipse.e4.core.
|
||||
* contexts.IEclipseContext, java.lang.String) */
|
||||
@Override
|
||||
public Object compute(IEclipseContext context, String contextKey) {
|
||||
ISensitiveAnalysisProblemService service = ContextInjectionFactory.make(SensitiveAnalysisProblemProvider.class, context);
|
||||
MApplication application = context.get(MApplication.class);
|
||||
IEclipseContext applicationContext = application.getContext();
|
||||
applicationContext.set(ISensitiveAnalysisProblemService.class, service);
|
||||
return service;
|
||||
}
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
package flintstones.entity.sensitiveanalysisproblem.service;
|
||||
|
||||
import flintstones.entity.sensitiveanalysismodel.SensitiveAnalysisModel;
|
||||
import flintstones.entity.sensitiveanalysisproblem.SensitiveAnalysisProblem;
|
||||
|
||||
public interface ISensitiveAnalysisProblemService {
|
||||
|
||||
/**
|
||||
* Gets a sensitive analysis problem by its id and the supported valuation id.
|
||||
*
|
||||
* @param problemId the problem id
|
||||
* @param valuationId the valuation id
|
||||
* @return Instanced SensitiveAnalysisProblem
|
||||
*/
|
||||
SensitiveAnalysisProblem getSensitiveAnalysisProblem(String problemId, String valuationId);
|
||||
|
||||
/**
|
||||
* Get all the sensitive analysis models names for a specific sensitive analysis problem and valuation
|
||||
* @param problemId the sensitive analysis problem id
|
||||
* @param valuationId the valuation id
|
||||
* @return Array with all the names
|
||||
*/
|
||||
String[] getSensitiveAnalysisModelsNamesFor(String problemId, String valuationId);
|
||||
|
||||
/**
|
||||
* Get all the sensitive analysis models ids for a specific sensitive analysis problem
|
||||
* @param sap the SensitiveAnalysisProblem
|
||||
* @return Array with all the ids
|
||||
*/
|
||||
String[] getSensitiveAnalysisModelsNames(SensitiveAnalysisProblem sap);
|
||||
|
||||
/**
|
||||
* Get all the sensitive analysis problems for a specific valuation
|
||||
* @param valuationId the valuation id
|
||||
* @return Array with all the ids
|
||||
*/
|
||||
String[] getSensitiveAnalysisProblemsIdsFor(String valuationId);
|
||||
|
||||
/**
|
||||
* Get a sensitive analysis model for a specific sensitive analysis problem
|
||||
* @param sap the SensitiveAnalysisProblem
|
||||
* @param model the SensitiveAnalysisModel id
|
||||
* @return SensitiveAnalysisModel
|
||||
*/
|
||||
SensitiveAnalysisModel getSensitiveAnalysisModel(SensitiveAnalysisProblem sap, String modelId);
|
||||
|
||||
/**
|
||||
* Get a sensitive analysis model for a specific sensitive analysis problem
|
||||
* @param problemId the SensitiveAnalysisProblem id
|
||||
* @param modelId the SensitiveAnalysisModel id
|
||||
* @param valuationId the supported valuation id
|
||||
* @return SensitiveAnalysisModel
|
||||
*/
|
||||
SensitiveAnalysisModel getSensitiveAnalysisModel(String problemId, String modelId, String valuationId);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user