Rev 1779 | Rev 1781 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1779 | Rev 1780 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | package pt.estgp.estgweb.domain; |
1 | package pt.estgp.estgweb.domain; |
2 | 2 | ||
3 | import com.owlike.genson.Genson; |
3 | import com.owlike.genson.Genson; |
4 | - | ||
- | 4 | import com.owlike.genson.GensonBuilder; |
|
5 | import org.json.JSONException; |
5 | import org.json.JSONException; |
6 | import org.json.JSONObject; |
6 | import org.json.JSONObject; |
7 | 7 | ||
8 | import java.io.IOException; |
8 | import java.io.IOException; |
9 | import java.util.ArrayList; |
9 | import java.util.ArrayList; |
Line 11... | Line 11... | ||
11 | /** |
11 | /** |
12 | * Created by jorgemachado on 03/02/17. |
12 | * Created by jorgemachado on 03/02/17. |
13 | */ |
13 | */ |
14 | public class BpmnProcessImpl extends BpmnProcess |
14 | public class BpmnProcessImpl extends BpmnProcess |
15 | { |
15 | { |
16 | static Genson genson = new Genson.Builder() |
16 | static Genson genson = new GensonBuilder() |
17 | - | ||
18 | .useFields(true) |
- | |
19 | .useMethods(true) |
17 | .useClassMetadata(true) |
20 | - | ||
21 | - | ||
22 | .exclude(5+0%2Fdocs%2Fapi+Object">Object.class) |
18 | .exclude(5+0%2Fdocs%2Fapi+Object">Object.class) |
- | 19 | .include(1.5.0/docs/api/java/lang/Boolean.html">Boolean.class) |
|
- | 20 | .include(1.5.0/docs/api/java/lang/Integer.html">Integer.class) |
|
- | 21 | .include(1.5.0/docs/api/java/lang/Long.html">Long.class) |
|
- | 22 | .include(1.5.0/docs/api/java/lang/Double.html">Double.class) |
|
- | 23 | .include(1.5.0/docs/api/java/lang/Float.html">Float.class) |
|
23 | .include(1.5.0/docs/api/java/util/ArrayList.html">ArrayList.class) |
24 | .include(1.5.0/docs/api/java/util/ArrayList.html">ArrayList.class) |
24 | .include(BpmnProcess.class) |
25 | .include(BpmnProcess.class) |
25 | .include(BpmnFlowComponent.class) |
26 | .include(BpmnFlowComponent.class) |
26 | .include(BpmnActorPool.class) |
27 | .include(BpmnActorPool.class) |
27 | .include(BpmnAbstractActorSelector.class) |
28 | .include(BpmnAbstractActorSelector.class) |
Line 31... | Line 32... | ||
31 | 32 | ||
32 | 33 | ||
33 | //.include(BpmnProcessStep.class) |
34 | //.include(BpmnProcessStep.class) |
34 | .create(); |
35 | .create(); |
35 | 36 | ||
36 | public JSONObject toJsonObject() throws 1.5.0/docs/api/java/io/IOException.html">IOException ,JSONException |
37 | public JSONObject toJsonObject() throws JSONException |
37 | { |
38 | { |
38 | return new JSONObject(genson.serialize(this)); |
39 | return new JSONObject(genson.serialize(this)); |
39 | } |
40 | } |
40 | 41 | ||
41 | public 1.5.0/docs/api/java/lang/String.html">String toJson() throws 1.5.0/docs/api/java/io/IOException.html">IOException |
42 | public 1.5.0/docs/api/java/lang/String.html">String toJson() { |
42 | { |
- | |
43 | return genson.serialize(this); |
43 | return genson.serialize(this); |
44 | } |
44 | } |
45 | 45 | ||
46 | public static 1.5.0/docs/api/java/lang/String.html">String toJsonArray(ArrayList<BpmnProcess> processes) |
46 | public static 1.5.0/docs/api/java/lang/String.html">String toJsonArray(ArrayList<BpmnProcess> processes) |
47 | { |
47 | { |
Line 50... | Line 50... | ||
50 | 50 | ||
51 | public static BpmnProcessImpl fromJson(1.5.0/docs/api/java/lang/String.html">String processJson) throws 1.5.0/docs/api/java/io/IOException.html">IOException { |
51 | public static BpmnProcessImpl fromJson(1.5.0/docs/api/java/lang/String.html">String processJson) throws 1.5.0/docs/api/java/io/IOException.html">IOException { |
52 | return genson.deserialize(processJson,BpmnProcessImpl.class); |
52 | return genson.deserialize(processJson,BpmnProcessImpl.class); |
53 | } |
53 | } |
54 | 54 | ||
- | 55 | //TESTES |
|
55 | public static void main(1.5.0/docs/api/java/lang/String.html">String[] args) throws 1.5.0/docs/api/java/io/IOException.html">IOException { |
56 | public static void main(1.5.0/docs/api/java/lang/String.html">String[] args) throws 1.5.0/docs/api/java/io/IOException.html">IOException { |
56 | 1.5.0/docs/api/java/lang/System.html">System.out.println(new BpmnProcessImpl().toJson()); |
- | |
- | 57 | ||
- | 58 | ||
57 | } |
59 | } |
58 | } |
60 | } |