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);
61 writeResponse(application, cat.toJson());
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()));
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());
89 writeResponse(application, Projects.from(member)
90 .axPendingParticipations().build());
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)
102 }
else if(AxConstants.PROJECT_GRANT_ITERATOR.equals(reason)) {
103 writeResponse(application,
new ProjectGrantProvider(member, reason, json)
105 }
else if(AxConstants.CATEGORY_ITERATOR.equals(reason)) {
106 writeResponse(application,
new CategoryProvider(member, reason, json)
108 }
else if(AxConstants.PHASE_ITERATOR.equals(reason)) {
109 writeResponse(application,
new PhaseProvider(member, reason, json)
111 }
else if(AxConstants.TAGS.equals(reason)) {
112 writeResponse(application,
new TagProvider(member, reason, json)
114 }
else if(AxConstants.MEMBER_PREFERENCES.equals(reason)) {
115 writeResponse(application,
new PreferencesProvider(member, reason, json)
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")))
123 }
else if(AxConstants.BAN_TOGGLE.equals(reason)) {
124 writeResponse(application, Jsons.object()
125 .add(
"banned", Banned.of(member).toggle(json.getString(
"axId")))
127 }
else if(AxConstants.AXPARTICIPATION_REQUESTED.equals(reason)) {
128 writeResponse(application, Jsons.object()
129 .add(
"requested", Projects.from(member).hasRequested(json))
131 }
else if(AxConstants.AXPARTICIPATION_STATUS.equals(reason)) {
132 writeResponse(application, Jsons.object()
133 .add(
"participant", Projects.from(member).isParticipant(json))
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())))
139 }
else if(AxConstants.AXPARTICIPATION_ASK.equals(reason)) {
140 Projects.from(member).axAskParticipate(json);
141 writeResponse(application, Jsons.object()
142 .add(
"requested",
true)
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);
150 writeResponse(application, cat.toJson());
152 }
else if(AxConstants.TALENT_CATEGORIES.equals(reason)) {
153 Jsons categories = Jsons.array();
154 SqlClause.select(
"c").from(
"AxTalentCategory c")
156 .dao(
new AlliancePU())
157 .resultList(AxTalentCategory.class).forEach(category -> {
158 categories.addValue(Jsons.read(category.toJson()));
160 writeResponse(application, categories.build());
162 writeResponse(application,
"none");