OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 156 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 156 Rev 174
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.ui.light;
14
 package org.openconcerto.ui.light;
15
 
15
 
-
 
16
import org.openconcerto.utils.io.JSONAble;
-
 
17
import org.openconcerto.utils.io.JSONConverter;
-
 
18
 
16
import java.io.Externalizable;
19
import java.io.Externalizable;
17
import java.io.IOException;
20
import java.io.IOException;
18
import java.io.ObjectInput;
21
import java.io.ObjectInput;
19
import java.io.ObjectOutput;
22
import java.io.ObjectOutput;
20
import java.util.ArrayList;
23
import java.util.ArrayList;
21
import java.util.Collections;
24
import java.util.Collections;
22
import java.util.List;
25
import java.util.List;
23
 
26
 
24
import org.openconcerto.utils.io.JSONAble;
-
 
25
import org.openconcerto.utils.io.JSONConverter;
-
 
26
import net.minidev.json.JSONArray;
27
import net.minidev.json.JSONArray;
27
import net.minidev.json.JSONObject;
28
import net.minidev.json.JSONObject;
28
 
29
 
29
public class RowsBulk implements Externalizable, JSONAble {
30
public class RowsBulk implements Externalizable, JSONAble {
30
 
31
 
Line 141... Line 142...
141
    public void fromJSON(final JSONObject json) {
142
    public void fromJSON(final JSONObject json) {
142
        this.offset = JSONConverter.getParameterFromJSON(json, "offset", Integer.class);
143
        this.offset = JSONConverter.getParameterFromJSON(json, "offset", Integer.class);
143
        this.total = JSONConverter.getParameterFromJSON(json, "total", Integer.class);
144
        this.total = JSONConverter.getParameterFromJSON(json, "total", Integer.class);
144
 
145
 
145
        final JSONArray jsonRows = JSONConverter.getParameterFromJSON(json, "rows", JSONArray.class);
146
        final JSONArray jsonRows = JSONConverter.getParameterFromJSON(json, "rows", JSONArray.class);
146
        this.rows = new ArrayList<Row>();
147
        this.rows = new ArrayList<>();
147
        if (jsonRows != null) {
148
        if (jsonRows != null) {
148
            for (final Object o : jsonRows) {
149
            for (final Object o : jsonRows) {
149
                this.rows.add(new Row(JSONConverter.getObjectFromJSON(o, JSONObject.class)));
150
                this.rows.add(new Row(JSONConverter.getObjectFromJSON(o, JSONObject.class)));
150
            }
151
            }
151
        }
152
        }
152
    }
153
    }
153
 
154
 
154
    @Override
155
    @Override
155
    public String toString() {
156
    public String toString() {
156
        return this.rows.size() + " rows at offset " + offset + " (total:" + total + ") remove:" + this.remove;
157
        return this.rows.size() + " rows at offset " + this.offset + " (total:" + this.total + ") remove:" + this.remove;
157
    }
158
    }
158
}
159
}