private static CnsSubscriptionProtocol getEndpointAndProtoIndexValProtocol(String composite) { String[] arr = composite.split(":"); if (arr.length < 2) { throw new IllegalArgumentException( "Bad format for EndpointAndProtocol composite. Must be of the form <protocol>:<endpoint>. Got:" + composite); } return CnsSubscriptionProtocol.valueOf(arr[0]); }
private static CNSSubscription extractSubscriptionFromColumn( CmbColumn<CmbComposite, String> column, String topicArn) throws JSONException { JSONObject json = new JSONObject(column.getValue()); CNSSubscription s = new CNSSubscription(json.getString("subArn")); s.setEndpoint(json.getString("endPoint")); s.setUserId(json.getString("userId")); if (json.has("confirmDate")) { s.setConfirmDate(new Date(json.getLong("confirmDate"))); } if (json.has("requestDate")) { s.setRequestDate(new Date(json.getLong("requestDate"))); } if (json.has("protocol")) { s.setProtocol(CnsSubscriptionProtocol.valueOf(json.getString("protocol"))); } if (json.has("isConfirmed")) { s.setConfirmed(json.getBoolean("isConfirmed")); } s.setToken(json.getString("token")); if (json.has("authenticateOnSubscribe")) { s.setAuthenticateOnUnsubscribe(json.getBoolean("authenticateOnSubscribe")); } if (json.has("rawMessageDelivery")) { s.setRawMessageDelivery(json.getBoolean("rawMessageDelivery")); } s.setTopicArn(topicArn); return s; }