Rev 1779 | Rev 1781 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1653 | jmachado | 1 | package pt.estgp.estgweb.domain; |
2 | |||
1670 | jmachado | 3 | import com.owlike.genson.Genson; |
1780 | jmachado | 4 | import com.owlike.genson.GensonBuilder; |
1670 | jmachado | 5 | import org.json.JSONException; |
6 | import org.json.JSONObject; |
||
7 | |||
8 | import java.io.IOException; |
||
1775 | jmachado | 9 | import java.util.ArrayList; |
1670 | jmachado | 10 | |
1653 | jmachado | 11 | /** |
12 | * Created by jorgemachado on 03/02/17. |
||
13 | */ |
||
1670 | jmachado | 14 | public class BpmnProcessImpl extends BpmnProcess |
15 | { |
||
1780 | jmachado | 16 | static Genson genson = new GensonBuilder() |
17 | .useClassMetadata(true) |
||
1775 | jmachado | 18 | .exclude(5+0%2Fdocs%2Fapi+Object">Object.class) |
1780 | jmachado | 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) |
||
1775 | jmachado | 24 | .include(1.5.0/docs/api/java/util/ArrayList.html">ArrayList.class) |
1670 | jmachado | 25 | .include(BpmnProcess.class) |
1775 | jmachado | 26 | .include(BpmnFlowComponent.class) |
27 | .include(BpmnActorPool.class) |
||
28 | .include(BpmnAbstractActorSelector.class) |
||
29 | .include(BpmnProcessVariable.class) |
||
30 | .include(1.5.0/docs/api/java/lang/String.html">String.class) |
||
1778 | jmachado | 31 | |
32 | |||
1779 | jmachado | 33 | |
1670 | jmachado | 34 | //.include(BpmnProcessStep.class) |
35 | .create(); |
||
36 | |||
1780 | jmachado | 37 | public JSONObject toJsonObject() throws JSONException |
1670 | jmachado | 38 | { |
39 | return new JSONObject(genson.serialize(this)); |
||
40 | } |
||
41 | |||
1780 | jmachado | 42 | public 1.5.0/docs/api/java/lang/String.html">String toJson() { |
1670 | jmachado | 43 | return genson.serialize(this); |
44 | } |
||
1775 | jmachado | 45 | |
1776 | jmachado | 46 | public static 1.5.0/docs/api/java/lang/String.html">String toJsonArray(ArrayList<BpmnProcess> processes) |
1775 | jmachado | 47 | { |
48 | return genson.serialize(processes); |
||
49 | } |
||
50 | |||
1776 | jmachado | 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 { |
1775 | jmachado | 52 | return genson.deserialize(processJson,BpmnProcessImpl.class); |
53 | } |
||
1778 | jmachado | 54 | |
1780 | jmachado | 55 | //TESTES |
1778 | jmachado | 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 { |
1780 | jmachado | 57 | |
58 | |||
1778 | jmachado | 59 | } |
1653 | jmachado | 60 | } |