BrightSide Workbench Full Report + Source Code
org.turro.contacts.GroupIt Class Reference
Inheritance diagram for org.turro.contacts.GroupIt:
Collaboration diagram for org.turro.contacts.GroupIt:

Public Member Functions

String getId ()
 
void setId (String id)
 
String getCategory ()
 
void setCategory (String category)
 
String getName ()
 
void setName (String name)
 
String getPathName ()
 
void setPathName (String pathName)
 
GroupIt getParent ()
 
void setParent (GroupIt parent)
 
boolean isPublishable ()
 
void setPublishable (boolean publishable)
 
boolean isValid ()
 
Collection< GroupItchildren ()
 
Collection< GroupItchildren (String entityPath)
 
Collection< Groupedentities ()
 
Collection< GroupedfullEntities ()
 
Collection< GroupedfullEntities (String entityRoot)
 
FieldItSet fields ()
 

Static Public Member Functions

static Collection< String > categories ()
 
static Collection< GroupItroots (String category)
 
static Collection< GroupItroots (String category, String entityPath)
 
static GroupIt normalizePaths (GroupIt group)
 
static void normalizePaths (String oldPath)
 
static void delete (String path)
 
static GroupIt getOrCreate (String category, String node, GroupIt parent)
 

Detailed Description

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

Definition at line 41 of file GroupIt.java.

Member Function Documentation

◆ categories()

static Collection<String> org.turro.contacts.GroupIt.categories ( )
static

Definition at line 115 of file GroupIt.java.

115  {
116  Dao dao = new ContactsPU();
117  return dao.getResultList(
118  " select distinct g.category from GroupIt g"
119  );
120  }
Here is the caller graph for this function:

◆ children() [1/2]

Collection<GroupIt> org.turro.contacts.GroupIt.children ( )

Definition at line 148 of file GroupIt.java.

