Subversion Repositories bacoAlunos

Rev

Rev 1776 | Rev 1779 | 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
 
1775 jmachado 32
            .exclude("getJson", BpmnProcessImpl.class)
33
            .exclude("getJsonObject", BpmnProcessImpl.class)
1670 jmachado 34
            //.include(BpmnProcessStep.class)
35
            .create();
36
 
1776 jmachado 37
    public JSONObject toJsonObject() throws 1.5.0/docs/api/java/io/IOException.html">IOException ,JSONException
1670 jmachado 38
    {
39
        return new JSONObject(genson.serialize(this));
40
    }
41
 
1776 jmachado 42
    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 43
    {
44
        return genson.serialize(this);
45
    }
1775 jmachado 46
 
1776 jmachado 47
    public static 1.5.0/docs/api/java/lang/String.html">String toJsonArray(ArrayList<BpmnProcess> processes)
1775 jmachado 48
    {
49
        return genson.serialize(processes);
50
    }
51
 
1776 jmachado 52
    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 53
        return genson.deserialize(processJson,BpmnProcessImpl.class);
54
    }
1778 jmachado 55
 
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 {
57
        1.5.0/docs/api/java/lang/System.html">System.out.println(new BpmnProcessImpl().toJson());
58
    }
1653 jmachado 59
}