|
|
|
@ -17,6 +17,7 @@ import org.json.JSONObject;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
|
|
|
|
import java.util.Collection;
|
|
|
|
|
import java.util.LinkedList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
@ -239,6 +240,18 @@ public class Field implements Comparable, PropertiesModelBuilder, ViewStyleDefin
|
|
|
|
|
} catch (JsonProcessingException e) {
|
|
|
|
|
logger.error(e.getMessage(), e);
|
|
|
|
|
}
|
|
|
|
|
} else if (this.value instanceof Collection) {
|
|
|
|
|
Collection valueCollection = (Collection) this.value;
|
|
|
|
|
StringBuilder valueBuilder = new StringBuilder();
|
|
|
|
|
valueBuilder.append("[");
|
|
|
|
|
for (int i = 0; i < valueCollection.size(); i++) {
|
|
|
|
|
valueBuilder.append(parseString(valueCollection.stream().toArray()[i]));
|
|
|
|
|
if (i < valueCollection.size() - 1) {
|
|
|
|
|
valueBuilder.append(", ");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
valueBuilder.append("]");
|
|
|
|
|
fieldValues.put(this.id, valueBuilder.toString());
|
|
|
|
|
} else {
|
|
|
|
|
fieldValues.put(this.id, this.value.toString());
|
|
|
|
|
}
|
|
|
|
@ -251,4 +264,13 @@ public class Field implements Comparable, PropertiesModelBuilder, ViewStyleDefin
|
|
|
|
|
public void toMap(Map<String, Object> fieldValues, int index) {
|
|
|
|
|
fieldValues.put(this.id, this.value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String parseString(Object value) {
|
|
|
|
|
if (value instanceof String) {
|
|
|
|
|
if (((String)value).contains(",")) {
|
|
|
|
|
return "\"" + value + "\"";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return value.toString();
|
|
|
|
|
}
|
|
|
|
|
}
|