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

Public Member Functions

 ProjectGrantList ()
 
AxProjectGrant getProjectGrant (ProcedenceId id)
 
void doFilter (DaoHtmlSearch dhs)
 

Static Public Member Functions

static ArrayList< AxProjectGrantgetGrants ()
 

Detailed Description

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

Definition at line 45 of file ProjectGrantList.java.

Constructor & Destructor Documentation

◆ ProjectGrantList()

org.turro.alliance.client.ProjectGrantList.ProjectGrantList ( )

Definition at line 47 of file ProjectGrantList.java.

47  {
48  addAll(ObjectCache.instance().sync("alliance-grants", ArrayList.class, () -> ProjectGrantList.getGrants()));
49  }
Here is the call graph for this function:

Member Function Documentation

◆ doFilter()

void org.turro.alliance.client.ProjectGrantList.doFilter ( DaoHtmlSearch  dhs)

Definition at line 55 of file ProjectGrantList.java.

55  {
56  if(dhs != null) {
57  DaoSearchKey dsk = dhs.get("search-value");
58  if(dsk != null) {
59  String search = dsk.getValue();
60  removeIf(pg -> !Strings.findsIgnoreCase(pg.getTitle(), search));
61  }
62  dsk = dhs.get("minimis");
63  if(dsk != null) {
64  String minimis = dsk.getValue();
65  removeIf(pg -> {
66  if("minimis".equals(minimis)) {
67  return !pg.isMinimis();
68  } else if("nominimis".equals(minimis)) {
69  return pg.isMinimis();
70  } else {
71  return false;
72  }
73  });
74  }
75  dsk = dhs.get("grant");
76  if(dsk != null) {
77  String grant = dsk.getValue();
78  removeIf(pg -> {
79  if("subvention".equals(grant)) {
80  return !pg.isSubvention();
81  } else if("loan".equals(grant)) {
82  return !pg.isLoan();
83  } else if("combination".equals(grant)) {
84  return !pg.isLoan() && !pg.isSubvention();
85  } else {
86  return false;
87  }
88  });
89  }
90  dsk = dhs.get("collab");
91  if(dsk != null) {
92  String collab = dsk.getValue();
93  removeIf(pg -> {
94  if("collaboration".equals(collab)) {
95  return !pg.isCollaboration();
96  } else if("individual".equals(collab)) {
97  return pg.isCollaboration();
98  } else {
99  return false;
100  }
101  });
102  }
103  dsk = dhs.get("micro");
104  if(dsk != null) {
105  String micro = dsk.getValue();
106  removeIf(pg -> "true".equals(micro) && !pg.isMicro());
107  }
108  dsk = dhs.get("small");
109  if(dsk != null) {
110  String small = dsk.getValue();
111  removeIf(pg -> "true".equals(small) && !pg.isSmall());
112  }
113  dsk = dhs.get("medium");
114  if(dsk != null) {
115  String medium = dsk.getValue();
116  removeIf(pg -> "true".equals(medium) && !pg.isMedium());
117  }
118  dsk = dhs.get("big");
119  if(dsk != null) {
120  String big = dsk.getValue();
121  removeIf(pg -> "true".equals(big) && !pg.isBig());
122  }
123  dsk = dhs.get("hiring");
124  if(dsk != null) {
125  String hiring = dsk.getValue();
126  removeIf(pg -> "true".equals(hiring) && !pg.isHiring());
127  }
128  dsk = dhs.get("idi");
129  if(dsk != null) {
130  String idi = dsk.getValue();
131  removeIf(pg -> "true".equals(idi) && !pg.isIdi());
132  }
133  dsk = dhs.get("investment");
134  if(dsk != null) {
135  String investment = dsk.getValue();
136  removeIf(pg -> "true".equals(investment) && !pg.isInvestment());
137  }
138  dsk = dhs.get("start-up");
139  if(dsk != null) {
140  String startup = dsk.getValue();
141  removeIf(pg -> "true".equals(startup) && !pg.isStartUp());
142  }
143  dsk = dhs.get("deadline");
144  if(dsk != null) {
145  String deadline = dsk.getValue();
146  removeIf(pg -> {
147  if(pg.getEndDate() != null) {
148  if("active".equals(deadline)) {
149  return Time.from(pg.getEndDate()).isBefore(Instant.now());
150  } else if("ended".equals(deadline)) {
151  return Time.from(pg.getEndDate()).isAfter(Instant.now());
152  } else if("recurrent".equals(deadline)) {
153  return pg.isRecurrent();
154  }
155  }
156  return false;
157  });
158  }
159  }
160  }
Here is the call graph for this function:

◆ getGrants()

static ArrayList<AxProjectGrant> org.turro.alliance.client.ProjectGrantList.getGrants ( )
static

Definition at line 162 of file ProjectGrantList.java.

162  {
163  ArrayList<AxProjectGrant> list = new ArrayList<>();
164  Servers.getServers(AxServer.SERVER_SERVICE).forEach(server -> {
165  Jsons criteria = Jsons.object();
166  criteria.add(JsonProvider.JSON_ONLY_ITEMS, true);
167  criteria.add("notSelf", true);
168  Jsons data = Servers.getData(server, AxConstants.PROJECT_GRANT_ITERATOR, criteria);
169  Jsons items = data.getArray(JsonProvider.JSON_ITEMS);
170  for(JsonValue e : items.getStructure().asArray()) {
171  list.add(AxProjectGrant.fromJson(e));
172  }
173  });
174  list.addAll(SqlClause.select("pg").from("ProjectGrant pg")
175  .dao(new DossierPU())
176  .resultList(ProjectGrant.class)
177  .stream()
178  .map(pg -> AxProjectGrant.from(0, pg))
179  .toList());
180  list.sort((pg1, pg2) -> {
181  return Comparison.descendant().compare(pg1.getEndDate(), pg2.getEndDate()).get();
182  });
183  return list;
184  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getProjectGrant()

AxProjectGrant org.turro.alliance.client.ProjectGrantList.getProjectGrant ( ProcedenceId  id)

Definition at line 51 of file ProjectGrantList.java.

51  {
52  return stream().filter(pg -> pg.getProjectGrantId().equals(id)).findFirst().orElse(null);
53  }

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