use of com.google.gwt.json.client.JSONString in project rstudio by rstudio.
the class RemoteServer method getRmdPublishDetails.
@Override
public void getRmdPublishDetails(String target, ServerRequestCallback<RmdPublishDetails> requestCallback) {
JSONArray params = new JSONArray();
params.set(0, new JSONString(target));
sendRequest(RPC_SCOPE, GET_RMD_PUBLISH_DETAILS, params, requestCallback);
}
use of com.google.gwt.json.client.JSONString in project pentaho-platform by pentaho.
the class PermissionsPanel method saveSecuritySettings.
private void saveSecuritySettings() {
JSONObject jsNewRoleAssignments = new JSONObject();
JSONArray jsLogicalRoleAssignments = new JSONArray();
int x = 0;
for (Map.Entry<String, List<String>> roleAssignment : newRoleAssignments.entrySet()) {
JSONArray jsLogicalRoles = new JSONArray();
int y = 0;
for (String logicalRoleName : roleAssignment.getValue()) {
jsLogicalRoles.set(y++, new JSONString(logicalRoleName));
}
JSONObject jsRoleAssignment = new JSONObject();
jsRoleAssignment.put("roleName", new JSONString(roleAssignment.getKey()));
jsRoleAssignment.put("logicalRoles", jsLogicalRoles);
jsLogicalRoleAssignments.set(x++, jsRoleAssignment);
}
jsNewRoleAssignments.put("assignments", jsLogicalRoleAssignments);
RequestBuilder saveSettingRequestBuilder = new RequestBuilder(RequestBuilder.PUT, GWT.getHostPageBaseURL() + "api/userroledao/roleAssignments");
saveSettingRequestBuilder.setHeader("Content-Type", "application/json");
saveSettingRequestBuilder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
try {
saveSettingRequestBuilder.sendRequest(jsNewRoleAssignments.toString(), new RequestCallback() {
public void onError(Request request, Throwable exception) {
}
public void onResponseReceived(Request request, Response response) {
if (response.getStatusCode() == 200) {
masterRoleMap.putAll(newRoleAssignments);
newRoleAssignments.clear();
}
}
});
} catch (RequestException e) {
// ignored
}
}
use of com.google.gwt.json.client.JSONString in project pentaho-platform by pentaho.
the class GeneralPanel method setMetadataResponse.
/**
* Accept metadata response object and parse for use in General panel
*
* @param response
*/
protected void setMetadataResponse(Response response) {
JSONObject json = (JSONObject) JSONParser.parseLenient(response.getText());
if (json != null) {
JSONArray arr = (JSONArray) json.get("stringKeyStringValueDto");
for (int i = 0; i < arr.size(); i++) {
JSONValue arrVal = arr.get(i);
String key = arrVal.isObject().get("key").isString().stringValue();
if (key != null && SolutionBrowserPanel.getInstance().isAdministrator()) {
if (key.equals(org.pentaho.platform.api.repository2.unified.RepositoryFile.SCHEDULABLE_KEY) && !fileSummary.isFolder() || key.equals(org.pentaho.platform.api.repository2.unified.RepositoryFile.HIDDEN_KEY)) {
String value = arrVal.isObject().get("value").isString().stringValue();
if (key.startsWith(METADATA_PERM_PREFIX)) {
JSONObject nv = new JSONObject();
nv.put(key, new JSONString(value));
metadataPerms.add(nv);
}
}
}
}
for (final JSONObject nv : metadataPerms) {
Set<String> keys = nv.keySet();
for (final String key : keys) {
if (key != null && SolutionBrowserPanel.getInstance().isAdministrator()) {
if (key.equals(org.pentaho.platform.api.repository2.unified.RepositoryFile.SCHEDULABLE_KEY) && !fileSummary.isFolder() || key.equals(org.pentaho.platform.api.repository2.unified.RepositoryFile.HIDDEN_KEY)) {
final CheckBox cb = new CheckBox(Messages.getString(key.substring(METADATA_PERM_PREFIX.length()).toLowerCase()));
cb.setWordWrap(false);
cb.setValue(Boolean.parseBoolean(nv.get(key).isString().stringValue()));
cb.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
dirty = true;
nv.put(key, new JSONString(cb.getValue().toString()));
}
});
metadataPermsPanel.add(cb);
}
}
}
}
}
}
use of com.google.gwt.json.client.JSONString in project pentaho-platform by pentaho.
the class RunInBackgroundCommand method getJsonSimpleTrigger.
@SuppressWarnings("deprecation")
protected JSONObject getJsonSimpleTrigger(int repeatCount, int interval, Date startDate, Date endDate) {
JSONObject trigger = new JSONObject();
// $NON-NLS-1$
trigger.put("repeatInterval", new JSONNumber(interval));
// $NON-NLS-1$
trigger.put("repeatCount", new JSONNumber(repeatCount));
trigger.put("startTime", // $NON-NLS-1$
startDate != null ? new JSONString(DateTimeFormat.getFormat(PredefinedFormat.ISO_8601).format(startDate)) : JSONNull.getInstance());
if (endDate != null) {
endDate.setHours(23);
endDate.setMinutes(59);
endDate.setSeconds(59);
}
trigger.put("endTime", // $NON-NLS-1$
endDate == null ? JSONNull.getInstance() : new JSONString(DateTimeFormat.getFormat(PredefinedFormat.ISO_8601).format(endDate)));
return trigger;
}
use of com.google.gwt.json.client.JSONString in project pentaho-platform by pentaho.
the class FavoritePickItem method toJson.
public JSONObject toJson() {
JSONObject jso = new JSONObject();
jso.put("fullPath", new JSONString(fullPath));
if (lastUse != null) {
jso.put("title", new JSONString(title));
jso.put("lastUse", new JSONNumber(lastUse));
}
return jso;
}
Aggregations