analyseWriter/src/baseEvaluations/creerNouvelleEvaluation.java
pablo rodriguez 6c88b6b3b4 V4.4.4
Préparation pour nouvelle version avec gestion de la base des
évaluations.
La méthode analyseStyle peut être appliqué au niveau des styles de page
dans les en-têtes ou les pied de page.
2023-04-01 09:54:28 +02:00

120 lines
4.0 KiB
Java

package baseEvaluations;
import java.text.ParseException;
import java.util.Date;
import MEPTL.commandes;
import cXML.node;
public class creerNouvelleEvaluation {
node evaluation = new node();
boolean addBase = false;
public node getEvaluation() {
return evaluation;
}
public creerNouvelleEvaluation(String nameEval, boolean addBase) {
this.addBase=addBase;
evaluation = nouvelleEvaluation(evaluation, nameEval);
}
public creerNouvelleEvaluation(node evaluation) {
String name = "Nouvelle évaluation";
evaluation = nouvelleEvaluation(evaluation, name);
}
public creerNouvelleEvaluation(node evaluation, String name, boolean addBase) {
this.addBase = addBase;
evaluation = nouvelleEvaluation(evaluation, name);
}
private node nouvelleEvaluation(node evaluation, String nameEvaluation) {
evaluation.setNomElt("evaluation");
if(addBase) {
Date aujourdhui = new Date();
try {
evaluation.getAttributs().put("date", calcul.formatDateWriter.DateLibreOffice(aujourdhui));
} catch (ParseException e) {
e.printStackTrace();
}
}
evaluation.getAttributs().put("version", commandes.version);
evaluation.getAttributs().put("name", nameEvaluation);
evaluation.getAttributs().put("PathFilenameAnalysis", commandes.PathFilenameAnalysis);
evaluation.getAttributs().put("path", commandes.path);
evaluation.getAttributs().put("fichierStudentMoodle", String.valueOf(commandes.fichierStudentMoodle));
evaluation.getAttributs().put("sansFeeback", String.valueOf(commandes.sansFeeback) );
evaluation.getAttributs().put("noDetail", String.valueOf(commandes.noDetail) );
evaluation.getAttributs().put("noNote", String.valueOf(commandes.noNote) );
evaluation.getAttributs().put("zipfeedback", String.valueOf(commandes.zipfeedback) );
evaluation.getAttributs().put("verifHisto2", String.valueOf(commandes.verifHisto2) );
evaluation.getAttributs().put("ecritNoteCSV", String.valueOf(commandes.ecritNoteCSV) );
evaluation.getAttributs().put("newLogo", String.valueOf(commandes.newLogo) );
evaluation.getAttributs().put("noLogo", String.valueOf(commandes.noLogo) );
evaluation.getAttributs().put("analyse_nombres_modifications_simultané_maxi", String.valueOf(commandes.analyse_nombres_modifications_simultané_maxi) );
//Supprime le node fichier s'il existe.
node nodremove = evaluation.retourneFirstEnfantsByName("fichier");
if(!nodremove.isVide()) evaluation.getNodes().remove(nodremove);
evaluation.getNodes().add(commandes.sujet);
if(commandes.sujet.getAttributs().get("analysis_filename").contains(".xml")) {
evaluation.getAttributs().put("analysis_filename",commandes.sujet.getAttributs().get("analysis_filename"));
}else {
evaluation.getAttributs().put("analysis_filename",commandes.nameSujet);
}
evaluation.getAttributs().put("fourniCSV", String.valueOf(commandes.fourniCSV) );
if(commandes.nameCSV!=null) {
evaluation.getAttributs().put("nameCSV", commandes.nameCSV );
}else {
evaluation.getAttributs().put("nameCSV", "");
}
evaluation.getAttributs().put("fourniCSV", String.valueOf(commandes.fourniCSV) );
if(commandes.nameSVG!=null) {
evaluation.getAttributs().put("nameSVG", commandes.nameSVG );
}else {
evaluation.getAttributs().put("nameSVG", "" );
}
//Supprime le node fichier s'il existe.
nodremove = evaluation.retourneFirstEnfantsByName("fileCSV");
if(!nodremove.isVide()) evaluation.getNodes().remove(nodremove);
evaluation.getNodes().add(commandes.nodeCSV);
if(commandes.nameSVG!=null) {
if(!commandes.nameSVG.isBlank() && !commandes.contenuFichierSVG.isBlank()) {
node SVG = new node();
SVG.setNomElt("nodSVG");
SVG.setContenu(commandes.contenuFichierSVG);
evaluation.getNodes().add(SVG);
}
}
if(addBase) {
if(commandes.evaluationsBase!=null) {
commandes.evaluationsBase.getNodes().add(0, evaluation);
}
}
return evaluation;
}
}