Subversion Repositories bacoAlunos

Rev

Rev 1775 | Rev 1778 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

package pt.estgp.estgweb.domain;

import com.owlike.genson.Genson;

import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;
import java.util.ArrayList;

/**
 * Created by jorgemachado on 03/02/17.
 */

public class BpmnProcessImpl extends BpmnProcess
{
    static Genson genson = new Genson.Builder()
            .useClassMetadata(true)
            .exclude(5+0%2Fdocs%2Fapi+Object">Object.class)
            .include(1.5.0/docs/api/java/util/ArrayList.html">ArrayList.class)
            .include(BpmnProcess.class)
            .include(BpmnFlowComponent.class)
            .include(BpmnActorPool.class)
            .include(BpmnAbstractActorSelector.class)
            .include(BpmnProcessVariable.class)
            .include(1.5.0/docs/api/java/lang/String.html">String.class)
            .exclude("getJson", BpmnProcessImpl.class)
            .exclude("getJsonObject", BpmnProcessImpl.class)
            //.include(BpmnProcessStep.class)
            .create();

    public JSONObject toJsonObject() throws 1.5.0/docs/api/java/io/IOException.html">IOException ,JSONException
    {
        return new JSONObject(genson.serialize(this));
    }

    public 1.5.0/docs/api/java/lang/String.html">String toJson() throws 1.5.0/docs/api/java/io/IOException.html">IOException
    {
        return genson.serialize(this);
    }

    public static 1.5.0/docs/api/java/lang/String.html">String toJsonArray(ArrayList<BpmnProcess> processes)
    {
        return genson.serialize(processes);
    }

    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 {
        return genson.deserialize(processJson,BpmnProcessImpl.class);
    }
}