PageRenderTime 16ms CodeModel.GetById 11ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/hippo/src/main/java/com/googlecode/hdbc/view/policy/ExperimentsOutputPolicy.java

http://hdbc.googlecode.com/
Java | 23 lines | 19 code | 4 blank | 0 comment | 0 complexity | 65be9a48f15ef9095045022058582866 MD5 | raw file
 1package com.googlecode.hdbc.view.policy;
 2
 3import java.util.Map;
 4import com.googlecode.hdbc.controller.ModelAttributes;
 5import com.googlecode.hdbc.model.record.ExperimentData;
 6import net.sf.json.JSONObject;
 7
 8public class ExperimentsOutputPolicy implements ICustomOutputPolicy {
 9
10	@SuppressWarnings("unchecked")
11	@Override
12	public Map<String, Object> customOutput(Map<String, Object> model) {
13		JSONObject detail = new JSONObject();
14		ExperimentData experiment = (ExperimentData) model.get(ModelAttributes.OBJECT);
15		detail.put("uid", experiment.getUid());
16		detail.put("title", experiment.getTitle());
17		detail.put("purpose", experiment.getPurpose());
18		JSONObject json = new JSONObject();
19		json.put("experiment", detail);
20		return (Map<String, Object>) json;
21	}
22
23}