Cisco Cisco Prime Home 6.3 개발자 가이드
Cisco Prime Home – Integration Guide
OL-28558-01 v5.1
72
public Credentials getCredentials() {
final JSONObject attributes = optJSONObject("credentials", new
JSONObject());
final String login = attributes.optString("login");
final String password = attributes.optString("password");
return new Credentials(login, password);
final String password = attributes.optString("password");
return new Credentials(login, password);
}
public void setCredentials(final Credentials credentials) {
public void setCredentials(final Credentials credentials) {
try {
final JSONObject json = optJSONObject("credentials", new
JSONObject());
json.put("login", credentials.getLogin());
json.put("password", credentials.getPassword());
put("credentials", json);
json.put("password", credentials.getPassword());
put("credentials", json);
} catch (JSONException e) {
throw new RuntimeException(e);
}
}
public String[] getLabels() {
public String[] getLabels() {
try {
final JSONArray json = optJSONArray("labels");
if (json == null) return new String[0];
final String[] labels = new String[json.length()];
for (int i = 0; i < json.length(); i++) {
if (json == null) return new String[0];
final String[] labels = new String[json.length()];
for (int i = 0; i < json.length(); i++) {
labels[i] = json.getJSONObject(i).getString("name");
}
return labels;
return labels;
} catch (JSONException e) {
throw new RuntimeException(e);
}
}
public void setLabels(final String[] labels) {
public void setLabels(final String[] labels) {
try {
final JSONArray json = new JSONArray();
for (String labelName : labels) {
for (String labelName : labels) {
final JSONObject label = new JSONObject();
label.put("name", labelName);
label.put("name", labelName);
}
put("labels", json);
put("labels", json);
} catch (JSONException e) {
throw new RuntimeException(e);
}
}
public boolean isNotPersisted() {
public boolean isNotPersisted() {
return !has("revision");
}
public JSONObject optJSONObject(final String key, final
public JSONObject optJSONObject(final String key, final
JSONObject defaultValue) {
final JSONObject value = optJSONObject(key);
return value != null ? value : defaultValue;
return value != null ? value : defaultValue;
}
}
com.clearaccess.subscriber.api.Address
/*
* Copyright (c) 2010 ClearAccess, Inc.