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.entity.method.phase</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<name>[bundle] Phase</name>
</project>
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>flintstones.entity.method.phase</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.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>1779484362566</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,11 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Phase
Bundle-SymbolicName: flintstones.entity.method.phase;singleton:=true
Bundle-Version: 1.0.0.qualifier
Automatic-Module-Name: flintstones.entity.method.phase
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: org.eclipse.nebula.widgets.opal.breadcrumb,
flintstones.helper.data,
flintstones.entity.extensionenum
Export-Package: flintstones.entity.method.phase
@@ -0,0 +1,5 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xml>
<?eclipse version="3.4"?>
<plugin>
<extension-point id="flintstones.phasemethod.extensionpoint" name="PhaseMethod extension point" schema="schema/flintstones.phasemethod.exsd"/>
</plugin>
@@ -0,0 +1,113 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="flintstones.phasemethod" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appinfo>
<meta.schema plugin="flintstones.phasemethod" id="flintstones.phasemethod" name="Phase method"/>
</appinfo>
<documentation>
Este punto de extensión nos permite definir los modelos de fase de un método.
==============================================================================================================================================
This extension point allows us to define the phase models of a method.
</documentation>
</annotation>
<element name="extension">
<annotation>
<appinfo>
<meta.element />
</appinfo>
</annotation>
<complexType>
<choice>
<element ref="phase" minOccurs="1" maxOccurs="unbounded"/>
</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="phase">
<complexType>
<attribute name="uid" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="implementation" type="string" use="required">
<annotation>
<documentation>
</documentation>
<appinfo>
<meta.attribute kind="java" basedOn="flintstones.entity.method.phase.PhaseMethod:"/>
</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>
@@ -0,0 +1,13 @@
package flintstones.entity.method.phase;
public class ImportedDataNotFoundException extends Error {
/**
*
*/
private static final long serialVersionUID = 1L;
public ImportedDataNotFoundException(String phase, String[] arr) {
super("Ninguna de las claves encontradas en la fase " + phase + "=> " + String.join(", ", arr));
}
}
@@ -0,0 +1,192 @@
package flintstones.entity.method.phase;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map.Entry;
import java.util.stream.Collectors;
import flintstones.entity.extensionenum.ExtensionEnum;
import flintstones.helper.data.text.ClassToString;
/**
* The Class PhaseMethod.
*/
public abstract class PhaseMethod {
/** The id. */
private String id;
/** The position. */
private int position;
private PhaseMethod previousPhase;
private HashMap<String, Object> methodData = new HashMap<>();
private HashMap<String, Object> exportedData = new HashMap<>();
private HashMap<String, Object> carryOverData = new HashMap<>();
/**
* The Enum Fields.
*/
public enum Fields implements ExtensionEnum {
/** The id. */
uid,
/** The name. */
name,
/** The implementation. */
implementation,
/** The description. */
description;
}
/** The Constant EXTENSION_POINT. */
public static final String EXTENSION_POINT = "flintstones.phasemethod.extensionpoint"; //$NON-NLS-1$
/**
* Gets the id.
*
* @return the id
*/
public String getId() {
return this.id;
}
/**
* Sets the id.
*
* @param id the new id
*/
public void setId(String id) {
this.id = id;
}
/**
* Gets the name.
*
* @return the name
*/
public abstract String getName();
public String getInfo() {
return "";
}
/**
* Gets the position.
*
* @return the position
*/
public int getPosition() {
return this.position;
}
/**
* Sets the position.
*
* @param position the new position
*/
public void setPosition(int position) {
this.position = position;
}
protected void exportData(String key, Object value, boolean carryOver ) {
exportedData.put(key, value);
if(carryOver)
carryOverData.put(key, value);
}
protected void exportData(String key, Object value) {
exportData(key, value, false);
}
protected void deleteData(String key) {
exportedData.remove(key);
}
public Object getExportedData(String key) {
return exportedData.get(key);
}
public String getExportedSummary() {
ArrayList<String> lines = new ArrayList<>();
for(Entry<String, Object> entry : exportedData.entrySet()) {
String key = entry.getKey();
String value = ClassToString.getClassAsString(entry.getValue());
String line = key + " => " + value;
lines.add(line);
}
return lines.stream().collect(Collectors.joining("\n"));
}
public String[] getExportedKeys( boolean onlyCarried ) {
if(onlyCarried)
return carryOverData.keySet().toArray(new String[0]);
return exportedData.keySet().toArray(new String[0]);
}
public Object importData(String... keys) {
if(previousPhase == null)
return null;
for(String key : keys) {
Object item = previousPhase.getExportedData(key);
if(item != null)
return item;
}
throw new ImportedDataNotFoundException(previousPhase.getName(), keys);
}
public Object importDataFromMethod(String ...keys) {
for(String key : keys) {
Object item = methodData.get(key);
if(item != null)
return item;
}
return null;
}
public void carryData() {
if(previousPhase == null)
return ;
String[] keys = previousPhase.getExportedKeys(true);
for(String key : keys) {
Object item = previousPhase.getExportedData(key);
exportData(key, item, true);
}
}
public void setPreviousPhase(PhaseMethod phase) {
this.previousPhase = phase;
this.carryData();
}
public void setMethodData(HashMap<String, Object> methodData) {
this.methodData = methodData;
}
public PhaseMethod getPreviousPhase() {
return previousPhase;
}
public boolean canBeExecuted() {
return true;
}
}
@@ -0,0 +1,19 @@
package flintstones.entity.method.phase;
/**
* The Class PhaseNotFoundException.
*/
public class PhaseNotFoundException extends RuntimeException {
/** The Constant serialVersionUID. */
private static final long serialVersionUID = 1L;
/**
* Instantiates a new phase not found exception.
*
* @param phaseNumber the phase number
*/
public PhaseNotFoundException(int phaseNumber) {
super("\n Fase no encontrada en la posición " + phaseNumber + " durante la llamada a import(...)");
}
}