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

javapns.notification.management.APNPayload Maven / Gradle / Ivy

package javapns.notification.management;

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

import java.util.Map;

/**
 * An MDM payload for APN (Access Point Name).
 *
 * @author Sylvain Pedneault
 */
class APNPayload extends MobileConfigPayload {
  public APNPayload(final int payloadVersion, final String payloadOrganization, final String payloadIdentifier, final String payloadDisplayName, final Map defaultsData, final String defaultsDomainName, final Map[] apns, final String apn, final String username) throws JSONException {
    super(payloadVersion, "com.apple.apn.managed", payloadOrganization, payloadIdentifier, payloadDisplayName);
    final JSONObject payload = getPayload();
    payload.put("DefaultsData", defaultsData);
    payload.put("defaultsDomainName", defaultsDomainName);
    for (final Map apnsEntry : apns) {
      payload.put("apns", apnsEntry);
    }
    payload.put("apn", apn);
    payload.put("username", username);
  }

  public void setPassword(final APNPayload value) throws JSONException {
    getPayload().put("password", value);
  }

  public void setProxy(final String value) throws JSONException {
    getPayload().put("proxy", value);
  }

  public void setProxyPort(final int value) throws JSONException {
    getPayload().put("proxyPort", value);
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy