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

Static Public Attributes

static final String SERVER_SERVICE = "/axserver"
 

Protected Member Functions

void doProcess (Application application, KeyValueMap map, WsMember member, Jsons json, String reason)
 

Detailed Description

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

Definition at line 49 of file AxServer.java.

Member Function Documentation

◆ doProcess()

void org.turro.alliance.service.AxServer.doProcess ( Application  application,
KeyValueMap  map,
WsMember  member,
Jsons  json,
String  reason 
)
protected

Definition at line 54 of file AxServer.java.

54  {
55  if(AxConstants.CATEGORY.equals(reason)) {
56  AxCategory cat = SqlClause.select("c").from("AxCategory c")
57  .where().equal("c.categoryId", json.getLong("id"))
58  .dao(new AlliancePU())
59  .singleResult(AxCategory.class);
60  if(cat != null) {
61  writeResponse(application, cat.toJson());
62  }
63  } else if(AxConstants.CATEGORIES.equals(reason)) {
64  Jsons categories = Jsons.array();
65  SqlClause.select("c").from("AxCategory c")
66  .orderBy("c.uniquePath")
67  .dao(new AlliancePU())
68  .resultList(AxCategory.class).forEach(category -> {
69  categories.addValue(Jsons.read(category.toJson()));
70  });
71  writeResponse(application, categories.build());
72  } else if(AxConstants.PROJECT.equals(reason)) {
73  writeResponse(application, Projects.from(member)
74  .project(json.getString("id")).toString());
75  } else if(AxConstants.PARTICIPATIONS.equals(reason)) {
76  writeResponse(application, Projects.from(member)
77  .participations(json.getString("id")).build());
78  } else if(AxConstants.AXPARTICIPATIONS.equals(reason)) {
79  writeResponse(application, Projects.from(member)
80  .axParticipations(json.getString("id"), json.getString("as", null)).build());
81  } else if(AxConstants.AXFULL_PARTICIPATIONS.equals(reason)) {
82  writeResponse(application, Projects.from(member)
83  .axFullParticipations().build());
84  } else if(AxConstants.AXPENDING_REQUESTS.equals(reason)) {
85  if(!Strings.isBlank(json.getString("id", null))) {
86  writeResponse(application, Projects.from(member)
87  .axAllParticipations(json.getString("id", null)).build());
88  } else {
89  writeResponse(application, Projects.from(member)
90  .axPendingParticipations().build());
91  }
92  } else if(AxConstants.AXPENDING_VALIDATE.equals(reason)) {
93  Projects.from(member).axValidatePending(Jsons.read(json.getObject("item").toString()));
94  } else if(AxConstants.AXPENDING_DELETE.equals(reason)) {
95  Projects.from(member).axDeleteParticipation(Jsons.read(json.getObject("item").toString()));
96  } else if(AxConstants.UPDATE_SERVER.equals(reason)) {
97  ImportFromMembers.connect(member);
98  writeResponse(application, Jsons.object().add("imported", true).build());
99  } else if(AxConstants.PROJECT_ITERATOR.equals(reason)) {
100  writeResponse(application, new ProjectProvider(member, reason, json)
101  .getData().build());
102  } else if(AxConstants.PROJECT_GRANT_ITERATOR.equals(reason)) {
103  writeResponse(application, new ProjectGrantProvider(member, reason, json)
104  .getData().build());
105  } else if(AxConstants.CATEGORY_ITERATOR.equals(reason)) {
106  writeResponse(application, new CategoryProvider(member, reason, json)
107  .getData().build());
108  } else if(AxConstants.PHASE_ITERATOR.equals(reason)) {
109  writeResponse(application, new PhaseProvider(member, reason, json)
110  .getData().build());
111  } else if(AxConstants.TAGS.equals(reason)) {
112  writeResponse(application, new TagProvider(member, reason, json)
113  .getData().build());
114  } else if(AxConstants.MEMBER_PREFERENCES.equals(reason)) {
115  writeResponse(application, new PreferencesProvider(member, reason, json)
116  .getData().build());
117  } else if(AxConstants.SAVE_PREFERENCES.equals(reason)) {
118  new AlliancePU().saveObject(AxMemberPreferences.fromJson(json.asJsonValue()));
119  } else if(AxConstants.BAN_STATUS.equals(reason)) {
120  writeResponse(application, Jsons.object()
121  .add("banned", Banned.of(member).status(json.getString("axId")))
122  .build());
123  } else if(AxConstants.BAN_TOGGLE.equals(reason)) {
124  writeResponse(application, Jsons.object()
125  .add("banned", Banned.of(member).toggle(json.getString("axId")))
126  .build());
127  } else if(AxConstants.AXPARTICIPATION_REQUESTED.equals(reason)) {
128  writeResponse(application, Jsons.object()
129  .add("requested", Projects.from(member).hasRequested(json))
130  .build());
131  } else if(AxConstants.AXPARTICIPATION_STATUS.equals(reason)) {
132  writeResponse(application, Jsons.object()
133  .add("participant", Projects.from(member).isParticipant(json))
134  .build());
135  } else if(AxConstants.AXPARTICIPATION_SAVE.equals(reason)) {
136  writeResponse(application, Jsons.object()
137  .add("participant", Projects.from(member).save(Jsons.read(json.getObject("item").toString())))
138  .build());
139  } else if(AxConstants.AXPARTICIPATION_ASK.equals(reason)) {
140  Projects.from(member).axAskParticipate(json);
141  writeResponse(application, Jsons.object()
142  .add("requested", true)
143  .build());
144  } else if(AxConstants.TALENT_CATEGORY.equals(reason)) {
145  AxTalentCategory cat = SqlClause.select("c").from("AxTalentCategory c")
146  .where().equal("c.categoryId", json.getLong("id"))
147  .dao(new AlliancePU())
148  .singleResult(AxTalentCategory.class);
149  if(cat != null) {
150  writeResponse(application, cat.toJson());
151  }
152  } else if(AxConstants.TALENT_CATEGORIES.equals(reason)) {
153  Jsons categories = Jsons.array();
154  SqlClause.select("c").from("AxTalentCategory c")
155  .orderBy("c.name")
156  .dao(new AlliancePU())
157  .resultList(AxTalentCategory.class).forEach(category -> {
158  categories.addValue(Jsons.read(category.toJson()));
159  });
160  writeResponse(application, categories.build());
161  } else {
162  writeResponse(application, "none");
163  }
164  }
Here is the call graph for this function:

Member Data Documentation

◆ SERVER_SERVICE

final String org.turro.alliance.service.AxServer.SERVER_SERVICE = "/axserver"
static

Definition at line 51 of file AxServer.java.


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