BrightSide Workbench Full Report + Source Code
org.turro.hr.humanres.HumanResourceAptitude Class Reference

Public Member Functions

 HumanResourceAptitude (HumanResource humanResource, boolean canChange, AptitudeDegree aptitudeDegree)
 
HumanResource getHumanResource ()
 
AptitudeDegree getAptitudeDegree ()
 
String getRealName ()
 
String getName ()
 
String toString ()
 
double getCost ()
 
double getPrice ()
 
double getMarketPrice ()
 

Static Public Member Functions

static Collection< HumanResourceAptitudeload (Date date, String value, Collection< AptitudeDegree > required, boolean onlyActive, int nRows)
 
static HumanResourceAptitude get (Date date, String text)
 

Detailed Description

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

Definition at line 38 of file HumanResourceAptitude.java.

Constructor & Destructor Documentation

◆ HumanResourceAptitude()

org.turro.hr.humanres.HumanResourceAptitude.HumanResourceAptitude ( HumanResource  humanResource,
boolean  canChange,
AptitudeDegree  aptitudeDegree 
)

Definition at line 44 of file HumanResourceAptitude.java.

44  {
45  this.humanResource = humanResource;
46  this.canChange = canChange;
47  this.aptitudeDegree = aptitudeDegree;
48  }
Here is the caller graph for this function:

Member Function Documentation

◆ get()

static HumanResourceAptitude org.turro.hr.humanres.HumanResourceAptitude.get ( Date  date,
String  text 
)
static

Definition at line 133 of file HumanResourceAptitude.java.

133  {
134  String s[] = text.split(" - ");
135  if(s.length > 1) {
136  String name = s.length == 3 ? s[0] + " - " + s[1] : s[0];
137  String aptitude = s.length == 3 ? s[2] : s[1];
138  EntityManager em = new ErpPU().getEntityManager();
139  try {
140  Query q = em.createQuery(
141  " select res from HumanResource res " +
142  " where res.name = :name");
143  q.setParameter("name", name);
144  q.setMaxResults(1);
145  HumanResource hr = (HumanResource) q.getSingleResult();
146  for(OwnedAptitude off : hr.getActiveAptitudes(date)) {
147  if(off.getAptitudeDegree().getFullName().equals(aptitude)) {
148  return new HumanResourceAptitude(hr, false, off.getAptitudeDegree());
149  }
150  }
151  } catch(Exception ex) {
152  return null;
153  } finally {
154  em.close();
155  }
156  }
157  return null;
158  }
HumanResourceAptitude(HumanResource humanResource, boolean canChange, AptitudeDegree aptitudeDegree)
Here is the call graph for this function:

◆ getAptitudeDegree()

AptitudeDegree org.turro.hr.humanres.HumanResourceAptitude.getAptitudeDegree ( )

Definition at line 54 of file HumanResourceAptitude.java.

54  {
55  return aptitudeDegree;
56  }
Here is the caller graph for this function:

◆ getCost()

double org.turro.hr.humanres.HumanResourceAptitude.getCost ( )

Definition at line 91 of file HumanResourceAptitude.java.

91  {
92  return humanResource.getCostHour() + aptitudeDegree.getCost();
93  }
Here is the call graph for this function:

◆ getHumanResource()

HumanResource org.turro.hr.humanres.HumanResourceAptitude.getHumanResource ( )

Definition at line 50 of file HumanResourceAptitude.java.

50  {
51  return humanResource;
52  }
Here is the caller graph for this function:

◆ getMarketPrice()

double org.turro.hr.humanres.HumanResourceAptitude.getMarketPrice ( )

Definition at line 99 of file HumanResourceAptitude.java.

99  {
100  return humanResource.getMarketPrice() + aptitudeDegree.getMarketPrice();
101  }
Here is the call graph for this function:

◆ getName()

String org.turro.hr.humanres.HumanResourceAptitude.getName ( )

Definition at line 70 of file HumanResourceAptitude.java.

70  {
71  PhraseBuilder pb = new PhraseBuilder();
72  if(humanResource != null) {
73  if(canChange) {
74  pb.addWord("Variable");
75  } else {
76  pb.addWord(humanResource.getName());
77  }
78  }
79  pb.addPendingSeparator(" -");
80  if(aptitudeDegree != null) {
81  pb.addWord(aptitudeDegree.getFullName());
82  }
83  return pb.toString();
84  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPrice()

double org.turro.hr.humanres.HumanResourceAptitude.getPrice ( )

Definition at line 95 of file HumanResourceAptitude.java.

95  {
96  return humanResource.getPriceHour() + aptitudeDegree.getPrice();
97  }
Here is the call graph for this function:

◆ getRealName()

String org.turro.hr.humanres.HumanResourceAptitude.getRealName ( )

Definition at line 58 of file HumanResourceAptitude.java.

58  {
59  PhraseBuilder pb = new PhraseBuilder();
60  if(humanResource != null) {
61  pb.addWord(humanResource.getName());
62  }
63  pb.addPendingSeparator(" -");
64  if(aptitudeDegree != null) {
65  pb.addWord(aptitudeDegree.getFullName());
66  }
67  return pb.toString();
68  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load()

static Collection<HumanResourceAptitude> org.turro.hr.humanres.HumanResourceAptitude.load ( Date  date,
String  value,
Collection< AptitudeDegree required,
boolean  onlyActive,
int  nRows 
)
static

Definition at line 103 of file HumanResourceAptitude.java.

103  {
104  ArrayList<HumanResourceAptitude> result = new ArrayList<HumanResourceAptitude>();
105  EntityManager em = new ErpPU().getEntityManager();
106  try {
107  WhereClause wc = SQLHelper.getWhereClause(new String[]{
108  "res.name"
109  }, value);
110  Query q = em.createQuery(
111  "select res from HumanResource res " +
112  "where res.active = :active " +
113  wc.getClause() +
114  " order by res.name"
115  );
116  wc.addNamedValue("active", onlyActive);
117  q.setMaxResults(nRows);
118  wc.setNamedParameters(q);
119  List<HumanResource> l = q.getResultList();
120  for(HumanResource hr : l) {
121  for(OwnedAptitude off : hr.getActiveAptitudes(date)) {
122  if(required.isEmpty() || off.getAptitudeDegree().isIn(required)) {
123  result.add(new HumanResourceAptitude(hr, false, off.getAptitudeDegree()));
124  }
125  }
126  }
127  } finally {
128  em.close();
129  }
130  return result;
131  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ toString()

String org.turro.hr.humanres.HumanResourceAptitude.toString ( )

Definition at line 87 of file HumanResourceAptitude.java.

87  {
88  return getName();
89  }
Here is the call graph for this function:

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