BrightSide Workbench Full Report + Source Code
org.turro.relpaths.RelatedPathsUtil Class Reference

Static Public Member Functions

static void addRelation (String origin, String destination, String description)
 
static void removeRelation (String origin, String destination)
 
static void removePath (String path)
 
static boolean existsRelation (String origin, String destination)
 
static boolean existsPath (String path)
 
static List< RelatedPathsdestinations (String path)
 
static List< RelatedPathsorigins (String path)
 

Detailed Description

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

Definition at line 33 of file RelatedPathsUtil.java.

Member Function Documentation

◆ addRelation()

static void org.turro.relpaths.RelatedPathsUtil.addRelation ( String  origin,
String  destination,
String  description 
)
static

Definition at line 35 of file RelatedPathsUtil.java.

35  {
36  if(!existsRelation(origin, destination)) {
37  RelatedPaths rp = new RelatedPaths();
38  rp.setOrigin(origin);
39  rp.setDestination(destination);
40  rp.setDescription(description);
41  if(!rp.isEmpty()) {
42  rp.setCreation(new Date());
43  Dao dao = new ContactsPU();
44  dao.saveObject(rp);
45  }
46  }
47  }
static boolean existsRelation(String origin, String destination)
Here is the call graph for this function:

◆ destinations()

static List<RelatedPaths> org.turro.relpaths.RelatedPathsUtil.destinations ( String  path)
static

Definition at line 86 of file RelatedPathsUtil.java.

86  {
87  Dao dao = new ContactsPU();
88  return (List<RelatedPaths>)dao.getResultList(
89  " select rp from RelatedPaths as rp" +
90  " where origin = ?",
91  new Object[] { path }
92  );
93  }

◆ existsPath()

static boolean org.turro.relpaths.RelatedPathsUtil.existsPath ( String  path)
static

Definition at line 77 of file RelatedPathsUtil.java.

77  {
78  Dao dao = new ContactsPU();
79  return ((Long) dao.getSingleResult(
80  " select count(*) from RelatedPaths " +
81  " where origin = ? or destination = ?",
82  new Object[] { path, path }
83  )) > 0;
84  }
Here is the call graph for this function:

◆ existsRelation()

static boolean org.turro.relpaths.RelatedPathsUtil.existsRelation ( String  origin,
String  destination 
)
static

Definition at line 68 of file RelatedPathsUtil.java.

68  {
69  Dao dao = new ContactsPU();
70  return ((Long) dao.getSingleResult(
71  " select count(*) from RelatedPaths " +
72  " where origin = ? and destination = ?",
73  new Object[] { origin, destination }
74  )) > 0;
75  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ origins()

static List<RelatedPaths> org.turro.relpaths.RelatedPathsUtil.origins ( String  path)
static

Definition at line 95 of file RelatedPathsUtil.java.

95  {
96  Dao dao = new ContactsPU();
97  return (List<RelatedPaths>)dao.getResultList(
98  " select rp from RelatedPaths as rp" +
99  " where destination = ?",
100  new Object[] { path }
101  );
102  }

◆ removePath()

static void org.turro.relpaths.RelatedPathsUtil.removePath ( String  path)
static

Definition at line 59 of file RelatedPathsUtil.java.

59  {
60  Dao dao = new ContactsPU();
61  dao.executeUpdate(
62  " delete from RelatedPaths " +
63  " where origin = ? or destination = ?",
64  new Object[] { path, path }
65  );
66  }
Here is the call graph for this function:

◆ removeRelation()

static void org.turro.relpaths.RelatedPathsUtil.removeRelation ( String  origin,
String  destination 
)
static

Definition at line 49 of file RelatedPathsUtil.java.

49  {
50  Dao dao = new ContactsPU();
51  dao.executeUpdate(
52  " delete from RelatedPaths " +
53  " where origin = ? " +
54  " and destination = ?",
55  new Object[] { origin, destination }
56  );
57  }
Here is the call graph for this function:

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