148  {
149  Dao dao = new ContactsPU();
150  return dao.getResultList(
151  " select g from GroupIt g " +
152  " where g.category = ? " +
153  " and g.parent = ?",
154  new Object[] { this.getCategory(), this }
155  );
156  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ children() [2/2]

Collection<GroupIt> org.turro.contacts.GroupIt.children ( String  entityPath)

Definition at line 158 of file GroupIt.java.

158  {
159  Dao dao = new ContactsPU();
160  return dao.getResultList(
161  " select g from GroupIt g " +
162  " where g.category = ? " +
163  " and g.parent = ? " +
164  " and exists ( " +
165  " select gd from Grouped gd " +
166  " where (gd.parent.pathName like concat(g.pathName, '/%') " +
167  " or gd.parent.pathName = g.pathName) " +
168  " and gd.path like ? " +
169  " ) ",
170  new Object[] { this.getCategory(), this, entityPath + "/%" }
171  );
172  }
Here is the call graph for this function:

◆ delete()

static void org.turro.contacts.GroupIt.delete ( String  path)
static

Definition at line 234 of file GroupIt.java.

234  {
235  Dao dao = new ContactsPU();
236  dao.executeUpdate(
237  "delete from Grouped where parent in (select gi from GroupIt gi where gi.pathName = ? or gi.pathName like ?)",
238  new Object[] { path, path + "/%" });
239  dao.executeUpdate(
240  "delete from GroupIt where pathName = ? or pathName like ?",
241  new Object[] { path, path + "/%" });
242  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ entities()

Collection<Grouped> org.turro.contacts.GroupIt.entities ( )

Definition at line 174 of file GroupIt.java.

174  {
175  Dao dao = new ContactsPU();
176  return dao.getResultList(
177  " select g from Grouped g " +
178  " where g.parent.category = ? " +
179  " and g.parent = ?",
180  new Object[] { this.getCategory(), this }
181  );
182  }
Here is the call graph for this function:

◆ fields()

FieldItSet org.turro.contacts.GroupIt.fields ( )

Definition at line 263 of file GroupIt.java.

263  {
264  FieldItSet fiu = FieldItUtil.fields(ContactsPU.getObjectPath(this));
265  GroupIt gi = getParent();
266  while(gi != null) {
267  fiu.addAll(FieldItUtil.fields(ContactsPU.getObjectPath(gi)));
268  gi = gi.getParent();
269  }
270  return fiu;
271  }
Here is the call graph for this function:

◆ fullEntities() [1/2]

Collection<Grouped> org.turro.contacts.GroupIt.fullEntities ( )

Definition at line 184 of file GroupIt.java.

184  {
185  Dao dao = new ContactsPU();
186  return dao.getResultList(
187  " select g from Grouped g " +
188  " where g.parent.category = ? " +
189  " and (g.parent = ? or g.parent.path like ?)",
190  new Object[] { this.getCategory(), this, this.getPathName() + "/%" }
191  );
192  }
Here is the call graph for this function:

◆ fullEntities() [2/2]

Collection<Grouped> org.turro.contacts.GroupIt.fullEntities ( String  entityRoot)

Definition at line 194 of file GroupIt.java.

194  {
195  Dao dao = new ContactsPU();
196  return dao.getResultList(
197  " select g from Grouped g " +
198  " where g.parent.category = ? " +
199  " and (g.parent = ? or g.parent.path like ?) " +
200  " and g.path like ? ",
201  new Object[] { this.getCategory(), this,
202  this.getPathName() + "/%", entityRoot + "/%" }
203  );
204  }
Here is the call graph for this function:

◆ getCategory()

String org.turro.contacts.GroupIt.getCategory ( )

Definition at line 68 of file GroupIt.java.

68  {
69  return category;
70  }
Here is the caller graph for this function:

◆ getId()

String org.turro.contacts.GroupIt.getId ( )

Definition at line 60 of file GroupIt.java.

60  {
61  return id;
62  }
Here is the caller graph for this function:

◆ getName()

String org.turro.contacts.GroupIt.getName ( )

Definition at line 76 of file GroupIt.java.

76  {
77  return name;
78  }
Here is the caller graph for this function:

◆ getOrCreate()

static GroupIt org.turro.contacts.GroupIt.getOrCreate ( String  category,
String  node,
GroupIt  parent 
)
static

Definition at line 244 of file GroupIt.java.

244  {
245  Dao dao = new ContactsPU();
246  String parentPath = parent != null ? parent.getPathName() + "/" : "/";
247  GroupIt gi = (GroupIt) dao.getSingleResultOrNull(
248  "select g from GroupIt g where g.category = ? and g.pathName = ?",
249  new Object[] { category, parentPath + node });
250  if(gi == null) {
251  gi = new GroupIt();
252  gi.setCategory(category);
253  gi.setName(node);
254  gi.setParent(parent);
255  gi.setPublishable(true);
256  gi = gi.normalizePaths(gi);
257  }
258  return gi;
259  }
Here is the call graph for this function:

◆ getParent()

GroupIt org.turro.contacts.GroupIt.getParent ( )

Definition at line 92 of file GroupIt.java.

92  {
93  return parent;
94  }
Here is the caller graph for this function:

◆ getPathName()

String org.turro.contacts.GroupIt.getPathName ( )

Definition at line 84 of file GroupIt.java.

84  {
85  return pathName;
86  }
Here is the caller graph for this function:

◆ isPublishable()

boolean org.turro.contacts.GroupIt.isPublishable ( )

Definition at line 100 of file GroupIt.java.

100  {
101  return publishable;
102  }

◆ isValid()

boolean org.turro.contacts.GroupIt.isValid ( )

Definition at line 110 of file GroupIt.java.

110  {
111  return !Strings.isBlank(name) &&
112  !name.contains("/");
113  }
Here is the caller graph for this function:

◆ normalizePaths() [1/2]

static GroupIt org.turro.contacts.GroupIt.normalizePaths ( GroupIt  group)
static

Definition at line 206 of file GroupIt.java.

206  {
207  Dao dao = new ContactsPU();
208  String d = "/" + group.getName();
209  GroupIt g = group.getParent();
210  while(g != null) {
211  d = "/" + g.getName() + d;
212  g = g.getParent();
213  }
214  group.setPathName(d);
215  return dao.saveObject(group);
216  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ normalizePaths() [2/2]

static void org.turro.contacts.GroupIt.normalizePaths ( String  oldPath)
static

Definition at line 218 of file GroupIt.java.

218  {
219  Dao dao = new ContactsPU();
220  for(GroupIt group : (List<GroupIt>) dao.getResultList(
221  "select g from GroupIt g where g.pathName like ?",
222  new Object[] { oldPath + "/%" })) {
223  String d = "/" + group.getName();
224  GroupIt g = group.getParent();
225  while(g != null) {
226  d = "/" + g.getName() + d;
227  g = g.getParent();
228  }
229  group.setPathName(d);
230  dao.saveObject(group);
231  }
232  }
Here is the call graph for this function:

◆ roots() [1/2]

static Collection<GroupIt> org.turro.contacts.GroupIt.roots ( String  category)
static

Definition at line 122 of file GroupIt.java.

122  {
123  Dao dao = new ContactsPU();
124  return dao.getResultList(
125  " select g from GroupIt g " +
126  " where g.category = ? " +
127  " and g.parent is null",
128  new Object[] { category }
129  );
130  }
Here is the caller graph for this function:

◆ roots() [2/2]

static Collection<GroupIt> org.turro.contacts.GroupIt.roots ( String  category,
String  entityPath 
)
static

Definition at line 132 of file GroupIt.java.

132  {
133  Dao dao = new ContactsPU();
134  return dao.getResultList(
135  " select g from GroupIt g " +
136  " where g.category = ? " +
137  " and g.parent is null " +
138  " and exists ( " +
139  " select gd from Grouped gd " +
140  " where (gd.parent.pathName like concat(g.pathName, '/%') " +
141  " or gd.parent.pathName = g.pathName) " +
142  " and gd.path like ? " +
143  " ) ",
144  new Object[] { category, entityPath + "/%" }
145  );
146  }

◆ setCategory()

void org.turro.contacts.GroupIt.setCategory ( String  category)

Definition at line 72 of file GroupIt.java.

72  {
73  this.category = category;
74  }
Here is the caller graph for this function:

◆ setId()

void org.turro.contacts.GroupIt.setId ( String  id)

Definition at line 64 of file GroupIt.java.

64  {
65  this.id = id;
66  }

◆ setName()

void org.turro.contacts.GroupIt.setName ( String  name)

Definition at line 80 of file GroupIt.java.

80  {
81  this.name = name;
82  }

◆ setParent()

void org.turro.contacts.GroupIt.setParent ( GroupIt  parent)

Definition at line 96 of file GroupIt.java.

96  {
97  this.parent = parent;
98  }
Here is the caller graph for this function:

◆ setPathName()

void org.turro.contacts.GroupIt.setPathName ( String  pathName)

Definition at line 88 of file GroupIt.java.

88  {
89  this.pathName = pathName;
90  }
Here is the caller graph for this function:

◆ setPublishable()

void org.turro.contacts.GroupIt.setPublishable ( boolean  publishable)

Definition at line 104 of file GroupIt.java.

104  {
105  this.publishable = publishable;
106  }
Here is the caller graph for this function:

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