|
@@ -14,7 +14,7 @@ import java.util.Map;
|
|
public abstract class ParamsUtil {
|
|
public abstract class ParamsUtil {
|
|
private ParamsUtil(){}
|
|
private ParamsUtil(){}
|
|
|
|
|
|
- public static Document convertParamsToDocument(Map params) {
|
|
|
|
|
|
+ public static Document convertParams2Doc(Map params) {
|
|
Assert.notNull(params, "Params can not be null.");
|
|
Assert.notNull(params, "Params can not be null.");
|
|
Document doc = new Document();
|
|
Document doc = new Document();
|
|
String id = (String) params.get(ConfigConstant.CONFIG_MODEL_ID);
|
|
String id = (String) params.get(ConfigConstant.CONFIG_MODEL_ID);
|
|
@@ -32,4 +32,23 @@ public abstract class ParamsUtil {
|
|
doc.add(new StoredField(ConfigConstant.CONFIG_MODEL_JSON, json));
|
|
doc.add(new StoredField(ConfigConstant.CONFIG_MODEL_JSON, json));
|
|
return doc;
|
|
return doc;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public static Document convertData2Doc(Map params) {
|
|
|
|
+ Assert.notNull(params, "Params can not be null.");
|
|
|
|
+ Document doc = new Document();
|
|
|
|
+ String id = (String) params.get(ConfigConstant.CONFIG_MODEL_ID);
|
|
|
|
+ Boolean success = (Boolean) params.get(ConfigConstant.DATA_SUCCESS);
|
|
|
|
+ String event = (String) params.get(ConfigConstant.DATA_EVENT);
|
|
|
|
+ String error = (String) params.get(ConfigConstant.DATA_ERROR);
|
|
|
|
+ String json = (String) params.get(ConfigConstant.CONFIG_MODEL_JSON);
|
|
|
|
+ Long createTime = (Long) params.get(ConfigConstant.CONFIG_MODEL_CREATE_TIME);
|
|
|
|
+
|
|
|
|
+ doc.add(new StringField(ConfigConstant.CONFIG_MODEL_ID, id, Field.Store.YES));
|
|
|
|
+ doc.add(new StringField(ConfigConstant.DATA_SUCCESS, String.valueOf(success), Field.Store.YES));
|
|
|
|
+ doc.add(new StringField(ConfigConstant.DATA_EVENT, event, Field.Store.YES));
|
|
|
|
+ doc.add(new TextField(ConfigConstant.DATA_ERROR, error, Field.Store.YES));
|
|
|
|
+ doc.add(new StoredField(ConfigConstant.CONFIG_MODEL_JSON, json));
|
|
|
|
+ doc.add(new LongPoint(ConfigConstant.CONFIG_MODEL_CREATE_TIME, createTime));
|
|
|
|
+ return doc;
|
|
|
|
+ }
|
|
}
|
|
}
|