2010-02-03 03:29:47 +01:00
|
|
|
package com.metaweb.gridworks.model;
|
2010-01-24 22:09:50 +01:00
|
|
|
|
2010-01-25 23:51:25 +01:00
|
|
|
import java.io.Serializable;
|
2010-01-27 02:48:42 +01:00
|
|
|
import java.util.Properties;
|
|
|
|
|
|
|
|
import org.json.JSONException;
|
2010-02-01 20:16:09 +01:00
|
|
|
import org.json.JSONWriter;
|
2010-01-25 23:51:25 +01:00
|
|
|
|
2010-02-03 03:29:47 +01:00
|
|
|
import com.metaweb.gridworks.Jsonizable;
|
|
|
|
import com.metaweb.gridworks.expr.HasFields;
|
2010-02-01 00:15:50 +01:00
|
|
|
|
2010-02-01 20:16:09 +01:00
|
|
|
public class ReconCandidate implements Serializable, HasFields, Jsonizable {
|
2010-01-25 23:51:25 +01:00
|
|
|
private static final long serialVersionUID = -8013997214978715606L;
|
|
|
|
|
2010-01-27 02:48:42 +01:00
|
|
|
public String topicID;
|
|
|
|
public String topicGUID;
|
|
|
|
public String topicName;
|
2010-01-24 22:09:50 +01:00
|
|
|
public String[] typeIDs;
|
2010-02-01 00:15:50 +01:00
|
|
|
public double score;
|
2010-01-27 02:48:42 +01:00
|
|
|
|
2010-02-01 00:15:50 +01:00
|
|
|
@Override
|
|
|
|
public Object getField(String name, Properties bindings) {
|
|
|
|
if ("id".equals(name)) {
|
|
|
|
return topicName;
|
|
|
|
} else if ("guid".equals(name)) {
|
|
|
|
return topicGUID;
|
|
|
|
} else if ("name".equals(name)) {
|
|
|
|
return topicName;
|
|
|
|
} else if ("type".equals(name)) {
|
|
|
|
return typeIDs;
|
|
|
|
} else if ("score".equals(name)) {
|
|
|
|
return score;
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
2010-02-01 20:16:09 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void write(JSONWriter writer, Properties options)
|
|
|
|
throws JSONException {
|
|
|
|
|
|
|
|
writer.object();
|
|
|
|
writer.key("id"); writer.value(topicID);
|
2010-02-01 21:57:52 +01:00
|
|
|
//writer.key("guid"); writer.value(topicGUID);
|
2010-02-01 20:16:09 +01:00
|
|
|
writer.key("name"); writer.value(topicName);
|
2010-02-02 21:50:35 +01:00
|
|
|
writer.key("score"); writer.value(score);
|
2010-02-01 20:16:09 +01:00
|
|
|
|
2010-02-01 21:57:52 +01:00
|
|
|
/*
|
2010-02-01 20:16:09 +01:00
|
|
|
writer.key("types"); writer.array();
|
|
|
|
for (String typeID : typeIDs) {
|
|
|
|
writer.value(typeID);
|
|
|
|
}
|
|
|
|
writer.endArray();
|
2010-02-01 21:57:52 +01:00
|
|
|
*/
|
2010-02-01 20:16:09 +01:00
|
|
|
|
|
|
|
writer.endObject();
|
|
|
|
}
|
2010-01-24 22:09:50 +01:00
|
|
|
}
|