19 package org.turro.alliance.client;
21 import java.io.Writer;
22 import java.util.List;
23 import java.util.Objects;
24 import java.util.Optional;
25 import org.turro.alliance.service.AxConstants;
26 import org.turro.collections.Item;
27 import org.turro.elephant.context.IConstructor;
28 import org.turro.json.Jsons;
29 import org.turro.marker.ElephantMarker;
30 import org.turro.ws.WsServer;
31 import org.turro.ws.content.tree.JsonHtmlClientTree;
32 import org.turro.ws.service.WsConstants;
41 super(server, constructor, writer);
46 marker.
put(
"server", getServer());
47 marker.
put(
"items", items);
63 return Jsons.object();
67 protected Long
getId(Jsons entity) {
68 return entity.getLong(
"categoryId");
73 return Optional.ofNullable(entity.getObject(
"parent"))
74 .filter(parent -> !Jsons.isNull(parent))
75 .map(parent -> parent.getLong(
"categoryId"))
81 return flat().stream()
82 .filter(i -> Objects.equals(
id, i.getId()))
83 .map(i -> i.getValue())
84 .findFirst().orElse(
null);
88 return "alliance/client/category";
void renderItem(ElephantMarker marker, Jsons item)
Long getParentId(Jsons entity)
void renderTree(ElephantMarker marker, List< Item< Jsons, Long >> items)
CategoryJsonTree(WsServer server, IConstructor constructor, Writer writer)
void process(String rootTmpl, String tmpl)
Object put(Object key, Object value)