Bonjour,
J’essaie de zipper plusieurs documents présents dans un objet métier.
Voici ce que je fais :
ImmoWorkProject.TESTZIP = function() {
var ID = this.getGrant().getTmpObject("immoDocument");
ID.resetFilters();
ID.resetValues();
ID.getField("documentType").setFilter('70'); // Type de doc : Bail
ID.getField("documentSubType").setFilter('920'); // Sous-Type de doc : EDLE
var rows = ID.search();
var list = new HashMap();
for (var i = 0; rows !=null && i < rows.size(); i++) {
var row = rows.get(i);
ID.setValues(row,true);
var doc = ID.getField("documentSource").getDocument(this.getGrant());
list.put(doc.getName(), doc);
console.log("doc = " + doc);
}
try {
var out = new java.io.ByteArrayOutputStream();
ZIPTool.build(out, list);
return out.toByteArray();
} catch(e) {
console.error("TESTZIP : "+ (e.javaException ? e.javaException.getMessage() : e));
return e.javaException ? e.javaException.getMessage() : e;
}
};
Mais j’obtiens l’erreur suivante :
2020-11-25 11:03:40,439 ERROR [com.simplicite.util.ScriptInterpreter] SIMPLICITE|http://e3m.simplicite.io:10188||ECORESC001|designer|com.simplicite.util.ScriptInterpreter|ImmoWorkProject/the_ajax_ImmoWorkProject||Erreur script: TESTZIP : class com.simplicite.util.DocumentDB cannot be cast to class [B (com.simplicite.util.DocumentDB is in unnamed module of loader org.apache.catalina.loader.ParallelWebappClassLoader @3f1c5af9; [B is in module java.base of loader 'bootstrap')
2020-11-25 11:03:40,436 INFO [com.simplicite.util.ScriptInterpreter] SIMPLICITE|http://e3m.simplicite.io:10188||INFO|designer|com.simplicite.util.ScriptInterpreter|ImmoWorkProject/the_ajax_ImmoWorkProject||Evénement: doc = {"path":"immoDocument/documentSource/0/16360/kane7rb EDLE FINOT ét2D.pdf","size":1595129,"mime":"application/pdf","name":"kane7rb EDLE FINOT ét2D.pdf","id":"24856","refid":"16360","refobject":"immoDocument","contenttype":"application/pdf","reffield":"documentSource"}
2020-11-25 11:03:40,434 INFO [com.simplicite.util.ScriptInterpreter] SIMPLICITE|http://e3m.simplicite.io:10188||INFO|designer|com.simplicite.util.ScriptInterpreter|ImmoWorkProject/the_ajax_ImmoWorkProject||Evénement: doc = {"path":"immoDocument/documentSource/0/16358/kane9rht EDLE V GABARROCA ét3 G.pdf","size":1858496,"mime":"application/pdf","name":"kane9rht EDLE V GABARROCA ét3 G.pdf","id":"24854","refid":"16358","refobject":"immoDocument","contenttype":"application/pdf","reffield":"documentSource"}
2020-11-25 11:03:40,432 INFO [com.simplicite.util.ScriptInterpreter] SIMPLICITE|http://e3m.simplicite.io:10188||INFO|designer|com.simplicite.util.ScriptInterpreter|ImmoWorkProject/the_ajax_ImmoWorkProject||Evénement: doc = {"path":"immoDocument/documentSource/0/16347/kane9rht EDLE PREVOST ét1 G.pdf","size":3405778,"mime":"application/pdf","name":"kane9rht EDLE PREVOST ét1 G.pdf","id":"24847","refid":"16347","refobject":"immoDocument","contenttype":"application/pdf","reffield":"documentSource"}
2020-11-25 11:03:40,430 INFO [com.simplicite.util.ScriptInterpreter] SIMPLICITE|http://e3m.simplicite.io:10188||INFO|designer|com.simplicite.util.ScriptInterpreter|ImmoWorkProject/the_ajax_ImmoWorkProject||Evénement: doc = {"path":"immoDocument/documentSource/0/16344/kane9rht EDLE SCAVINI Pierre 20160701.pdf","size":5391886,"mime":"application/pdf","name":"kane9rht EDLE SCAVINI Pierre 20160701.pdf","id":"24845","refid":"16344","refobject":"immoDocument","contenttype":"application/pdf","reffield":"documentSource"}
2020-11-25 11:03:40,428 INFO [com.simplicite.util.ScriptInterpreter] SIMPLICITE|http://e3m.simplicite.io:10188||INFO|designer|com.simplicite.util.ScriptInterpreter|ImmoWorkProject/the_ajax_ImmoWorkProject||Evénement: doc = {"path":"immoDocument/documentSource/0/16338/kane7rb EDLE LECOANET ét1 G 20160925.pdf","size":3422162,"mime":"application/pdf","name":"kane7rb EDLE LECOANET ét1 G 20160925.pdf","id":"24839","refid":"16338","refobject":"immoDocument","contenttype":"application/pdf","reffield":"documentSource"}
2020-11-25 11:03:40,426 INFO [com.simplicite.util.ScriptInterpreter] SIMPLICITE|http://e3m.simplicite.io:10188||INFO|designer|com.simplicite.util.ScriptInterpreter|ImmoWorkProject/the_ajax_ImmoWorkProject||Evénement: doc = {"path":"immoDocument/documentSource/0/15188/kane7rb EDLE LECOANET ét1 G 20160925.pdf","size":3422162,"mime":"application/pdf","name":"kane7rb EDLE LECOANET ét1 G 20160925.pdf","id":"24527","refid":"15188","refobject":"immoDocument","contenttype":"application/pdf","reffield":"documentSource"}
2020-11-25 11:03:40,424 INFO [com.simplicite.util.ScriptInterpreter] SIMPLICITE|http://e3m.simplicite.io:10188||INFO|designer|com.simplicite.util.ScriptInterpreter|ImmoWorkProject/the_ajax_ImmoWorkProject||Evénement: doc = {"path":"immoDocument/documentSource/0/15160/KALYKE - P24P - EDLE TRUTEAU 201803.pdf","size":34023064,"mime":"application/pdf","name":"KALYKE - P24P - EDLE TRUTEAU 201803.pdf","id":"24499","refid":"15160","refobject":"immoDocument","contenttype":"application/pdf","reffield":"documentSource"}
Ai-je oublié une étape svp ?
Merci d’avance pour votre aide.
Abed.