BrightSide Workbench Full Report + Source Code
org.turro.fieldit.FieldItUtil Class Reference

Static Public Member Functions

static FieldItSet fields (Object entity)
 
static FieldItSet fields (String path)
 
static ValueItSet values (Object entity)
 
static ValueItSet values (String path)
 
static ValueIt value (FieldIt field, String path)
 
static ValueIt value (String field, String path)
 
static String getLabel (Class javaClass)
 
static void delete (FieldIt field)
 
static void saveValues (Collection< ValueIt > values)
 
static Collection< String > related (String path)
 
static Collection< String > search (String path, String value)
 
static Object getFieldValue (String label, String entityPath)
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 37 of file FieldItUtil.java.

Member Function Documentation

◆ delete()

static void org.turro.fieldit.FieldItUtil.delete ( FieldIt  field)
static

Definition at line 122 of file FieldItUtil.java.

122  {
123  Dao dao = new ContactsPU();
124  dao.executeUpdate("delete from ValueIt where fieldIt = ?", new Object[] { field });
125  dao.deleteObject(field);
126  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ fields() [1/2]

static FieldItSet org.turro.fieldit.FieldItUtil.fields ( Object  entity)
static

Definition at line 39 of file FieldItUtil.java.

39  {
40  String path = Entities.getController(entity).getPath();
41  if(path != null) {
42  return fields(path);
43  }
44  return new FieldItSet();
45  }
static FieldItSet fields(Object entity)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ fields() [2/2]

static FieldItSet org.turro.fieldit.FieldItUtil.fields ( String  path)
static

Definition at line 47 of file FieldItUtil.java.

47  {
48  Dao dao = new ContactsPU();
49  List l = dao.getResultList(
50  " select v from FieldIt v " +
51  " where path = ?",
52  new Object[] { path }
53  );
54  FieldItSet fis = new FieldItSet();
55  fis.addAll(l);
56  return fis;
57  }

◆ getFieldValue()

static Object org.turro.fieldit.FieldItUtil.getFieldValue ( String  label,
String  entityPath 
)
static

Definition at line 166 of file FieldItUtil.java.

166  {
167  ValueIt value = FieldItUtil.value(label, entityPath);
168  if(value != null) {
169  Object v = value.getObjectValue();
170  return v == null ? "" : v;
171  }
172  return "";
173  }
static ValueIt value(FieldIt field, String path)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getLabel()

static String org.turro.fieldit.FieldItUtil.getLabel ( Class  javaClass)
static

Definition at line 103 of file FieldItUtil.java.

103  {
104  if(String.class.equals(javaClass)) {
105  return I_.get("String");
106  } else if(Long.class.equals(javaClass)) {
107  return I_.get("Long integer");
108  } else if(Double.class.equals(javaClass)) {
109  return I_.get("Double");
110  } else if(Date.class.equals(javaClass)) {
111  return I_.get("Date");
112  } else if(Boolean.class.equals(javaClass)) {
113  return I_.get("Boolean");
114  } else if(StringList.class.equals(javaClass)) {
115  return I_.get("String list");
116  } else if(AutoFillList.class.equals(javaClass)) {
117  return I_.get("Auto fill list");
118  }
119  return null;
120  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ related()

static Collection<String> org.turro.fieldit.FieldItUtil.related ( String  path)
static

Definition at line 140 of file FieldItUtil.java.

140  {
141  Path p = new Path(path);
142  Dao dao = new ContactsPU();
143  return dao.getResultList(
144  " select v.path from ValueIt v " +
145  " where path <> ? " +
146  " and path like ? " +
147  " and exists ( " +
148  " select v2 from " +
149  " )",
150  new Object[] { path, p.getRoot() + "/" }
151  );
152  }
Here is the caller graph for this function:

◆ saveValues()

static void org.turro.fieldit.FieldItUtil.saveValues ( Collection< ValueIt values)
static

Definition at line 128 of file FieldItUtil.java.

128  {
129  Dao dao = new ContactsPU();
130  for(ValueIt v : values) {
131  if(v.isValid()) {
132  dao.saveObject(v);
133  } else if(!Strings.isBlank(v.getId())) {
134  dao.deleteObject(v);
135  }
136  }
137  }
static ValueItSet values(Object entity)
Here is the caller graph for this function:

◆ search()

static Collection<String> org.turro.fieldit.FieldItUtil.search ( String  path,
String  value 
)
static

Definition at line 155 of file FieldItUtil.java.

155  {
156  Path p = new Path(path);
157  Dao dao = new ContactsPU();
158  return dao.getResultList(
159  " select v.path from ValueIt v " +
160  " where path like ? " +
161  " and v.value like ? ",
162  new Object[] { p.getRoot() + "/", value }
163  );
164  }

◆ value() [1/2]

static ValueIt org.turro.fieldit.FieldItUtil.value ( FieldIt  field,
String  path 
)
static

Definition at line 79 of file FieldItUtil.java.

79  {
80  Dao dao = new ContactsPU();
81  ValueIt vi = (ValueIt) dao.getSingleResultOrNull(
82  " select v from ValueIt v " +
83  " where path = ? and v.fieldIt = ? ",
84  new Object[] { path, field }
85  );
86  if(vi == null) {
87  vi = field.createValue();
88  vi.setPath(path);
89  }
90  return vi;
91  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ value() [2/2]

static ValueIt org.turro.fieldit.FieldItUtil.value ( String  field,
String  path 
)
static

Definition at line 93 of file FieldItUtil.java.

93  {
94  Dao dao = new ContactsPU();
95  ValueIt vi = (ValueIt) dao.getSingleResultOrNull(
96  " select v from ValueIt v " +
97  " where path = ? and v.fieldIt.name = ? ",
98  new Object[] { path, field }
99  );
100  return vi;
101  }
Here is the call graph for this function:

◆ values() [1/2]

static ValueItSet org.turro.fieldit.FieldItUtil.values ( Object  entity)
static

Definition at line 59 of file FieldItUtil.java.

59  {
60  String path = Entities.getController(entity).getPath();
61  if(path != null) {
62  return values(path);
63  }
64  return new ValueItSet();
65  }
Here is the call graph for this function:

◆ values() [2/2]

static ValueItSet org.turro.fieldit.FieldItUtil.values ( String  path)
static

Definition at line 67 of file FieldItUtil.java.

67  {
68  Dao dao = new ContactsPU();
69  List l = dao.getResultList(
70  " select v from ValueIt v " +
71  " where path = ?",
72  new Object[] { path }
73  );
74  ValueItSet vis = new ValueItSet();
75  vis.addAll(l);
76  return vis;
77  }

The documentation for this class was generated from the following file: