Subversion Repositories bacoAlunos

Rev

Rev 1775 | Rev 1778 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1775 Rev 1776
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
import com.owlike.genson.TransformationException;
-
 
-
 
4
 
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 12... Line 12...
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 Genson.Builder()
17
            .useMetadata(true)
17
            .useClassMetadata(true)
18
            .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/util/ArrayList.html">ArrayList.class)
19
            .include(1.5.0/docs/api/java/util/ArrayList.html">ArrayList.class)
20
            .include(BpmnProcess.class)
20
            .include(BpmnProcess.class)
21
            .include(BpmnFlowComponent.class)
21
            .include(BpmnFlowComponent.class)
22
            .include(BpmnActorPool.class)
22
            .include(BpmnActorPool.class)
Line 26... Line 26...
26
            .exclude("getJson", BpmnProcessImpl.class)
26
            .exclude("getJson", BpmnProcessImpl.class)
27
            .exclude("getJsonObject", BpmnProcessImpl.class)
27
            .exclude("getJsonObject", BpmnProcessImpl.class)
28
            //.include(BpmnProcessStep.class)
28
            //.include(BpmnProcessStep.class)
29
            .create();
29
            .create();
30
 
30
 
31
    public JSONObject toJsonObject() throws 1.5.0/docs/api/java/io/IOException.html">IOException, TransformationException ,JSONException
31
    public JSONObject toJsonObject() throws 1.5.0/docs/api/java/io/IOException.html">IOException ,JSONException
32
    {
32
    {
33
        return new JSONObject(genson.serialize(this));
33
        return new JSONObject(genson.serialize(this));
34
    }
34
    }
35
 
35
 
36
    public 1.5.0/docs/api/java/lang/String.html">String toJson() throws 1.5.0/docs/api/java/io/IOException.html">IOException,TransformationException
36
    public 1.5.0/docs/api/java/lang/String.html">String toJson() throws 1.5.0/docs/api/java/io/IOException.html">IOException
37
    {
37
    {
38
        return genson.serialize(this);
38
        return genson.serialize(this);
39
    }
39
    }
40
 
40
 
41
    public static 1.5.0/docs/api/java/lang/String.html">String toJsonArray(ArrayList<BpmnProcess> processes) throws TransformationException, 1.5.0/docs/api/java/io/IOException.html">IOException
41
    public static 1.5.0/docs/api/java/lang/String.html">String toJsonArray(ArrayList<BpmnProcess> processes)
42
    {
42
    {
43
        return genson.serialize(processes);
43
        return genson.serialize(processes);
44
    }
44
    }
45
 
45
 
46
    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, TransformationException {
46
    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 {
47
        return genson.deserialize(processJson,BpmnProcessImpl.class);
47
        return genson.deserialize(processJson,BpmnProcessImpl.class);
48
    }
48
    }
49
}
49
}