BrightSide Workbench Full Report + Source Code
org.turro.describeit.DescribeItUtil Class Reference

Static Public Member Functions

static void addDescription (Object entity, String id, String description, Contact contact, ChangedValue changed)
 
static void addDescription (String path, String id, String description, Contact contact, ChangedValue changed)
 
static void remove (String id)
 
static void remove (String path, String id)
 
static Collection< DescribeItdescriptions (Object entity)
 
static Collection< DescribeItdescriptions (String path)
 
static Collection< DescribeItdescriptions (String id, Object entity)
 
static Collection< DescribeItdescriptions (String id, String path)
 
static DescribeIt description (String id, Object entity)
 
static DescribeIt description (String id, String path)
 
static String descriptionString (String id, Object entity)
 
static String descriptionString (String id, String path)
 
static Collection< DescribeItpending ()
 
static long countPending ()
 
static long count ()
 
static long count (Object entity)
 
static long count (String path)
 

Static Public Attributes

static final String DEFAULT_ID = "Default"
 

Detailed Description

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

Definition at line 36 of file DescribeItUtil.java.

Member Function Documentation

◆ addDescription() [1/2]

static void org.turro.describeit.DescribeItUtil.addDescription ( Object  entity,
String  id,
String  description,
Contact  contact,
ChangedValue  changed 
)
static

Definition at line 40 of file DescribeItUtil.java.

40  {
41  String path = Entities.getController(entity).getPath();
42  if(path != null) {
43  addDescription(path, id, description, contact, changed);
44  }
45  }
static DescribeIt description(String id, Object entity)
static void addDescription(Object entity, String id, String description, Contact contact, ChangedValue changed)
Here is the call graph for this function:

◆ addDescription() [2/2]

static void org.turro.describeit.DescribeItUtil.addDescription ( String  path,
String  id,
String  description,
Contact  contact,
ChangedValue  changed 
)
static

Definition at line 47 of file DescribeItUtil.java.

47  {
48  if(Strings.isBlank(id)) {
49  id = DEFAULT_ID;
50  }
51  if(!Strings.isBlank(path) && !Strings.isBlank(description) && contact != null) {
52  DescribeIt describeIt = description(id, path);
53  Dao dao = new ContactsPU();
54  if(describeIt != null) {
55  if(describeIt.isContainsWiki()) {
56  if(!description.equals(describeIt.getWiki())) {
57  if(changed != null) {
58  changed.onChange(describeIt.getWiki(), description);
59  }
60  describeIt.setWiki(description);
61  describeIt.setBody(WikiCompiler.source(describeIt.getWiki()).html());
62  }
63  } else {
64  if(!description.equals(describeIt.getBody())) {
65  if(changed != null) {
66  changed.onChange(describeIt.getBody(), description);
67  }
68  describeIt.setBody(description);
69  }
70  }
71  } else {
72  describeIt = new DescribeIt();
73  describeIt.setDescribeId(id);
74  describeIt.setCreator(contact);
75  describeIt.setDateCreation(new Date());
76  describeIt.setPath(path);
77  if(describeIt.isContainsWiki()) {
78  describeIt.setWiki(description);
79  describeIt.setBody(WikiCompiler.source(describeIt.getWiki()).html());
80  } else {
81  describeIt.setBody(description);
82  }
83  }
84  dao.saveObject(describeIt);
85  }
86  }
Here is the call graph for this function:

◆ count() [1/3]

static long org.turro.describeit.DescribeItUtil.count ( )
static

Definition at line 185 of file DescribeItUtil.java.

