All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.venky.swf.plugins.templates.db.model.alerts.DeviceImpl Maven / Gradle / Ivy

The newest version!
package com.venky.swf.plugins.templates.db.model.alerts;

import com.venky.swf.db.table.ModelImpl;
import org.json.simple.JSONObject;
import org.json.simple.JSONValue;

public class DeviceImpl extends ModelImpl {
    public DeviceImpl(){
        super();
    }
    public DeviceImpl(Device device){
        super(device);
    }

    public JSONObject getSubscriptionJson(){
        JSONObject jsonObject = new JSONObject();
        Device device = getProxy();
        boolean isDeviceIdJSON = (device.getDeviceId().startsWith("{"));
        if (!isDeviceIdJSON){
            jsonObject.put("client","android");
            jsonObject.put("token",device.getDeviceId());
        }else {
            jsonObject = (JSONObject) JSONValue.parse(device.getDeviceId());
        }
        return jsonObject;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy