BrightSide Workbench Full Report + Source Code
AllianceUserMenu.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2022 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.user.menu;
20 
21 import org.turro.alliance.service.AxClient;
22 import org.turro.alliance.service.AxServer;
23 import org.turro.elephant.user.menu.DefaultUserMenu;
24 import org.turro.elephant.user.menu.UserMenu;
25 import org.turro.ws.service.member.Servers;
26 import org.turro.ws.service.server.Clients;
27 
32 @UserMenu
33 public class AllianceUserMenu extends DefaultUserMenu {
34 
35  public AllianceUserMenu() {
36  super("Alliance", null, null, 10);
37  }
38 
39  @Override
40  public void initMenu() {
41  addChild(new DefaultUserMenu("Projects", null, "/user/alliance/projects") {
42  @Override
43  public boolean isInRole() {
44  return Clients.hasMembers(AxClient.CLIENT_SERVICE);
45  }
46  @Override
47  public Object getDetail() {
48  return null;
49  }
50  });
51  addChild(new DefaultUserMenu("Project grants", null, "/user/alliance/projectgrants") {
52  @Override
53  public boolean isInRole() {
54  return Clients.hasMembers(AxClient.CLIENT_SERVICE);
55  }
56  @Override
57  public Object getDetail() {
58  return null;
59  }
60  });
61  addChild(new DefaultUserMenu("Project grants", null, "/user/alliance/cprojectgrants") {
62  @Override
63  public boolean isInRole() {
64  return Servers.hasServers(AxServer.SERVER_SERVICE);
65  }
66  @Override
67  public Object getDetail() {
68  return null;
69  }
70  });
71  addChild(new DefaultUserMenu("Centers", null, "/user/alliance/findcenter") {
72  @Override
73  public boolean isInRole() {
74  return Clients.hasMembers(AxClient.CLIENT_SERVICE);
75  }
76  @Override
77  public Object getDetail() {
78  return null;
79  }
80  });
81  addChild(new DefaultUserMenu("Students", null, "/user/alliance/findstudent") {
82  @Override
83  public boolean isInRole() {
84  return Clients.hasMembers(AxClient.CLIENT_SERVICE);
85  }
86  @Override
87  public Object getDetail() {
88  return null;
89  }
90  });
91  addChild(new DefaultUserMenu("Challenges", null, "/user/alliance/challenges") {
92  @Override
93  public boolean isInRole() {
94  return Clients.hasMembers(AxClient.CLIENT_SERVICE);
95  }
96  @Override
97  public Object getDetail() {
98  return null;
99  }
100  });
101  }
102 
103  @Override
104  public boolean isInRole() {
105  return !isHidden();
106  }
107 
108  @Override
109  public Object getDetail() {
110  return null;
111  }
112 
113 }
static final String CLIENT_SERVICE
Definition: AxClient.java:58
static final String SERVER_SERVICE
Definition: AxServer.java:51