OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 21 | Rev 61 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 21 Rev 25
Line 11... Line 11...
11
 * When distributing the software, include this License Header Notice in each file.
11
 * When distributing the software, include this License Header Notice in each file.
12
 */
12
 */
13
 
13
 
14
 package org.openconcerto.erp.generationDoc;
14
 package org.openconcerto.erp.generationDoc;
15
 
15
 
-
 
16
import static org.openconcerto.erp.generationDoc.SheetXml.getValidFileName;
-
 
17
import org.openconcerto.utils.StringUtils;
-
 
18
 
16
import java.io.File;
19
import java.io.File;
17
import java.util.ArrayList;
20
import java.util.ArrayList;
18
import java.util.HashMap;
21
import java.util.HashMap;
19
import java.util.List;
22
import java.util.List;
20
import java.util.Map;
23
import java.util.Map;
Line 33... Line 36...
33
    protected Map<Integer, Map<String, Object>> mapAllSheetValues = new HashMap<Integer, Map<String, Object>>();
36
    protected Map<Integer, Map<String, Object>> mapAllSheetValues = new HashMap<Integer, Map<String, Object>>();
34
 
37
 
35
    // Nom des feuilles
38
    // Nom des feuilles
36
    protected List<String> sheetNames = new ArrayList<String>();
39
    protected List<String> sheetNames = new ArrayList<String>();
37
 
40
 
-
 
41
    private File generatedOpenDocumentFile;
-
 
42
 
-
 
43
    public AbstractListeSheetXml() {
-
 
44
        generatedOpenDocumentFile = new File(getDocumentOutputDirectory(), getValidFileName(getName()) + ".ods");
-
 
45
    }
-
 
46
 
38
    public final Future<File> genere(final boolean visu, final boolean impression) {
47
    public final Future<SheetXml> createDocumentAsynchronous() {
39
        Callable<File> c = new Callable<File>() {
48
        Callable<SheetXml> c = new Callable<SheetXml>() {
40
            @Override
49
            @Override
41
            public File call() throws Exception {
50
            public SheetXml call() throws Exception {
42
                try {
51
                try {
43
                    createListeValues();
52
                    createListeValues();
44
                    File fGen = OOgenerationListeXML.genere(getModele(), locationOO, getFileName(), listAllSheetValues, mapAllSheetValues, styleAllSheetValues, sheetNames, null);
53
                    generatedOpenDocumentFile = OOgenerationListeXML.genere(getTemplateId(), getDocumentOutputDirectory(), getValidFileName(getName()), listAllSheetValues, mapAllSheetValues,
45
                    AbstractListeSheetXml.this.f = fGen;
54
                            styleAllSheetValues, sheetNames, null);
46
                    useOO(fGen, visu, impression, getFileName());
-
 
47
                    return fGen;
55
                    return AbstractListeSheetXml.this;
48
                } catch (Exception e) {
56
                } catch (Exception e) {
49
                    DEFAULT_HANDLER.uncaughtException(null, e);
57
                    DEFAULT_HANDLER.uncaughtException(null, e);
50
                    // rethrow exception so that the unsuspecting caller can use this as the
58
                    // rethrow exception so that the unsuspecting caller can use this as the
51
                    // original task
59
                    // original task
52
                    throw e;
60
                    throw e;
Line 55... Line 63...
55
                    return null;
63
                    return null;
56
                }
64
                }
57
 
65
 
58
            }
66
            }
59
        };
67
        };
60
        return this.runnableQueue.submit(c);
68
        return runnableQueue.submit(c);
61
    }
69
    }
62
 
70
 
63
    /**
71
    /**
64
     * To fill listAllSheetValues, styleAllSheetValues, mapAllSheetValues, sheetNames
72
     * To fill listAllSheetValues, styleAllSheetValues, mapAllSheetValues, sheetNames
65
     */
73
     */
66
    protected abstract void createListeValues();
74
    protected abstract void createListeValues();
-
 
75
 
-
 
76
    @Override
-
 
77
    public String getStoragePathP() {
-
 
78
        return StringUtils.firstUp(elt.getPluralName());
-
 
79
    }
-
 
80
 
-
 
81
    @Override
-
 
82
    public File getGeneratedFile() {
-
 
83
        return generatedOpenDocumentFile;
-
 
84
    }
-
 
85
 
-
 
86
    @Override
-
 
87
    public File getDocumentOutputDirectoryP() {
-
 
88
        return DocumentLocalStorageManager.getInstance().getDocumentOutputDirectory(this.getTemplateId());
-
 
89
    }
-
 
90
 
-
 
91
    @Override
-
 
92
    public File getPDFOutputDirectoryP() {
-
 
93
        return DocumentLocalStorageManager.getInstance().getPDFOutputDirectory(this.getTemplateId());
-
 
94
    }
67
}
95
}