19 package org.turro.alliance.client.model;
21 import java.util.ArrayList;
22 import java.util.List;
23 import org.turro.alliance.service.AxConstants;
24 import org.turro.alliance.service.AxServer;
25 import org.turro.dossier.entity.Dossier;
26 import org.turro.json.Jsons;
27 import org.turro.ws.service.member.Servers;
28 import org.zkoss.bind.annotation.BindingParam;
29 import org.zkoss.bind.annotation.Command;
30 import org.zkoss.bind.annotation.ExecutionArgParam;
31 import org.zkoss.bind.annotation.Init;
32 import org.zkoss.bind.annotation.NotifyChange;
33 import org.zkoss.zk.ui.Executions;
44 public void init(@ExecutionArgParam(
"dossier")
Dossier dossier) {
45 if(dossier !=
null) this.dossier = dossier;
46 if(this.dossier ==
null) {
47 this.dossier = (
Dossier) Executions.getCurrent().getAttribute(
"dossier");
51 @NotifyChange(
"model")
54 Servers.getData(request.getServer(),
AxConstants.AXPENDING_VALIDATE,
55 Jsons.object().add(
"item", request.getAxPending().asJsonValue()));
59 @NotifyChange(
"model")
62 Servers.getData(request.getServer(),
AxConstants.AXPENDING_DELETE,
63 Jsons.object().add(
"item", request.getAxPending().asJsonValue()));
67 @NotifyChange(
"model")
70 Servers.getData(request.getServer(),
AxConstants.AXPARTICIPATION_SAVE,
71 Jsons.object().add(
"item", request.getAxPending().asJsonValue()));
77 private List<RequestAdapter> model;
81 model =
new ArrayList<>();
83 Jsons request = Jsons.object();
85 request.add(
"id", String.valueOf(dossier.
getId()));
87 Jsons requests = Servers.getData(server,
AxConstants.AXPENDING_REQUESTS, request);
88 if(!Jsons.isEmpty(requests)) requests.getStructure().asArray().forEach(axr -> {
89 model.add(new RequestAdapter(server, Jsons.read(axr.toString())));
void save(@BindingParam("request") RequestAdapter request)
void validate(@BindingParam("request") RequestAdapter request)
void init(@ExecutionArgParam("dossier") Dossier dossier)
List< RequestAdapter > getModel()
void delete(@BindingParam("request") RequestAdapter request)
static final String SERVER_SERVICE