Subversion Repositories bacoAlunos

Rev

Rev 1778 | Rev 1780 | 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;
1776 jmachado 4
 
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
{
16
    static Genson genson = new Genson.Builder()
1778 jmachado 17
 
18
            .useFields(true)
19
            .useMethods(true)
20
 
21
 
1775 jmachado 22
            .exclude(5+0%2Fdocs%2Fapi+Object">Object.class)
23
            .include(1.5.0/docs/api/java/util/ArrayList.html">ArrayList.class)
1670 jmachado 24
            .include(BpmnProcess.class)
1775 jmachado 25
            .include(BpmnFlowComponent.class)
26
            .include(BpmnActorPool.class)
27
            .include(BpmnAbstractActorSelector.class)
28
            .include(BpmnProcessVariable.class)
29
            .include(1.5.0/docs/api/java/lang/String.html">String.class)
1778 jmachado 30
 
31
 
1779 jmachado 32
 
1670 jmachado 33
            //.include(BpmnProcessStep.class)
34
            .create();
35
 
1776 jmachado 36
    public JSONObject toJsonObject() throws 1.5.0/docs/api/java/io/IOException.html">IOException ,JSONException
1670 jmachado 37
    {
38
        return new JSONObject(genson.serialize(this));
39
    }
40
 
1776 jmachado 41
    public 1.5.0/docs/api/java/lang/String.html">String toJson() throws 1.5.0/docs/api/java/io/IOException.html">IOException
1670 jmachado 42
    {
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
 
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
        1.5.0/docs/api/java/lang/System.html">System.out.println(new BpmnProcessImpl().toJson());
57
    }
1653 jmachado 58
}