mirror of
https://gitee.com/jmix/cuba.git
synced 2024-12-03 03:38:33 +08:00
EntityLog failed if there is no formatter for date. #PL-2244
This commit is contained in:
parent
90db824ae1
commit
53db6ab82c
@ -4,6 +4,7 @@
|
||||
*/
|
||||
package com.haulmont.cuba.security.app;
|
||||
|
||||
import com.haulmont.chile.core.datatypes.Datatype;
|
||||
import com.haulmont.chile.core.datatypes.Datatypes;
|
||||
import com.haulmont.chile.core.model.Instance;
|
||||
import com.haulmont.chile.core.model.MetaClass;
|
||||
@ -58,7 +59,7 @@ public class EntityLog implements EntityLogAPI {
|
||||
protected Metadata metadata;
|
||||
|
||||
@Inject
|
||||
private UserSessionSource userSessionSource;
|
||||
protected UserSessionSource userSessionSource;
|
||||
|
||||
@Inject
|
||||
public EntityLog(Configuration configuration) {
|
||||
@ -324,15 +325,15 @@ public class EntityLog implements EntityLogAPI {
|
||||
}
|
||||
}
|
||||
|
||||
private String stringify(Object value) {
|
||||
protected String stringify(Object value) {
|
||||
if (value == null)
|
||||
return "";
|
||||
else if (value instanceof Instance) {
|
||||
return ((Instance) value).getInstanceName();
|
||||
} else if (value instanceof Date) {
|
||||
SimpleDateFormat df = new SimpleDateFormat(
|
||||
Datatypes.getFormatStrings(userSessionSource.getLocale()).getDateTimeFormat());
|
||||
return df.format(value);
|
||||
Datatype datatype = Datatypes.getNN(value.getClass());
|
||||
//noinspection unchecked
|
||||
return datatype.format(value);
|
||||
} else if (value instanceof Iterable) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("[");
|
||||
|
@ -22,7 +22,7 @@
|
||||
<datatype class="com.haulmont.chile.core.datatypes.impl.StringDatatype"/>
|
||||
|
||||
<datatype class="com.haulmont.chile.core.datatypes.impl.DateTimeDatatype"
|
||||
format="yyyy-MM-dd'T'HH:mm:ss.SSS"/>
|
||||
format="yyyy-MM-dd HH:mm:ss.SSS"/>
|
||||
|
||||
<datatype class="com.haulmont.chile.core.datatypes.impl.DateDatatype"
|
||||
format="yyyy-MM-dd"/>
|
||||
|
Loading…
Reference in New Issue
Block a user