public code v1

This commit is contained in:
Francisco Jesús Martínez Mimbrera
2026-05-23 00:32:57 +02:00
commit 759a8968a2
4357 changed files with 163763 additions and 0 deletions
@@ -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,14 @@
<?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.model.ahpsort.profileassignment.provider</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<name>[bundle] Provider</name>
</project>
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>flintstones.model.ahpsort.profileassignment.provider</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>1779484362718</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>
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
@@ -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
@@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
@@ -0,0 +1,20 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Provider
Bundle-SymbolicName: flintstones.model.ahpsort.profileassignment.provider
Bundle-Version: 1.0.0.qualifier
Automatic-Module-Name: flintstones.model.profileassignment.provider
Bundle-RequiredExecutionEnvironment: JavaSE-11
Require-Bundle: flintstones.model.ahpsort.profileassignment.service,
flintstones.entity.problemelement,
flintstones.entity.ahpsort.profileassignment,
javax.inject,
flintstones.model.problemelement.service,
org.eclipse.e4.core.contexts,
flintstones.model.ahppreferences.service,
org.eclipse.e4.core.di,
org.eclipse.e4.ui.model.workbench,
flintstones.application.constants,
org.eclipse.e4.ui.workbench
Service-Component: component.xml
Bundle-ActivationPolicy: lazy
@@ -0,0 +1,5 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
component.xml
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xml>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="flintstones.model.ahpsort.profileassignment.provider">
<implementation class="flintstones.model.ahpsort.profileassignment.provider.ProfileAssignmentServiceContextFunction" />
<property name="service.context.key" type="String" value="flintstones.model.ahpsort.profileassignment.service.IProfileAssignmentService" />
<service>
<provide interface="org.eclipse.e4.core.contexts.IContextFunction" />
</service>
</scr:component>
@@ -0,0 +1,21 @@
package flintstones.model.ahpsort.profileassignment.provider;
import flintstones.model.ahpsort.profileassignment.service.IProfileAssignmentService;
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;
public class ProfileAssignmentServiceContextFunction extends ContextFunction {
@Override
public Object compute(IEclipseContext context, String contextKey) {
IProfileAssignmentService domainService = ContextInjectionFactory.make(ProfileAssignmentServiceProvider.class, context);
MApplication application = context.get(MApplication.class);
IEclipseContext applicationContext = application.getContext();
applicationContext.set(IProfileAssignmentService.class, domainService);
return domainService;
}
}
@@ -0,0 +1,139 @@
package flintstones.model.ahpsort.profileassignment.provider;
import java.util.HashMap;
import java.util.Map.Entry;
import javax.inject.Inject;
import flintstones.entity.problemelement.entities.SortingProfile;
import flintstones.entity.problemelement.entities.SortingProfile.SortingProfileType;
import flintstones.entity.ahpsort.profileassignment.ProfileAssignment;
import flintstones.entity.problemelement.entities.Criterion;
import flintstones.entity.problemelement.entities.Expert;
import flintstones.model.ahpsort.profileassignment.service.IProfileAssignmentService;
import flintstones.model.problemelement.service.IProblemElementService;
public class ProfileAssignmentServiceProvider implements IProfileAssignmentService {
HashMap<Expert,HashMap<Criterion, ProfileAssignment>> assignments = new HashMap<>();
@Inject
IProblemElementService problemService;
SortingProfileType type = SortingProfile.SortingProfileType.Central;
@Override
public ProfileAssignment get(Expert e, Criterion c) {
HashMap<Criterion, ProfileAssignment> map = assignments.get(e);
if(map == null)
return null;
return map.get(c);
}
@Override
public ProfileAssignment create(Expert e, Criterion c) {
return new ProfileAssignment(e, c);
}
@Override
public ProfileAssignment getOrDefault(Expert e, Criterion c) {
ProfileAssignment pa = get(e,c);
if(pa == null)
return create(e,c);
return pa;
}
@Override
public void addOrUpdate(ProfileAssignment pa) {
delete(pa.getExpert(), pa.getCriterion());
HashMap<Criterion, ProfileAssignment> map = assignments.get(pa.getExpert());
if(map == null)
map = new HashMap<>();
map.put(pa.getCriterion(), pa);
assignments.put(pa.getExpert(), map);
for( SortingProfile profile : pa.getAllProfiles() ) {
profile.setOrder(-1);
if(problemService.getById(SortingProfile.Type, profile.getId()) == null)
problemService.add(profile);
}
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("\n");
for(Entry<Expert, HashMap<Criterion, ProfileAssignment>> entry : assignments.entrySet()) {
Expert e = entry.getKey();
for( Entry<Criterion, ProfileAssignment> entry2 : entry.getValue().entrySet()) {
Criterion c = entry2.getKey();
for( SortingProfile profile : entry2.getValue().getAllProfiles() ) {
sb.append( e.getName() );
sb.append(", ");
sb.append( c.getName() );
sb.append(" -> ");
sb.append(profile.getName());
sb.append("\n");
}
}
}
sb.append("\n\nTYPE: " + type.toString());
return sb.toString();
}
@Override
public HashMap<Expert,HashMap<Criterion, ProfileAssignment>> getAll() {
return assignments;
}
@Override
public boolean delete(Expert e, Criterion c) {
HashMap<Criterion, ProfileAssignment> map = assignments.get(e);
if(map == null)
return false;
ProfileAssignment pa = map.get(c);
if(pa == null)
return false;
for( SortingProfile profile : pa.getAllProfiles() ) {
problemService.delete(profile);
}
return map.remove(c) != null;
}
@Override
public HashMap<Criterion,ProfileAssignment> get(Expert e) {
HashMap<Criterion, ProfileAssignment> map = assignments.get(e);
return map;
}
@Override
public void clear() {
assignments.clear();
}
@Override
public void setType(SortingProfileType typex) {
this.type = typex;
}
@Override
public SortingProfileType getType() {
return type;
}
}