18 package org.turro.dossier.entity;
20 import java.util.Date;
21 import javax.persistence.Column;
22 import javax.persistence.Entity;
23 import javax.persistence.GeneratedValue;
24 import javax.persistence.GenerationType;
25 import javax.persistence.Id;
26 import javax.persistence.ManyToOne;
27 import org.turro.string.ObjectString;
28 import org.turro.string.Strings;
29 import org.turro.elephant.util.BooleanFormats;
30 import org.turro.elephant.util.DateFormats;
31 import org.turro.elephant.util.DecimalFormats;
32 import org.turro.i18n.I_;
39 public class FieldValue implements java.io.Serializable {
42 @GeneratedValue(strategy=GenerationType.IDENTITY)
43 @Column(name=
"IDENTIFIER")
46 @Column(name=
"FIELD_VALUE")
60 this.dossier = dossier;
68 this.fieldDef = fieldDef;
90 return Strings.isBlank(value);
94 value = ObjectString.formatNativeObject(obj,
false);
98 return ObjectString.parseNativeString(value, fieldDef.getJavaClass(),
false);
107 if(obj instanceof Boolean) {
111 return ((Boolean) obj) ?
I_.
get(fieldDef.getLabelKey()) :
"";
113 }
else if(obj instanceof Number) {
115 }
else if(obj instanceof Date) {
117 }
else if(obj instanceof String) {
120 return obj ==
null ?
"" : obj.toString();
125 if(obj instanceof Boolean) {
126 return ((Boolean) obj) ?
I_.
get(fieldDef.getLabelKey()) :
"";
127 }
else if(obj instanceof Number) {
129 }
else if(obj instanceof Date) {
131 }
else if(obj instanceof String) {
132 return I_.
get(fieldDef.getLabelKey()) +
": " + (String) obj;
134 return obj ==
null ?
"" :
I_.
get(fieldDef.getLabelKey()) +
": " + obj.toString();
String getLabeledObjectString()
void setDossier(Dossier dossier)
void setFieldDef(FieldDef fieldDef)
String getObjectString(boolean label)
void setObjectValue(Object obj)
void setValue(String value)
static String get(String msg)