key = nodeStyleParagraphSujet.getAttributs().keys();
while(key.hasMoreElements()) {
String k = key.nextElement();
if(nodeStyleParagraphSujet.getAttributs().get(k).contains("‼") || nodeStyleParagraphSujet.getAttributs().get(k).contains("‽")){
if(nodeStyleParagraphStudent!=null) {
String valueAttributStudent = nodeStyleParagraphStudent.getAttributs().get(k);
String valueAttributSujet = nodeStyleParagraphSujet.getAttributs().get(k).replace("‼", "‽");
node item = retourneNoteAvecResultatsAnalyse(nameItem,k, valueAttributStudent, valueAttributSujet,nameElt);
retour.getNodes().add(item);
}else {
String valueAttributStudent = "null";
String valueAttributSujet = nodeStyleParagraphSujet.getAttributs().get(k).replace("‼", "‽");
node item = retourneNoteAvecResultatsAnalyse(nameItem, k, valueAttributStudent, valueAttributSujet,nameElt);
retour.getNodes().add(item);
}
}
}
if(nodeStyleParagraphStudent!=null) {
if(nodeStyleParagraphSujet.retourneEnfantsByNameExist("style:paragraph-properties") && nodeStyleParagraphStudent.retourneEnfantsByNameExist("style:paragraph-properties") ) {
node propertiesSujet = nodeStyleParagraphSujet.retourneFirstEnfantsByName("style:paragraph-properties");
node propertiesStudent = nodeStyleParagraphStudent.retourneFirstEnfantsByName("style:paragraph-properties");
key = propertiesSujet.getAttributs().keys();
while(key.hasMoreElements()) {
String k = key.nextElement();
if(propertiesSujet.getAttributs().get(k).contains("‼") || propertiesSujet.getAttributs().get(k).contains("‽")){
if(propertiesStudent!=null) {
String valueAttributStudent = propertiesStudent.getAttributs().get(k);
String valueAttributSujet = propertiesSujet.getAttributs().get(k).replace("‼", "‽");
node item = retourneNoteAvecResultatsAnalyse(nameItem,k, valueAttributStudent, valueAttributSujet,"style:paragraph-properties");
retour.getNodes().add(item);
}else {
String valueAttributStudent = "null";
String valueAttributSujet = propertiesSujet.getAttributs().get(k).replace("‼", "‽");
node item = retourneNoteAvecResultatsAnalyse(nameItem, k, valueAttributStudent, valueAttributSujet,"style:paragraph-properties");
retour.getNodes().add(item);
}
}
}
}
}else {
node propertiesSujet = nodeStyleParagraphSujet.retourneFirstEnfantsByName("style:paragraph-properties");
key = propertiesSujet.getAttributs().keys();
while(key.hasMoreElements()) {
String k = key.nextElement();
if(propertiesSujet.getAttributs().get(k).contains("‼") || propertiesSujet.getAttributs().get(k).contains("‽")){
String valueAttributStudent = "null";
String valueAttributSujet = propertiesSujet.getAttributs().get(k).replace("‼", "‽");
node item = retourneNoteAvecResultatsAnalyse(nameItem, k, valueAttributStudent, valueAttributSujet,"style:paragraph-properties");
retour.getNodes().add(item);
}
}
}
if(nodeStyleParagraphStudent!=null) {
if(nodeStyleParagraphSujet.retourneEnfantsByNameExist("style:text-properties") && nodeStyleParagraphStudent.retourneEnfantsByNameExist("style:text-properties") ) {
node propertiesSujet = nodeStyleParagraphSujet.retourneFirstEnfantsByName("style:text-properties");
node propertiesStudent = nodeStyleParagraphStudent.retourneFirstEnfantsByName("style:text-properties");
key = propertiesSujet.getAttributs().keys();
while(key.hasMoreElements()) {
String k = key.nextElement();
if(propertiesSujet.getAttributs().get(k).contains("‼") || propertiesSujet.getAttributs().get(k).contains("‽")){
if(propertiesStudent!=null) {
String valueAttributStudent = propertiesStudent.getAttributs().get(k);
String valueAttributSujet = propertiesSujet.getAttributs().get(k).replace("‼", "‽");
node item = retourneNoteAvecResultatsAnalyse(nameItem,k, valueAttributStudent, valueAttributSujet,"style:text-properties");
retour.getNodes().add(item);
}else {
String valueAttributStudent = "null";
String valueAttributSujet = propertiesSujet.getAttributs().get(k).replace("‼", "‽");
node item = retourneNoteAvecResultatsAnalyse(nameItem, k, valueAttributStudent, valueAttributSujet,"style:text-properties");
retour.getNodes().add(item);
}
}
}
}
}else {
node propertiesSujet = nodeStyleParagraphSujet.retourneFirstEnfantsByName("style:text-properties");
key = propertiesSujet.getAttributs().keys();
while(key.hasMoreElements()) {
String k = key.nextElement();
if(propertiesSujet.getAttributs().get(k).contains("‼") || propertiesSujet.getAttributs().get(k).contains("‽")){
String valueAttributStudent = "null";
String valueAttributSujet = propertiesSujet.getAttributs().get(k).replace("‼", "‽");
node item = retourneNoteAvecResultatsAnalyse(nameItem, k, valueAttributStudent, valueAttributSujet,"style:text-properties");
retour.getNodes().add(item);
}
}
}
return retour;
}
/**
* Retourne le nom du fichier de l'étudiant pour le Zip pour Moodle.
*
* @param filename
* @param nodana
* @return
*/
public static String retourneLeNomDuFeedback( String filename,node nodana, node verif) {
System.getProperty("file.encoding","UTF-8");
int number_match = 2;
int mini_modification = 0;
boolean plagiat = false;
boolean copiercoller = false;
boolean pasAssezDeModification =false;
node verifStudent = null;
if((commandes.verifHisto||commandes.verifHisto2)) { //&&commandes.ecritNoteCSV&&commandes.fourniCSV
if(verif.getAttributs().get("number_match") != null) number_match = Integer.valueOf(verif.getAttributs().get("number_match"));
if(verif.getAttributs().get("mini_number_modification") != null) mini_modification = Integer.valueOf(verif.getAttributs().get("mini_number_modification"));
//verification du plagiat
verifStudent = verif.retourneFirstNodeByNameAndAttributValue("fichier", "dossier", nodana.retourneFirstEnfantsByName("ouverture").getAttributs().get("dossier"));
if(verifStudent != null) {
if(verifStudent.getAttributs().get("filename").equals(nodana.retourneFirstEnfantsByName("ouverture").getAttributs().get("filename"))) {
if(Integer.valueOf(verifStudent.getAttributs().get("nombre_correspondances_consecutives"))>number_match) plagiat=true;
if(!verifStudent.getAttributs().get("first_modification_identique").equals("null") && Integer.valueOf(verifStudent.getAttributs().get("nombre_correspondances_consecutives"))>=number_match) plagiat=true;
if(verifStudent.getAttributs().get("copier_coller")!=null) copiercoller=true;
if(Integer.valueOf(verifStudent.getAttributs().get("nombre_modification"))<=mini_modification) pasAssezDeModification=true;
}
}
}
//nom du fichier feedback
String metaS = nodana.retourneFirstEnfantsByName("ouverture").getAttributs().get("metaSujet");
if(metaS.equals("?")) metaS = "metaSujet-inconnu";
if(metaS.isEmpty()) metaS = "metaSujet-inconnu";
String cheminFeedBack = nodana.retourneFirstEnfantsByName("ouverture").getAttributs().get("dossier") +"-"+metaS; //+ "-DateLong" + aujourdhui.getTime()
boolean baremeABC = false;
if(nodana.retourneFirstEnfantsByName("ouverture").getAttributs().get("baremeABC")!=null) {
try {
baremeABC = Boolean.valueOf(nodana.retourneFirstEnfantsByName("ouverture").getAttributs().get("baremeABC"));
}catch (Exception e) {
}
}
if(!baremeABC) {
if(!commandes.noNote) {
if(!plagiat) cheminFeedBack = cheminFeedBack + "-" + nodana.retourneFirstEnfantsByName("bodyetnotation").getAttributs().get("note") + ".html";
if(plagiat) cheminFeedBack = cheminFeedBack + "-Plagiat.html";
if(copiercoller) cheminFeedBack = cheminFeedBack + "-Copier-Coller.html";
if(pasAssezDeModification) cheminFeedBack = cheminFeedBack + "-Pas assez de modification.html";
}else {
cheminFeedBack = cheminFeedBack + ".html";
}
}else {
if(!commandes.noNote) {
if(!plagiat) cheminFeedBack = cheminFeedBack + "-" + nodana.retourneFirstEnfantsByName("bodyetnotation").getAttributs().get("noteABC") + ".html";
if(plagiat) cheminFeedBack = cheminFeedBack + "-Plagiat.html";
if(copiercoller) cheminFeedBack = cheminFeedBack + "-Copier-Coller.html";
if(pasAssezDeModification) cheminFeedBack = cheminFeedBack + "-Pas assez de modification.html";
}else {
cheminFeedBack = cheminFeedBack + ".html";
}
}
return filename + cheminFeedBack;
}
/**
* Affichage uniquement dans la console Les erreurs.
* @param nod
*/
public static StringBuilder messageSystem(node nod) {
StringBuilder Text = new StringBuilder();
node ouverture = nod.retourneFirstEnfantsByName("ouverture");
node notation = nod.retourneFirstEnfantsByName("bodyetnotation");
node erreurs = nod.retourneFirstEnfantsByName("erreurs");
boolean flagError = Boolean.valueOf(erreurs.getAttributs().get("oneError"));
Text.append("
");
if(!commandes.fichierStudentMoodle) {
Text.append("Dossier analysé : " + ouverture.getAttributs().get("dossier") + "
");
System.out.println("\nDossier analysé : " + ouverture.getAttributs().get("dossier"));}
else {
Text.append("Fichier analysé : " + ouverture.getAttributs().get("dossier")+"
");
System.out.println("\nFichier analysé : " + ouverture.getAttributs().get("dossier"));}
if(notation.getAttributs().get("baremeABC").equals("true")) {
Text.append(" Note : " + notation.getAttributs().get("noteABC")+"
");
System.out.println("\nNote : " + notation.getAttributs().get("noteABC"));
}else {
Text.append("Note : " + notation.getAttributs().get("note") + "/" + ouverture.getAttributs().get("notefrom")+"
");
System.out.println("\nNote : " + notation.getAttributs().get("note") + "/" + ouverture.getAttributs().get("notefrom"));
}
if(flagError) {
Text.append("ERREUR dans le fichier de l'étudiant.
");
System.out.println("\t ERREUR dans le fichier de l'étudiant.");
if(Boolean.valueOf(erreurs.getAttributs().get("manqueHistorique"))) {
Text.append("Erreur : Il n'y a pas d'historique dans le fichier.Peut être que le fichier n'a pas été modifié ou il a été réïnitialisé par l'étudiant.
");
System.out.println("\t Erreur : Il n'y a pas d'historique dans le fichier.Peut être que le fichier n'a pas été modifié ou il a été réïnitialisé par l'étudiant.");
}
if(Boolean.valueOf(erreurs.getAttributs().get("manqueCreationDate"))) {
Text.append("Erreur : Ce n'est pas la bonne date de création du fichier. Le fichier a été réïnitialisé ou ce n'est pas le fichier de l'évaluation.
");
System.out.println("\t Erreur : Ce n'est pas la bonne date de création du fichier. Le fichier a été réïnitialisé ou ce n'est pas le fichier de l'évaluation.");
}
if(Boolean.valueOf(erreurs.getAttributs().get("manqueValeurCreationDate"))) {
Text.append("Erreur : Ce n'est pas la bonne date de création du fichier.
");
System.out.println("\t Erreur : Ce n'est pas la bonne date de création du fichier.");
}
if(Boolean.valueOf(erreurs.getAttributs().get("manqueMetaSujet"))) {
Text.append("Erreur : La propriété personnalisé \"Sujet\" a été supprimé dans le fichier de l'étudiant.
");
System.out.println("\t Erreur : La propriété personnalisé \"Sujet\" a été supprimé dans le fichier de l'étudiant.");
}
if(Boolean.valueOf(erreurs.getAttributs().get("manqueValeurMetaSujet"))) {
Text.append("Erreur : La propriété personnalisé \"Sujet \" a été modifié par l'étudiant.\nLa valeur de cette propriété personnalisé dans le fichier de l'étudiant est \"" + ouverture.getAttributs().get("metaSujet")+"\".\nCe n'est pas la valeur correct.
");
System.out.println("\t Erreur : La propriété personnalisé \"Sujet \" a été modifié par l'étudiant.\nLa valeur de cette propriété personnalisé dans le fichier de l'étudiant est \"" + ouverture.getAttributs().get("metaSujet")+"\".\nCe n'est pas la valeur correct.");
}
if(Boolean.valueOf(erreurs.getAttributs().get("manqueInitialCreator"))) {
Text.append("Erreur : Le créateur initial ne correspond pas au créateur initial du fichier fourni à l'étudiant.
");
System.out.println("\t Erreur : Le créateur initial n'est pas correct.");
}
}
Text.append("
");
System.out.println();
return Text;
}
/**
* Ajoute dans le node nodanalyse.
* Le node saut et son attribut titre
* Et place un titre, ou titre1, ou titre2, ou titre3
*
* @param nod
* @return
*/
public static node addNodeSautTitre(node nodSujet, node nodanalyse, node nodmenu, Run a) {
if(nodSujet.getAttributs().get("titre")!=null) {
node N = new node();
N.setNomElt("saut");
N.getAttributs().put("titre", nodSujet.getAttributs().get("titre"));
N.setClose(true);
nodanalyse.getNodes().add(N);
if(nodSujet.getAttributs().get("addmenu")!=null) if(nodSujet.getAttributs().get("addmenu").equalsIgnoreCase("true")) {
if(a.retourneFirstNodeByNameAttributValue(nodmenu, "item", "titre", nodSujet.getAttributs().get("titre"))!=null) {
N.getAttributs().put("id", a.retourneFirstNodeByNameAttributValue(nodmenu, "item", "titre", nodSujet.getAttributs().get("titre")).getAttributs().get("id"));
N.getAttributs().put("addmenu", "true");
}
}
}
if(nodSujet.getAttributs().get("titre1")!=null) {
node N = new node();
N.setNomElt("saut");
N.getAttributs().put("titre1", nodSujet.getAttributs().get("titre1"));
N.setClose(true);
nodanalyse.getNodes().add(N);
if(nodSujet.getAttributs().get("addmenu")!=null) if(nodSujet.getAttributs().get("addmenu").equalsIgnoreCase("true")) {
if(a.retourneFirstNodeByNameAttributValue(nodmenu, "item", "titre", nodSujet.getAttributs().get("titre1"))!=null) {
N.getAttributs().put("id", a.retourneFirstNodeByNameAttributValue(nodmenu, "item", "titre", nodSujet.getAttributs().get("titre1")).getAttributs().get("id"));
N.getAttributs().put("addmenu", "true");
}
}
}
if(nodSujet.getAttributs().get("titre2")!=null) {
node N = new node();
N.setNomElt("saut");
N.getAttributs().put("titre2", nodSujet.getAttributs().get("titre2"));
N.setClose(true);
nodanalyse.getNodes().add(N);
if(nodSujet.getAttributs().get("addmenu")!=null) if(nodSujet.getAttributs().get("addmenu").equalsIgnoreCase("true")) {
if(a.retourneFirstNodeByNameAttributValue(nodmenu, "item", "titre", nodSujet.getAttributs().get("titre2"))!=null) {
N.getAttributs().put("id", a.retourneFirstNodeByNameAttributValue(nodmenu, "item", "titre", nodSujet.getAttributs().get("titre2")).getAttributs().get("id"));
N.getAttributs().put("addmenu", "true");
}
}
}
if(nodSujet.getAttributs().get("titre3")!=null) {
node N = new node();
N.setNomElt("saut");
N.getAttributs().put("titre3", nodSujet.getAttributs().get("titre3"));
N.setClose(true);
nodanalyse.getNodes().add(N);
if(nodSujet.getAttributs().get("addmenu")!=null) if(nodSujet.getAttributs().get("addmenu").equalsIgnoreCase("true")) {
if(a.retourneFirstNodeByNameAttributValue(nodmenu, "item", "titre", nodSujet.getAttributs().get("titre3"))!=null) {
N.getAttributs().put("id", a.retourneFirstNodeByNameAttributValue(nodmenu, "item", "titre", nodSujet.getAttributs().get("titre3")).getAttributs().get("id"));
N.getAttributs().put("addmenu", "true");
}
}
}
return nodanalyse;
}
/**
* Ajoute un saut de ligne.
* @param nodSujet
* @param nodanalyse
* @return
*/
public static node addSaut(node nodSujet, node nodanalyse) {
if(nodSujet.getAttributs().get("saut")!=null) {
if(nodSujet.getAttributs().get("saut").equalsIgnoreCase("true")) {
node N = new node();
N.setNomElt("saut");
//N.getAttributs().put("titre", "");
N.setClose(true);
nodanalyse.getNodes().add(N);
}
}
return nodanalyse;
}
/**
* Vérirication des historiques
* @param verification
* @param a
* @return le node verif
*/
public static node verificationHistorique(node verification, Run a) {
node verif = new node();
verif.setNomElt("verification");
verif.setAttributs(verification.getAttributs());
verif.getAttributs().put("number_match", String.valueOf(commandes.number_match));
verif.getAttributs().put("mini_number_modification", String.valueOf(commandes.mini_number_modification));
verif.getAttributs().put("nombres_modifications_simultané_maxi", String.valueOf(commandes.nombres_modifications_simultané_maxi));
ArrayList LesFichiers = verification.retourneLesEnfantsByName("fichier", new ArrayList());
System.out.println();
System.out.println("***** DEBUT VERIFICATION DES HISTORIQUES DES MODIFICATION ****");
System.out.println();
commandes.message.append("\n\n***** DEBUT VERIFICATION DES HISTORIQUES DES MODIFICATION ****\n");
for(int i = 0 ; i < LesFichiers.size() ; i++) {
node nodStudent = new node();
nodStudent.setNomElt("fichier");
nodStudent.setAttributs(LesFichiers.get(i).getAttributs());
//String nameStudent1 = LesFichiers.get(i).getAttributs().get("dossier");
ArrayList HitoriqueDuFichier = LesFichiers.get(i).retourneEnfantsByName("text:changed-region", new ArrayList());
int nombreModifications = HitoriqueDuFichier.size();
nodStudent.getAttributs().put("nombre_modification", String.valueOf(nombreModifications));
int compteurnombreCorrespondance = 0 ;
int compteurnombreCorrespondancesSuivi = 0;
int compteurnombreCorrespondancesconsecutive = 0;
System.out.println(LesFichiers.get(i).getAttributs().get("dossier") + " - number of modifications : " + nombreModifications);
commandes.message.append("\n"+LesFichiers.get(i).getAttributs().get("dossier") + " - number of modifications : " + nombreModifications);
@SuppressWarnings("unchecked")
ArrayList LesFichiers2 = (ArrayList) LesFichiers.clone();
LesFichiers2.remove(i);
Dictionary lesdates = new Hashtable();
Date DateMini = null; //Première date de modification
// Parcours toutes les modifications dans l'historique
for(int j = 0 ; j < HitoriqueDuFichier.size(); j++) {
node nodDate = null;
node nodDateCreator = null;
String dcdate1 ="";
@SuppressWarnings("unused")
String dccreator ="";
nodDate = HitoriqueDuFichier.get(j).retourneFirstEnfantsByName("dc:date");
nodDateCreator = HitoriqueDuFichier.get(j).retourneFirstEnfantsByName("dc:creator");
if(nodDate!=null) {
dcdate1 = nodDate.getContenu().get(0);
}
if(nodDate!=null) {
dccreator = nodDateCreator.getContenu().get(0);
}
Date DcDate1 = DateLibreOffice(dcdate1);
if(DateMini==null) DateMini = DcDate1; // Amorçage de la date premère date de modification
if(DateMini!=null && DateMini.after(DcDate1)) DateMini = DcDate1; //recherche la première date de modification
if(lesdates.get(dcdate1)==null) {
lesdates.put(dcdate1, 1);
}else {
int compteur = lesdates.get(dcdate1) + 1;
lesdates.put(dcdate1, compteur);
}
node N1 = HitoriqueDuFichier.get(j).getNodes().get(0);
for(int i2 = 0 ; i2 < LesFichiers2.size(); i2++) {
String nameStudent2 = LesFichiers2.get(i2).getAttributs().get("dossier");
ArrayList HitoriqueDuFichier2 = LesFichiers2.get(i2).retourneEnfantsByName("text:changed-region", new ArrayList());
for(int j2 = 0 ; j2 correspondances = nodStudent.retourneEnfantsByName("correspondance", new ArrayList());
node c = correspondances.get(correspondances.size()-1);
if(c.getAttributs().get("Avec_etudiant").equals(nameStudent2)&&c.getAttributs().get("dc:creator").equals(dccreator2)) {
compteurnombreCorrespondancesSuivi++;
if(compteurnombreCorrespondancesconsecutive+1>compteurnombreCorrespondancesconsecutive) compteurnombreCorrespondancesconsecutive++;
}else {
compteurnombreCorrespondancesSuivi=0;
}
}
node correspondance = new node();
correspondance.getNodes().add(N2);
correspondance.setNomElt("correspondance");
correspondance.getAttributs().put("date", dcdate1);
correspondance.getAttributs().put("type",N1.getNomElt());
correspondance.getAttributs().put("Avec_etudiant", nameStudent2);
correspondance.getAttributs().put("dc:creator", dccreator2);
nodStudent.getNodes().add(correspondance);
System.out.println("\t** Trouve une correspondance ** " + dcdate1);
commandes.message.append("\n\t** Trouve une correspondance ** " + dcdate1);
break;
}
// }
}
}
}
}
Enumeration key = lesdates.keys();
while(key.hasMoreElements()) {
String k = key.nextElement();
if(lesdates.get(k)>1) {
node modificationsMemeDate = new node();
modificationsMemeDate.setNomElt("memeinstant");
modificationsMemeDate.getAttributs().put("date", k);
modificationsMemeDate.getAttributs().put("nombres_modifications_simultané", String.valueOf(lesdates.get(k)));
if(commandes.nombres_modifications_simultané_maxi0)compteurnombreCorrespondancesconsecutive++; //C'est histoire des arbres et des intervalles entre les arbres. Il faut ajouter plus 1 au nombre de correspondances consecutives.
nodStudent.getAttributs().put("nombre_correspondance", String.valueOf(compteurnombreCorrespondance));
nodStudent.getAttributs().put("nombre_modifications_date_unique", String.valueOf(lesdates.size()));
nodStudent.getAttributs().put("nombre_correspondances_consecutives", String.valueOf(compteurnombreCorrespondancesconsecutive));
nodStudent.getAttributs().put("first_modification_date", String.valueOf(DateMini));
verif.getNodes().add(nodStudent);
System.out.println("\tDate de modification date unique " + String.valueOf(lesdates.size()));
commandes.message.append("\n\tDate de modification date unique " + String.valueOf(lesdates.size()));
}
// Ci-dessous le code pour vérifier la première date de modification dans le fichier.
// Recherche dans le node verif
int lastIndex = verif.getNodes().size();
for(int i = 0 ; i < lastIndex;i++) {
String D1 = verif.getNodes().get(i).getAttributs().get("first_modification_date");
boolean trouve =false;
for(int j = 0; j < lastIndex; j++) {
if(i!=j) {
String D2 = verif.getNodes().get(j).getAttributs().get("first_modification_date");
if(!D1.equals("null") && D1.equals(D2)) {
if(verif.getNodes().get(i).getAttributs().get("")==null) {
verif.getNodes().get(i).getAttributs().put("first_modification_identique", verif.getNodes().get(j).getAttributs().get("dossier"));
}else {
verif.getNodes().get(i).getAttributs().put("first_modification_identique_2", verif.getNodes().get(j).getAttributs().get("dossier"));
}
if(verif.getNodes().get(j).getAttributs().get("")==null) {
verif.getNodes().get(j).getAttributs().put("first_modification_identique", verif.getNodes().get(i).getAttributs().get("dossier"));
}else {
verif.getNodes().get(j).getAttributs().put("first_modification_identique_2", verif.getNodes().get(i).getAttributs().get("dossier"));
}
trouve=true;
}
}
}
if(!trouve) {
verif.getNodes().get(i).getAttributs().put("first_modification_identique","null");
}else {
verif.getNodes().get(i).getAttributs().put("plagiat", "probable");
System.out.println("\t\t ************************");
System.out.println("\t\t ** Plagiat PROBABLE **");
System.out.println("\t\t ************************");
commandes.message.append("\n\t\t ************************");
commandes.message.append("\n\t\t Plagiat PROBABLE ");
commandes.message.append("\n\t\t ************************");
}
}
System.out.println();
System.out.println("** FIN DE LA VERIFIACTION **");
System.out.println();
commandes.message.append("\n** FIN DE LA VERIFICATION **\n");
return verif;
}
/**
* Ecriture de l'ensemble des notes brutes sans vérification et sans rechercher les identifiants des étudiants
* @param nodesana
* @throws IOException
*/
public static void ecritureCSV(node ana) throws IOException{
Date aujourdhui = new Date();
Path outputFilePath = Paths.get(commandes.path + "/DateLong" + aujourdhui.getTime()+ "-Notes.csv");
if(commandes.fourniDossierDestination) outputFilePath = Paths.get(commandes.path +"/"+ commandes.pathDestination + "/DateLong" + aujourdhui.getTime()+ "-Notes.csv");
if(!commandes.fourniDossierDestination) System.out.println(commandes.path +"\\DateLong" + aujourdhui.getTime()+ "-Notes.csv");
if(commandes.fourniDossierDestination) System.out.println(commandes.path +"\\"+ commandes.pathDestination + "\\DateLong" + aujourdhui.getTime()+ "-Notes.csv");
BufferedWriter fichier = Files.newBufferedWriter(outputFilePath, StandardCharsets.UTF_8);
fichier.write("prénom nom;date modification;producteur;durée edition;sujet;note\n");
for (int i = 0 ; i < ana.getNodes().size() ; i++) {
node nodouverture = ana.getNodes().get(i).retourneFirstEnfantsByName("ouverture");
String identification = nodouverture.getAttributs().get("dossier");
String sujet = nodouverture.getAttributs().get("metaSujet");
String dateModif = nodouverture.getAttributs().get("dateModification");
String producteur = nodouverture.getAttributs().get("producteur");
String dureeEdition = nodouverture.getAttributs().get("dureeEdition");
String note = ana.getNodes().get(i).retourneFirstEnfantsByName("bodyetnotation").getAttributs().get("note");
if(nodouverture.getAttributs().get("baremeABC")!=null) {
try {
if(Boolean.valueOf(nodouverture.getAttributs().get("baremeABC"))) {
note = ana.getNodes().get(i).retourneFirstEnfantsByName("bodyetnotation").getAttributs().get("noteABC");
}
}catch (Exception e) {
}
}
fichier.write(identification + ";" + dateModif + ";" + producteur + ";" + traitementDureeEdition(dureeEdition) + ";"+ sujet + ";" + traitementNote(note) + "\n");
}
fichier.close();
commandes.message.append("\n");
commandes.message.append("*************************");
commandes.message.append("\n");
commandes.message.append("\nLe fichier au format CSV a été généré.");
commandes.message.append("\n" + outputFilePath.toString());
commandes.message.append("\n");
commandes.message.append("*************************");
}
/**
* Ecriture du fichier CSV avec vérification.
* Mais sans rechercher les identifiants des étudiants.
* @param ana
* @param verif
* @param a
* @throws IOException
*/
public static void ecritureCSV(node ana, node verif, Run a, node setting) throws IOException{
String separator =";"; //valeur par défaut du séparteur
Date aujourdhui = new Date();
Path outputFilePath = Paths.get(commandes.path + "/DateLong" + aujourdhui.getTime()+ "-Notes.csv");
if(commandes.fourniDossierDestination) outputFilePath = Paths.get(commandes.path +"/"+ commandes.pathDestination + "/DateLong" + aujourdhui.getTime()+ "-Notes.csv");
if(!commandes.fourniDossierDestination) System.out.println(commandes.path +"\\DateLong" + aujourdhui.getTime()+ "-Notes.csv");
if(commandes.fourniDossierDestination) System.out.println(commandes.path +"\\"+ commandes.pathDestination + "\\DateLong" + aujourdhui.getTime()+ "-Notes.csv");
BufferedWriter fichier = Files.newBufferedWriter(outputFilePath, StandardCharsets.UTF_8);
fichier.write("prénom nom;date modification;producteur;durée edition;sujet;nbr modification;nbr modification date unique;nbr match;note\n");
for (int i = 0 ; i < ana.getNodes().size() ; i++) {
node nodouverture = ana.getNodes().get(i).retourneFirstEnfantsByName("ouverture");
String identification = nodouverture.getAttributs().get("dossier");
String sujet = nodouverture.getAttributs().get("metaSujet");
String dateModif = nodouverture.getAttributs().get("dateModification");
String producteur = nodouverture.getAttributs().get("producteur");
String dureeEdition = nodouverture.getAttributs().get("dureeEdition");
node verifStudent = a.retourneNodeByNameAttributValueAttributValueExact(verif, "fichier", "dossier", identification, "dateModification", dateModif);
String note = "plagiat";
if(verifStudent!=null) {
int nbreCorrespondance = Integer.valueOf(verifStudent.getAttributs().get("nombre_correspondance"));
int nbrDateModificationUnique = Integer.valueOf(verifStudent.getAttributs().get("nombre_modifications_date_unique"));
if(nbreCorrespondance<=commandes.number_match) {
note = ana.getNodes().get(i).retourneFirstEnfantsByName("bodyetnotation").getAttributs().get("note");
if(nodouverture.getAttributs().get("baremeABC")!=null) {
try {
if(Boolean.valueOf(nodouverture.getAttributs().get("baremeABC"))) {
note = ana.getNodes().get(i).retourneFirstEnfantsByName("bodyetnotation").getAttributs().get("noteABC");
}
}catch (Exception e) {
}
}
}
if(nbrDateModificationUnique
* Mais avec rechercher des identifiants des étudiants.
* @param ana
* @param verif
* @param a
* @param nodeCVS
* @param verification
* @throws IOException
*/
public static void ecritureCSV(node ana, node verif, Run a, node nodeCVS, node setting) throws IOException {
String separator =";"; //valeur par défaut du séparteur
Charset encoding = StandardCharsets.UTF_8; //valeur par défaut
String champMoodleEmail = "adresse";
String champMoodleNumeroEtudiant = "identification";
String champPrenom = "prenom";
String champNom= "nom";
if(setting.getNomElt().equals("setting")) {
if(setting.containElementByName("csv")){
node csv = setting.retourneFirstEnfantsByName("csv");
if(csv.getAttributs().get("separator")!=null)separator = csv.getAttributs().get("separator");
if(csv.getAttributs().get("encoding")!=null) {
if(csv.getAttributs().get("encoding").equals("UFT-8")) encoding = StandardCharsets.UTF_8;
if(csv.getAttributs().get("encoding").equals("ISO-8859-1")) encoding = StandardCharsets.ISO_8859_1;
if(csv.getAttributs().get("encoding").equals("US-ASCII")) encoding = StandardCharsets.US_ASCII;
if(csv.getAttributs().get("encoding").equals("UTF-16")) encoding = StandardCharsets.UTF_16;
if(csv.getAttributs().get("encoding").equals("UTF-16BE")) encoding = StandardCharsets.UTF_16BE;
if(csv.getAttributs().get("encoding").equals("UTF-16LE")) encoding = StandardCharsets.UTF_16LE;
if(csv.containElementByName("import_moodle")) {
node import_moodle = csv.retourneFirstEnfantsByName("import_moodle");
if(import_moodle.getAttributs().get("email")!=null) champMoodleEmail=import_moodle.getAttributs().get("email");
if(import_moodle.getAttributs().get("id")!=null) champMoodleNumeroEtudiant=import_moodle.getAttributs().get("id");
if(import_moodle.getAttributs().get("firstname")!=null) champPrenom=import_moodle.getAttributs().get("firstname");
if(import_moodle.getAttributs().get("name")!=null) champNom=import_moodle.getAttributs().get("name");
}
}
}
}
Date aujourdhui = new Date();
Path outputFilePath = Paths.get(commandes.path + "/DateLong" + aujourdhui.getTime()+ "-Notes.csv");
if(commandes.fourniDossierDestination) outputFilePath = Paths.get(commandes.path +"/"+ commandes.pathDestination + "/DateLong" + aujourdhui.getTime()+ "-Notes.csv");
if(!commandes.fourniDossierDestination) System.out.println(commandes.path +"\\DateLong" + aujourdhui.getTime()+ "-Notes.csv");
if(commandes.fourniDossierDestination) System.out.println(commandes.path +"\\"+ commandes.pathDestination + "\\DateLong" + aujourdhui.getTime()+ "-Notes.csv");
BufferedWriter fichier = Files.newBufferedWriter(outputFilePath, encoding);
fichier.write("prénom nom"+separator+"email"+separator+"identifiant"+separator+"date modification"+separator+"producteur"+separator+"durée edition"+separator+"sujet"+separator+"nbr modification" + separator + "nbr modifications date unique" + separator+ "nbr match consecutif" + separator +"note" + separator +"commentaire\n");
for (int i = 0 ; i < ana.getNodes().size() ; i++) {
node nodouverture = ana.getNodes().get(i).retourneFirstEnfantsByName("ouverture");
node bodyetnotation = ana.getNodes().get(i).retourneFirstEnfantsByName("bodyetnotation");
String identification = nodouverture.getAttributs().get("dossier");
String sujet = nodouverture.getAttributs().get("metaSujet");
String dateModif = nodouverture.getAttributs().get("dateModification");
String producteur = nodouverture.getAttributs().get("producteur");
String dureeEdition = nodouverture.getAttributs().get("dureeEdition");
String mail = "-";
String numeroEtudiant = "-";
node verifStudent = null;
if(commandes.verifHisto2) verifStudent = a.retourneNodeByNameAttributValueAttributValueExact(verif, "fichier", "dossier", identification, "dateModification", dateModif);
String note = "";
//** rechercher les correspondances avec le prénom et le nom de l'étudiant
String[] ident = identification.split(" "); //séparateur entre le prénom et le nom par un espace
node A=null;
if(ident.length==2) {
A = a.retourneNodeByNameAttributValueAttributValueExact(nodeCVS, "student", champPrenom, ident[0], champNom, ident[1]);
if(A!=null) {
mail = A.getAttributs().get("\"" + champMoodleEmail + "\"");
if(mail==null) mail = A.getAttributs().get("'"+ champMoodleEmail +"'");
if(mail==null) mail = A.getAttributs().get(champMoodleEmail);
numeroEtudiant = A.getAttributs().get("\"" + champMoodleNumeroEtudiant + "\"");
if(numeroEtudiant==null) numeroEtudiant = A.getAttributs().get("'" + champMoodleNumeroEtudiant + "'");
if(numeroEtudiant==null) numeroEtudiant = A.getAttributs().get(champMoodleNumeroEtudiant);
}
}
if(ident.length==3) {
A = a.retourneNodeByNameAttributValueAttributValueExact(nodeCVS, "student", champPrenom, "\"" + ident[0] + " " + ident[1] +"\"", champNom, ident[2]);
if(A!=null) {
mail = A.getAttributs().get("\"" + champMoodleEmail + "\"");
if(mail==null) mail = A.getAttributs().get("'"+ champMoodleEmail +"'");
if(mail==null) mail = A.getAttributs().get(champMoodleEmail);
numeroEtudiant = A.getAttributs().get("\"" + champMoodleNumeroEtudiant + "\"");
if(numeroEtudiant==null) numeroEtudiant = A.getAttributs().get("'" + champMoodleNumeroEtudiant + "'");
if(numeroEtudiant==null) numeroEtudiant = A.getAttributs().get(champMoodleNumeroEtudiant);
}
if(A==null) {
A = a.retourneNodeByNameAttributValueAttributValueExact(nodeCVS, "student", champPrenom, ident[0], champNom, "\"" +ident[1] + " " + ident[2] + "\"");
if(A!=null) {
mail = A.getAttributs().get("\"" + champMoodleEmail + "\"");
if(mail==null) mail = A.getAttributs().get("'"+ champMoodleEmail +"'");
if(mail==null) mail = A.getAttributs().get(champMoodleEmail);
numeroEtudiant = A.getAttributs().get("\"" + champMoodleNumeroEtudiant + "\"");
if(numeroEtudiant==null) numeroEtudiant = A.getAttributs().get("'" + champMoodleNumeroEtudiant + "'");
if(numeroEtudiant==null) numeroEtudiant = A.getAttributs().get(champMoodleNumeroEtudiant);
}
}
}
if(ident.length==4) {
A = a.retourneNodeByNameAttributValueAttributValueExact(nodeCVS, "student", champPrenom, ident[0], champNom, "\"" + ident[1] + " " + ident[2] + " " + ident[3] + "\"");
if(A!=null) {
mail = A.getAttributs().get("\"" + champMoodleEmail + "\"");
if(mail==null) mail = A.getAttributs().get("'"+ champMoodleEmail +"'");
if(mail==null) mail = A.getAttributs().get(champMoodleEmail);
numeroEtudiant = A.getAttributs().get("\"" + champMoodleNumeroEtudiant + "\"");
if(numeroEtudiant==null) numeroEtudiant = A.getAttributs().get("'" + champMoodleNumeroEtudiant + "'");
if(numeroEtudiant==null) numeroEtudiant = A.getAttributs().get(champMoodleNumeroEtudiant);
}
if(A==null) {
A = a.retourneNodeByNameAttributValueAttributValueExact(nodeCVS, "student", champPrenom, "\"" + ident[0] + " " + ident[1] +"\"", champNom, "\"" + ident[2] + " " + ident[3] + "\"");
if(A!=null) {
mail = A.getAttributs().get("\"" + champMoodleEmail + "\"");
if(mail==null) mail = A.getAttributs().get("'"+ champMoodleEmail +"'");
if(mail==null) mail = A.getAttributs().get(champMoodleEmail);
numeroEtudiant = A.getAttributs().get("\"" + champMoodleNumeroEtudiant + "\"");
if(numeroEtudiant==null) numeroEtudiant = A.getAttributs().get("'" + champMoodleNumeroEtudiant + "'");
if(numeroEtudiant==null) numeroEtudiant = A.getAttributs().get(champMoodleNumeroEtudiant);
}
}
if(A==null) {
A = a.retourneNodeByNameAttributValueAttributValueExact(nodeCVS, "student", champPrenom, "\"" + ident[0] + " " + ident[1] + ident[2] + "\"", champNom, ident[3]);
if(A!=null) {
mail = A.getAttributs().get("\"" + champMoodleEmail + "\"");
if(mail==null) mail = A.getAttributs().get("'"+ champMoodleEmail +"'");
if(mail==null) mail = A.getAttributs().get(champMoodleEmail);
numeroEtudiant = A.getAttributs().get("\"" + champMoodleNumeroEtudiant + "\"");
if(numeroEtudiant==null) numeroEtudiant = A.getAttributs().get("'" + champMoodleNumeroEtudiant + "'");
if(numeroEtudiant==null) numeroEtudiant = A.getAttributs().get(champMoodleNumeroEtudiant);
}
}
}
if(commandes.verifHisto2) if(verifStudent!=null) {
int nbreCorrespondanceConsecutive = Integer.valueOf(verifStudent.getAttributs().get("nombre_correspondances_consecutives"));
int nbrDateModificationUnique = Integer.valueOf(verifStudent.getAttributs().get("nombre_modifications_date_unique"));
note = bodyetnotation.getAttributs().get("note");
if(bodyetnotation.getAttributs().get("baremeABC")!=null) {
try {
if(Boolean.valueOf(bodyetnotation.getAttributs().get("baremeABC"))) {
note = bodyetnotation.getAttributs().get("noteABC");
}
}catch (Exception e) {
}
}
if(nbreCorrespondanceConsecutive>commandes.number_match) {
bodyetnotation.getAttributs().put("commentaire","Echange de fichier - plagiat");
note = "0" ;
}
if(nbrDateModificationUnique<=commandes.mini_number_modification) {
bodyetnotation.getAttributs().put("commentaire","pas assez de modification.");
note="0";
}
if(!verifStudent.getAttributs().get("first_modification_identique").equals("null") && nbreCorrespondanceConsecutive>=commandes.number_match) {
note = "0" ;
bodyetnotation.getAttributs().put("commentaire","Echange de fichier - plagiat");
}
if(verifStudent.getAttributs().get("copier_coller")!=null){
bodyetnotation.getAttributs().put("commentaire","des copiés et des collés");
}
String nbrModification = verifStudent.getAttributs().get("nombre_modification");
String nombre_modifications_date_unique = verifStudent.getAttributs().get("nombre_modifications_date_unique");
fichier.write(identification + separator + mail + separator + numeroEtudiant + separator + dateModif + separator + producteur + separator + traitementDureeEdition(dureeEdition) + separator + sujet + separator + nbrModification +separator + nombre_modifications_date_unique + separator + nbreCorrespondanceConsecutive + separator + traitementNote(note) + separator + bodyetnotation.getAttributs().get("commentaire")+"\n");
}
if(!commandes.verifHisto2) {
note = bodyetnotation.getAttributs().get("note");
if(bodyetnotation.getAttributs().get("baremeABC")!=null) {
try {
if(Boolean.valueOf(bodyetnotation.getAttributs().get("baremeABC"))) {
note = bodyetnotation.getAttributs().get("noteABC");
}
}catch (Exception e) {
}
}
fichier.write(identification + separator + mail + separator + numeroEtudiant + separator + dateModif + separator + producteur + separator + traitementDureeEdition(dureeEdition) + separator + sujet + separator + "" + separator + "" + "" + separator + "" + separator + traitementNote(note) + separator + bodyetnotation.getAttributs().get("commentaire")+"\n");
}
}
fichier.close();
commandes.message.append("\n");
commandes.message.append("*-***********************");
commandes.message.append("\n");
commandes.message.append("\nLe fichier au format CSV a été généré.");
commandes.message.append("\n" + outputFilePath.toString());
commandes.message.append("\n");
commandes.message.append("*************************");
}
/**
* Traitement de la durée d'édition.
*
* @param dureeEdition
* @return
*/
public static String traitementDureeEdition(String dureeEdition) {
dureeEdition = dureeEdition.replace("P", "");
dureeEdition = dureeEdition.replace("D", " j ");
dureeEdition = dureeEdition.replace("T", " ");
dureeEdition = dureeEdition.replace("H", " h ");
dureeEdition = dureeEdition.replace("M", " min ");
dureeEdition = dureeEdition.replace("S", " s");
return dureeEdition;
}
/**
* Remplace la virgule par un point.
*
* @param note
* @return
*/
private static String traitementNote(String note) {
if(note==null) return note;
note = note.replace(",", ".");
return note;
}
/**
*
* @param libreoffice_date
* @return
*/
private static Date DateLibreOffice(String libreoffice_date){
boolean contientHeure = false;
if(libreoffice_date.contains("T")) {
libreoffice_date=libreoffice_date.replace("T", " ");
contientHeure=true;
}
SimpleDateFormat simpledateformat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
Date d = null;
if(!contientHeure) simpledateformat = new SimpleDateFormat("yyyy-MM-dd");
try {
d = simpledateformat.parse(libreoffice_date);
}catch(ParseException e) {
e.printStackTrace();
}
return d;
}
/**
* Chargement dans un node du fichier CSV de la liste des étudiants.
* La liste des étudiants doit contenir les champs Prénom, Nom, Numéro d'identification, Adresse de courriel
* Le séparateur doit être le point-virgule et l'encodage UTF-8.
* @param a
* @param nameCSV
* @return
* @throws IOException
*/
public static node chargementFichierCSV() {
String targetString = "";
String cheminVersLeFichierCSV = "";
if(commandes.console) cheminVersLeFichierCSV = commandes.path + "/" + commandes.nameCSV;
if(!commandes.console) {
commandes.nameCSV = commandes.nameCSV.replace("\\", "/");
cheminVersLeFichierCSV = commandes.nameCSV;
}
try {
BufferedReader br = new BufferedReader(
new InputStreamReader(
new FileInputStream(cheminVersLeFichierCSV), "UTF-8"));
String line;
while ((line = br.readLine()) != null) {
targetString = targetString + line + "\n";
}
br.close();
} catch (IOException e) {
commandes.clotureWithErrorFile(cheminVersLeFichierCSV);
e.printStackTrace();
}
String[] target = targetString.split("\\n");
node nodeCVS = new node();
nodeCVS.setNomElt("fileCSV");
String[] line1 = target[0].split(";");
for(int i = 1 ; i < target.length ; i++) {
node nodeEtudiant = new node();
nodeEtudiant.setNomElt("student");
for(int j = 0 ; j < line1.length; j++) {
nodeEtudiant.getAttributs().put(line1[j], target[i].split(";")[j]);
}
nodeCVS.getNodes().add(nodeEtudiant);
}
//a.ecritureNodeEnXML(nodeCVS, "nodeCVS"); //écriture du node du node CSV
return nodeCVS;
}
/**
* Charge le fichier SVG pour le nouveau Logo dans les feedbacks
* @param a
* @param nameSVG
* @return
*/
public static String chargementFichierSVG() {
String targetString = "";
String cheminVersFichier = commandes.nameSVG;
if(commandes.console) cheminVersFichier =commandes.path + "/" + commandes.nameSVG;
try {
BufferedReader br = new BufferedReader(
new InputStreamReader(
new FileInputStream(cheminVersFichier), "UTF-8"));
String line;
while ((line = br.readLine()) != null) {
targetString = targetString + line + "\n";
}
br.close();
} catch (IOException e) {
commandes.clotureWithErrorFile(commandes.nameSVG);
e.printStackTrace();
}
return targetString;
}
public static node ajouteValeurParDefautAuStyleParagraph(node ensembleDesParagraphes ) {
node LesStyleDefaut = null;
if(ensembleDesParagraphes.retourneEnfantsByNameExist("style:default-style")) {
LesStyleDefaut = ensembleDesParagraphes.retourneFirstEnfantsByName("style:default-style");
}
for(int i =0 ; i < ensembleDesParagraphes.getNodes().size(); i++) {
node nodStyle = ensembleDesParagraphes.getNodes().get(i);
//le paragarph properties
node nodeStyleParDefautParagraphProperties = LesStyleDefaut.retourneFirstEnfantsByName("style:paragraph-properties");
node LesNodesStyleParagraph = nodStyle.retourneFirstEnfantsByName("style:paragraph-properties");
Enumeration K = nodeStyleParDefautParagraphProperties.getAttributs().keys();
while(K.hasMoreElements()){
String Key = K.nextElement();
if(LesNodesStyleParagraph.getNomElt().equals("style:paragraph-properties")) {
if(LesNodesStyleParagraph.getAttributs().get(Key)==null) {
LesNodesStyleParagraph.getAttributs().put(Key, nodeStyleParDefautParagraphProperties.getAttributs().get(Key));
}
}else {
node n = new node();
n.setNomElt("style:paragraph-properties");
n.setAttributs(nodeStyleParDefautParagraphProperties.getAttributs());
nodStyle.getNodes().add(n);
break;
}
}
//le text properties
node nodeStyleParDefautTextProperties = LesStyleDefaut.retourneFirstEnfantsByName("style:text-properties");
node LesNodesStyleText = nodStyle.retourneFirstEnfantsByName("style:text-properties");
K = nodeStyleParDefautTextProperties.getAttributs().keys();
while(K.hasMoreElements()){
String Key = K.nextElement();
if(LesNodesStyleText.getNomElt().equals("style:text-properties")) {
if(LesNodesStyleText.getAttributs().get(Key)==null) {
LesNodesStyleText.getAttributs().put(Key, nodeStyleParDefautTextProperties.getAttributs().get(Key));
}
}else {
node n = new node();
n.setNomElt("style:text-properties");
n.setAttributs(nodeStyleParDefautTextProperties.getAttributs());
nodStyle.getNodes().add(n);
break;
}
}
}
return ensembleDesParagraphes;
}
/**
*
* @param ensembleDesParagraphes
* @return
*/
public static node ajouteValeurLesValeursDuStyleParagraphParent(node ensembleDesParagraphes) {
for(int i = 0 ; i < ensembleDesParagraphes.getNodes().size(); i++) {
node nodStyle = ensembleDesParagraphes.getNodes().get(i);
node parent = null;
if(nodStyle.getAttributs().get("style:parent-style-name")!=null) {
String nameStyleParent = nodStyle.getAttributs().get("style:parent-style-name");
if(ensembleDesParagraphes.retourneFirstNodeByNameAndAttributValueExactStrict("style:style", "style:name", nameStyleParent)!=null) {
parent = ensembleDesParagraphes.retourneFirstNodeByNameAndAttributValueExactStrict("style:style", "style:name", nameStyleParent);
}
}
if(parent!=null) {
//le paragraph properties
node nodeStyleParentParagraphProperties = parent.retourneFirstEnfantsByName("style:paragraph-properties");
node LesNodesStyleParagraph = nodStyle.retourneFirstEnfantsByName("style:paragraph-properties");
Enumeration K = nodeStyleParentParagraphProperties.getAttributs().keys();
while(K.hasMoreElements()){
String Key = K.nextElement();
if(LesNodesStyleParagraph.getNomElt().equals("style:paragraph-properties")) {
if(LesNodesStyleParagraph.getAttributs().get(Key)==null) {
LesNodesStyleParagraph.getAttributs().put(Key, nodeStyleParentParagraphProperties.getAttributs().get(Key));
}
}else {
node n = new node();
n.setNomElt("style:paragraph-properties");
n.setAttributs(nodeStyleParentParagraphProperties.getAttributs());
nodStyle.getNodes().add(n);
break;
}
}
//le text properties
node nodeStyleParDefautTextProperties = parent.retourneFirstEnfantsByName("style:text-properties");
node LesNodesStyleText = nodStyle.retourneFirstEnfantsByName("style:text-properties");
K = nodeStyleParDefautTextProperties.getAttributs().keys();
while(K.hasMoreElements()){
String Key = K.nextElement();
if(LesNodesStyleText.getNomElt().equals("style:text-properties")) {
if(LesNodesStyleText.getAttributs().get(Key)==null) {
LesNodesStyleText.getAttributs().put(Key, nodeStyleParDefautTextProperties.getAttributs().get(Key));
}
}else {
node n = new node();
n.setNomElt("style:text-properties");
n.setAttributs(nodeStyleParDefautTextProperties.getAttributs());
nodStyle.getNodes().add(n);
break;
}
}
}
}
return ensembleDesParagraphes;
}
/**
* Evalue le nom du node
*
* @param retour : le node retour qui contient l'item ajouté
* @param nodStudent : le node Student qui peut être null
* @param nameNode : le nom du node
* @param point : les points
* @param nameElt : le nom de l'élément
* @return
*/
private static node evaluNameNode(node retour, node nodStudent, String nameNode, String point, String nameElt) {
node item = null;
if(nodStudent!=null) {
item = retourneNoteAvecResultatsAnalyse(nameNode,"name", nodStudent.getNomElt(),nameNode + "‽" +point, nameElt );
}else {
outils.IncrementPointTotal(Integer.valueOf(point));
item = new node(nameNode, "Erreur", "Nom du node" , "null", nameNode, 2, outils.getPointEnJeu(),nameElt);
}
retour.getNodes().add(item);
return retour;
}
/**
* Si le node style:header-style ne possède pas d'attribut alors l'entete n'est pas activé.
* Le nombre d'attribut est null.
* @param retour
* @param nodStudent
* @param nameNode
* @param point
* @param nameElt
* @return
*/
private static node evaluEntetePasActive(node retour, String nbAttributStudent, String nbAttribut, String point, String nameElt) {
node item = null;
if(nbAttributStudent!=null) {
item = retourneNoteAvecResultatsAnalyse(nbAttribut,"active", nbAttributStudent,nbAttribut + "‽" +point, nameElt );
}else {
outils.IncrementPointTotal(Integer.valueOf(point));
item = new node(nbAttribut, "Erreur", "active" , "null", nbAttribut, 2, outils.getPointEnJeu(),nameElt);
}
retour.getNodes().add(item);
return retour;
}
private static node evaluPiedPagePasActive(node retour, String nbAttributStudent, String nbAttribut, String point, String nameElt) {
node item = null;
if(nbAttributStudent!=null) {
item = retourneNoteAvecResultatsAnalyse(nbAttribut,"active", nbAttributStudent,nbAttribut + "‽" +point, nameElt );
}else {
outils.IncrementPointTotal(Integer.valueOf(point));
item = new node(nbAttribut, "Erreur", "active" , "null", nbAttribut, 2, outils.getPointEnJeu(),nameElt);
}
retour.getNodes().add(item);
return retour;
}
/**
* Evalue le champ auteur (éditeur).
* @param retour
* @param nodStudent
* @param nameCreator
* @param point
* @param nameElt
* @return
*/
private static node evaluNameCreator(node retour, node nodStudent, String nameCreator, String point, String nameElt) {
node item = null;
if(nodStudent!=null) {
item = retourneNoteAvecResultatsAnalyse(nameCreator,"name", nodStudent.getAttributs().get("creator"),nameCreator + "↑‽" +point, nameElt );
}else {
outils.IncrementPointTotal(Integer.valueOf(point));
item = new node(nameCreator, "Erreur", "Nom du l'éditeur" , "null", nameCreator, 2, outils.getPointEnJeu(),nameElt);
}
retour.getNodes().add(item);
return retour;
}
/**
* Evalue le nom de l'auteur (créteur ou premier auteur)
* @param retour
* @param nodStudent
* @param nameCreator
* @param point
* @param nameElt
* @return
*/
private static node evalNameInitialCreator(node retour, node nodStudent, String nameCreator, String point, String nameElt) {
node item = null;
if(nodStudent!=null) {
item = retourneNoteAvecResultatsAnalyse(nameCreator,"name", nodStudent.getContenu().get(0),nameCreator + "↑‽" +point, nameElt );
}else {
outils.IncrementPointTotal(Integer.valueOf(point));
item = new node(nameCreator, "Erreur", "Nom du créateur" , "null", nameCreator, 2, outils.getPointEnJeu(),nameElt);
}
retour.getNodes().add(item);
return retour;
}
}