BrightSide Workbench Full Report + Source Code
org.turro.alliance.provider.Projects Class Reference

Public Member Functions

Jsons project (String projectId)
 
Jsons participations (String projectId)
 
Jsons axParticipations (String projectId, String as)
 
Jsons axPendingParticipations ()
 
Jsons axAllParticipations (String projectId)
 
Jsons axFullParticipations ()
 
void axAskParticipate (Jsons request)
 
boolean isParticipant (Jsons request)
 
boolean hasRequested (Jsons request)
 
boolean save (Jsons request)
 
void axValidatePending (Jsons axPending)
 
void axDeleteParticipation (Jsons axRequest)
 

Static Public Member Functions

static Projects from (WsMember member)
 

Detailed Description

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

Definition at line 39 of file provider/Projects.java.

Member Function Documentation

◆ axAllParticipations()

Jsons org.turro.alliance.provider.Projects.axAllParticipations ( String  projectId)

Definition at line 88 of file provider/Projects.java.

88  {
89  Jsons participations = Jsons.array();
90  SqlClause.select("p").from("AxParticipationRequest p")
91  .where().equal("id", correctId(projectId))
92  .dao(dao.get())
93  .resultList(AxParticipationRequest.class)
94  .forEach(p -> {
95  participations.addValue(Jsons.read(p.toJson()));
96  });
97  SqlClause.select("p").from("AxAllianceParticipation p")
98  .where().equal("id", correctId(projectId))
99  .dao(dao.get())
100  .resultList(AxAllianceParticipation.class)
101  .forEach(p -> {
102  participations.addValue(Jsons.read(p.toJson()));
103  });
104  return participations;
105  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ axAskParticipate()

void org.turro.alliance.provider.Projects.axAskParticipate ( Jsons  request)

Definition at line 130 of file provider/Projects.java.

130  {
131  AxParticipationRequest axp = new AxParticipationRequest();
132  RelationId ri = new RelationId();
133  ri.setRelatedEntityId(request.getString("contactId"));
134  ri.setRelatedMemberId(member.getMemberId());
135  axp.setRelation(ri);
136  axp.setId(request.getString("axId"));
137  switch(request.getString("as")) {
138  case "Beneficiary" -> axp.setBeneficiary(true);
139  case "Offerer" -> axp.setOfferer(true);
140  case "Consortium" -> axp.setConsortium(true);
141  }
142  axp.setName(request.getString("contactName"));
143  axp.setFace(request.getString("contactFace"));
144  axp.setCompany(request.getString("companyName"));
145  axp.setCompanyFace(request.getString("companyFace"));
146  axp.setMemberName(member.getContact().getTradeName());
147  Participations.from(axp).add();
148  }
IContact getContact()
Definition: WsMember.java:130
Here is the call graph for this function:
Here is the caller graph for this function:

◆ axDeleteParticipation()

void org.turro.alliance.provider.Projects.axDeleteParticipation ( Jsons  axRequest)

Definition at line 182 of file provider/Projects.java.

182  {
183  if(axRequest.getBoolean("validated")) {
184  AxAllianceParticipation ap = AxAllianceParticipation.fromJson(axRequest.asJsonValue());
185  dao.get().deleteObject(ap);
186  } else {
187  AxParticipationRequest pr = AxParticipationRequest.fromJson(axRequest.asJsonValue());
188  dao.get().deleteObject(pr);
189  }
190  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ axFullParticipations()

Jsons org.turro.alliance.provider.Projects.axFullParticipations ( )

Definition at line 107 of file provider/Projects.java.

107  {
108  Jsons participations = Jsons.array();
109  SqlClause.select("p").from("AxParticipationRequest p")
110  .where().equal("mainMemberId", member.getMemberId())
111  .or().equal("relatedMemberId", member.getMemberId())
112  .orderBy("p.creation desc")
113  .dao(dao.get())
114  .resultList(AxParticipationRequest.class)
115  .forEach(p -> {
116  participations.addValue(Jsons.read(p.toJson()));
117  });
118  SqlClause.select("p").from("AxAllianceParticipation p")
119  .where().equal("mainMemberId", member.getMemberId())
120  .or().equal("relatedMemberId", member.getMemberId())
121  .orderBy("p.creation desc")
122  .dao(dao.get())
123  .resultList(AxAllianceParticipation.class)
124  .forEach(p -> {
125  participations.addValue(Jsons.read(p.toJson()));
126  });
127  return participations;
128  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ axParticipations()

Jsons org.turro.alliance.provider.Projects.axParticipations ( String  projectId,
String  as 
)

Definition at line 61 of file provider/Projects.java.

61  {
62  Jsons participations = Jsons.array();
63  SqlClause.select("p").from("AxAllianceParticipation p")
64  .where().equal("id", correctId(projectId))
65  .startIf(!Strings.isBlank(as))
66  .and().isTrue(Strings.lowerCase(as))
67  .endIf()
68  .dao(dao.get())
69  .resultList(AxAllianceParticipation.class)
70  .forEach(p -> {
71  participations.addValue(Jsons.read(p.toJson()));
72  });
73  return participations;
74  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ axPendingParticipations()

Jsons org.turro.alliance.provider.Projects.axPendingParticipations ( )

Definition at line 76 of file provider/Projects.java.

76  {
77  Jsons participations = Jsons.array();
78  SqlClause.select("p").from("AxParticipationRequest p")
79  .where().equal("mainMemberId", member.getMemberId())
80  .dao(dao.get())
81  .resultList(AxParticipationRequest.class)
82  .forEach(p -> {
83  participations.addValue(Jsons.read(p.toJson()));
84  });
85  return participations;
86  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ axValidatePending()

void org.turro.alliance.provider.Projects.axValidatePending ( Jsons  axPending)

Definition at line 176 of file provider/Projects.java.

176  {
177  AxParticipationRequest pr = AxParticipationRequest.fromJson(axPending.asJsonValue());
178  Participations.from(pr).validate();
179  dao.get().deleteObject(pr);
180  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ from()

static Projects org.turro.alliance.provider.Projects.from ( WsMember  member)
static

Definition at line 207 of file provider/Projects.java.

207  {
208  return new Projects(member);
209  }
Here is the caller graph for this function:

◆ hasRequested()

boolean org.turro.alliance.provider.Projects.hasRequested ( Jsons  request)

Definition at line 160 of file provider/Projects.java.

160  {
161  return !SqlClause.select("p").from("AxParticipationRequest p")
162  .where().equal("id", request.getString("axId"))
163  .and().equal("relatedEntityId", request.getString("contactId"))
164  .and().equal("relatedMemberId", member.getMemberId())
165  .and().isTrue(request.getString("as").toLowerCase())
166  .dao(dao.get())
167  .resultList(AxParticipationRequest.class).isEmpty();
168  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isParticipant()

boolean org.turro.alliance.provider.Projects.isParticipant ( Jsons  request)

Definition at line 150 of file provider/Projects.java.

150  {
151  return !SqlClause.select("p").from("AxAllianceParticipation p")
152  .where().equal("id", request.getString("axId"))
153  .and().equal("relatedEntityId", request.getString("contactId"))
154  .and().equal("relatedMemberId", member.getMemberId())
155  .and().isTrue(request.getString("as").toLowerCase())
156  .dao(dao.get())
157  .resultList(AxAllianceParticipation.class).isEmpty();
158  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ participations()

Jsons org.turro.alliance.provider.Projects.participations ( String  projectId)

Definition at line 49 of file provider/Projects.java.

49  {
50  Jsons participations = Jsons.array();
51  SqlClause.select("p").from("AxParticipation p")
52  .where().equal("id", projectId)
53  .dao(dao.get())
54  .resultList(AxParticipation.class)
55  .forEach(p -> {
56  participations.addValue(Jsons.read(p.toJson()));
57  });
58  return participations;
59  }
Here is the caller graph for this function:

◆ project()

Jsons org.turro.alliance.provider.Projects.project ( String  projectId)

Definition at line 41 of file provider/Projects.java.

41  {
42  AxProject project = SqlClause.select("p").from("AxProject p")
43  .where().equal("id", projectId)
44  .dao(dao.get())
45  .singleResult(AxProject.class);
46  return Jsons.read(project.toJson());
47  }
Here is the caller graph for this function:

◆ save()

boolean org.turro.alliance.provider.Projects.save ( Jsons  request)

Definition at line 170 of file provider/Projects.java.

170  {
171  AxAllianceParticipation ap = AxAllianceParticipation.fromJson(request.asJsonValue());
172  dao.get().saveObject(ap);
173  return true;
174  }
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: