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

Public Member Functions

 ProjectJsonIterator (IConstructor constructor, IContact contact, WsServer server, Writer writer, boolean mail)
 

Protected Member Functions

String entityRoot ()
 
Jsons entity (String value)
 
void renderSummary (ElephantMarker marker, Jsons e, int page)
 
void renderItem (ElephantMarker marker, Jsons e, int page)
 
String title (Jsons e)
 
Collection< String > metas (Jsons e)
 
String getTemplateRoot ()
 
String getItemLink (Jsons e)
 
String reason ()
 
Jsons criteria ()
 

Detailed Description

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

Definition at line 54 of file ProjectJsonIterator.java.

Constructor & Destructor Documentation

◆ ProjectJsonIterator()

org.turro.alliance.client.ProjectJsonIterator.ProjectJsonIterator ( IConstructor  constructor,
IContact  contact,
WsServer  server,
Writer  writer,
boolean  mail 
)

Definition at line 56 of file ProjectJsonIterator.java.

56  {
57  super(constructor, contact, server, writer, mail);
58  }

Member Function Documentation

◆ criteria()

Jsons org.turro.alliance.client.ProjectJsonIterator.criteria ( )
protected

Definition at line 173 of file ProjectJsonIterator.java.

173  {
174  Jsons criteria = Jsons.object();
175  criteria.add("withBanned", contact.isAdmin());
176  Item<Jsons, Long> selected = getNavigationTree().getSelectedItem();
177  if(selected != null) {
178  criteria.addArray("categoryIds");
179  selected.selfAndChildrenIds().forEach(id -> {
180  criteria.add(id);
181  });
182  }
183  if(isSearchOption()) {
184  criteria.toRoot();
185  JsonHtmlSearch dhs = JsonHtmlSearch.getInstance(constructor, ElephantContext.getContextVariable(constructor));
186  if(dhs != null) {
187  DaoSearchKey dsk = dhs.get("search-value");
188  criteria.add("search", dsk.getValue());
189  dsk = dhs.get("phase");
190  criteria.add("phase", Converter.STANDARD.convert(Strings.isBlank(dsk.getValue(), "-1"), Integer.class, -1));
191  }
192  }
193  return criteria;
194  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ entity()

Jsons org.turro.alliance.client.ProjectJsonIterator.entity ( String  value)
protected

Definition at line 67 of file ProjectJsonIterator.java.

67  {
68  return items.getStructure().getArrayValues(JsonObject.class).stream()
69  .filter(item -> item.getString("id").equals(value.replaceAll("_", "#")))
70  .map(item -> Jsons.read(item.toString()))
71  .findFirst().orElse(null);
72  }

◆ entityRoot()

String org.turro.alliance.client.ProjectJsonIterator.entityRoot ( )
protected

Definition at line 61 of file ProjectJsonIterator.java.

61  {
62  // c for client?
63  return "caxproject";
64  }

◆ getItemLink()

String org.turro.alliance.client.ProjectJsonIterator.getItemLink ( Jsons  e)
protected

Definition at line 162 of file ProjectJsonIterator.java.

162  {
163  return constructor.getCurrentContext().getFullPath() +
164  "?item=" + e.getString("id").replaceAll("#", "_");
165  }
Here is the caller graph for this function:

◆ getTemplateRoot()

String org.turro.alliance.client.ProjectJsonIterator.getTemplateRoot ( )
protected

Definition at line 157 of file ProjectJsonIterator.java.

157  {
158  return isMail() ? "content/newsletter/sections/alliance/client/projects" : "alliance/client/project";
159  }
Here is the caller graph for this function:

◆ metas()

Collection<String> org.turro.alliance.client.ProjectJsonIterator.metas ( Jsons  e)
protected

Definition at line 149 of file ProjectJsonIterator.java.

149  {
150  ArrayList<RepositoryFile> files = new ArrayList<>();
151  String path = getItemLink(e);
152  SocialNet sn = new SocialNet(path, e.getString("name"), e.getString("summary", "*"), files);
153  return sn.getMetas();
154  }
Here is the call graph for this function:

◆ reason()

String org.turro.alliance.client.ProjectJsonIterator.reason ( )
protected

Definition at line 168 of file ProjectJsonIterator.java.

168  {
169  return AxConstants.PROJECT_ITERATOR;
170  }

◆ renderItem()

void org.turro.alliance.client.ProjectJsonIterator.renderItem ( ElephantMarker  marker,
Jsons  e,
int  page 
)
protected

Definition at line 90 of file ProjectJsonIterator.java.

90  {
91  Jsons criteria = Jsons.object();
92  criteria.add("projectId", e.context().read("$.projectId.entityId", String.class));
93  Jsons project = P2Ps.getP2PData(getServer().getServerDomain(),
94  e.context().read("$.projectId.memberId", Long.class),
95  AxP2PServer.AX_P2P_SERVICE, AxConstants.PROJECT, criteria);
96  if(project != null) {
97  Jsons memberInfo = Servers.getData(getServer(), WsConstants.CLIENT_INFO);
98  ProjectCtrl banctrl = new ProjectCtrl();
99  banctrl.setServer(getServer());
100  banctrl.setAxId(e.getString("id"));
101  banctrl.setAction(ProjectAction.TOGGLE_BAN);
102  marker.put("banctrl", banctrl);
103  ProjectCtrl offctrl = new ProjectCtrl();
104  offctrl.setServer(getServer());
105  offctrl.setAxId(e.getString("id"));
106  offctrl.setAction(ProjectAction.PARTICIPATE);
107  offctrl.setParticiationLabel("Offerer");
108  marker.put("offctrl", offctrl);
109  ProjectCtrl benctrl = new ProjectCtrl();
110  benctrl.setServer(getServer());
111  benctrl.setAxId(e.getString("id"));
112  benctrl.setAction(ProjectAction.PARTICIPATE);
113  benctrl.setParticiationLabel("Beneficiary");
114  marker.put("benctrl", benctrl);
115  ProjectCtrl conctrl = new ProjectCtrl();
116  conctrl.setServer(getServer());
117  conctrl.setAxId(e.getString("id"));
118  conctrl.setAction(ProjectAction.PARTICIPATE);
119  conctrl.setParticiationLabel("Consortium");
120  marker.put("conctrl", conctrl);
121  marker.put("itemLink", getItemLink(e));
122  marker.put("dossier", JsonSearch.of(project).silent().root());
123  criteria = Jsons.object();
124  criteria.add("projectId", e.context().read("$.projectId.entityId", String.class));
125  Jsons attachments = P2Ps.getP2PData(getServer().getServerDomain(),
126  e.context().read("$.projectId.memberId", Long.class),
127  AxP2PServer.AX_P2P_SERVICE, AxConstants.ATTACHMENTS, criteria);
128  marker.put("attachments", JsonSearch.of(attachments).silent().root());
129  marker.put("server", getServer());
130  marker.put("domain", getServer().getServerDomain());
131  marker.put("service", getServer().getService());
132  marker.put("member", e.context().read("$.projectId.memberId", Long.class));
133  marker.put("serverFace", getServer().getContact().getFaces().getUrl());
134  marker.put("axid", e.getString("id"));
135  marker.put("selfMember", memberInfo.getLong("id"));
136  if(Objects.equals(marker.get("member"), marker.get("selfMember"))) {
137  marker.put("internalLink", Entities.getController("/dossier/" + e.context().read("$.projectId.entityId")).getEntityUrl());
138  }
139  }
140  marker.process(getTemplateRoot(), getFullTemplate(), getWriter());
141  }
Here is the call graph for this function:

◆ renderSummary()

void org.turro.alliance.client.ProjectJsonIterator.renderSummary ( ElephantMarker  marker,
Jsons  e,
int  page 
)
protected

Definition at line 75 of file ProjectJsonIterator.java.

75  {
76  if(e != null) {
77  ProjectCtrl pctrl = new ProjectCtrl();
78  pctrl.setServer(getServer());
79  pctrl.setAxId(e.getString("id"));
80  pctrl.setAction(ProjectAction.TOGGLE_BAN);
81  marker.put("banctrl", pctrl);
82  marker.put("itemLink", getItemLink(e));
83  marker.put("project", JsonSearch.of(e).silent().root());
84  marker.put("server", getServer());
85  }
86  marker.process(getTemplateRoot(), getSummaryTemplate(), getWriter());
87  }
Here is the call graph for this function:

◆ title()

String org.turro.alliance.client.ProjectJsonIterator.title ( Jsons  e)
protected

Definition at line 144 of file ProjectJsonIterator.java.

144  {
145  return Strings.isBlank(e.getString("name"), null);
146  }

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