185 |
ilm |
1 |
/*
|
|
|
2 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
|
|
3 |
*
|
|
|
4 |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
|
|
|
5 |
*
|
|
|
6 |
* The contents of this file are subject to the terms of the GNU General Public License Version 3
|
|
|
7 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
|
|
|
8 |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
|
|
|
9 |
* language governing permissions and limitations under the License.
|
|
|
10 |
*
|
|
|
11 |
* When distributing the software, include this License Header Notice in each file.
|
|
|
12 |
*/
|
|
|
13 |
|
|
|
14 |
package org.openconcerto.erp.generationEcritures;
|
|
|
15 |
|
|
|
16 |
import org.openconcerto.erp.core.edm.Attachment;
|
|
|
17 |
import org.openconcerto.sql.model.DBRoot;
|
|
|
18 |
import org.openconcerto.sql.model.SQLInsert;
|
|
|
19 |
import org.openconcerto.sql.model.SQLTable;
|
|
|
20 |
import org.openconcerto.sql.users.User;
|
|
|
21 |
|
|
|
22 |
public class MouvementGED {
|
|
|
23 |
private String url;
|
|
|
24 |
private Mouvement mvt;
|
|
|
25 |
|
|
|
26 |
public MouvementGED(String url) {
|
|
|
27 |
this.url = url;
|
|
|
28 |
}
|
|
|
29 |
|
|
|
30 |
public void setEcriture(Mouvement mvt) {
|
|
|
31 |
this.mvt = mvt;
|
|
|
32 |
}
|
|
|
33 |
|
|
|
34 |
public SQLInsert createInsert(DBRoot root, User user) {
|
|
|
35 |
final SQLInsert insert = new SQLInsert();
|
|
|
36 |
final SQLTable table = root.getTable("ATTACHMENT");
|
|
|
37 |
insert.add(table.getField("SOURCE_TABLE"), "MOUVEMENT");
|
|
|
38 |
insert.add(table.getField("SOURCE_ID"), this.mvt.getId().intValue());
|
|
|
39 |
insert.add(table.getField("NAME"), this.url);
|
|
|
40 |
insert.add(table.getField("FILENAME"), this.url);
|
|
|
41 |
insert.add(table.getField("MIMETYPE"), Attachment.MIMETYPE_URL);
|
|
|
42 |
insert.add(table.getField("FILESIZE"), 0);
|
|
|
43 |
insert.add(table.getField("STORAGE_PATH"), "");
|
|
|
44 |
insert.add(table.getField("STORAGE_FILENAME"), "");
|
|
|
45 |
return insert;
|
|
|
46 |
}
|
|
|
47 |
|
|
|
48 |
}
|