BrightSide Workbench Full Report + Source Code
org.turro.alliance.client.ProjectGrantVM Class Reference

Public Member Functions

 ProjectGrantVM ()
 
void search ()
 
void clear ()
 
String getItemTemplate ()
 
String getTemplate ()
 
void setTemplate (String template)
 
AxProjectGrant getSelected ()
 
void select (@BindingParam("item") AxProjectGrant grant)
 
void unselect ()
 
void selectSource (@BindingParam("source") String source)
 
boolean isSourceSelected (String source)
 
void selectTag (@BindingParam("tag") String tag)
 
boolean isTagSelected (String tag)
 
List< AxProjectGrantgetGrants ()
 
List< String > getSources ()
 
List< String > getTags ()
 
ProjectGrantFilter getFilter ()
 
ArrayList< AxProjectGrantloadGrants ()
 
ArrayList< TagItem > loadTags ()
 

Detailed Description

Constructor & Destructor Documentation

◆ ProjectGrantVM()

org.turro.alliance.client.ProjectGrantVM.ProjectGrantVM ( )

Definition at line 59 of file Elephant/elephant-alliance/src/main/java/org/turro/alliance/client/ProjectGrantVM.java.

59  {
60  loadFilter();
61  }

Member Function Documentation

◆ clear()

void org.turro.alliance.client.ProjectGrantVM.clear ( )

Definition at line 69 of file Elephant/elephant-alliance/src/main/java/org/turro/alliance/client/ProjectGrantVM.java.

69  {
70  filter.clear();
71  saveFilter();
72  Application.getApplication().sendRedirect("");
73  }
Here is the call graph for this function:

◆ getFilter()

ProjectGrantFilter org.turro.alliance.client.ProjectGrantVM.getFilter ( )

Definition at line 183 of file Elephant/elephant-alliance/src/main/java/org/turro/alliance/client/ProjectGrantVM.java.

183  {
184  return filter;
185  }

◆ getGrants()

List<AxProjectGrant> org.turro.alliance.client.ProjectGrantVM.getGrants ( )

Definition at line 146 of file Elephant/elephant-alliance/src/main/java/org/turro/alliance/client/ProjectGrantVM.java.

146  {
147  Clients.scrollTo(0, 0);
148  if(selected != null) {
149  return List.of(selected);
150  } else {
151  List<AxProjectGrant> grants = ObjectCache.instance().sync("alliance-grants", ArrayList.class, () -> loadGrants());
152  if(grants != null) {
153  saveFilter();
154  return filter(grants);
155  } else {
156  return Collections.EMPTY_LIST;
157  }
158  }
159  }
Here is the call graph for this function:

◆ getItemTemplate()

String org.turro.alliance.client.ProjectGrantVM.getItemTemplate ( )

Definition at line 77 of file Elephant/elephant-alliance/src/main/java/org/turro/alliance/client/ProjectGrantVM.java.

77  {
78  if(filter.getTemplate().equals("items")) {
79  return "divided link items";
80  } else {
81  return "cards";
82  }
83  }
Here is the call graph for this function:

◆ getSelected()

AxProjectGrant org.turro.alliance.client.ProjectGrantVM.getSelected ( )

Definition at line 99 of file Elephant/elephant-alliance/src/main/java/org/turro/alliance/client/ProjectGrantVM.java.

99  {
100  return selected;
101  }

◆ getSources()

List<String> org.turro.alliance.client.ProjectGrantVM.getSources ( )

Definition at line 161 of file Elephant/elephant-alliance/src/main/java/org/turro/alliance/client/ProjectGrantVM.java.

161  {
162  List<AxProjectGrant> grants = ObjectCache.instance().sync("alliance-grants", ArrayList.class, () -> loadGrants());
163  if(grants != null) {
164  return grants.stream().map(g -> g.getSource()).filter(s -> !Strings.isBlank(s)).distinct().sorted().toList();
165  } else {
166  return Collections.EMPTY_LIST;
167  }
168  }
Here is the call graph for this function:

◆ getTags()

List<String> org.turro.alliance.client.ProjectGrantVM.getTags ( )

Definition at line 170 of file Elephant/elephant-alliance/src/main/java/org/turro/alliance/client/ProjectGrantVM.java.

170  {
171  List<TagItem> tags = ObjectCache.instance().sync("alliance-grants-tags", ArrayList.class, () -> loadTags());
172  if(tags != null) {
173  return tags.stream().map(t -> t.tag()).filter(s -> !Strings.isBlank(s)).distinct().sorted().toList();
174  } else {
175  return Collections.EMPTY_LIST;
176  }
177  }
Here is the call graph for this function:

◆ getTemplate()

String org.turro.alliance.client.ProjectGrantVM.getTemplate ( )

Definition at line 85 of file Elephant/elephant-alliance/src/main/java/org/turro/alliance/client/ProjectGrantVM.java.

85  {
86  return filter.getTemplate();
87  }
Here is the call graph for this function:

◆ isSourceSelected()

boolean org.turro.alliance.client.ProjectGrantVM.isSourceSelected ( String  source)

Definition at line 126 of file Elephant/elephant-alliance/src/main/java/org/turro/alliance/client/ProjectGrantVM.java.

