Java Code Examples for com.google.gwt.json.client.JSONObject#toString()

The following examples show how to use com.google.gwt.json.client.JSONObject#toString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DigitalObjectEditing.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
@Override
public String getToken(DigitalObjectEditorPlace place) {
    String[] digitalObjectPids = place.getPids();
    if (digitalObjectPids != null && digitalObjectPids.length > 1) {
        // batch edits should not be bookmarked
        throw new UnsupportedOperationException(Arrays.toString(digitalObjectPids));
    }
    Record[] digitalObjects = place.getDigitalObjects();
    if (digitalObjects != null && digitalObjects.length > 1) {
        // batch edits should not be bookmarked
        String[] pids = ClientUtils.toFieldValues(digitalObjects, "pid");
        throw new UnsupportedOperationException(Arrays.toString(pids));
    }
    JSONObject json = new JSONObject();
    JsonTokenizer.putString(json, EDITOR, place.editor == null ? null : place.editor.name());
    JsonTokenizer.putString(json, PID, place.getPid());
    String jsonString = json.toString();
    return jsonString;
}
 
Example 2
Source File: Project.java    From geowe-core with GNU General Public License v3.0 6 votes vote down vote up
public String toJSON() {

		JSONObject projectObject = new JSONObject();
		projectObject.put("version", new JSONString(getVersion()));
		projectObject.put("title", new JSONString(getTitle()));
		projectObject.put("description", new JSONString(getDescription()));
		projectObject.put("date", new JSONString(getDate()));		
		
		JSONArray layersArray = new JSONArray();
		int index = 0;
		for(ProjectVectorLayer projectLayer: vectors) {
			layersArray.set(index, projectLayer.getJSONObject());
			
			index++;
		}
		
		projectObject.put("vectors", layersArray);

		return projectObject.toString();
	}
 
Example 3
Source File: WorkflowManaging.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
@Override
public String toToken() {
    JSONObject json = new JSONObject();
    JsonTokenizer.putString(json, Tokenizer.TYPE, Type.NEWJOBEDIT.name());
    JsonTokenizer.putString(json, Tokenizer.JOB_ID, jobId);
    JsonTokenizer.putString(json, Tokenizer.MODEL_PID, modelPid);

    return json.toString();
}
 
Example 4
Source File: DigitalObjectCreating.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
@Override
public String getToken(DigitalObjectCreatorPlace place) {
    JSONObject json = new JSONObject();
    JsonTokenizer.putString(json, MODEL, place.model);
    JsonTokenizer.putString(json, PARENT, place.parent);
    String jsonString = json.toString();
    return jsonString;
}
 
Example 5
Source File: Importing.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
@Override
public String getToken(ImportPlace place) {
    JSONObject json = new JSONObject();
    Type importType = place.getType();
    JsonTokenizer.putString(json, TYPE, importType == null ? null : importType.name());
    JsonTokenizer.putString(json, BATCHID, place.getBatchId());
    return json.toString();
}
 
Example 6
Source File: WorkflowManaging.java    From proarc with GNU General Public License v3.0 4 votes vote down vote up
@Override
public String toToken() {
    JSONObject json = new JSONObject();
    JsonTokenizer.putString(json, Tokenizer.TYPE, Type.JOBS.name());
    return json.toString();
}
 
Example 7
Source File: WorkflowManaging.java    From proarc with GNU General Public License v3.0 4 votes vote down vote up
@Override
public String toToken() {
    JSONObject json = new JSONObject();
    JsonTokenizer.putString(json, Tokenizer.TYPE, Type.TASKS.name());
    return json.toString();
}
 
Example 8
Source File: WorkflowManaging.java    From proarc with GNU General Public License v3.0 4 votes vote down vote up
@Override
public String toToken() {
    JSONObject json = new JSONObject();
    JsonTokenizer.putString(json, Tokenizer.TYPE, Type.NEWJOB.name());
    return json.toString();
}