Eugene-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- 1738 discussions
r1249 - trunk/eugene/src/main/java/org/nuiton/eugene/models/object/reader/yaml
by agiraudet@users.nuiton.org 22 May '13
by agiraudet@users.nuiton.org 22 May '13
22 May '13
Author: agiraudet
Date: 2013-05-22 15:51:42 +0200 (Wed, 22 May 2013)
New Revision: 1249
Url: http://nuiton.org/projects/eugene/repository/revisions/1249
Log:
ajout d'une nouvelle fonctionnalit?\195?\169 ?\195?\160 YamlToObjectModel.java : g?\195?\168re les valeurs par d?\195?\169faut saisis dans un fichier externe
Modified:
trunk/eugene/src/main/java/org/nuiton/eugene/models/object/reader/yaml/YamlToObjectModel.java
Modified: trunk/eugene/src/main/java/org/nuiton/eugene/models/object/reader/yaml/YamlToObjectModel.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/models/object/reader/yaml/YamlToObjectModel.java 2013-05-16 16:01:22 UTC (rev 1248)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/models/object/reader/yaml/YamlToObjectModel.java 2013-05-22 13:51:42 UTC (rev 1249)
@@ -15,54 +15,59 @@
* Time: 11:15
*/
-//TODO: gestion des labels
-
public class YamlToObjectModel {
protected Yaml yaml;
protected String packageOM;
protected Map<String, String> imports;
+ protected Map<String, String> defaultValues;
+ protected boolean defaultVoid;
//mots clefs
- public static final String IMPORTS = "imports";
- public static final String PACKAGE = "package";
- public static final String VERSION = "version";
- public static final String NAME = "name";
+ public static final String FILE_DEFAULT_VALUES = "yamlobjectmodel.default";
+ public static final String DEFAULT = "default";
+ public static final String SEPARATOR = ".";
+
+ public static final String ABSTRACT = "abstract";
+ public static final String ASSOCIATION_CLASS_NAME = "associationclassname";
+ public static final String ASSOCIATION_TYPE = "associationtype";
+ public static final String ATTRIBUTE = "attribute";
+ public static final String BODY_CODE = "bodeycode";
public static final String CLASS = "class";
- public static final String INTERFACE = "interface";
public static final String CLASS_ASSOCIATION = "classassociation";
+ public static final String COMMENTS = "comments";
+ public static final String DEFAULT_VALUE = "defaultvalue";
+ public static final String DOCUMENTATION = "documentation";
public static final String ENUMERATION = "enumeration";
- public static final String STATIC = "static";
- public static final String DOCUMENTATION = "documentation";
- public static final String TAG_VALUES = "tagvalues";
- public static final String COMMENTS = "comments";
- public static final String STEREOTYPES = "stereotypes";
public static final String EXTERN = "extern";
+ public static final String FINAL = "final";
+ public static final String IMPORTS = "imports";
public static final String INNER = "inner";
- public static final String TYPE = "type";
- public static final String ATTRIBUTE = "attribute";
+ public static final String INTERFACE = "interface";
+ public static final String LITERAL = "literal";
+ public static final String MAX_MULTIPLICITY = "maxmultiplicity";
+ public static final String MIN_MULTIPLICITY = "minmultiplicity";
+ public static final String NAME = "name";
+ public static final String NAVIGABLE = "navigable";
public static final String OPERATION = "operation";
- public static final String SUPER_INTERFACES = "superinterfaces";
- public static final String SUPER_CLASSES = "superclasses";
+ public static final String ORDERED = "ordered";
public static final String ORDERING = "ordering";
- public static final String DEFAULT_VALUE = "defaultvalue";
- public static final String MIN_MULTIPLICITY = "minmultiplicity";
- public static final String MAX_MULTIPLICITY = "maxmultiplicity";
- public static final String ORDERED = "ordered";
- public static final String UNIQUE = "unique";
- public static final String NAVIGABLE = "navigable";
- public static final String ASSOCIATION_TYPE = "associationtype";
- public static final String FINAL = "final";
- public static final String ASSOCIATION_CLASS_NAME = "associationclassname";
+ public static final String PACKAGE = "package";
+ public static final String PARAMETER = "parameter";
+ public static final String PARTICIPANT = "participant";
+ public static final String RETURN_PARAMETER = "returnparameter";
public static final String REVERSE_ATTRIBUTE_NAME = "reverseattributename";
public static final String REVERSE_MAX_MULTIPLICITY = "reversemaxmultiplicity";
+ public static final String STATIC = "static";
+ public static final String STEREOTYPES = "stereotypes";
+ public static final String SUPER_CLASSES = "superclasses";
+ public static final String SUPER_INTERFACES = "superinterfaces";
+ public static final String TAG_VALUES = "tagvalues";
public static final String TRANSIENT = "transient";
+ public static final String TYPE = "type";
+ public static final String UNIQUE = "unique";
+ public static final String VERSION = "version";
public static final String VISIBILITY = "visibility";
- public static final String ABSTRACT = "abstract";
- public static final String PARAMETER = "parameter";
- public static final String RETURN_PARAMETER = "returnparameter";
- public static final String BODY_CODE = "bodeycode";
- public static final String PARTICIPANT = "participant";
- public static final String LITERAL = "literal";
+ public static final String ELEMENT = "element";
private boolean _loginit = true;
private void log(String str) {
@@ -85,14 +90,46 @@
yaml = new Yaml();
}
- //TODO: retourner boolean sur reussite chargement ? ou lever excpetions ?
- //TODO: charger valeurs par defaut en fonction de la version de la syntaxe yaml (syntaxe: version), charger les valeurs à partir d'un fichier ou d'une classe ?
+ //TODO: gestion des labels ? -> non pas pour le moment (plutot pour la syntaxe "user friendly")
+ //TODO: retourner boolean sur reussite chargement ? ou lever excpetions ? -> aucun des deux pour le moment
+ //TODO: charger valeurs par defaut en fonction de la version de la syntaxe yaml (syntaxe: version), charger les valeurs à partir d'un fichier ou d'une classe ? -> a partir d'un fichier YAML
//if(valeur == null) -> charger valeur par defaut -charger celles de l'utilisateur ou celles du programme ou rien
public void loadFile(File file, ObjectModel model) throws IOException {
+ //test - log
+ //chargement du fichier contenant les valeurs par defaut
+ defaultValues = new LinkedHashMap<String, String>();
+ String defaultValuesPATH = file.getParent()+File.separator+FILE_DEFAULT_VALUES;
+ File defaultValuesFILE = new File(defaultValuesPATH);
+ if(defaultValuesFILE.isFile() && defaultValuesFILE.canRead())
+ {
+ InputStream defaultValuesIN = new FileInputStream(defaultValuesPATH);
+ Object defaultValuesYAML = yaml.load(defaultValuesIN);
+ defaultValuesIN.close();
+ if(defaultValuesYAML instanceof Map)
+ {
+ for(Object entry : ((Map) defaultValuesYAML).entrySet())
+ {
+ defaultValues.put(String.valueOf(((Map.Entry) entry).getKey()),String.valueOf(((Map.Entry) entry).getValue()));
+ log("default=[key="+String.valueOf(((Map.Entry) entry).getKey())+" value="+String.valueOf(((Map.Entry) entry).getValue())+"]");
+ }
+ }
+ }
+ //charges les valeurs par defaut du logiciel si false ou ne fait rien si true
+ if(defaultValues.get(DEFAULT) == null)
+ {
+ defaultVoid = false;
+
+ }
+ else
+ {
+ defaultVoid = Boolean.valueOf(String.valueOf(defaultValues.get(DEFAULT)));
+ }
+ //test - log
+
ObjectModelImpl modelOM = (ObjectModelImpl) model;
- InputStream input = new FileInputStream(file);
- Object modelYAML = yaml.load(input);
- input.close();
+ InputStream inputModel = new FileInputStream(file);
+ Object modelYAML = yaml.load(inputModel);
+ inputModel.close();
List<String> ignore = new LinkedList<String>();
ignore.add(IMPORTS);
@@ -141,21 +178,42 @@
//load package
Object packageYAML = collectElement((List) modelYAML, PACKAGE);
if (packageYAML == null) {
- ;
+ if(defaultValues.containsKey(PACKAGE))
+ {
+ packageOM = defaultValues.get(PACKAGE);
+ }
+ else
+ {
+ ;
+ }
} else {
packageOM = String.valueOf(packageYAML);
}
Object nameYAML = collectElement((List) modelYAML, NAME);
if (nameYAML == null) {
- ;
+ if(defaultValues.containsKey(NAME))
+ {
+ modelOM.setName(defaultValues.get(NAME));
+ }
+ else
+ {
+ ;
+ }
} else {
modelOM.setName(String.valueOf(nameYAML));
}
Object versionYAML = collectElement((List) modelYAML, VERSION);
if (versionYAML == null) {
- ;
+ if(defaultValues.containsKey(VERSION))
+ {
+ modelOM.setVersion(defaultValues.get(VERSION));
+ }
+ else
+ {
+ ;
+ }
} else {
modelOM.setVersion(String.valueOf(versionYAML));
}
@@ -207,14 +265,31 @@
Object nameYAML = collectElement((List) elementYAML, NAME);
if (nameYAML == null) {
- ;
+ if(defaultValues.containsKey(ELEMENT+SEPARATOR+NAME))
+ {
+ elementOM.setName(defaultValues.get(ELEMENT+SEPARATOR+NAME));
+ }
+ else
+ {
+ ;
+ }
} else {
elementOM.setName(String.valueOf(nameYAML));
}
Object staticYAML = collectElement((List) elementYAML, STATIC);
if (staticYAML == null) {
- ;
+ if(defaultValues.containsKey(ELEMENT+SEPARATOR+STATIC))
+ {
+ elementOM.setStatic(Boolean.valueOf(defaultValues.get(ELEMENT+SEPARATOR+STATIC)));
+ //log
+ log("default value loaded "+ELEMENT+SEPARATOR+STATIC+"="+defaultValues.containsKey(ELEMENT+SEPARATOR+STATIC));
+ //log
+ }
+ else
+ {
+ ;
+ }
} else {
elementOM.setStatic(Boolean.valueOf(String.valueOf(staticYAML)));
}
@@ -333,7 +408,8 @@
Object superClassesYAML = collectElement((List) classYAML, SUPER_CLASSES);
if (superClassesYAML instanceof List) {
for (Object superClass : (List) superClassesYAML) {
- ObjectModelImplRef superClassOM = new ObjectModelImplRef();
+ ObjectModelImplSuperClassRef superClassOM = new ObjectModelImplSuperClassRef();
+ //ObjectModelImplRef superClassOM = new ObjectModelImplRef();
superClassOM.setName(String.valueOf(superClass));
classOM.addSuperclass(superClassOM);
}
1
0
See <http://ci.nuiton.org/jenkins/job/eugene/1134/changes>
Changes:
[agiraudet] ajout de YamlUtil.java
[agiraudet] modification de eugene/models/object/reader/YamlObjectModelReader.java : nouveaux appels des méthodes de la classe YamlToObjectModel
modification de eugene/models/object/reader/yaml/YamlToObjectModel.java : nouvelle implémentation et nouvelles fonctionnalités
------------------------------------------
Started by an SCM change
Building on master in workspace <http://ci.nuiton.org/jenkins/job/eugene/ws/>
Updating http://svn.nuiton.org/svn/eugene/trunk at revision '2013-05-16T11:41:20.652 +0200'
A eugene/src/main/java/org/nuiton/eugene/models/object/reader/yaml/YamlUtil.java
U eugene/src/main/java/org/nuiton/eugene/models/object/reader/yaml/YamlToObjectModel.java
U eugene/src/main/java/org/nuiton/eugene/models/object/reader/YamlObjectModelReader.java
At revision 1247
Parsing POMs
Modules changed, recalculating dependency graph
[trunk] $ /opt/jdk/bin/java -XX:MaxPermSize=256m -Xmx448m -Dhudson.DNSMultiCast.disabled=true -Djava.awt.headless=true -XX:-UseGCOverheadLimit -cp /var/local/jenkins/data/plugins/maven-plugin/WEB-INF/lib/maven3-agent-1.2.jar:/opt/maven3/boot/plexus-classworlds-2.4.jar org.jvnet.hudson.maven3.agent.Maven3Main /opt/maven3 /opt/repository/apache-tomcat-7.0.39/webapps/jenkins/WEB-INF/lib/remoting-2.22.jar /var/local/jenkins/data/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-1.2.jar 41632
<===[JENKINS REMOTING CAPACITY]===> channel started
log4j:WARN No appenders could be found for logger (org.apache.commons.beanutils.converters.BooleanConverter).
log4j:WARN Please initialize the log4j system properly.
Executing Maven: -B -f <http://ci.nuiton.org/jenkins/job/eugene/ws/trunk/pom.xml> -e clean install
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] EUGene
[INFO] EUGene :: EUGene
[INFO] EUGene :: Java templates
[INFO] EUGene :: Maven plugin
[INFO] EUGene :: PlantUML templates
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building EUGene 2.6.3-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ eugene ---
[INFO] Deleting <http://ci.nuiton.org/jenkins/job/eugene/ws/trunk/target>
[INFO]
[INFO] --- maven-enforcer-plugin:1.2:enforce (check-project-files) @ eugene ---
[INFO]
[INFO] --- maven-antrun-plugin:1.7:run (generate-surefire-workdir) @ eugene ---
[INFO] Executing tasks
main:
[mkdir] Created dir: <http://ci.nuiton.org/jenkins/job/eugene/ws/trunk/target/surefire-workdir>
[INFO] Executed tasks
[INFO]
[INFO] --- maven-site-plugin:3.2:attach-descriptor (attach-descriptor) @ eugene ---
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ eugene ---
[INFO] Installing <http://ci.nuiton.org/jenkins/job/eugene/ws/trunk/pom.xml> to /var/local/maven/data/repository/org/nuiton/eugene/2.6.3-SNAPSHOT/eugene-2.6.3-SNAPSHOT.pom
[INFO] Installing <http://ci.nuiton.org/jenkins/job/eugene/ws/trunk/target/eugene-2.6.3-SNAPSH…> to /var/local/maven/data/repository/org/nuiton/eugene/2.6.3-SNAPSHOT/eugene-2.6.3-SNAPSHOT-site_en.xml
[INFO] Installing <http://ci.nuiton.org/jenkins/job/eugene/ws/trunk/target/eugene-2.6.3-SNAPSH…> to /var/local/maven/data/repository/org/nuiton/eugene/2.6.3-SNAPSHOT/eugene-2.6.3-SNAPSHOT-site_fr.xml
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building EUGene :: EUGene 2.6.3-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ eugene ---
[INFO] Deleting <http://ci.nuiton.org/jenkins/job/eugene/ws/trunk/eugene/target>
[INFO]
[INFO] --- maven-enforcer-plugin:1.2:enforce (check-project-files) @ eugene ---
[INFO]
[INFO] --- processor-maven-plugin:1.3:process (default) @ eugene ---
[INFO] Processing 103 files(s).
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ eugene ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.1:compile (default-compile) @ eugene ---
[INFO] Compiling 103 source files to <http://ci.nuiton.org/jenkins/job/eugene/ws/trunk/eugene/target/classes>
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] bootstrap class path not set in conjunction with -source 1.6
<http://ci.nuiton.org/jenkins/job/eugene/ws/trunk/eugene/target/processed-so…>:[32,50] error: cannot find symbol
[INFO] 1error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] EUGene ............................................ SUCCESS [6.055s]
[INFO] EUGene :: EUGene .................................. FAILURE [7.087s]
[INFO] EUGene :: Java templates .......................... SKIPPED
[INFO] EUGene :: Maven plugin ............................ SKIPPED
[INFO] EUGene :: PlantUML templates ...................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16.065s
[INFO] Finished at: Thu May 16 11:41:50 CEST 2013
[INFO] Final Memory: 24M/168M
[INFO] ------------------------------------------------------------------------
[JENKINS] Archiving <http://ci.nuiton.org/jenkins/job/eugene/ws/trunk/pom.xml> to /var/local/jenkins/data/jobs/eugene/modules/org.nuiton$eugene/builds/2013-05-16_11-41-30/archive/org.nuiton/eugene/2.6.3-SNAPSHOT/eugene-2.6.3-SNAPSHOT.pom
[JENKINS] Archiving <http://ci.nuiton.org/jenkins/job/eugene/ws/trunk/target/eugene-2.6.3-SNAPSH…> to /var/local/jenkins/data/jobs/eugene/modules/org.nuiton$eugene/builds/2013-05-16_11-41-30/archive/org.nuiton/eugene/2.6.3-SNAPSHOT/eugene-2.6.3-SNAPSHOT-site_en.xml
[JENKINS] Archiving <http://ci.nuiton.org/jenkins/job/eugene/ws/trunk/target/eugene-2.6.3-SNAPSH…> to /var/local/jenkins/data/jobs/eugene/modules/org.nuiton$eugene/builds/2013-05-16_11-41-30/archive/org.nuiton/eugene/2.6.3-SNAPSHOT/eugene-2.6.3-SNAPSHOT-site_fr.xml
[JENKINS] Archiving <http://ci.nuiton.org/jenkins/job/eugene/ws/trunk/eugene-plantuml-templates/…> to /var/local/jenkins/data/jobs/eugene/modules/org.nuiton.eugene$eugene-plantuml-templates/builds/2013-05-16_11-41-30/archive/org.nuiton.eugene/eugene-plantuml-templates/2.6.3-SNAPSHOT/eugene-plantuml-templates-2.6.3-SNAPSHOT.pom
[JENKINS] Archiving <http://ci.nuiton.org/jenkins/job/eugene/ws/trunk/eugene-maven-plugin/pom.xml> to /var/local/jenkins/data/jobs/eugene/modules/org.nuiton.eugene$eugene-maven-plugin/builds/2013-05-16_11-41-30/archive/org.nuiton.eugene/eugene-maven-plugin/2.6.3-SNAPSHOT/eugene-maven-plugin-2.6.3-SNAPSHOT.pom
[JENKINS] Archiving <http://ci.nuiton.org/jenkins/job/eugene/ws/trunk/eugene/pom.xml> to /var/local/jenkins/data/jobs/eugene/modules/org.nuiton.eugene$eugene/builds/2013-05-16_11-41-30/archive/org.nuiton.eugene/eugene/2.6.3-SNAPSHOT/eugene-2.6.3-SNAPSHOT.pom
[JENKINS] Archiving <http://ci.nuiton.org/jenkins/job/eugene/ws/trunk/eugene-java-templates/pom.…> to /var/local/jenkins/data/jobs/eugene/modules/org.nuiton.eugene$eugene-java-templates/builds/2013-05-16_11-41-30/archive/org.nuiton.eugene/eugene-java-templates/2.6.3-SNAPSHOT/eugene-java-templates-2.6.3-SNAPSHOT.pom
Waiting for Jenkins to finish collecting data
mavenExecutionResult exceptions not empty
message : Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.1:compile (default-compile) on project eugene: Compilation failure
bootstrap class path not set in conjunction with -source 1.6
<http://ci.nuiton.org/jenkins/job/eugene/ws/trunk/eugene/target/processed-so…>:[32,50] error: cannot find symbol
cause : Compilation failure
bootstrap class path not set in conjunction with -source 1.6
<http://ci.nuiton.org/jenkins/job/eugene/ws/trunk/eugene/target/processed-so…>:[32,50] error: cannot find symbol
Stack trace :
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.1:compile (default-compile) on project eugene: Compilation failure
bootstrap class path not set in conjunction with -source 1.6
<http://ci.nuiton.org/jenkins/job/eugene/ws/trunk/eugene/target/processed-so…>:[32,50] error: cannot find symbol
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:79)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:329)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:158)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:100)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:66)
at hudson.remoting.UserRequest.perform(UserRequest.java:118)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:326)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
Caused by: org.apache.maven.plugin.CompilationFailureException: Compilation failure
bootstrap class path not set in conjunction with -source 1.6
<http://ci.nuiton.org/jenkins/job/eugene/ws/trunk/eugene/target/processed-so…>:[32,50] error: cannot find symbol
at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:656)
at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:128)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 27 more
Failed to send e-mail to agiraudet because no e-mail address is known, and no default e-mail domain is configured
Sending e-mails to: eugene-commits(a)list.nuiton.org
channel stopped
Failed to send e-mail to agiraudet because no e-mail address is known, and no default e-mail domain is configured
1
1
17 May '13
See <http://ci.nuiton.org/jenkins/job/eugene/org.nuiton.eugene$eugene/1134/chang…>
Changes:
[agiraudet] ajout de YamlUtil.java
[agiraudet] modification de eugene/models/object/reader/YamlObjectModelReader.java : nouveaux appels des méthodes de la classe YamlToObjectModel
modification de eugene/models/object/reader/yaml/YamlToObjectModel.java : nouvelle implémentation et nouvelles fonctionnalités
------------------------------------------
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building EUGene :: EUGene 2.6.3-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ eugene ---
[INFO] Deleting <http://ci.nuiton.org/jenkins/job/eugene/org.nuiton.eugene$eugene/ws/target>
[INFO]
[INFO] --- maven-enforcer-plugin:1.2:enforce (check-project-files) @ eugene ---
[INFO]
[INFO] --- processor-maven-plugin:1.3:process (default) @ eugene ---
[INFO] Processing 103 files(s).
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ eugene ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.1:compile (default-compile) @ eugene ---
[INFO] Compiling 103 source files to <http://ci.nuiton.org/jenkins/job/eugene/org.nuiton.eugene$eugene/ws/target/…>
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] bootstrap class path not set in conjunction with -source 1.6
<http://ci.nuiton.org/jenkins/job/eugene/org.nuiton.eugene$eugene/ws/target/…>:[32,50] error: cannot find symbol
[INFO] 1error
[INFO] -------------------------------------------------------------
1
1
r1248 - in trunk: eugene/src/main/java/org/nuiton/eugene/models/object/reader eugene/src/main/java/org/nuiton/eugene/models/object/reader/yaml eugene-plantuml-templates eugene-plantuml-templates/src/main/java/org/nuiton/eugene/plantuml
by agiraudet@users.nuiton.org 16 May '13
by agiraudet@users.nuiton.org 16 May '13
16 May '13
Author: agiraudet
Date: 2013-05-16 18:01:22 +0200 (Thu, 16 May 2013)
New Revision: 1248
Url: http://nuiton.org/projects/eugene/repository/revisions/1248
Log:
ajout de nouvelles fonctionnalit?\195?\169s ?\195?\160 YamlToObjectModel.java : g?\195?\168re presque toutes les options de l'ObjectModel (les principales) pour la syntaxe pure YAML
ajout de nouvelles fonctionnalit?\195?\169s ?\195?\160 PlantumlTemplatesGenerator.java : affiches d?\195?\169sormais les g?\195?\169n?\195?\169ralisations et classes d'association dans les diagrammes g?\195?\169n?\195?\169r?\195?\169s avec PlantUML
mise ?\195?\160 jour de la version de la d?\195?\169pendance de PlantUML du module eugene-plantuml-template
correction d'un import vers une classe supprim?\195?\169e dans YamlObjectModelReader.java
Note: d?\195?\169couverte d'un bug dans ObjectModelClassImpl.java ligne 124 (v?\195?\169rification avant prochain commit)
Modified:
trunk/eugene-plantuml-templates/pom.xml
trunk/eugene-plantuml-templates/src/main/java/org/nuiton/eugene/plantuml/PlantumlTemplatesGenerator.java
trunk/eugene/src/main/java/org/nuiton/eugene/models/object/reader/YamlObjectModelReader.java
trunk/eugene/src/main/java/org/nuiton/eugene/models/object/reader/yaml/YamlToObjectModel.java
trunk/eugene/src/main/java/org/nuiton/eugene/models/object/reader/yaml/YamlUtil.java
Modified: trunk/eugene/src/main/java/org/nuiton/eugene/models/object/reader/YamlObjectModelReader.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/models/object/reader/YamlObjectModelReader.java 2013-05-15 15:59:44 UTC (rev 1247)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/models/object/reader/YamlObjectModelReader.java 2013-05-16 16:01:22 UTC (rev 1248)
@@ -29,7 +29,6 @@
import org.apache.commons.logging.LogFactory;
import org.nuiton.eugene.ModelHelper;
import org.nuiton.eugene.models.object.ObjectModel;
-import org.nuiton.eugene.models.object.reader.yaml.Test;
import org.nuiton.eugene.models.object.reader.yaml.YamlToObjectModel;
import org.yaml.snakeyaml.error.YAMLException;
Modified: trunk/eugene/src/main/java/org/nuiton/eugene/models/object/reader/yaml/YamlToObjectModel.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/models/object/reader/yaml/YamlToObjectModel.java 2013-05-15 15:59:44 UTC (rev 1247)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/models/object/reader/yaml/YamlToObjectModel.java 2013-05-16 16:01:22 UTC (rev 1248)
@@ -35,7 +35,7 @@
public static final String DOCUMENTATION = "documentation";
public static final String TAG_VALUES = "tagvalues";
public static final String COMMENTS = "comments";
- public static final String STEREOTYPES = "stereotype";
+ public static final String STEREOTYPES = "stereotypes";
public static final String EXTERN = "extern";
public static final String INNER = "inner";
public static final String TYPE = "type";
@@ -64,28 +64,30 @@
public static final String PARTICIPANT = "participant";
public static final String LITERAL = "literal";
+ private boolean _loginit = true;
+ private void log(String str) {
+ try {
+ FileWriter log;
+ String path = "/tmp/log.yaml.txt";
- private boolean _log = false;
-
- private void log(String str) throws IOException {
- FileWriter log = null;
- String path = "/tmp/log.yaml.txt";
- if (_log) {
- log = new FileWriter(path, _log);
+ if (_loginit) {
+ log = new FileWriter(path, false);
+ log.close();
+ _loginit = false;
+ }
+ log = new FileWriter(path, true);
log.write("[LOG] " + str + "\n");
log.close();
- } else {
- log = new FileWriter(path, _log);
- log.write("[LOG] start v1.0\n");
- log.close();
- _log = true;
- }
+ } catch (IOException e) {;}
}
public YamlToObjectModel() {
yaml = new Yaml();
}
+ //TODO: retourner boolean sur reussite chargement ? ou lever excpetions ?
+ //TODO: charger valeurs par defaut en fonction de la version de la syntaxe yaml (syntaxe: version), charger les valeurs à partir d'un fichier ou d'une classe ?
+ //if(valeur == null) -> charger valeur par defaut -charger celles de l'utilisateur ou celles du programme ou rien
public void loadFile(File file, ObjectModel model) throws IOException {
ObjectModelImpl modelOM = (ObjectModelImpl) model;
InputStream input = new FileInputStream(file);
@@ -93,8 +95,8 @@
input.close();
List<String> ignore = new LinkedList<String>();
- ignore.add("imports");
- ignore.add("tagvalues");
+ ignore.add(IMPORTS);
+ ignore.add(TAG_VALUES);
browseKeySetToLowerCase(modelYAML, ignore);
loadModel(modelYAML, modelOM);
@@ -111,8 +113,8 @@
return null;
}
- public List collectAllElements(List data, Object key) {
- List res = new LinkedList();
+ public List<Object> collectAllElements(List data, Object key) {
+ List<Object> res = new LinkedList<Object>();
for (Object obj : data) {
if (obj instanceof Map) {
if (((Map) obj).containsKey(key)) {
@@ -194,9 +196,7 @@
loadEnumeration(enumerationYAML, enumerationOM);
modelOM.addEnumeration(enumerationOM);
}
-
}
- //return true/false -> chargement reussi ?
}
public void loadElement(Object elementYAML, ObjectModelElementImpl elementOM) {
@@ -249,6 +249,9 @@
ObjectModelImplRef stereotypeOM = new ObjectModelImplRef();
stereotypeOM.setName(String.valueOf(stereotype));
elementOM.addStereotype(stereotypeOM);
+ //log
+ log("stereotype="+stereotypeOM.getName());
+ //log
}
}
}
@@ -350,8 +353,29 @@
List participantsYAML = collectAllElements((List) associationClassYAML, PARTICIPANT);
for (Object participantYAML : participantsYAML) {
- ObjectModeImplAssociationClassParticipant participant = new ObjectModeImplAssociationClassParticipant();
- //TODO:
+ if (participantYAML instanceof List) {
+
+ ObjectModeImplAssociationClassParticipant participantOM = new ObjectModeImplAssociationClassParticipant();
+ participantOM.setAssociationClass(associationClassOM);
+
+ Object nameYAML = collectElement((List) participantYAML, NAME);
+ if (nameYAML == null) {
+ ;
+ } else {
+ participantOM.setName(String.valueOf(nameYAML));
+ }
+
+ Object attributeYAML = collectElement((List) participantYAML, ATTRIBUTE);
+ if (attributeYAML == null) {
+ ;
+ } else {
+ participantOM.setAttribute(String.valueOf(attributeYAML));
+ }
+
+ associationClassOM.addParticipant(participantOM);
+
+ log("associationClass");
+ }
}
}
}
@@ -545,5 +569,4 @@
}
}
}
-
}
Modified: trunk/eugene/src/main/java/org/nuiton/eugene/models/object/reader/yaml/YamlUtil.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/models/object/reader/yaml/YamlUtil.java 2013-05-15 15:59:44 UTC (rev 1247)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/models/object/reader/yaml/YamlUtil.java 2013-05-16 16:01:22 UTC (rev 1248)
@@ -24,6 +24,7 @@
keySetToLowerCase((Map) obj);
for (Object key : ((Map) obj).keySet()) {
+ //tester si String ou caster avec valueOf
if (!ignore.contains(key)) {
browseKeySetToLowerCase(((Map) obj).get(key), ignore);
}
Modified: trunk/eugene-plantuml-templates/pom.xml
===================================================================
--- trunk/eugene-plantuml-templates/pom.xml 2013-05-15 15:59:44 UTC (rev 1247)
+++ trunk/eugene-plantuml-templates/pom.xml 2013-05-16 16:01:22 UTC (rev 1248)
@@ -46,7 +46,7 @@
<dependency>
<groupId>net.sourceforge.plantuml</groupId>
<artifactId>plantuml</artifactId>
- <version>7962</version>
+ <version>7965</version>
</dependency>
</dependencies>
Modified: trunk/eugene-plantuml-templates/src/main/java/org/nuiton/eugene/plantuml/PlantumlTemplatesGenerator.java
===================================================================
--- trunk/eugene-plantuml-templates/src/main/java/org/nuiton/eugene/plantuml/PlantumlTemplatesGenerator.java 2013-05-15 15:59:44 UTC (rev 1247)
+++ trunk/eugene-plantuml-templates/src/main/java/org/nuiton/eugene/plantuml/PlantumlTemplatesGenerator.java 2013-05-16 16:01:22 UTC (rev 1248)
@@ -3,6 +3,7 @@
import net.sourceforge.plantuml.GeneratedImage;
import net.sourceforge.plantuml.SourceFileReader;
import org.nuiton.eugene.models.object.*;
+import org.nuiton.eugene.models.object.xml.ObjectModelClassImpl;
import java.io.*;
import java.util.*;
@@ -12,12 +13,27 @@
public class PlantumlTemplatesGenerator extends ObjectModelGenerator {
+ private boolean _loginit = true;
+ private void log(String str) {
+ try {
+ FileWriter log;
+ String path = "/tmp/log.yaml.txt";
+
+ if (_loginit) {
+ log = new FileWriter(path, false);
+ log.close();
+ _loginit = false;
+ }
+ log = new FileWriter(path, true);
+ log.write("[LOG] " + str + "\n");
+ log.close();
+ } catch (IOException e) {;}
+ }
+
@Override
public void generateFromModel(Writer output, ObjectModel input) throws IOException {
- /*//log
- FileWriter log = new FileWriter(File.separator+"tmp"+File.separator+"test2.log");
- log.close();
- *///log
+ //log
+ //log
// utiliser le systeme de templates a l'avenir
@@ -33,9 +49,18 @@
if(class_tmp.getStereotypes().size()>0)
{
classStereotype = "<<";
+ boolean first = true;
for(String str : class_tmp.getStereotypes())
{
- classStereotype = classStereotype+","+str;
+ if(first)
+ {
+ classStereotype = classStereotype+str;
+ first = false;
+ }
+ else
+ {
+ classStereotype = classStereotype+" ,"+str;
+ }
}
classStereotype = classStereotype+">>";
}
@@ -147,6 +172,55 @@
}
}
+ //classes d'association
+ Map<String,LinkedList<String>> associationClass = new LinkedHashMap<String, LinkedList<String>>();
+ for(ObjectModelClassifier classifier : input.getClassifiers())
+ {
+ for(ObjectModelAttribute attribute : classifier.getAttributes())
+ {
+ if(attribute.hasAssociationClass())
+ {
+ String key = attribute.getAssociationClass().getName();
+ String value = classifier.getName();
+ if(associationClass.containsKey(key))
+ {
+ associationClass.get(key).add(value);
+ }
+ else
+ {
+ associationClass.put(key,new LinkedList<String>());
+ associationClass.get(key).add(value);
+ }
+ }
+ }
+ }
+ for(Map.Entry<String,LinkedList<String>> entry : associationClass.entrySet())
+ {
+ boolean first = true;
+ output.write("(");
+ for(String value : entry.getValue())
+ {
+ if(first)
+ {
+ output.write(value);
+ first = false;
+ }else
+ {
+ output.write(", "+value);
+ }
+ }
+ output.write(") .. "+entry.getKey()+"\n");
+ }
+
+ //extensions/generalisations (heritage)
+ for(ObjectModelClass classOM : input.getClasses())
+ {
+ for(ObjectModelClass superClassOM : classOM.getSuperclasses())
+ {
+ output.write(superClassOM.getName()+" <|-- "+classOM.getName());
+ }
+ }
+
// fin du fichier
output.write("\n@enduml");
}
@@ -177,8 +251,7 @@
File plantuml = new File(destDir+File.separator+this.getFilenameForModel(model));
SourceFileReader reader = new SourceFileReader(plantuml);
List<GeneratedImage> lst = reader.getGeneratedImages();
- File diagram = new File(destDir+File.separator+model.getName()+".png");
- diagram = lst.get(0).getPngFile();
+ new File(lst.get(0).getPngFile(), destDir+File.separator+model.getName()+".png");
} catch (InterruptedException e) {
e.printStackTrace();
}
1
0
r1247 - trunk/eugene/src/main/java/org/nuiton/eugene/models/object/reader/yaml
by agiraudet@users.nuiton.org 15 May '13
by agiraudet@users.nuiton.org 15 May '13
15 May '13
Author: agiraudet
Date: 2013-05-15 17:59:44 +0200 (Wed, 15 May 2013)
New Revision: 1247
Url: http://nuiton.org/projects/eugene/repository/revisions/1247
Log:
ajout de YamlUtil.java
Added:
trunk/eugene/src/main/java/org/nuiton/eugene/models/object/reader/yaml/YamlUtil.java
Modified:
trunk/eugene/src/main/java/org/nuiton/eugene/models/object/reader/yaml/YamlToObjectModel.java
Modified: trunk/eugene/src/main/java/org/nuiton/eugene/models/object/reader/yaml/YamlToObjectModel.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/models/object/reader/yaml/YamlToObjectModel.java 2013-05-15 15:38:03 UTC (rev 1246)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/models/object/reader/yaml/YamlToObjectModel.java 2013-05-15 15:59:44 UTC (rev 1247)
@@ -8,15 +8,19 @@
import java.util.*;
import static org.nuiton.eugene.models.object.reader.yaml.YamlUtil.browseKeySetToLowerCase;
+
/**
* User: agiraudet
* Date: 15/05/13
* Time: 11:15
*/
+
+//TODO: gestion des labels
+
public class YamlToObjectModel {
protected Yaml yaml;
protected String packageOM;
- protected Map<String,String> imports;
+ protected Map<String, String> imports;
//mots clefs
public static final String IMPORTS = "imports";
@@ -62,17 +66,15 @@
private boolean _log = false;
+
private void log(String str) throws IOException {
FileWriter log = null;
String path = "/tmp/log.yaml.txt";
- if(_log)
- {
+ if (_log) {
log = new FileWriter(path, _log);
log.write("[LOG] " + str + "\n");
log.close();
- }
- else
- {
+ } else {
log = new FileWriter(path, _log);
log.write("[LOG] start v1.0\n");
log.close();
@@ -80,8 +82,7 @@
}
}
- public YamlToObjectModel()
- {
+ public YamlToObjectModel() {
yaml = new Yaml();
}
@@ -96,7 +97,7 @@
ignore.add("tagvalues");
browseKeySetToLowerCase(modelYAML, ignore);
- loadModel(modelYAML,modelOM);
+ loadModel(modelYAML, modelOM);
}
public Object collectElement(List data, Object key) {
@@ -122,96 +123,75 @@
return res;
}
- public void loadModel(Object modelYAML, ObjectModelImpl modelOM)
- {
- if(modelYAML instanceof List)
- {
+ public void loadModel(Object modelYAML, ObjectModelImpl modelOM) {
+ if (modelYAML instanceof List) {
//load imports
imports = new LinkedHashMap<String, String>();
Object importsYAML = collectElement((List) modelYAML, IMPORTS);
- if(importsYAML instanceof Map)
- {
- for(Object entry : ((Map) importsYAML).entrySet())
- {
- if(entry instanceof Map.Entry)
- {
- imports.put(String.valueOf(((Map.Entry) entry).getKey()),String.valueOf(((Map.Entry) entry).getValue()));
+ if (importsYAML instanceof Map) {
+ for (Object entry : ((Map) importsYAML).entrySet()) {
+ if (entry instanceof Map.Entry) {
+ imports.put(String.valueOf(((Map.Entry) entry).getKey()), String.valueOf(((Map.Entry) entry).getValue()));
}
}
}
//load package
Object packageYAML = collectElement((List) modelYAML, PACKAGE);
- if(packageYAML == null)
- {
+ if (packageYAML == null) {
;
- }
- else
- {
+ } else {
packageOM = String.valueOf(packageYAML);
}
Object nameYAML = collectElement((List) modelYAML, NAME);
- if(nameYAML == null)
- {
+ if (nameYAML == null) {
;
- }
- else
- {
+ } else {
modelOM.setName(String.valueOf(nameYAML));
}
Object versionYAML = collectElement((List) modelYAML, VERSION);
- if(versionYAML == null)
- {
+ if (versionYAML == null) {
;
- }
- else
- {
+ } else {
modelOM.setVersion(String.valueOf(versionYAML));
}
Object tagValuesYAML = collectElement((List) modelYAML, TAG_VALUES);
- if(tagValuesYAML instanceof Map)
- {
- for(Object entry : ((Map) tagValuesYAML).entrySet())
- {
- if(entry instanceof Map.Entry)
- {
- modelOM.addTagValue(String.valueOf(((Map.Entry) entry).getKey()),String.valueOf(((Map.Entry) entry).getValue()));
+ if (tagValuesYAML instanceof Map) {
+ for (Object entry : ((Map) tagValuesYAML).entrySet()) {
+ if (entry instanceof Map.Entry) {
+ modelOM.addTagValue(String.valueOf(((Map.Entry) entry).getKey()), String.valueOf(((Map.Entry) entry).getValue()));
}
}
}
List classesYAML = collectAllElements((List) modelYAML, CLASS);
- for(Object classYAML : classesYAML)
- {
+ for (Object classYAML : classesYAML) {
ObjectModelClassImpl classOM = new ObjectModelClassImpl();
- loadClass(classYAML,classOM);
+ loadClass(classYAML, classOM);
modelOM.addClass(classOM);
}
List interfacesYAML = collectAllElements((List) modelYAML, INTERFACE);
- for(Object interfaceYAML : interfacesYAML)
- {
+ for (Object interfaceYAML : interfacesYAML) {
ObjectModelInterfaceImpl interfaceOM = new ObjectModelInterfaceImpl();
- loadInterface(interfaceYAML,interfaceOM);
+ loadInterface(interfaceYAML, interfaceOM);
modelOM.addInterface(interfaceOM);
}
List classesAssociationYAML = collectAllElements((List) modelYAML, CLASS_ASSOCIATION);
- for(Object classAssociationYAML : classesAssociationYAML)
- {
+ for (Object classAssociationYAML : classesAssociationYAML) {
ObjectModelAssociationClassImpl classAssociationOM = new ObjectModelAssociationClassImpl();
- loadAssociationClass(classAssociationYAML,classAssociationOM);
+ loadAssociationClass(classAssociationYAML, classAssociationOM);
modelOM.addAssociationClass(classAssociationOM);
}
List enumerationsYAML = collectAllElements((List) modelYAML, ENUMERATION);
- for(Object enumerationYAML : enumerationsYAML)
- {
+ for (Object enumerationYAML : enumerationsYAML) {
ObjectModelEnumerationImpl enumerationOM = new ObjectModelEnumerationImpl();
- loadEnumeration(enumerationYAML,enumerationOM);
+ loadEnumeration(enumerationYAML, enumerationOM);
modelOM.addEnumeration(enumerationOM);
}
@@ -219,71 +199,53 @@
//return true/false -> chargement reussi ?
}
- public void loadElement(Object elementYAML, ObjectModelElementImpl elementOM)
- {
- if(elementYAML instanceof List)
- {
+ public void loadElement(Object elementYAML, ObjectModelElementImpl elementOM) {
+ if (elementYAML instanceof List) {
//TODO: setDeclaringElement
//TODO: setObjectModelImpl
//TODO: addModifier
Object nameYAML = collectElement((List) elementYAML, NAME);
- if(nameYAML == null)
- {
+ if (nameYAML == null) {
;
- }
- else
- {
+ } else {
elementOM.setName(String.valueOf(nameYAML));
}
Object staticYAML = collectElement((List) elementYAML, STATIC);
- if(staticYAML == null)
- {
+ if (staticYAML == null) {
;
- }
- else
- {
+ } else {
elementOM.setStatic(Boolean.valueOf(String.valueOf(staticYAML)));
}
Object documentationYAML = collectElement((List) elementYAML, DOCUMENTATION);
- if(documentationYAML == null)
- {
+ if (documentationYAML == null) {
;
- }
- else
- {
+ } else {
elementOM.setDocumentation(String.valueOf(documentationYAML));
}
Object tagValuesYAML = collectElement((List) elementYAML, TAG_VALUES);
- if(tagValuesYAML instanceof Map)
- {
- for(Object entry : ((Map) tagValuesYAML).entrySet())
- {
- if(entry instanceof Map.Entry)
- {
- elementOM.addTagValue(String.valueOf(((Map.Entry) entry).getKey()),String.valueOf(((Map.Entry) entry).getValue()));
+ if (tagValuesYAML instanceof Map) {
+ for (Object entry : ((Map) tagValuesYAML).entrySet()) {
+ if (entry instanceof Map.Entry) {
+ elementOM.addTagValue(String.valueOf(((Map.Entry) entry).getKey()), String.valueOf(((Map.Entry) entry).getValue()));
}
}
}
Object commentsYAML = collectElement((List) elementYAML, COMMENTS);
- if(commentsYAML instanceof List)
- {
- for(Object comment : (List) commentsYAML)
- {
+ if (commentsYAML instanceof List) {
+ for (Object comment : (List) commentsYAML) {
elementOM.addComment(String.valueOf(comment));
}
}
Object stereotypesYAML = collectElement((List) elementYAML, STEREOTYPES);
{
- if(stereotypesYAML instanceof List)
- {
- for(Object stereotype : (List) stereotypesYAML)
- {
+ if (stereotypesYAML instanceof List) {
+ for (Object stereotype : (List) stereotypesYAML) {
ObjectModelImplRef stereotypeOM = new ObjectModelImplRef();
stereotypeOM.setName(String.valueOf(stereotype));
elementOM.addStereotype(stereotypeOM);
@@ -293,75 +255,57 @@
}
}
- public void loadClassifier(Object classifierYAML, ObjectModelClassifierImpl classifierOM)
- {
- if(classifierYAML instanceof List)
- {
+ public void loadClassifier(Object classifierYAML, ObjectModelClassifierImpl classifierOM) {
+ if (classifierYAML instanceof List) {
//TODO: addDependency
loadElement(classifierYAML, classifierOM);
Object packageYAML = collectElement((List) classifierYAML, PACKAGE);
- if(packageYAML == null)
- {
+ if (packageYAML == null) {
classifierOM.setPackage(packageOM);
- }
- else
- {
+ } else {
classifierOM.setPackage(String.valueOf(packageYAML));
}
Object externYAML = collectElement((List) classifierYAML, EXTERN);
- if(externYAML == null)
- {
+ if (externYAML == null) {
;
- }
- else
- {
+ } else {
classifierOM.setExtern(Boolean.valueOf(String.valueOf(externYAML)));
}
Object innerYAML = collectElement((List) classifierYAML, INNER);
- if(innerYAML == null)
- {
+ if (innerYAML == null) {
;
- }
- else
- {
+ } else {
classifierOM.setInner(Boolean.valueOf(String.valueOf(innerYAML)));
}
Object typeYAML = collectElement((List) classifierYAML, TYPE);
- if(typeYAML == null)
- {
+ if (typeYAML == null) {
;
- }
- else
- {
+ } else {
classifierOM.setType(String.valueOf(typeYAML));
}
List attributesYAML = collectAllElements((List) classifierYAML, ATTRIBUTE);
- for(Object attributeYAML : attributesYAML)
- {
+ for (Object attributeYAML : attributesYAML) {
ObjectModelAttributeImpl attributeOM = new ObjectModelAttributeImpl();
loadAttribute(attributeYAML, attributeOM);
classifierOM.addAttribute(attributeOM);
}
List operationsYAML = collectAllElements((List) classifierYAML, OPERATION);
- for(Object operationYAML : operationsYAML)
- {
+ for (Object operationYAML : operationsYAML) {
ObjectModelOperationImpl operationOM = new ObjectModelOperationImpl();
loadOperation(operationYAML, operationOM);
classifierOM.addOperation(operationOM);
}
Object superInterfacesYAML = collectElement((List) classifierYAML, SUPER_INTERFACES);
- if(superInterfacesYAML instanceof List)
- {
- for(Object superInterface : (List) superInterfacesYAML)
- {
+ if (superInterfacesYAML instanceof List) {
+ for (Object superInterface : (List) superInterfacesYAML) {
ObjectModelImplRef superInterfaceOM = new ObjectModelImplRef();
superInterfaceOM.setName(String.valueOf(superInterface));
classifierOM.addInterface(superInterfaceOM);
@@ -370,29 +314,22 @@
}
}
- public void loadClass(Object classYAML, ObjectModelClassImpl classOM)
- {
- if(classYAML instanceof List)
- {
+ public void loadClass(Object classYAML, ObjectModelClassImpl classOM) {
+ if (classYAML instanceof List) {
//TODO: addInnerClassifier
loadClassifier(classYAML, classOM);
Object abstractYAML = collectElement((List) classYAML, ABSTRACT);
- if(abstractYAML == null)
- {
+ if (abstractYAML == null) {
;
- }
- else
- {
+ } else {
classOM.setAbstract(Boolean.valueOf(String.valueOf(abstractYAML)));
}
Object superClassesYAML = collectElement((List) classYAML, SUPER_CLASSES);
- if(superClassesYAML instanceof List)
- {
- for(Object superClass : (List) superClassesYAML)
- {
+ if (superClassesYAML instanceof List) {
+ for (Object superClass : (List) superClassesYAML) {
ObjectModelImplRef superClassOM = new ObjectModelImplRef();
superClassOM.setName(String.valueOf(superClass));
classOM.addSuperclass(superClassOM);
@@ -401,40 +338,31 @@
}
}
- public void loadInterface(Object interfaceYAML, ObjectModelInterfaceImpl interfaceOM)
- {
- if(interfaceYAML instanceof List)
- {
+ public void loadInterface(Object interfaceYAML, ObjectModelInterfaceImpl interfaceOM) {
+ if (interfaceYAML instanceof List) {
loadClassifier(interfaceYAML, interfaceOM);
}
}
- public void loadAssociationClass(Object associationClassYAML, ObjectModelAssociationClassImpl associationClassOM)
- {
- if(associationClassYAML instanceof List)
- {
+ public void loadAssociationClass(Object associationClassYAML, ObjectModelAssociationClassImpl associationClassOM) {
+ if (associationClassYAML instanceof List) {
loadClass(associationClassYAML, associationClassOM);
- List participantsYAML = collectAllElements((List) associationClassYAML, PARTICIPANT);
- for(Object participantYAML : participantsYAML)
- {
+ List participantsYAML = collectAllElements((List) associationClassYAML, PARTICIPANT);
+ for (Object participantYAML : participantsYAML) {
ObjectModeImplAssociationClassParticipant participant = new ObjectModeImplAssociationClassParticipant();
//TODO:
}
}
}
- public void loadEnumeration(Object enumerationYAML, ObjectModelEnumerationImpl enumerationOM)
- {
- if(enumerationYAML instanceof List)
- {
+ public void loadEnumeration(Object enumerationYAML, ObjectModelEnumerationImpl enumerationOM) {
+ if (enumerationYAML instanceof List) {
loadElement(enumerationYAML, enumerationOM);
Object literalsYAML = collectElement((List) enumerationYAML, LITERAL);
- if(literalsYAML instanceof List)
- {
- for(Object literalYAML : (List) literalsYAML)
- {
+ if (literalsYAML instanceof List) {
+ for (Object literalYAML : (List) literalsYAML) {
ObjectModelImplRef literalOM = new ObjectModelImplRef();
literalOM.setName(String.valueOf(literalYAML));
enumerationOM.addLiteral(literalOM);
@@ -443,249 +371,177 @@
}
}
- public void loadParameter(Object parameterYAML, ObjectModelParameterImpl parameterOM)
- {
- if(parameterYAML instanceof List)
- {
+ public void loadParameter(Object parameterYAML, ObjectModelParameterImpl parameterOM) {
+ if (parameterYAML instanceof List) {
loadElement(parameterYAML, parameterOM);
Object orderingYAML = collectElement((List) parameterYAML, ORDERING);
- if(orderingYAML == null)
- {
+ if (orderingYAML == null) {
;
- }
- else
- {
+ } else {
parameterOM.setOrdering(String.valueOf(orderingYAML));
}
Object typeYAML = collectElement((List) parameterYAML, TYPE);
- if(typeYAML == null)
- {
+ if (typeYAML == null) {
;
- }
- else
- {
+ } else {
String type = String.valueOf(typeYAML);
- if(imports.containsKey(type))
- {
+ if (imports.containsKey(type)) {
parameterOM.setType(imports.get(type));
- }
- else
- {
+ } else {
parameterOM.setType(type);
}
}
Object defaultValueYAML = collectElement((List) parameterYAML, DEFAULT_VALUE);
- if(defaultValueYAML == null)
- {
+ if (defaultValueYAML == null) {
;
- }
- else
- {
+ } else {
parameterOM.setDefaultValue(String.valueOf(defaultValueYAML));
}
Object minMultiplicityYAML = collectElement((List) parameterYAML, MIN_MULTIPLICITY);
- if(minMultiplicityYAML == null)
- {
+ if (minMultiplicityYAML == null) {
;
- }
- else
- {
+ } else {
parameterOM.setMinMultiplicity(Integer.valueOf(String.valueOf(minMultiplicityYAML)));
}
Object maxMultiplicityYAML = collectElement((List) parameterYAML, MAX_MULTIPLICITY);
- if(maxMultiplicityYAML == null)
- {
+ if (maxMultiplicityYAML == null) {
;
- }
- else
- {
+ } else {
parameterOM.setMaxMultiplicity(Integer.valueOf(String.valueOf(maxMultiplicityYAML)));
}
Object orderedYAML = collectElement((List) parameterYAML, ORDERED);
- if(orderedYAML == null)
- {
+ if (orderedYAML == null) {
;
- }
- else
- {
+ } else {
parameterOM.setOrdered(Boolean.valueOf(String.valueOf(orderedYAML)));
}
Object uniqueYAML = collectElement((List) parameterYAML, UNIQUE);
- if(uniqueYAML == null)
- {
+ if (uniqueYAML == null) {
;
- }
- else
- {
+ } else {
parameterOM.setUnique(Boolean.valueOf(String.valueOf(uniqueYAML)));
}
}
}
- public void loadAttribute(Object attributeYAML, ObjectModelAttributeImpl attributeOM)
- {
- if(attributeYAML instanceof List)
- {
+ public void loadAttribute(Object attributeYAML, ObjectModelAttributeImpl attributeOM) {
+ if (attributeYAML instanceof List) {
loadParameter(attributeYAML, attributeOM);
Object navigableYAML = collectElement((List) attributeYAML, NAVIGABLE);
- if(navigableYAML == null)
- {
+ if (navigableYAML == null) {
;
- }
- else
- {
+ } else {
attributeOM.setNavigable(Boolean.valueOf(String.valueOf(navigableYAML)));
}
Object associationTypeYAML = collectElement((List) attributeYAML, ASSOCIATION_TYPE);
- if(associationTypeYAML == null)
- {
+ if (associationTypeYAML == null) {
;
- }
- else
- {
+ } else {
attributeOM.setAssociationType(String.valueOf(associationTypeYAML));
}
Object finalYAML = collectElement((List) attributeYAML, FINAL);
- if(finalYAML == null)
- {
+ if (finalYAML == null) {
;
- }
- else
- {
+ } else {
attributeOM.setFinal(Boolean.valueOf(String.valueOf(finalYAML)));
}
Object staticYAML = collectElement((List) attributeYAML, STATIC);
- if(staticYAML == null)
- {
+ if (staticYAML == null) {
;
- }
- else
- {
+ } else {
attributeOM.setStatic(Boolean.valueOf(String.valueOf(staticYAML)));
}
Object associationClassNameYAML = collectElement((List) attributeYAML, ASSOCIATION_CLASS_NAME);
- if(associationClassNameYAML == null)
- {
+ if (associationClassNameYAML == null) {
;
- }
- else
- {
+ } else {
attributeOM.setAssociationClassName(String.valueOf(associationClassNameYAML));
}
Object reverseAttributeNameYAML = collectElement((List) attributeYAML, REVERSE_ATTRIBUTE_NAME);
- if(reverseAttributeNameYAML == null)
- {
+ if (reverseAttributeNameYAML == null) {
;
- }
- else
- {
+ } else {
attributeOM.setReverseAttributeName(String.valueOf(reverseAttributeNameYAML));
}
Object reverseMaxMultiplicityYAML = collectElement((List) attributeYAML, REVERSE_MAX_MULTIPLICITY);
- if(reverseMaxMultiplicityYAML == null)
- {
+ if (reverseMaxMultiplicityYAML == null) {
;
- }
- else
- {
+ } else {
attributeOM.setReverseMaxMultiplicity(Integer.valueOf(String.valueOf(reverseMaxMultiplicityYAML)));
}
Object transientYAML = collectElement((List) attributeYAML, TRANSIENT);
- if(transientYAML == null)
- {
+ if (transientYAML == null) {
;
- }
- else
- {
+ } else {
attributeOM.setTransient(Boolean.valueOf(String.valueOf(transientYAML)));
}
Object visibilityYAML = collectElement((List) attributeYAML, VISIBILITY);
- if(visibilityYAML == null)
- {
+ if (visibilityYAML == null) {
;
- }
- else
- {
+ } else {
attributeOM.setVisibility(String.valueOf(visibilityYAML));
}
}
}
- public void loadOperation(Object operationYAML, ObjectModelOperationImpl operationOM)
- {
- if(operationYAML instanceof List)
- {
+ public void loadOperation(Object operationYAML, ObjectModelOperationImpl operationOM) {
+ if (operationYAML instanceof List) {
//TODO: addExceptionParameter
loadElement(operationYAML, operationOM);
Object abstractYAML = collectElement((List) operationYAML, ABSTRACT);
- if(abstractYAML == null)
- {
+ if (abstractYAML == null) {
;
- }
- else
- {
+ } else {
operationOM.setAbstract(Boolean.valueOf(String.valueOf(abstractYAML)));
}
Object visibilityYAML = collectElement((List) operationYAML, VISIBILITY);
- if(visibilityYAML == null)
- {
+ if (visibilityYAML == null) {
;
- }
- else
- {
+ } else {
operationOM.setVisibility(String.valueOf(visibilityYAML));
}
Object returnParameterYAML = collectElement((List) operationYAML, RETURN_PARAMETER);
- if(returnParameterYAML == null)
- {
+ if (returnParameterYAML == null) {
;
- }
- else
- {
+ } else {
ObjectModelParameterImpl parameterOM = new ObjectModelAttributeImpl();
loadParameter(returnParameterYAML, parameterOM);
operationOM.setReturnParameter(parameterOM);
}
Object bodyCodeYAML = collectElement((List) operationYAML, BODY_CODE);
- if(bodyCodeYAML == null)
- {
+ if (bodyCodeYAML == null) {
;
- }
- else
- {
+ } else {
operationOM.setBodyCode(String.valueOf(bodyCodeYAML));
}
List parametersYAML = collectAllElements((List) operationYAML, PARAMETER);
- {
- for(Object parameterYAML : parametersYAML)
- {
- ObjectModelParameterImpl parameterOM = new ObjectModelAttributeImpl();
- loadParameter(parameterYAML, parameterOM);
- operationOM.addParameter(parameterOM);
- }
+ for (Object parameterYAML : parametersYAML) {
+ ObjectModelParameterImpl parameterOM = new ObjectModelAttributeImpl();
+ loadParameter(parameterYAML, parameterOM);
+ operationOM.addParameter(parameterOM);
}
}
}
Added: trunk/eugene/src/main/java/org/nuiton/eugene/models/object/reader/yaml/YamlUtil.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/models/object/reader/yaml/YamlUtil.java (rev 0)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/models/object/reader/yaml/YamlUtil.java 2013-05-15 15:59:44 UTC (rev 1247)
@@ -0,0 +1,37 @@
+package org.nuiton.eugene.models.object.reader.yaml;
+
+import java.util.*;
+
+/**
+ * User: agiraudet
+ * Date: 14/05/13
+ * Time: 11:53
+ */
+public class YamlUtil {
+
+ public static void keySetToLowerCase(Map map) {
+ List keys = new ArrayList(map.keySet());
+ for (Object obj : keys) {
+ String key = String.valueOf(obj).toLowerCase();
+ Object value = map.get(obj);
+ map.remove(obj);
+ map.put(key, value);
+ }
+ }
+
+ public static void browseKeySetToLowerCase(Object obj, List ignore) {
+ if (obj instanceof Map) {
+ keySetToLowerCase((Map) obj);
+
+ for (Object key : ((Map) obj).keySet()) {
+ if (!ignore.contains(key)) {
+ browseKeySetToLowerCase(((Map) obj).get(key), ignore);
+ }
+ }
+ } else if (obj instanceof List) {
+ for (Object tmp : (List) obj) {
+ browseKeySetToLowerCase(tmp, ignore);
+ }
+ }
+ }
+}
1
0
r1246 - in trunk/eugene/src/main/java/org/nuiton/eugene/models/object/reader: . yaml
by agiraudet@users.nuiton.org 15 May '13
by agiraudet@users.nuiton.org 15 May '13
15 May '13
Author: agiraudet
Date: 2013-05-15 17:38:03 +0200 (Wed, 15 May 2013)
New Revision: 1246
Url: http://nuiton.org/projects/eugene/repository/revisions/1246
Log:
modification de eugene/models/object/reader/YamlObjectModelReader.java : nouveaux appels des m?\195?\169thodes de la classe YamlToObjectModel
modification de eugene/models/object/reader/yaml/YamlToObjectModel.java : nouvelle impl?\195?\169mentation et nouvelles fonctionnalit?\195?\169s
Modified:
trunk/eugene/src/main/java/org/nuiton/eugene/models/object/reader/YamlObjectModelReader.java
trunk/eugene/src/main/java/org/nuiton/eugene/models/object/reader/yaml/YamlToObjectModel.java
Modified: trunk/eugene/src/main/java/org/nuiton/eugene/models/object/reader/YamlObjectModelReader.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/models/object/reader/YamlObjectModelReader.java 2013-05-14 09:45:39 UTC (rev 1245)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/models/object/reader/YamlObjectModelReader.java 2013-05-15 15:38:03 UTC (rev 1246)
@@ -29,6 +29,7 @@
import org.apache.commons.logging.LogFactory;
import org.nuiton.eugene.ModelHelper;
import org.nuiton.eugene.models.object.ObjectModel;
+import org.nuiton.eugene.models.object.reader.yaml.Test;
import org.nuiton.eugene.models.object.reader.yaml.YamlToObjectModel;
import org.yaml.snakeyaml.error.YAMLException;
@@ -55,18 +56,13 @@
@Override
protected void beforeReadFile(File... files) {
super.beforeReadFile(files);
- //TODO : instancier parser yaml + controler clefs des maps
yamlToObjectModel = new YamlToObjectModel();
}
@Override
protected void readFileToModel(File file, ObjectModel model) throws IOException {
try {
- //TODO
- //test
- //NOTE: model deja instance
- yamlToObjectModel.test(file, model);
- //test
+ yamlToObjectModel.loadFile(file,model);
} catch (YAMLException e) {
throw new IOException("Unable to parse ObjectModel input file : " + file, e);
}
Modified: trunk/eugene/src/main/java/org/nuiton/eugene/models/object/reader/yaml/YamlToObjectModel.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/models/object/reader/yaml/YamlToObjectModel.java 2013-05-14 09:45:39 UTC (rev 1245)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/models/object/reader/yaml/YamlToObjectModel.java 2013-05-15 15:38:03 UTC (rev 1246)
@@ -7,431 +7,687 @@
import java.io.*;
import java.util.*;
+import static org.nuiton.eugene.models.object.reader.yaml.YamlUtil.browseKeySetToLowerCase;
/**
* User: agiraudet
- * Date: 06/05/13
- * Time: 12:08
- * <p/>
- * Note1: le parsage se base sur la syntaxe 5-1uml.yaml
- * Note2: surcharger les méthodes ou le langage pour les prochaines syntaxes ?
+ * Date: 15/05/13
+ * Time: 11:15
*/
public class YamlToObjectModel {
protected Yaml yaml;
- protected Object modelYAML;
- protected ObjectModelImpl modelOM;
-
protected String packageOM;
protected Map<String,String> imports;
- private String _log = "/tmp/log.yaml.txt";
+ //mots clefs
+ public static final String IMPORTS = "imports";
+ public static final String PACKAGE = "package";
+ public static final String VERSION = "version";
+ public static final String NAME = "name";
+ public static final String CLASS = "class";
+ public static final String INTERFACE = "interface";
+ public static final String CLASS_ASSOCIATION = "classassociation";
+ public static final String ENUMERATION = "enumeration";
+ public static final String STATIC = "static";
+ public static final String DOCUMENTATION = "documentation";
+ public static final String TAG_VALUES = "tagvalues";
+ public static final String COMMENTS = "comments";
+ public static final String STEREOTYPES = "stereotype";
+ public static final String EXTERN = "extern";
+ public static final String INNER = "inner";
+ public static final String TYPE = "type";
+ public static final String ATTRIBUTE = "attribute";
+ public static final String OPERATION = "operation";
+ public static final String SUPER_INTERFACES = "superinterfaces";
+ public static final String SUPER_CLASSES = "superclasses";
+ public static final String ORDERING = "ordering";
+ public static final String DEFAULT_VALUE = "defaultvalue";
+ public static final String MIN_MULTIPLICITY = "minmultiplicity";
+ public static final String MAX_MULTIPLICITY = "maxmultiplicity";
+ public static final String ORDERED = "ordered";
+ public static final String UNIQUE = "unique";
+ public static final String NAVIGABLE = "navigable";
+ public static final String ASSOCIATION_TYPE = "associationtype";
+ public static final String FINAL = "final";
+ public static final String ASSOCIATION_CLASS_NAME = "associationclassname";
+ public static final String REVERSE_ATTRIBUTE_NAME = "reverseattributename";
+ public static final String REVERSE_MAX_MULTIPLICITY = "reversemaxmultiplicity";
+ public static final String TRANSIENT = "transient";
+ public static final String VISIBILITY = "visibility";
+ public static final String ABSTRACT = "abstract";
+ public static final String PARAMETER = "parameter";
+ public static final String RETURN_PARAMETER = "returnparameter";
+ public static final String BODY_CODE = "bodeycode";
+ public static final String PARTICIPANT = "participant";
+ public static final String LITERAL = "literal";
- public YamlToObjectModel() {
- //TODO : mettre toutes les clefs des Maps en minuscules
- //TODO : instancier le parseur YAML (éviter une instance par fichier chargé)
- //TODO : verifier syntaxe du code -> utiliser convention de Sun
- //TODO : differencier attributs optionnels/obligatoires :: if null -> valeur par defaut, else -> valeur | valeurs par defaut dans fichier yaml ?
- //TODO : charger les éléments du même niveau dans la même méthode
- //TODO : Impl or not Impl ?
- yaml = new Yaml();
- modelYAML = null;
- modelOM = null;
- this.startLog();
- }
-
- private void startLog() {
+ private boolean _log = false;
+ private void log(String str) throws IOException {
FileWriter log = null;
- try {
- log = new FileWriter(this._log, false);
+ String path = "/tmp/log.yaml.txt";
+ if(_log)
+ {
+ log = new FileWriter(path, _log);
+ log.write("[LOG] " + str + "\n");
+ log.close();
+ }
+ else
+ {
+ log = new FileWriter(path, _log);
log.write("[LOG] start v1.0\n");
log.close();
- } catch (IOException e) {
- e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ _log = true;
}
}
- private void writeLog(String str) {
- FileWriter log = null;
- try {
- log = new FileWriter(this._log, true);
- log.write("[LOG] " + str + "\n");
- log.close();
- } catch (IOException e) {
- e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
- }
+ public YamlToObjectModel()
+ {
+ yaml = new Yaml();
}
- public void test(File file, ObjectModel model) throws IOException {
- //load file
+ public void loadFile(File file, ObjectModel model) throws IOException {
+ ObjectModelImpl modelOM = (ObjectModelImpl) model;
InputStream input = new FileInputStream(file);
- modelYAML = this.yaml.load(input);
+ Object modelYAML = yaml.load(input);
input.close();
- //file loaded
- modelOM = (ObjectModelImpl) model;
- loadModel();
+
+ List<String> ignore = new LinkedList<String>();
+ ignore.add("imports");
+ ignore.add("tagvalues");
+ browseKeySetToLowerCase(modelYAML, ignore);
+
+ loadModel(modelYAML,modelOM);
}
- //TODO : utiliser design pattern
- //TODO : utiliser genericite
- public void loadModel() {
- if (modelYAML instanceof List) {
- loadImports();
- Object nameYAML = collectElement((List) modelYAML, "name");
- if(nameYAML != null)
+ public Object collectElement(List data, Object key) {
+ for (Object obj : data) {
+ if (obj instanceof Map) {
+ if (((Map) obj).containsKey(key)) {
+ return ((Map) obj).get(key);
+ }
+ }
+ }
+ return null;
+ }
+
+ public List collectAllElements(List data, Object key) {
+ List res = new LinkedList();
+ for (Object obj : data) {
+ if (obj instanceof Map) {
+ if (((Map) obj).containsKey(key)) {
+ res.add(((Map) obj).get(key));
+ }
+ }
+ }
+ return res;
+ }
+
+ public void loadModel(Object modelYAML, ObjectModelImpl modelOM)
+ {
+ if(modelYAML instanceof List)
+ {
+ //load imports
+ imports = new LinkedHashMap<String, String>();
+ Object importsYAML = collectElement((List) modelYAML, IMPORTS);
+ if(importsYAML instanceof Map)
{
- modelOM.setName(String.valueOf(nameYAML));
+ for(Object entry : ((Map) importsYAML).entrySet())
+ {
+ if(entry instanceof Map.Entry)
+ {
+ imports.put(String.valueOf(((Map.Entry) entry).getKey()),String.valueOf(((Map.Entry) entry).getValue()));
+ }
+ }
}
+
+ //load package
+ Object packageYAML = collectElement((List) modelYAML, PACKAGE);
+ if(packageYAML == null)
+ {
+ ;
+ }
else
{
- ;//TODO : charger valeur par defaut ou lever exception ?
+ packageOM = String.valueOf(packageYAML);
}
- Object versionYAML = collectElement((List) modelYAML, "version");
- if(versionYAML != null)
+ Object nameYAML = collectElement((List) modelYAML, NAME);
+ if(nameYAML == null)
{
- modelOM.setVersion(String.valueOf(versionYAML));
+ ;
}
else
{
- ;//TODO : charger valeur par defaut
+ modelOM.setName(String.valueOf(nameYAML));
}
- Object packageYAML = collectElement((List) modelYAML, "package");
- if(packageYAML != null)
+ Object versionYAML = collectElement((List) modelYAML, VERSION);
+ if(versionYAML == null)
{
- packageOM = String.valueOf(packageYAML);
+ ;
}
else
{
- ;//TODO : charger valeur par defaut
+ modelOM.setVersion(String.valueOf(versionYAML));
}
- //modelOM.setName(String.valueOf(this.collectElement((List) modelYAML, "name")));
- //modelOM.setVersion(String.valueOf(this.collectElement((List) modelYAML, "version")));
+ Object tagValuesYAML = collectElement((List) modelYAML, TAG_VALUES);
+ if(tagValuesYAML instanceof Map)
+ {
+ for(Object entry : ((Map) tagValuesYAML).entrySet())
+ {
+ if(entry instanceof Map.Entry)
+ {
+ modelOM.addTagValue(String.valueOf(((Map.Entry) entry).getKey()),String.valueOf(((Map.Entry) entry).getValue()));
+ }
+ }
+ }
- List classesYAML = this.collectAllElement((List) modelYAML, "class");
- for (Object classYAML : classesYAML) {
- ObjectModelClassImpl classOM = loadClass(classYAML);
- //tester null ?
+ List classesYAML = collectAllElements((List) modelYAML, CLASS);
+ for(Object classYAML : classesYAML)
+ {
+ ObjectModelClassImpl classOM = new ObjectModelClassImpl();
+ loadClass(classYAML,classOM);
modelOM.addClass(classOM);
}
- } else {
- ;//TODO : lever exception
+
+ List interfacesYAML = collectAllElements((List) modelYAML, INTERFACE);
+ for(Object interfaceYAML : interfacesYAML)
+ {
+ ObjectModelInterfaceImpl interfaceOM = new ObjectModelInterfaceImpl();
+ loadInterface(interfaceYAML,interfaceOM);
+ modelOM.addInterface(interfaceOM);
+ }
+
+ List classesAssociationYAML = collectAllElements((List) modelYAML, CLASS_ASSOCIATION);
+ for(Object classAssociationYAML : classesAssociationYAML)
+ {
+ ObjectModelAssociationClassImpl classAssociationOM = new ObjectModelAssociationClassImpl();
+ loadAssociationClass(classAssociationYAML,classAssociationOM);
+ modelOM.addAssociationClass(classAssociationOM);
+ }
+
+ List enumerationsYAML = collectAllElements((List) modelYAML, ENUMERATION);
+ for(Object enumerationYAML : enumerationsYAML)
+ {
+ ObjectModelEnumerationImpl enumerationOM = new ObjectModelEnumerationImpl();
+ loadEnumeration(enumerationYAML,enumerationOM);
+ modelOM.addEnumeration(enumerationOM);
+ }
+
}
+ //return true/false -> chargement reussi ?
}
- public ObjectModelClassImpl loadClass(Object classYAML) {
- if (classYAML instanceof List) {
- ObjectModelClassImpl classOM = new ObjectModelClassImpl();
+ public void loadElement(Object elementYAML, ObjectModelElementImpl elementOM)
+ {
+ if(elementYAML instanceof List)
+ {
+ //TODO: setDeclaringElement
+ //TODO: setObjectModelImpl
+ //TODO: addModifier
- this.loadStereotypes((List) classYAML, classOM);
- this.loadTagValues((List) classYAML, classOM);
- this.loadComments((List) classYAML, classOM);
+ Object nameYAML = collectElement((List) elementYAML, NAME);
+ if(nameYAML == null)
+ {
+ ;
+ }
+ else
+ {
+ elementOM.setName(String.valueOf(nameYAML));
+ }
- classOM.setPackage(packageOM);
+ Object staticYAML = collectElement((List) elementYAML, STATIC);
+ if(staticYAML == null)
+ {
+ ;
+ }
+ else
+ {
+ elementOM.setStatic(Boolean.valueOf(String.valueOf(staticYAML)));
+ }
- Object nameYAML = collectElement((List) classYAML, "name");
- if(nameYAML != null)
+ Object documentationYAML = collectElement((List) elementYAML, DOCUMENTATION);
+ if(documentationYAML == null)
{
- classOM.setName(String.valueOf(nameYAML));
+ ;
}
else
{
- //TODO : lever exception ?
+ elementOM.setDocumentation(String.valueOf(documentationYAML));
}
- Object abstractYAML = collectElement((List) classYAML, "abstract");
- if(abstractYAML != null)
+ Object tagValuesYAML = collectElement((List) elementYAML, TAG_VALUES);
+ if(tagValuesYAML instanceof Map)
{
- classOM.setAbstract(Boolean.valueOf(String.valueOf(abstractYAML)));//degolass
+ for(Object entry : ((Map) tagValuesYAML).entrySet())
+ {
+ if(entry instanceof Map.Entry)
+ {
+ elementOM.addTagValue(String.valueOf(((Map.Entry) entry).getKey()),String.valueOf(((Map.Entry) entry).getValue()));
+ }
+ }
}
+
+ Object commentsYAML = collectElement((List) elementYAML, COMMENTS);
+ if(commentsYAML instanceof List)
+ {
+ for(Object comment : (List) commentsYAML)
+ {
+ elementOM.addComment(String.valueOf(comment));
+ }
+ }
+
+ Object stereotypesYAML = collectElement((List) elementYAML, STEREOTYPES);
+ {
+ if(stereotypesYAML instanceof List)
+ {
+ for(Object stereotype : (List) stereotypesYAML)
+ {
+ ObjectModelImplRef stereotypeOM = new ObjectModelImplRef();
+ stereotypeOM.setName(String.valueOf(stereotype));
+ elementOM.addStereotype(stereotypeOM);
+ }
+ }
+ }
+ }
+ }
+
+ public void loadClassifier(Object classifierYAML, ObjectModelClassifierImpl classifierOM)
+ {
+ if(classifierYAML instanceof List)
+ {
+ //TODO: addDependency
+
+ loadElement(classifierYAML, classifierOM);
+
+ Object packageYAML = collectElement((List) classifierYAML, PACKAGE);
+ if(packageYAML == null)
+ {
+ classifierOM.setPackage(packageOM);
+ }
else
{
- ;//TODO : charger la valeur par defaut
+ classifierOM.setPackage(String.valueOf(packageYAML));
}
- /*classOM.setName(String.valueOf(this.collectElement((List) classYAML, "name")));
- //Object finalYAML = this.collectElement((List) classYAML, "final");//final not implemented by ObjectModel
- Object abstractYAML = this.collectElement((List) classYAML, "abstract");
- //TODO : utiliser operateur ternaire
- if (abstractYAML instanceof Boolean) {
- classOM.setAbstract((Boolean) abstractYAML);
- } else//sale
+ Object externYAML = collectElement((List) classifierYAML, EXTERN);
+ if(externYAML == null)
{
- classOM.setAbstract(Boolean.valueOf(String.valueOf(abstractYAML)));
- }*/
+ ;
+ }
+ else
+ {
+ classifierOM.setExtern(Boolean.valueOf(String.valueOf(externYAML)));
+ }
- //TODO : loadAttributes
- List attributesYAML = this.collectAllElement((List) classYAML, "attribute");
- for (Object attributeYAML : attributesYAML) {
- ObjectModelAttributeImpl attributeOM = loadAttribute(attributeYAML);
- classOM.addAttribute(attributeOM);
+ Object innerYAML = collectElement((List) classifierYAML, INNER);
+ if(innerYAML == null)
+ {
+ ;
}
- //TODO : loadOperations
+ else
+ {
+ classifierOM.setInner(Boolean.valueOf(String.valueOf(innerYAML)));
+ }
- //this.modelOM.addClass(classOM);
- return classOM;
- } else {
- ;//TODO : lever exception
- return null;
+ Object typeYAML = collectElement((List) classifierYAML, TYPE);
+ if(typeYAML == null)
+ {
+ ;
+ }
+ else
+ {
+ classifierOM.setType(String.valueOf(typeYAML));
+ }
+
+ List attributesYAML = collectAllElements((List) classifierYAML, ATTRIBUTE);
+ for(Object attributeYAML : attributesYAML)
+ {
+ ObjectModelAttributeImpl attributeOM = new ObjectModelAttributeImpl();
+ loadAttribute(attributeYAML, attributeOM);
+ classifierOM.addAttribute(attributeOM);
+ }
+
+ List operationsYAML = collectAllElements((List) classifierYAML, OPERATION);
+ for(Object operationYAML : operationsYAML)
+ {
+ ObjectModelOperationImpl operationOM = new ObjectModelOperationImpl();
+ loadOperation(operationYAML, operationOM);
+ classifierOM.addOperation(operationOM);
+ }
+
+ Object superInterfacesYAML = collectElement((List) classifierYAML, SUPER_INTERFACES);
+ if(superInterfacesYAML instanceof List)
+ {
+ for(Object superInterface : (List) superInterfacesYAML)
+ {
+ ObjectModelImplRef superInterfaceOM = new ObjectModelImplRef();
+ superInterfaceOM.setName(String.valueOf(superInterface));
+ classifierOM.addInterface(superInterfaceOM);
+ }
+ }
}
}
- public void loadInterface(Object _interface) {
- ;//TODO
+ public void loadClass(Object classYAML, ObjectModelClassImpl classOM)
+ {
+ if(classYAML instanceof List)
+ {
+ //TODO: addInnerClassifier
+
+ loadClassifier(classYAML, classOM);
+
+ Object abstractYAML = collectElement((List) classYAML, ABSTRACT);
+ if(abstractYAML == null)
+ {
+ ;
+ }
+ else
+ {
+ classOM.setAbstract(Boolean.valueOf(String.valueOf(abstractYAML)));
+ }
+
+ Object superClassesYAML = collectElement((List) classYAML, SUPER_CLASSES);
+ if(superClassesYAML instanceof List)
+ {
+ for(Object superClass : (List) superClassesYAML)
+ {
+ ObjectModelImplRef superClassOM = new ObjectModelImplRef();
+ superClassOM.setName(String.valueOf(superClass));
+ classOM.addSuperclass(superClassOM);
+ }
+ }
+ }
}
- public void loadAssociationClass(Object _associationClass) {
- ;//TODO
+ public void loadInterface(Object interfaceYAML, ObjectModelInterfaceImpl interfaceOM)
+ {
+ if(interfaceYAML instanceof List)
+ {
+ loadClassifier(interfaceYAML, interfaceOM);
+ }
}
- public void loadEnumeration(Object _enumeration) {
- ;//TODO
+ public void loadAssociationClass(Object associationClassYAML, ObjectModelAssociationClassImpl associationClassOM)
+ {
+ if(associationClassYAML instanceof List)
+ {
+ loadClass(associationClassYAML, associationClassOM);
+
+ List participantsYAML = collectAllElements((List) associationClassYAML, PARTICIPANT);
+ for(Object participantYAML : participantsYAML)
+ {
+ ObjectModeImplAssociationClassParticipant participant = new ObjectModeImplAssociationClassParticipant();
+ //TODO:
+ }
+ }
}
- public ObjectModelAttributeImpl loadAttribute(Object attributeYAML) {
- if(attributeYAML instanceof List)
+ public void loadEnumeration(Object enumerationYAML, ObjectModelEnumerationImpl enumerationOM)
+ {
+ if(enumerationYAML instanceof List)
{
- ObjectModelAttributeImpl attributeOM = new ObjectModelAttributeImpl();
+ loadElement(enumerationYAML, enumerationOM);
- this.loadStereotypes((List) attributeYAML, attributeOM);
- this.loadTagValues((List) attributeYAML, attributeOM);
- this.loadComments((List) attributeYAML, attributeOM);
+ Object literalsYAML = collectElement((List) enumerationYAML, LITERAL);
+ if(literalsYAML instanceof List)
+ {
+ for(Object literalYAML : (List) literalsYAML)
+ {
+ ObjectModelImplRef literalOM = new ObjectModelImplRef();
+ literalOM.setName(String.valueOf(literalYAML));
+ enumerationOM.addLiteral(literalOM);
+ }
+ }
+ }
+ }
- Object nameYAML = collectElement((List) attributeYAML, "name");
- if(nameYAML != null)
+ public void loadParameter(Object parameterYAML, ObjectModelParameterImpl parameterOM)
+ {
+ if(parameterYAML instanceof List)
+ {
+ loadElement(parameterYAML, parameterOM);
+
+ Object orderingYAML = collectElement((List) parameterYAML, ORDERING);
+ if(orderingYAML == null)
{
- attributeOM.setName(String.valueOf(nameYAML));
+ ;
}
else
{
- //TODO : charger la valeur par defaut
+ parameterOM.setOrdering(String.valueOf(orderingYAML));
}
- Object typeYAML = collectElement((List) attributeYAML, "type");
- if(typeYAML != null)
+ Object typeYAML = collectElement((List) parameterYAML, TYPE);
+ if(typeYAML == null)
{
- //TODO : gerer les imports et detection des types primitifs...
+ ;
+ }
+ else
+ {
String type = String.valueOf(typeYAML);
if(imports.containsKey(type))
{
- attributeOM.setType(imports.get(type));
+ parameterOM.setType(imports.get(type));
}
else
{
- attributeOM.setType(type);
+ parameterOM.setType(type);
}
}
+
+ Object defaultValueYAML = collectElement((List) parameterYAML, DEFAULT_VALUE);
+ if(defaultValueYAML == null)
+ {
+ ;
+ }
else
{
- ;//TODO : lever exception
+ parameterOM.setDefaultValue(String.valueOf(defaultValueYAML));
}
- Object visibilityYAML = collectElement((List) attributeYAML, "visibility");
- if(visibilityYAML != null)
+ Object minMultiplicityYAML = collectElement((List) parameterYAML, MIN_MULTIPLICITY);
+ if(minMultiplicityYAML == null)
{
- attributeOM.setVisibility(String.valueOf(visibilityYAML));
+ ;
}
else
{
- //TODO : charger valeur par defaut
+ parameterOM.setMinMultiplicity(Integer.valueOf(String.valueOf(minMultiplicityYAML)));
}
- Object staticYAML = collectElement((List) attributeYAML, "static");
- if(staticYAML != null)
+ Object maxMultiplicityYAML = collectElement((List) parameterYAML, MAX_MULTIPLICITY);
+ if(maxMultiplicityYAML == null)
{
- attributeOM.setStatic(Boolean.valueOf(String.valueOf(staticYAML)));//tester boolean ?
+ ;
}
else
{
- //TODO : charger valeur par defaut
+ parameterOM.setMaxMultiplicity(Integer.valueOf(String.valueOf(maxMultiplicityYAML)));
}
- Object finalYAML = collectElement((List) attributeYAML, "final");
- if(finalYAML != null)
+ Object orderedYAML = collectElement((List) parameterYAML, ORDERED);
+ if(orderedYAML == null)
{
- attributeOM.setFinal(Boolean.valueOf(String.valueOf(finalYAML)));
+ ;
}
else
{
- //TODO : charger la valeur par defaut
+ parameterOM.setOrdered(Boolean.valueOf(String.valueOf(orderedYAML)));
}
- Object associationTypeYAML = collectElement((List) attributeYAML, "asociationType");
- if(associationTypeYAML != null)
+ Object uniqueYAML = collectElement((List) parameterYAML, UNIQUE);
+ if(uniqueYAML == null)
{
- attributeOM.setAssociationType(String.valueOf(associationTypeYAML));
+ ;
}
else
{
- //TODO : charger la valeur par defaut
+ parameterOM.setUnique(Boolean.valueOf(String.valueOf(uniqueYAML)));
}
+ }
+ }
- Object minMultiplicityYAML = collectElement((List) attributeYAML, "minMultiplicity");
- if(minMultiplicityYAML != null)
+ public void loadAttribute(Object attributeYAML, ObjectModelAttributeImpl attributeOM)
+ {
+ if(attributeYAML instanceof List)
+ {
+ loadParameter(attributeYAML, attributeOM);
+
+ Object navigableYAML = collectElement((List) attributeYAML, NAVIGABLE);
+ if(navigableYAML == null)
{
- attributeOM.setMinMultiplicity(Integer.valueOf(String.valueOf(minMultiplicityYAML)));
+ ;
}
else
{
- //TODO : charger la valeur par defaut
+ attributeOM.setNavigable(Boolean.valueOf(String.valueOf(navigableYAML)));
}
- Object maxMultiplicityYAML = collectElement((List) attributeYAML, "maxMultiplicity");
- if(maxMultiplicityYAML != null)
+ Object associationTypeYAML = collectElement((List) attributeYAML, ASSOCIATION_TYPE);
+ if(associationTypeYAML == null)
{
- attributeOM.setMaxMultiplicity(Integer.valueOf(String.valueOf(maxMultiplicityYAML)));
+ ;
}
else
{
- //TODO : charger la valeur par defaut
+ attributeOM.setAssociationType(String.valueOf(associationTypeYAML));
}
- Object navigableYAML = collectElement((List) attributeYAML, "navigable");
- if(navigableYAML != null)
+ Object finalYAML = collectElement((List) attributeYAML, FINAL);
+ if(finalYAML == null)
{
- attributeOM.setNavigable(Boolean.valueOf(String.valueOf(navigableYAML)));
+ ;
}
else
{
- //TODO : charger la valeur par defaut
+ attributeOM.setFinal(Boolean.valueOf(String.valueOf(finalYAML)));
}
- Object orderingYAML = collectElement((List) attributeYAML, "ordering");
- if(orderingYAML != null)
+ Object staticYAML = collectElement((List) attributeYAML, STATIC);
+ if(staticYAML == null)
{
- attributeOM.setOrdering(String.valueOf(orderingYAML));
+ ;
}
else
{
- //TODO : charger la valeur par defaut
+ attributeOM.setStatic(Boolean.valueOf(String.valueOf(staticYAML)));
}
- Object labelYAML = collectElement((List) attributeYAML, "label");
- if(labelYAML != null)
+ Object associationClassNameYAML = collectElement((List) attributeYAML, ASSOCIATION_CLASS_NAME);
+ if(associationClassNameYAML == null)
{
- //TODO : gestion des labels et operations correspondantes
- writeLog("label="+String.valueOf(labelYAML));
+ ;
}
+ else
+ {
+ attributeOM.setAssociationClassName(String.valueOf(associationClassNameYAML));
+ }
- return attributeOM;
- }
- return null;
- }
+ Object reverseAttributeNameYAML = collectElement((List) attributeYAML, REVERSE_ATTRIBUTE_NAME);
+ if(reverseAttributeNameYAML == null)
+ {
+ ;
+ }
+ else
+ {
+ attributeOM.setReverseAttributeName(String.valueOf(reverseAttributeNameYAML));
+ }
- public void loadOperation(Object operationYAML) {
- ;//TODO
- }
+ Object reverseMaxMultiplicityYAML = collectElement((List) attributeYAML, REVERSE_MAX_MULTIPLICITY);
+ if(reverseMaxMultiplicityYAML == null)
+ {
+ ;
+ }
+ else
+ {
+ attributeOM.setReverseMaxMultiplicity(Integer.valueOf(String.valueOf(reverseMaxMultiplicityYAML)));
+ }
- public void loadImports()
- { //pour etre sur que les imports seront des <String,String>
- if(modelYAML instanceof List)//verification inutile ?
- {
- Map<Object,Object> tmp = collectMap((List) modelYAML,"imports");
- imports = new LinkedHashMap();
- for(Map.Entry<Object,Object> entry : tmp.entrySet())
+
+ Object transientYAML = collectElement((List) attributeYAML, TRANSIENT);
+ if(transientYAML == null)
{
- imports.put(String.valueOf(entry.getKey()),String.valueOf(entry.getValue()));
+ ;
}
- writeLog("imports="+imports);
- }
- }
+ else
+ {
+ attributeOM.setTransient(Boolean.valueOf(String.valueOf(transientYAML)));
+ }
- public void loadStereotypes(List elementYAML, ObjectModelElementImpl elementOM) {
- Object stereotypes = this.collectElement(elementYAML, "stereotype");
- if (stereotypes instanceof List) {
- for (Object stereotype : (List) stereotypes) {
- ObjectModelImplRef ref = new ObjectModelImplRef();
- ref.setName(String.valueOf(stereotype));
- elementOM.addStereotype(ref);
+ Object visibilityYAML = collectElement((List) attributeYAML, VISIBILITY);
+ if(visibilityYAML == null)
+ {
+ ;
}
+ else
+ {
+ attributeOM.setVisibility(String.valueOf(visibilityYAML));
+ }
}
}
- //TODO : pour model
- public void loadComments(List elementYAML, ObjectModelElementImpl elementOM) {
- Object comments = this.collectElement(elementYAML, "comments");
- if (comments instanceof List) {
- for (Object comment : (List) comments) {
- elementOM.addComment(String.valueOf(comment));
+ public void loadOperation(Object operationYAML, ObjectModelOperationImpl operationOM)
+ {
+ if(operationYAML instanceof List)
+ {
+ //TODO: addExceptionParameter
+
+ loadElement(operationYAML, operationOM);
+
+ Object abstractYAML = collectElement((List) operationYAML, ABSTRACT);
+ if(abstractYAML == null)
+ {
+ ;
}
- }
- }
+ else
+ {
+ operationOM.setAbstract(Boolean.valueOf(String.valueOf(abstractYAML)));
+ }
- //TODO : pour model
- public void loadTagValues(List elementYAML, ObjectModelElementImpl elementOM) {
- Object tagValues = this.collectElement(elementYAML, "tagValues");
- if (tagValues instanceof Map) {
- for (Object entry : ((Map) tagValues).entrySet()) {
- String key = String.valueOf(((Map.Entry) entry).getKey());
- String value = String.valueOf(((Map.Entry) entry).getValue());
- elementOM.addTagValue(key, value);
+ Object visibilityYAML = collectElement((List) operationYAML, VISIBILITY);
+ if(visibilityYAML == null)
+ {
+ ;
}
- }
- }
+ else
+ {
+ operationOM.setVisibility(String.valueOf(visibilityYAML));
+ }
- public Object collectElement(List data, Object key) {
- for (Object obj : data) {
- if (obj instanceof Map) {
- if (((Map) obj).containsKey(key)) {
- return ((Map) obj).get(key);
- }
+ Object returnParameterYAML = collectElement((List) operationYAML, RETURN_PARAMETER);
+ if(returnParameterYAML == null)
+ {
+ ;
}
- }
- return null;
- }
+ else
+ {
+ ObjectModelParameterImpl parameterOM = new ObjectModelAttributeImpl();
+ loadParameter(returnParameterYAML, parameterOM);
+ operationOM.setReturnParameter(parameterOM);
+ }
- public List collectList(List data, Object key) {
- for (Object obj : data) {
- if (obj instanceof Map) {
- if (((Map) obj).containsKey(key)) {
- if (((Map) obj).get(key) instanceof List) {
- return (List) ((Map) obj).get(key);
- /*List res = new LinkedList();
- for(Object tmp : (List) ((Map) obj).get(_key))
- {
- res.add(tmp);
- }
- return res;*/
- }
- }
+ Object bodyCodeYAML = collectElement((List) operationYAML, BODY_CODE);
+ if(bodyCodeYAML == null)
+ {
+ ;
}
- }
- return null;
- }
+ else
+ {
+ operationOM.setBodyCode(String.valueOf(bodyCodeYAML));
+ }
- public Map collectMap(List data, Object key) {
- for (Object obj : data) {
- if (obj instanceof Map) {
- if (((Map) obj).containsKey(key)) {
- if (((Map) obj).get(key) instanceof Map) {
- return (Map) ((Map) obj).get(key);
- /*Map res = new LinkedHashMap();
- for(Object tmp : ((Map) ((Map) obj).get(_key)).entrySet())
- {
- if(tmp instanceof Map.Entry)//ou cast
- {
- res.put(((Map.Entry) tmp).getKey(),((Map.Entry) tmp).getValue());
- }
- }
- return res;*/
- }
+ List parametersYAML = collectAllElements((List) operationYAML, PARAMETER);
+ {
+ for(Object parameterYAML : parametersYAML)
+ {
+ ObjectModelParameterImpl parameterOM = new ObjectModelAttributeImpl();
+ loadParameter(parameterYAML, parameterOM);
+ operationOM.addParameter(parameterOM);
}
}
}
- return null;
}
- //collectElements
- public List collectAllElement(List data, Object key) {
- List res = new LinkedList();
- for (Object obj : data) {
- if (obj instanceof Map) {
- if (((Map) obj).containsKey(key)) {
- res.add(((Map) obj).get(key));
- }
- }
- }
- return res;
- }
}
1
0
Jenkins build is back to normal : eugene » EUGene :: Java templates #1133
by admin+hudson@codelutin.com 14 May '13
by admin+hudson@codelutin.com 14 May '13
14 May '13
Jenkins build is back to normal : eugene » EUGene :: Maven plugin #1133
by admin+hudson@codelutin.com 14 May '13
by admin+hudson@codelutin.com 14 May '13
14 May '13
Jenkins build is back to normal : eugene » EUGene :: EUGene #1133
by admin+hudson@codelutin.com 14 May '13
by admin+hudson@codelutin.com 14 May '13
14 May '13
14 May '13