126  {
127  return filter.containsSource(source);
128  }
Here is the call graph for this function:

◆ isTagSelected()

boolean org.turro.alliance.client.ProjectGrantVM.isTagSelected ( String  tag)

Definition at line 140 of file Elephant/elephant-alliance/src/main/java/org/turro/alliance/client/ProjectGrantVM.java.

140  {
141  return filter.containsTag(tag);
142  }
Here is the call graph for this function:

◆ loadGrants()

ArrayList<AxProjectGrant> org.turro.alliance.client.ProjectGrantVM.loadGrants ( )

Definition at line 210 of file Elephant/elephant-alliance/src/main/java/org/turro/alliance/client/ProjectGrantVM.java.

210  {
211  ArrayList<AxProjectGrant> list = new ArrayList<>();
212  Servers.getServers(AxServer.SERVER_SERVICE).forEach(server -> {
213  Jsons criteria = Jsons.object();
214  criteria.add(JsonProvider.JSON_ONLY_ITEMS, true);
215  criteria.add("notSelf", true);
216  Jsons data = Servers.getData(server, AxConstants.PROJECT_GRANT_ITERATOR, criteria);
217  Jsons items = data.getArray(JsonProvider.JSON_ITEMS);
218  for(JsonValue e : items.getStructure().asArray()) {
219  list.add(AxProjectGrant.fromJson(e));
220  }
221  });
222  list.addAll(SqlClause.select("pg").from("ProjectGrant pg")
223  .dao(dao.get())
224  .resultList(ProjectGrant.class)
225  .stream()
226  .map(pg -> AxProjectGrant.from(0, pg))
227  .toList());
228  list.sort((pg1, pg2) -> {
229  return Comparison.descendant().compare(pg1.getEndDate(), pg2.getEndDate()).get();
230  });
231  return list;
232  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadTags()

ArrayList<TagItem> org.turro.alliance.client.ProjectGrantVM.loadTags ( )

Definition at line 234 of file Elephant/elephant-alliance/src/main/java/org/turro/alliance/client/ProjectGrantVM.java.

234  {
235  ArrayList<TagItem> list = new ArrayList<>();
236  Servers.getServers(AxServer.SERVER_SERVICE).forEach(server -> {
237  Jsons criteria = Jsons.object();
238  criteria.add(JsonProvider.JSON_ONLY_ITEMS, true);
239  criteria.add("root", "axproject-grant");
240  Jsons data = Servers.getData(server, AxConstants.TAGS, criteria);
241  Jsons items = data.getArray(JsonProvider.JSON_ITEMS);
242  for(JsonValue e : items.getStructure().asArray()) {
243  Tag tag = Tag.fromJson(e);
244  list.add(new TagItem(tag.getTagName(), Path.pathFrom(tag.getEntityPath()).getLastNode()));
245  }
246  });
247  Tags.getFromRoot("/project-grant/").forEach(t -> {
248  list.add(new TagItem(t.getTagName(), Path.pathFrom(t.getEntityPath()).getLastNode() + "##0"));
249  });
250  list.sort((t1, t2) -> {
251  return Comparison.descendant().compare(t1.tag(), t2.tag()).get();
252  });
253  return list;
254  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ search()

void org.turro.alliance.client.ProjectGrantVM.search ( )

◆ select()

void org.turro.alliance.client.ProjectGrantVM.select ( @BindingParam("item") AxProjectGrant  grant)

Definition at line 105 of file Elephant/elephant-alliance/src/main/java/org/turro/alliance/client/ProjectGrantVM.java.

105  {
106  selected = grant;
107  new ParticipationInfo(grant, ParticipationReason.REASON_SEEN).check();
108  }
Here is the call graph for this function:

◆ selectSource()

void org.turro.alliance.client.ProjectGrantVM.selectSource ( @BindingParam("source") String  source)

Definition at line 118 of file Elephant/elephant-alliance/src/main/java/org/turro/alliance/client/ProjectGrantVM.java.

118  {
119  if(filter.containsSource(source)) {
120  filter.removeSource(source);
121  } else {
122  filter.addSource(source);
123  }
124  }
Here is the call graph for this function:

◆ selectTag()

void org.turro.alliance.client.ProjectGrantVM.selectTag ( @BindingParam("tag") String  tag)

Definition at line 132 of file Elephant/elephant-alliance/src/main/java/org/turro/alliance/client/ProjectGrantVM.java.

132  {
133  if(filter.containsTag(tag)) {
134  filter.removeTag(tag);
135  } else {
136  filter.addTag(tag);
137  }
138  }
Here is the call graph for this function:

◆ setTemplate()

void org.turro.alliance.client.ProjectGrantVM.setTemplate ( String  template)

Definition at line 89 of file Elephant/elephant-alliance/src/main/java/org/turro/alliance/client/ProjectGrantVM.java.

89  {
90  filter.setTemplate(template);
91  saveFilter();
92  Application.getApplication().sendRedirect("");
93  }
Here is the call graph for this function:

◆ unselect()

void org.turro.alliance.client.ProjectGrantVM.unselect ( )

Definition at line 112 of file Elephant/elephant-alliance/src/main/java/org/turro/alliance/client/ProjectGrantVM.java.

112  {
113  selected = null;
114  }

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