BrightSide Workbench Full Report + Source Code
org.turro.security.Secs Class Reference

Static Public Member Functions

static SecSet search (String root, String value, int max)
 
static SecSet getAvailables ()
 
static SecSet getSiblings (Set< String > secNames)
 
static List< String > getIdentifiers (Dao dao, Set< SecItem > sets)
 
static void removeSyndication (Dao dao, String syndication)
 

Detailed Description

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

Definition at line 33 of file Secs.java.

Member Function Documentation

◆ getAvailables()

static SecSet org.turro.security.Secs.getAvailables ( )
static

Definition at line 49 of file Secs.java.

49  {
50  Dao dao = new ContactsPU();
51  WhereClause wc = new WhereClause();
52  wc.addClause("select new org.turro.security.SecItem(s.name, count(s))");
53  wc.addClause("from Syndication s");
54  wc.addClause("where 1=1");
55  wc.addClause("group by s.name");
56  return new SecSet(dao.getResultList(wc));
57  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getIdentifiers()

static List<String> org.turro.security.Secs.getIdentifiers ( Dao  dao,
Set< SecItem sets 
)
static

Definition at line 85 of file Secs.java.

85  {
86  WhereClause wc = new WhereClause();
87  wc.addClause("select distinct s.contact.id from Syndication s");
88  wc.addClause("where 1=1");
89  int count = 0;
90  for(SecItem sec : sets) {
91  wc.addClause("and exists (");
92  wc.addClause("select s.name from Syndication s2");
93  wc.addClause("where s2.contact = s.contact");
94  wc.addClause("and s2.name = :name" + count);
95  wc.addNamedValue("name" + count, sec.getSecName());
96  wc.addClause(")");
97  count++;
98  }
99  return dao.getResultList(String.class, wc);
100  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSiblings()

static SecSet org.turro.security.Secs.getSiblings ( Set< String >  secNames)
static

Definition at line 59 of file Secs.java.

59  {
60  Dao dao = new ContactsPU();
61  SecSet finalSet = null;
62  for(String sec : secNames) {
63  SecSet set = getSiblings(dao, sec);
64  if(finalSet != null) {
65  finalSet.retainAll(set);
66  } else {
67  finalSet = set;
68  }
69  }
70  return Optional.ofNullable(finalSet).orElseGet(() -> SecSet.empty());
71  }
static SecSet getSiblings(Set< String > secNames)
Definition: Secs.java:59
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeSyndication()

static void org.turro.security.Secs.removeSyndication ( Dao  dao,
String  syndication 
)
static

Definition at line 102 of file Secs.java.

102  {
103  WhereClause wc = new WhereClause();
104  wc.addClause("delete from Syndication s");
105  wc.addClause("where s.name = :name");
106  wc.addNamedValue("name", syndication);
107  dao.executeUpdate(wc);
108  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ search()

static SecSet org.turro.security.Secs.search ( String  root,
String  value,
int  max 
)
static

Definition at line 35 of file Secs.java.

35  {
36  Dao dao = new ContactsPU();
37  WhereClause wc = new WhereClause();
38  wc.addClause("select new org.turro.security.SecItem(s.name, count(s))");
39  wc.addClause("from Syndication s");
40  wc.addClause("where 1=1");
41  if(!Strings.isBlank(value)) {
42  wc.addLikeFields(new String[]{ "s.name" }, value.toString());
43  }
44  wc.addClause("group by s.name");
45  wc.addClause("order by s.name");
46  return new SecSet(dao.getResultList(wc, max));
47  }
Here is the call graph for this function:

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