185  {
186  Dao dao = new ContactsPU();
187  return (Long) dao.getSingleResultOrNull(
188  " select count(c) from DescribeIt c "
189  );
190  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ count() [2/3]

static long org.turro.describeit.DescribeItUtil.count ( Object  entity)
static

Definition at line 192 of file DescribeItUtil.java.

192  {
193  String path = Entities.getController(entity).getPath();
194  if(path != null) {
195  return count(path);
196  }
197  return 0;
198  }
Here is the call graph for this function:

◆ count() [3/3]

static long org.turro.describeit.DescribeItUtil.count ( String  path)
static

Definition at line 200 of file DescribeItUtil.java.

200  {
201  Dao dao = new ContactsPU();
202  Long count = (Long) dao.getSingleResultOrNull(
203  " select count(c) from DescribeIt c " +
204  " where path = ? " +
205  " order by dateCreation desc ",
206  new Object[] { path }
207  );
208  if(count != null) {
209  return count;
210  }
211  return 0;
212  }
Here is the call graph for this function:

◆ countPending()

static long org.turro.describeit.DescribeItUtil.countPending ( )
static

Definition at line 177 of file DescribeItUtil.java.

177  {
178  Dao dao = new ContactsPU();
179  return (Long) dao.getSingleResultOrNull(
180  " select count(c) from DescribeIt c " +
181  " where accepted = FALSE "
182  );
183  }
Here is the call graph for this function:

◆ description() [1/2]

static DescribeIt org.turro.describeit.DescribeItUtil.description ( String  id,
Object  entity 
)
static

Definition at line 142 of file DescribeItUtil.java.

142  {
143  Collection<DescribeIt> list = descriptions(id, entity);
144  if(list != null && !list.isEmpty()) {
145  return list.iterator().next();
146  }
147  return null;
148  }
static Collection< DescribeIt > descriptions(Object entity)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ description() [2/2]

static DescribeIt org.turro.describeit.DescribeItUtil.description ( String  id,
String  path 
)
static

Definition at line 150 of file DescribeItUtil.java.

150  {
151  Collection<DescribeIt> list = descriptions(id, path);
152  if(list != null && !list.isEmpty()) {
153  return list.iterator().next();
154  }
155  return null;
156  }
Here is the call graph for this function:

◆ descriptions() [1/4]

static Collection<DescribeIt> org.turro.describeit.DescribeItUtil.descriptions ( Object  entity)
static

Definition at line 105 of file DescribeItUtil.java.

105  {
106  String path = Entities.getController(entity).getPath();
107  if(path != null) {
108  return descriptions(path);
109  }
110  return null;
111  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ descriptions() [2/4]

static Collection<DescribeIt> org.turro.describeit.DescribeItUtil.descriptions ( String  id,
Object  entity 
)
static

Definition at line 123 of file DescribeItUtil.java.

123  {
124  String path = Entities.getController(entity).getPath();
125  if(path != null) {
126  return descriptions(id, path);
127  }
128  return null;
129  }
Here is the call graph for this function:

◆ descriptions() [3/4]

static Collection<DescribeIt> org.turro.describeit.DescribeItUtil.descriptions ( String  id,
String  path 
)
static

Definition at line 131 of file DescribeItUtil.java.

131  {
132  Dao dao = new ContactsPU();
133  return dao.getResultList(
134  " select c from DescribeIt c " +
135  " where path = ? " +
136  " and describeId = ? " +
137  " order by dateCreation ",
138  new Object[] { path, id }
139  );
140  }

◆ descriptions() [4/4]

static Collection<DescribeIt> org.turro.describeit.DescribeItUtil.descriptions ( String  path)
static

Definition at line 113 of file DescribeItUtil.java.

113  {
114  Dao dao = new ContactsPU();
115  return dao.getResultList(
116  " select c from DescribeIt c " +
117  " where path = ? " +
118  " order by dateCreation ",
119  new Object[] { path }
120  );
121  }

◆ descriptionString() [1/2]

static String org.turro.describeit.DescribeItUtil.descriptionString ( String  id,
Object  entity 
)
static

Definition at line 158 of file DescribeItUtil.java.

158  {
159  DescribeIt di = description(id, entity);
160  return di != null ? di.getBody() : null;
161  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ descriptionString() [2/2]

static String org.turro.describeit.DescribeItUtil.descriptionString ( String  id,
String  path 
)
static

Definition at line 163 of file DescribeItUtil.java.

163  {
164  DescribeIt di = description(id, path);
165  return di != null ? di.getBody() : null;
166  }
Here is the call graph for this function:

◆ pending()

static Collection<DescribeIt> org.turro.describeit.DescribeItUtil.pending ( )
static

Definition at line 168 of file DescribeItUtil.java.

168  {
169  Dao dao = new ContactsPU();
170  return dao.getResultList(
171  " select c from DescribeIt c " +
172  " where accepted = FALSE " +
173  " order by dateCreation "
174  );
175  }

◆ remove() [1/2]

static void org.turro.describeit.DescribeItUtil.remove ( String  id)
static

Definition at line 88 of file DescribeItUtil.java.

88  {
89  Dao dao = new ContactsPU();
90  dao.executeUpdate(
91  " delete from DescribeIt c " +
92  " where c.id = '" + id + "'"
93  );
94  }
Here is the call graph for this function:

◆ remove() [2/2]

static void org.turro.describeit.DescribeItUtil.remove ( String  path,
String  id 
)
static

Definition at line 96 of file DescribeItUtil.java.

96  {
97  Dao dao = new ContactsPU();
98  dao.executeUpdate(
99  " delete from DescribeIt c" +
100  " where c.describeId = '" + id + "'" +
101  " and c.path = '" + path + "'"
102  );
103  }
Here is the call graph for this function:

Member Data Documentation

◆ DEFAULT_ID

final String org.turro.describeit.DescribeItUtil.DEFAULT_ID = "Default"
static

Definition at line 38 of file DescribeItUtil.java.


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