BrightSide Workbench Full Report + Source Code
org.turro.skills.Skills Class Reference

Static Public Member Functions

static List< SkillgetRootSkillsFrom (String rootFilter, SkillType... types)
 
static List< SkillRootgetSkillsAsRootFrom (String entityPath, SkillType... types)
 
static List< SkillgetSkillsFrom (String entityPath, SkillType... types)
 
static List< SkillRootgetAvailables (String rootFilter, SkillType... types)
 
static List< SkillRootgetValidateds (String rootFilter, SkillType... types)
 
static List< SkillRootgetAvailables (String rootFilter, boolean validated, SkillType... types)
 
static void addSkillFor (String entityPath, Skill skill)
 
static void setSkillsFor (String entityPath, Set< Skill > skills, SkillType... types)
 
static void removeSkillsFor (String entityPath, SkillType... types)
 
static void removeSkillsFor (Dao dao, String entityPath, SkillType... types)
 
static void removeSkills (String entityPath)
 
static Set< String > getAllPaths (String root)
 

Detailed Description

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

Definition at line 38 of file Skills.java.

Member Function Documentation

◆ addSkillFor()

static void org.turro.skills.Skills.addSkillFor ( String  entityPath,
Skill  skill 
)
static

Definition at line 85 of file Skills.java.

85  {
86  Dao dao = new ElephantPU();
87  skill.setEntityPath(entityPath);
88  dao.saveObject(skill);
89  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAllPaths()

static Set<String> org.turro.skills.Skills.getAllPaths ( String  root)
static

Definition at line 125 of file Skills.java.

125  {
126  return new HashSet<>(SqlClause.select("distinct s.entityPath").from("Skill s")
127  .where().startsWith("s.entityPath", "/" + root + "/")
128  .dao(new ElephantPU())
129  .resultList(String.class));
130  }
Here is the caller graph for this function:

◆ getAvailables() [1/2]

static List<SkillRoot> org.turro.skills.Skills.getAvailables ( String  rootFilter,
boolean  validated,
SkillType...  types 
)
static

Definition at line 68 of file Skills.java.

68  {
69  WhereClause wc = new WhereClause();
70  wc.addClause("select new org.turro.skills.SkillRoot(s.skill, s.type, count(s))");
71  wc.addClause("from Skill s");
72  wc.addClause(validated ? "where s.validated = TRUE" : "where 1=1");
73  if(!Strings.isBlank(rootFilter)) {
74  wc.addClause("and s.entityPath like :root");
75  wc.addNamedValue("root", "/" + rootFilter + "/%");
76  }
77  if(types != null) {
78  wc.addClause("and s.type in (:types)");
79  wc.addNamedValue("types", Arrays.asList(types));
80  }
81  wc.addClause("group by s.skill, s.type");
82  return new ElephantPU().getResultList(SkillRoot.class, wc);
83  }
Here is the call graph for this function:

◆ getAvailables() [2/2]

static List<SkillRoot> org.turro.skills.Skills.getAvailables ( String  rootFilter,
SkillType...  types 
)
static

Definition at line 60 of file Skills.java.

60  {
61  return getAvailables(rootFilter, false, types);
62  }
static List< SkillRoot > getAvailables(String rootFilter, SkillType... types)
Definition: Skills.java:60
Here is the caller graph for this function:

◆ getRootSkillsFrom()

static List<Skill> org.turro.skills.Skills.getRootSkillsFrom ( String  rootFilter,
SkillType...  types 
)
static

Definition at line 40 of file Skills.java.

40  {
41  return getSkillsFrom(rootFilter == null ? "*" : rootFilter, types);
42  }
static List< Skill > getSkillsFrom(String entityPath, SkillType... types)
Definition: Skills.java:48
Here is the call graph for this function:

◆ getSkillsAsRootFrom()

static List<SkillRoot> org.turro.skills.Skills.getSkillsAsRootFrom ( String  entityPath,
SkillType...  types 
)
static

Definition at line 44 of file Skills.java.

44  {
45  return getSkillsFrom(entityPath, types).stream().map(s -> new SkillRoot(s)).collect(Collectors.toList());
46  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSkillsFrom()

static List<Skill> org.turro.skills.Skills.getSkillsFrom ( String  entityPath,
SkillType...  types 
)
static

Definition at line 48 of file Skills.java.

48  {
49  WhereClause wc = new WhereClause();
50  wc.addClause("select s from Skill s");
51  wc.addClause("where s.entityPath = :path");
52  wc.addNamedValue("path", entityPath);
53  if(types != null) {
54  wc.addClause("and s.type in (:types)");
55  wc.addNamedValue("types", Arrays.asList(types));
56  }
57  return new ElephantPU().getResultList(Skill.class, wc);
58  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getValidateds()

static List<SkillRoot> org.turro.skills.Skills.getValidateds ( String  rootFilter,
SkillType...  types 
)
static

Definition at line 64 of file Skills.java.

64  {
65  return getAvailables(rootFilter, true, types);
66  }
Here is the call graph for this function:

◆ removeSkills()

static void org.turro.skills.Skills.removeSkills ( String  entityPath)
static

Definition at line 114 of file Skills.java.

114  {
115  Dao dao = new ElephantPU();
116  WhereClause wc = new WhereClause();
117  wc.addClause("delete from Skill");
118  wc.addClause("where entityPath = :path");
119  wc.addNamedValue("path", entityPath);
120  dao.executeUpdate(wc);
121  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeSkillsFor() [1/2]

static void org.turro.skills.Skills.removeSkillsFor ( Dao  dao,
String  entityPath,
SkillType...  types 
)
static

Definition at line 102 of file Skills.java.

102  {
103  WhereClause wc = new WhereClause();
104  wc.addClause("delete from Skill s");
105  wc.addClause("where s.entityPath = :path");
106  wc.addNamedValue("path", entityPath);
107  if(types != null) {
108  wc.addClause("and s.type in (:types)");
109  wc.addNamedValue("types", Arrays.asList(types));
110  }
111  dao.executeUpdate(wc);
112  }
Here is the call graph for this function:

◆ removeSkillsFor() [2/2]

static void org.turro.skills.Skills.removeSkillsFor ( String  entityPath,
SkillType...  types 
)
static

Definition at line 98 of file Skills.java.

98  {
99  removeSkillsFor(new ElephantPU(), entityPath, types);
100  }
static void removeSkillsFor(String entityPath, SkillType... types)
Definition: Skills.java:98
Here is the caller graph for this function:

◆ setSkillsFor()

static void org.turro.skills.Skills.setSkillsFor ( String  entityPath,
Set< Skill skills,
SkillType...  types 
)
static

Definition at line 91 of file Skills.java.

91  {
92  Dao dao = new ElephantPU();
93  removeSkillsFor(dao, entityPath, types);
94  skills.forEach(s -> s.setEntityPath(entityPath));
95  dao.saveCollection(skills);
96  }
Here is the call graph for this function:
Here is the caller graph for this function:

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