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

Static Public Member Functions

static SkillSet getAvailables (String root)
 
static SkillSet getAvailables (String root, boolean user)
 
static SkillSet getSiblings (String root, Set< String > skillNames)
 
static List< String > getIdentifiers (String root, Set< SkillItem > set)
 
static List< String > getIdentifiers (Dao dao, String root, Set< SkillItem > set)
 
static List< String > getEntityPaths (String root, Set< SkillItem > set)
 
static List< String > getEntityPaths (Dao dao, String root, Set< SkillItem > set)
 
static SkillSet getSkills (Object entity)
 
static SkillSet getSkills (String entityPath)
 

Detailed Description

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

Definition at line 40 of file SkillTags.java.

Member Function Documentation

◆ getAvailables() [1/2]

static SkillSet org.turro.skills.tags.SkillTags.getAvailables ( String  root)
static

Definition at line 42 of file SkillTags.java.

42  {
43  Dao dao = new ElephantPU();
44  WhereClause wc = new WhereClause();
45  wc.addClause("select new org.turro.skills.tags.SkillItem(t.skill, t.type, count(t))");
46  wc.addClause("from Skill t");
47  wc.addIn("where", "t.type", Arrays.asList(SkillType.values()));
48  if(!Strings.isBlank(root)) {
49  wc.addClause("and t.entityPath like concat('/', :root, '/%')");
50  wc.addNamedValue("root", root);
51  }
52  wc.addClause("group by t.skill, t.type");
53  return new SkillSet(dao.getResultList(wc));
54  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAvailables() [2/2]

static SkillSet org.turro.skills.tags.SkillTags.getAvailables ( String  root,
boolean  user 
)
static

Definition at line 56 of file SkillTags.java.

56  {
57  Dao dao = new ElephantPU();
58  WhereClause wc = new WhereClause();
59  wc.addClause("select new org.turro.skills.tags.SkillItem(t.skill, t.type, count(t))");
60  wc.addClause("from Skill t");
61  wc.addIn("where", "t.type", new ArrayList(user ? SkillType.getNaturals() : SkillType.getJuridicals()));
62  if(!Strings.isBlank(root)) {
63  wc.addClause("and t.entityPath like concat('/', :root, '/%')");
64  wc.addNamedValue("root", root);
65  }
66  wc.addClause("group by t.skill, t.type");
67  return new SkillSet(dao.getResultList(wc));
68  }
Here is the call graph for this function:

◆ getEntityPaths() [1/2]

static List<String> org.turro.skills.tags.SkillTags.getEntityPaths ( Dao  dao,
String  root,
Set< SkillItem set 
)
static

Definition at line 112 of file SkillTags.java.

112  {
113  List<String> skills = set.stream().map(t -> t.getSkillName()).collect(Collectors.toList());
114  if(!skills.isEmpty()) {
115  WhereClause wc = new WhereClause();
116  wc.addClause("select distinct t.entityPath from Skill t");
117  wc.addClause("where 1=1");
118  if(!Strings.isBlank(root)) {
119  wc.addClause("and t.entityPath like concat('/', :root, '/%')");
120  wc.addNamedValue("root", root);
121  }
122  int count = 0;
123  for(String skill : skills) {
124  wc.addClause("and exists (");
125  wc.addClause("select t2.entityPath from Skill t2");
126  wc.addClause("where t2.entityPath = t.entityPath");
127  wc.addClause("and t2.skill = :skill" + count);
128  wc.addNamedValue("skill" + count, skill);
129  wc.addClause(")");
130  count++;
131  }
132  return dao.getResultList(String.class, wc);
133  }
134  return Collections.EMPTY_LIST;
135  }
Here is the call graph for this function:

◆ getEntityPaths() [2/2]

static List<String> org.turro.skills.tags.SkillTags.getEntityPaths ( String  root,
Set< SkillItem set 
)
static

Definition at line 108 of file SkillTags.java.

108  {
109  return getEntityPaths(new ElephantPU(), root, set);
110  }
static List< String > getEntityPaths(String root, Set< SkillItem > set)
Definition: SkillTags.java:108
Here is the caller graph for this function:

◆ getIdentifiers() [1/2]

static List<String> org.turro.skills.tags.SkillTags.getIdentifiers ( Dao  dao,
String  root,
Set< SkillItem set 
)
static

Definition at line 104 of file SkillTags.java.

104  {
105  return getEntityPaths(dao, root, set).stream().map(s -> Path.getIdentifier(s)).collect(Collectors.toList());
106  }
Here is the call graph for this function:

◆ getIdentifiers() [2/2]

static List<String> org.turro.skills.tags.SkillTags.getIdentifiers ( String  root,
Set< SkillItem set 
)
static

Definition at line 100 of file SkillTags.java.

100  {
101  return getIdentifiers(new ElephantPU(), root, set);
102  }
static List< String > getIdentifiers(String root, Set< SkillItem > set)
Definition: SkillTags.java:100
Here is the caller graph for this function:

◆ getSiblings()

static SkillSet org.turro.skills.tags.SkillTags.getSiblings ( String  root,
Set< String >  skillNames 
)
static

Definition at line 70 of file SkillTags.java.

70  {
71  Dao dao = new ElephantPU();
72  SkillSet finalSet = null;
73  for(String tag : skillNames) {
74  SkillSet set = getSiblings(dao, root, tag);
75  if(finalSet != null) {
76  finalSet.retainAll(set);
77  } else {
78  finalSet = set;
79  }
80  }
81  return Optional.ofNullable(finalSet).orElseGet(() -> SkillSet.empty());
82  }
static SkillSet getSiblings(String root, Set< String > skillNames)
Definition: SkillTags.java:70
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSkills() [1/2]

static SkillSet org.turro.skills.tags.SkillTags.getSkills ( Object  entity)
static

Definition at line 137 of file SkillTags.java.

137  {
138  return getSkills(Entities.getController(entity).getPath());
139  }
static SkillSet getSkills(Object entity)
Definition: SkillTags.java:137
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSkills() [2/2]

static SkillSet org.turro.skills.tags.SkillTags.getSkills ( String  entityPath)
static

Definition at line 141 of file SkillTags.java.

141  {
142  Dao dao = new ElephantPU();
143  WhereClause wc = new WhereClause();
144  wc.addClause("select new org.turro.skils.tags.SkillItem(t.skill, t.type, count(t))");
145  wc.addClause("from Skill t");
146  wc.addClause("where t.entityPath = :path");
147  wc.addNamedValue("path", entityPath);
148  wc.addClause("group by t.skill, t.type");
149  return new SkillSet(dao.getResultList(wc));
150  }
Here is the call graph for this function:

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