mirror of
https://gitee.com/jmix/cuba.git
synced 2024-12-03 19:57:36 +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;
|
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.datatypes.Datatypes;
|
||||||
import com.haulmont.chile.core.model.Instance;
|
import com.haulmont.chile.core.model.Instance;
|
||||||
import com.haulmont.chile.core.model.MetaClass;
|
import com.haulmont.chile.core.model.MetaClass;
|
||||||
@ -58,7 +59,7 @@ public class EntityLog implements EntityLogAPI {
|
|||||||
protected Metadata metadata;
|
protected Metadata metadata;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private UserSessionSource userSessionSource;
|
protected UserSessionSource userSessionSource;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public EntityLog(Configuration configuration) {
|
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)
|
if (value == null)
|
||||||
return "";
|
return "";
|
||||||
else if (value instanceof Instance) {
|
else if (value instanceof Instance) {
|
||||||
return ((Instance) value).getInstanceName();
|
return ((Instance) value).getInstanceName();
|
||||||
} else if (value instanceof Date) {
|
} else if (value instanceof Date) {
|
||||||
SimpleDateFormat df = new SimpleDateFormat(
|
Datatype datatype = Datatypes.getNN(value.getClass());
|
||||||
Datatypes.getFormatStrings(userSessionSource.getLocale()).getDateTimeFormat());
|
//noinspection unchecked
|
||||||
return df.format(value);
|
return datatype.format(value);
|
||||||
} else if (value instanceof Iterable) {
|
} else if (value instanceof Iterable) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("[");
|
sb.append("[");
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
<datatype class="com.haulmont.chile.core.datatypes.impl.StringDatatype"/>
|
<datatype class="com.haulmont.chile.core.datatypes.impl.StringDatatype"/>
|
||||||
|
|
||||||
<datatype class="com.haulmont.chile.core.datatypes.impl.DateTimeDatatype"
|
<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"
|
<datatype class="com.haulmont.chile.core.datatypes.impl.DateDatatype"
|
||||||
format="yyyy-MM-dd"/>
|
format="yyyy-MM-dd"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user