BrightSide Workbench Full Report + Source Code
client/ProjectDashboard.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2023 Lluis TurrĂ³ Cutiller <http://www.turro.org/>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Affero General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Affero General Public License for more details.
14  *
15  * You should have received a copy of the GNU Affero General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 package org.turro.alliance.client;
20 
21 import org.turro.alliance.service.AxConstants;
22 import org.turro.auth.Authentication;
23 import org.turro.elephant.context.ElephantContext;
24 import org.turro.json.Jsons;
25 import org.turro.ws.WsServer;
26 import org.turro.ws.content.JsonProvider;
27 import org.turro.ws.content.context.JsonClientContext;
28 import org.turro.ws.content.iterator.JsonHtmlClientIterator;
29 import org.turro.ws.content.search.JsonHtmlSearch;
30 import org.turro.ws.dashboard.AbstractJsonDashboard;
31 import org.turro.ws.service.member.Servers;
32 
37 public class ProjectDashboard extends AbstractJsonDashboard {
38 
39  @Override
40  protected JsonHtmlClientIterator initIterator() {
41  WsServer server = JsonClientContext.getInstance(constructor).getServer();
42  CategoryJsonTree ct = new CategoryJsonTree(server, getConstructor(), null);
43  ProjectJsonIterator pi = new ProjectJsonIterator(getConstructor(), Authentication.getIContact(), server, null, false);
44  pi.setNavigationTree(ct);
45  return pi;
46  }
47 
48  @Override
49  protected void initSearchEngine() {
50  JsonHtmlSearch dhs = JsonHtmlSearch.getInstance(getConstructor(), ElephantContext.getContextVariable(getConstructor()));
51  if(dhs != null && !dhs.hasAttribute(getConstructor(), "")) {
52  dhs.setTagRoot("axproject");
53  dhs.setAttribute(getConstructor(), "server", getIterator().getServer());
54  dhs.setAttribute(getConstructor(), "phases",
55  Servers.getData(getIterator().getServer(), AxConstants.PHASE_ITERATOR, Jsons.object())
56  .getArrayAsSearchList(JsonProvider.JSON_ITEMS));
57  }
58  }
59 
60 }
static String getContextVariable(IConstructor constructor)