BrightSide Workbench Full Report + Source Code
org.turro.related.Relateds Class Reference

Public Member Functions

Related addOrigin (String origin, String description)
 
Related addDestination (String destination, String description)
 
Relateds removeOrigin (String origin)
 
Relateds removeDestination (String destination)
 
boolean existsOrigin (String origin)
 
boolean existsDestination (String destination)
 
List< Relatedorigins ()
 
List< Relateddestinations ()
 
Related add (String origin, String destination, String description)
 
Relateds remove (String origin, String destination)
 
Relateds removeAny (String removePath)
 
boolean exists (String origin, String destination)
 
boolean existsAny (String existPath)
 

Static Public Member Functions

static Set< String > getAllPaths (String root)
 
static Relateds from (String entityPath)
 
static Relateds empty ()
 

Detailed Description

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

Definition at line 35 of file Relateds.java.

Member Function Documentation

◆ add()

Related org.turro.related.Relateds.add ( String  origin,
String  destination,
String  description 
)

Definition at line 77 of file Relateds.java.

77  {
78  if(!exists(origin, destination)) {
79  Related re = new Related();
80  re.setOrigin(origin);
81  re.setDestination(destination);
82  re.setDescription(description);
83  if(!re.isEmpty()) {
84  re.setCreation(new Date());
85  return dao.get().saveObject(re);
86  }
87  }
88  return null;
89  }
boolean exists(String origin, String destination)
Definition: Relateds.java:109
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addDestination()

Related org.turro.related.Relateds.addDestination ( String  destination,
String  description 
)

Definition at line 41 of file Relateds.java.

41  {
42  return add(entityPath, destination, description);
43  }
Related add(String origin, String destination, String description)
Definition: Relateds.java:77
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addOrigin()

Related org.turro.related.Relateds.addOrigin ( String  origin,
String  description 
)

Definition at line 37 of file Relateds.java.

37  {
38  return add(origin, entityPath, description);
39  }
Here is the call graph for this function:

◆ destinations()

List<Related> org.turro.related.Relateds.destinations ( )

Definition at line 68 of file Relateds.java.

68  {
69  return SqlClause.select("p").from("Related p")
70  .where().equal("origin", entityPath)
71  .dao(dao.get())
72  .resultList(Related.class);
73  }
Here is the caller graph for this function:

◆ empty()

static Relateds org.turro.related.Relateds.empty ( )
static

Definition at line 149 of file Relateds.java.

149  {
150  return new Relateds(null);
151  }
Here is the caller graph for this function:

◆ exists()

boolean org.turro.related.Relateds.exists ( String  origin,
String  destination 
)

Definition at line 109 of file Relateds.java.

109  {
110  return SqlClause.count().from("Related")
111  .where().equal("origin", origin)
112  .and().equal("destination", destination)
113  .dao(dao.get())
114  .singleResult(Long.class) > 0;
115  }
Here is the caller graph for this function:

◆ existsAny()

boolean org.turro.related.Relateds.existsAny ( String  existPath)

Definition at line 117 of file Relateds.java.

117  {
118  return SqlClause.count().from("Related")
119  .where().equal("origin", existPath)
120  .or().equal("destination", existPath)
121  .dao(dao.get())
122  .singleResult(Long.class) > 0;
123  }

◆ existsDestination()

boolean org.turro.related.Relateds.existsDestination ( String  destination)

Definition at line 57 of file Relateds.java.

57  {
58  return exists(entityPath, destination);
59  }
Here is the call graph for this function:

◆ existsOrigin()

boolean org.turro.related.Relateds.existsOrigin ( String  origin)

Definition at line 53 of file Relateds.java.

53  {
54  return exists(origin, entityPath);
55  }
Here is the call graph for this function:

◆ from()

static Relateds org.turro.related.Relateds.from ( String  entityPath)
static

Definition at line 145 of file Relateds.java.

145  {
146  return new Relateds(entityPath);
147  }
Here is the caller graph for this function:

◆ getAllPaths()

static Set<String> org.turro.related.Relateds.getAllPaths ( String  root)
static

Definition at line 125 of file Relateds.java.

125  {
126  Set<String> all = new HashSet<>(
127  SqlClause.select("distinct origin").from("Related")
128  .where().startsWith("origin", "/" + root + "/")
129  .dao(new ElephantPU())
130  .resultList(String.class));
131  all.addAll(
132  SqlClause.select("distinct destination").from("Related")
133  .where().startsWith("destination", "/" + root + "/")
134  .dao(new ElephantPU())
135  .resultList(String.class));
136  return all;
137  }
Here is the caller graph for this function:

◆ origins()

List<Related> org.turro.related.Relateds.origins ( )

Definition at line 61 of file Relateds.java.

61  {
62  return SqlClause.select("p").from("Related p")
63  .where().equal("destination", entityPath)
64  .dao(dao.get())
65  .resultList(Related.class);
66  }

◆ remove()

Relateds org.turro.related.Relateds.remove ( String  origin,
String  destination 
)

Definition at line 91 of file Relateds.java.

91  {
92  SqlClause.delete("Related")
93  .where().equal("origin", origin)
94  .and().equal("destination", destination)
95  .dao(dao.get())
96  .execute();
97  return this;
98  }

◆ removeAny()

Relateds org.turro.related.Relateds.removeAny ( String  removePath)

Definition at line 100 of file Relateds.java.

100  {
101  SqlClause.delete("Related")
102  .where().equal("origin", removePath)
103  .or().equal("destination", removePath)
104  .dao(dao.get())
105  .execute();
106  return this;
107  }
Here is the caller graph for this function:

◆ removeDestination()

Relateds org.turro.related.Relateds.removeDestination ( String  destination)

Definition at line 49 of file Relateds.java.

49  {
50  return remove(entityPath, destination);
51  }

◆ removeOrigin()

Relateds org.turro.related.Relateds.removeOrigin ( String  origin)

Definition at line 45 of file Relateds.java.

45  {
46  return remove(origin, entityPath);
47  }

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