BrightSide Workbench Full Report + Source Code
org.turro.alliance.service.AxClient Class Reference
Inheritance diagram for org.turro.alliance.service.AxClient:
Collaboration diagram for org.turro.alliance.service.AxClient:

Static Public Attributes

static final String CLIENT_SERVICE = "/axclient"
 

Protected Member Functions

void doProcess (Application application, KeyValueMap map, WsServer server, Jsons json, String reason)
 

Detailed Description

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

Definition at line 56 of file AxClient.java.

Member Function Documentation

◆ doProcess()

void org.turro.alliance.service.AxClient.doProcess ( Application  application,
KeyValueMap  map,
WsServer  server,
Jsons  json,
String  reason 
)
protected

Definition at line 61 of file AxClient.java.

61  {
62  if(AxConstants.USERS.equals(reason)) {
63  long memberId = json.getInt("memberId");
64  Jsons users = Jsons.array();
65  getParticipantsIds().forEach(id -> {
66  users.addValue(Jsons.read(AxContact.from(memberId, id).toJson()));
67  });
68  writeResponse(application, users.build());
69  } else if(AxConstants.PROJECTS.equals(reason)) {
70  long memberId = json.getInt("memberId");
71  Jsons projects = Jsons.array();
72  Dao dao = new DossierPU();
73  SqlClause.select("pc").from("AxProjectCategory pc")
74  .where().equal("pc.serverDomain", server.getServerDomain())
75  .dao(new AlliancePU())
76  .resultList(AxProjectCategory.class).forEach(pc -> {
77  Dossier dossier = dao.find(Dossier.class, Long.valueOf(pc.getProjectId()));
78  if(dossier != null && dossier.getProject() != null) {
79  projects.addValue(Jsons.read(AxProject.from(memberId, server, dossier, pc).toJson()));
80  }
81  });
82  writeResponse(application, projects.build());
83  } else if(AxConstants.PROJECT_GRANTS.equals(reason)) {
84  long memberId = json.getInt("memberId");
85  Jsons projectGrants = Jsons.array();
86  Dao dao = new DossierPU();
87  SqlClause.select("pc").from("AxProjectGrantPublic pc")
88  .where().equal("pc.serverDomain", server.getServerDomain())
89  .dao(new AlliancePU())
90  .resultList(AxProjectGrantPublic.class).forEach(pc -> {
91  ProjectGrant projectGrant = dao.find(ProjectGrant.class, Long.valueOf(pc.getProjectGrantId()));
92  if(projectGrant != null) {
93  projectGrants.addValue(Jsons.read(AxProjectGrant.from(memberId, projectGrant).toJson()));
94  }
95  });
96  writeResponse(application, projectGrants.build());
97  } else if(AxConstants.CENTERS.equals(reason)) {
98  long memberId = json.getInt("memberId");
99  Jsons centers = Jsons.array();
100  Contacts.getCenters().forEach(center -> {
101  centers.addValue(Jsons.read(AxCenter.from(memberId, center).toJson()));
102  });
103  writeResponse(application, centers.build());
104  } else if(AxConstants.STUDENTS.equals(reason)) {
105  long memberId = json.getInt("memberId");
106  Jsons students = Jsons.array();
107  Contacts.getStudents().forEach(student -> {
108  if(student.isStudent() && !student.isWorker()) {
109  students.addValue(Jsons.read(AxStudent.from(memberId, student).toJson()));
110  }
111  });
112  writeResponse(application, students.build());
113  } else if(AxConstants.CHALLENGES.equals(reason)) {
114  long memberId = json.getInt("memberId");
115  Jsons challenges = Jsons.array();
116  Dao dao = new StudentsPU();
117  SqlClause.select("pc").from("AxChallengeCategory pc")
118  .where().equal("pc.serverDomain", server.getServerDomain())
119  .dao(new AlliancePU())
120  .resultList(AxChallengeCategory.class).forEach(pc -> {
121  Challenge challenge = dao.find(Challenge.class, Long.valueOf(pc.getChallengeId()));
122  if(challenge != null) {
123  challenges.addValue(Jsons.read(AxChallenge.from(memberId, server, challenge, pc).toJson()));
124  }
125  });
126  writeResponse(application, challenges.build());
127  } else if(AxConstants.TAGS.equals(reason)) {
128  long memberId = json.getInt("memberId");
129  Jsons tags = Jsons.array();
130  Dao dao = new DossierPU();
131  SqlClause.select("pc").from("AxProjectCategory pc")
132  .where().equal("pc.serverDomain", server.getServerDomain())
133  .dao(new AlliancePU())
134  .resultList(AxProjectCategory.class).forEach(pc -> {
135  Dossier dossier = dao.find(Dossier.class, Long.valueOf(pc.getProjectId()));
136  if(dossier != null && dossier.getProject() != null) {
137  AxTag.from(memberId, dossier).forEach(tag -> {
138  tags.addValue(Jsons.read(tag.toJson()));
139  });
140  }
141  });
142  SqlClause.select("pc").from("AxProjectGrantPublic pc")
143  .where().equal("pc.serverDomain", server.getServerDomain())
144  .dao(new AlliancePU())
145  .resultList(AxProjectGrantPublic.class).forEach(pc -> {
146  ProjectGrant projectGrant = dao.find(ProjectGrant.class, Long.valueOf(pc.getProjectGrantId()));
147  if(projectGrant != null) {
148  AxTag.from(memberId, projectGrant).forEach(tag -> {
149  tags.addValue(Jsons.read(tag.toJson()));
150  });
151  }
152  });
153  writeResponse(application, tags.build());
154  }
155  }
Here is the call graph for this function:

Member Data Documentation

◆ CLIENT_SERVICE

final String org.turro.alliance.service.AxClient.CLIENT_SERVICE = "/axclient"
static

Definition at line 58 of file AxClient.java.


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