Log In | Get Help   
Home My Page Projects Code Snippets Project Openings Accounting and Billing Portal
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files
[abportal] Annotation of /src/main/java/eu/smartlm/abs/portal/graph/DatasetConstructor.java
[abportal] / src / main / java / eu / smartlm / abs / portal / graph / DatasetConstructor.java Repository:
ViewVC logotype

Annotation of /src/main/java/eu/smartlm/abs/portal/graph/DatasetConstructor.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (view) (download)

1 : dgarcia 1 package eu.smartlm.abs.portal.graph;
2 :    
3 :     import java.util.Set;
4 :    
5 :     import org.gridforum.x2003.urWg.HostDocument.Host;
6 :     import org.gridforum.x2003.urWg.ProjectNameDocument.ProjectName;
7 :     import org.gridforum.x2003.urWg.SubmitHostDocument.SubmitHost;
8 :     import org.gridforum.x2003.urWg.UserIdentityDocument.UserIdentity;
9 :     import org.jfree.data.category.DefaultCategoryDataset;
10 :    
11 :     import eu.smartlm.abs.portal.data.aggregation.DataAggregation;
12 :     import eu.smartlm.abs.portal.view.portlet.QueryPortlet;
13 :    
14 :     import eu.smartlm.schemas.x2009.x06.urec.ProductType;
15 :     import eu.smartlm.schemas.x2009.x06.urec.SmartLMUsageRecordType;
16 :    
17 :     /**
18 :     * This class is the responsible to build the different graphs taht are going to be shown in the Accounting and Billing Portal
19 :     * @author David García Pérez - CESGA
20 :     *
21 :     */
22 :     public class DatasetConstructor {
23 :    
24 :     /**
25 :     * This method creates the necessary Dataset to create a graph based on User usage information for some specific set of products
26 :     * @param usageRecords UsageRecords from where to extract the used hours
27 :     * @param users list of users that are going to appear in the dataset
28 :     * @param products list of selected applications to be calculate the hours
29 :     * @param type accounting or billing
30 :     * @return the dataset ready to make a graph
31 :     */
32 :     public static DefaultCategoryDataset constructDatasetForUsageVsUsersFilterByProducts(
33 :     Set<SmartLMUsageRecordType> usageRecords,
34 :     Set<UserIdentity> users,
35 :     Set<ProductType> products,
36 :     String type) {
37 :    
38 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
39 :    
40 :     for(UserIdentity user : users)
41 :     for(ProductType product : products)
42 :     dataset.addValue(DataAggregation.determineUsageByProduct(usageRecords, user, product, type), product.getName(), user.getLocalUserId());
43 :    
44 :     return dataset;
45 :     }
46 :    
47 :     /**
48 :     * This method creates the necessary Dataset to create a graph based on Product usage information for some specific set of users
49 :     * @param usageRecords UsageRecords from where to extract the used hours
50 :     * @param users list of users that are going to appear in the dataset
51 :     * @param products list of selected applications to be calculate the hours
52 :     * @param type accounting or billing
53 :     * @return the dataset ready to make a graph
54 :     */
55 :     public static DefaultCategoryDataset constructDatasetForUsageVsProductsFilterByUsers(
56 :     Set<SmartLMUsageRecordType> usageRecords,
57 :     Set<UserIdentity> users,
58 :     Set<ProductType> products,
59 :     String type) {
60 :    
61 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
62 :    
63 :     for(UserIdentity user : users)
64 :     for(ProductType product : products)
65 :     dataset.addValue(DataAggregation.determineUsageByProduct(usageRecords, user, product, type), user.getLocalUserId(), product.getName());
66 :    
67 :     return dataset;
68 :     }
69 :    
70 :    
71 :     /**
72 :     * It creates a Dataset to create a graph of Product usage vs time
73 :     * @param usageRecords usage records from where the usage information is going to be extracted
74 :     * @param products list of product from where we are interested to know the usage information
75 :     * @param type accounting and billing
76 :     * @return the necessary dataset to make the graph
77 :     */
78 :     public static DefaultCategoryDataset constructDatasetForUsageVsProduct(Set<SmartLMUsageRecordType> usageRecords, Set<ProductType> products, String type) {
79 :    
80 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
81 :    
82 :     for(ProductType product : products)
83 :     dataset.addValue(DataAggregation.determineUsageForAProduct(usageRecords, product, type), "category", product.getName());
84 :    
85 :     return dataset;
86 :     }
87 :    
88 :     /**
89 :     * This method creates the necessary Dataset to create a graph based on User usage information for some specific set of accountingGroups
90 :     * @param usageRecords UsageRecords from where to extract the used hours
91 :     * @param users list of users that are going to appear in the dataset
92 :     * @param accountingGroups list of selected applications to be calculate the hours
93 :     * @param type accounting or billing
94 :     * @return the dataset ready to make a graph
95 :     */
96 :     public static DefaultCategoryDataset constructDatasetForUsageVsUsersFilterByAccountingGroups(
97 :     Set<SmartLMUsageRecordType> usageRecords,
98 :     Set<UserIdentity> users,
99 :     Set<String> accountingGroups,
100 :     String type) {
101 :    
102 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
103 :    
104 :     for(UserIdentity user : users)
105 :     for(String accountingGroup : accountingGroups)
106 :     dataset.addValue(DataAggregation.determineUsageByAccountingGroup(usageRecords, user, accountingGroup, type), accountingGroup, user.getLocalUserId());
107 :    
108 :     return dataset;
109 :     }
110 :    
111 :     /**
112 :     * This method creates the necessary Dataset to create a graph based on AccountingGroup usage information for some specific set of Users
113 :     * @param usageRecords UsageRecords from where to extract the used hours
114 :     * @param users list of users that are going to appear in the dataset
115 :     * @param accountingGroups list of selected applications to be calculate the hours
116 :     * @param type accounting or billing
117 :     * @return the dataset ready to make a graph
118 :     */
119 :     public static DefaultCategoryDataset constructDatasetForUsageVsAccountingGroupsFilterByUsers(
120 :     Set<SmartLMUsageRecordType> usageRecords,
121 :     Set<UserIdentity> users,
122 :     Set<String> accountingGroups,
123 :     String type) {
124 :    
125 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
126 :    
127 :     for(UserIdentity user : users)
128 :     for(String accountingGroup : accountingGroups)
129 :     dataset.addValue(
130 :     DataAggregation.determineUsageByAccountingGroup(usageRecords, user, accountingGroup, type),
131 :     user.getLocalUserId(),
132 :     accountingGroup);
133 :    
134 :     return dataset;
135 :     }
136 :    
137 :     /**
138 :     * This method creates a dataset of time usage for AccountingGroups filtered by Users
139 :     * @param usageRecords usageRecords where to extract information
140 :     * @param departments from where we are going to calculate the time usage
141 :     * @param users from where we are going to calculate the time usage
142 :     * @return the dataset to construct the graph.
143 :     */
144 :     public static DefaultCategoryDataset constructDatasetForTimeUsageVsAccountingGroupFilterByUsers(
145 :     Set<SmartLMUsageRecordType> usageRecords, Set<String> accountingGroups,
146 :     Set<UserIdentity> users) {
147 :    
148 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
149 :    
150 :     for(UserIdentity user : users) {
151 :     for(String accountingGroup : accountingGroups) {
152 :     dataset.addValue(
153 :     DataAggregation.determineUsageForAnAccountingGroup(usageRecords, accountingGroup, QueryPortlet.TYPE_ACCOUNTING),
154 :     user.getLocalUserId(),
155 :     accountingGroup);
156 :     }
157 :     }
158 :    
159 :     return dataset;
160 :     }
161 :    
162 :     /**
163 :     * This method creates a dataset of billing usage for AccountingGroups filtered by Users
164 :     * @param usageRecords usageRecords where to extract information
165 :     * @param departments from where we are going to calculate the time usage
166 :     * @param users from where we are going to calculate the time usage
167 :     * @return the dataset to construct the graph.
168 :     */
169 :     public static DefaultCategoryDataset constructDatasetForBillingUsageVsAccountingGroupFilterByUsers(
170 :     Set<SmartLMUsageRecordType> usageRecords, Set<String> accountingGroups,
171 :     Set<UserIdentity> users) {
172 :    
173 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
174 :    
175 :     for(UserIdentity user : users) {
176 :     for(String accountingGroup : accountingGroups) {
177 :     dataset.addValue(
178 :     DataAggregation.determineUsageForAnAccountingGroup(usageRecords, accountingGroup, QueryPortlet.TYPE_BILLING),
179 :     user.getLocalUserId(),
180 :     accountingGroup);
181 :     }
182 :     }
183 :    
184 :     return dataset;
185 :     }
186 :    
187 :     /**
188 :     * This method creates the necessary Dataset to create a graph based on User usage information for some specific set of machines (Host)
189 :     * @param usageRecords UsageRecords from where to extract to the used hours
190 :     * @param users list of users that are going to appear in the dataset
191 :     * @param hosts list of selected hosts machines to be calculate the hours
192 :     * @return the dataset ready to make a graph
193 :     */
194 :     public static DefaultCategoryDataset constructDatasetForTimeUsageVsUsersFilterByHosts(
195 :     Set<SmartLMUsageRecordType> usageRecords, Set<UserIdentity> users,
196 :     Set<Host> hosts) {
197 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
198 :    
199 :     for(UserIdentity user: users) {
200 :     for(Host host : hosts) {
201 :     dataset.addValue(
202 :     DataAggregation.determineUsageByHost(usageRecords, user, host, QueryPortlet.TYPE_ACCOUNTING),
203 :     host.getStringValue(),
204 :     user.getLocalUserId());
205 :     }
206 :     }
207 :    
208 :     return dataset;
209 :     }
210 :    
211 :     /**
212 :     * This method creates the necessary Dataset to create a graph based on User billing usage information for some specific set of machines (Host)
213 :     * @param usageRecords UsageRecords from where to extract to the used hours
214 :     * @param users list of users that are going to appear in the dataset
215 :     * @param hosts list of selected hosts machines to be calculate the hours
216 :     * @return the dataset ready to make a graph
217 :     */
218 :     public static DefaultCategoryDataset constructDatasetForBillingUsageVsUsersFilterByHosts(Set<SmartLMUsageRecordType> usageRecords, Set<UserIdentity> users, Set<Host> hosts) {
219 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
220 :    
221 :     for(UserIdentity user: users) {
222 :     for(Host host : hosts) {
223 :     dataset.addValue(
224 :     DataAggregation.determineUsageByHost(usageRecords, user, host, QueryPortlet.TYPE_BILLING),
225 :     host.getStringValue(),
226 :     user.getLocalUserId());
227 :     }
228 :     }
229 :    
230 :     return dataset;
231 :     }
232 :    
233 :     /**
234 :     * This method creates the necessary Dataset to create a graph based on Hosts usage information for some specific set of Users
235 :     * @param usageRecords UsageRecords from where to extract to the used hours
236 :     * @param hosts list of selected hosts machines to be calculate the hours
237 :     * @param users list of users that are going to appear in the dataset
238 :     * @return the dataset ready to make a graph
239 :     */
240 :     public static DefaultCategoryDataset constructDatasetForTimeUsageVsHostsFilterByUsers(
241 :     Set<SmartLMUsageRecordType> usageRecords, Set<Host> hosts, Set<UserIdentity> users) {
242 :    
243 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
244 :    
245 :     for(UserIdentity user: users) {
246 :     for(Host host : hosts) {
247 :     dataset.addValue(
248 :     DataAggregation.determineUsageByHost(usageRecords, user, host, QueryPortlet.TYPE_ACCOUNTING),
249 :     user.getLocalUserId(),
250 :     host.getStringValue());
251 :     }
252 :     }
253 :    
254 :     return dataset;
255 :     }
256 :    
257 :     /**
258 :     * This method creates the necessary Dataset to create a graph based on Hosts billing usage information for some specific set of Users
259 :     * @param usageRecords UsageRecords from where to extract to the used hours
260 :     * @param hosts list of selected hosts machines to be calculate the hours
261 :     * @param users list of users that are going to appear in the dataset
262 :     * @return the dataset ready to make a graph
263 :     */
264 :     public static DefaultCategoryDataset constructDatasetForBillingUsageVsHostsFilterByUsers(
265 :     Set<SmartLMUsageRecordType> usageRecords, Set<Host> hosts, Set<UserIdentity> users) {
266 :    
267 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
268 :    
269 :     for(UserIdentity user: users) {
270 :     for(Host host : hosts) {
271 :     dataset.addValue(
272 :     DataAggregation.determineUsageByHost(usageRecords, user, host, QueryPortlet.TYPE_BILLING),
273 :     user.getLocalUserId(),
274 :     host.getStringValue());
275 :     }
276 :     }
277 :    
278 :     return dataset;
279 :     }
280 :    
281 :     /**
282 :     * This method creates the necessary Dataset to create a graph based on User usage information for some specific set of machines (submitHost)
283 :     * @param usageRecords UsageRecords from where to extract to the used hours
284 :     * @param users list of users that are going to appear in the dataset
285 :     * @param submitHosts list of selected submithosts machines to be calculate the hours
286 :     * @return the dataset ready to make a graph
287 :     */
288 :     public static DefaultCategoryDataset constructDatasetForTimeUsageVsUsersFilterBySubmitHosts(
289 :     Set<SmartLMUsageRecordType> usageRecords, Set<UserIdentity> users,
290 :     Set<SubmitHost> submitHosts) {
291 :    
292 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
293 :    
294 :     for(UserIdentity user: users) {
295 :     for(SubmitHost submitHost : submitHosts) {
296 :     dataset.addValue(
297 :     DataAggregation.determineUsageBySubmitHost(usageRecords, user, submitHost, QueryPortlet.TYPE_ACCOUNTING),
298 :     submitHost.getStringValue(),
299 :     user.getLocalUserId());
300 :     }
301 :     }
302 :    
303 :     return dataset;
304 :     }
305 :    
306 :     /**
307 :     * This method creates the necessary Dataset to create a graph based on User billing usage information for some specific set of machines (submitHost)
308 :     * @param usageRecords UsageRecords from where to extract to the used hours
309 :     * @param users list of users that are going to appear in the dataset
310 :     * @param submitHosts list of selected submithosts machines to be calculate the hours
311 :     * @return the dataset ready to make a graph
312 :     */
313 :     public static DefaultCategoryDataset constructDatasetForBillingUsageVsUsersFilterBySubmitHosts(
314 :     Set<SmartLMUsageRecordType> usageRecords, Set<UserIdentity> users,
315 :     Set<SubmitHost> submitHosts) {
316 :    
317 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
318 :    
319 :     for(UserIdentity user: users) {
320 :     for(SubmitHost submitHost : submitHosts) {
321 :     dataset.addValue(
322 :     DataAggregation.determineUsageBySubmitHost(usageRecords, user, submitHost, QueryPortlet.TYPE_BILLING),
323 :     submitHost.getStringValue(),
324 :     user.getLocalUserId());
325 :     }
326 :     }
327 :    
328 :     return dataset;
329 :     }
330 :    
331 :     /**
332 :     * This method creates the necessary Dataset to create a graph based on machines (submitHost) usage information for some specific set of User
333 :     * @param usageRecords UsageRecords from where to extract to the used hours
334 :     * @param submitHosts list of selected submithosts machines to be calculate the hours
335 :     * @param users list of users that are going to appear in the dataset
336 :     * @return the dataset ready to make a graph
337 :     */
338 :     public static DefaultCategoryDataset constructDatasetForTimeUsageVsSubmitHostsFilterByUsers(
339 :     Set<SmartLMUsageRecordType> usageRecords, Set<UserIdentity> users,
340 :     Set<SubmitHost> submitHosts) {
341 :    
342 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
343 :    
344 :     for(UserIdentity user: users) {
345 :     for(SubmitHost submitHost : submitHosts) {
346 :     dataset.addValue(
347 :     DataAggregation.determineUsageBySubmitHost(usageRecords, user, submitHost, QueryPortlet.TYPE_ACCOUNTING),
348 :     user.getLocalUserId(),
349 :     submitHost.getStringValue());
350 :     }
351 :     }
352 :    
353 :     return dataset;
354 :     }
355 :    
356 :     /**
357 :     * This method creates the necessary Dataset to create a graph based on machines (submitHost) billing usage information for some specific set of User
358 :     * @param usageRecords UsageRecords from where to extract to the used hours
359 :     * @param submitHosts list of selected submithosts machines to be calculate the hours
360 :     * @param users list of users that are going to appear in the dataset
361 :     * @return the dataset ready to make a graph
362 :     */
363 :     public static DefaultCategoryDataset constructDatasetForBillingUsageVsSubmitHostsFilterByUsers(
364 :     Set<SmartLMUsageRecordType> usageRecords, Set<UserIdentity> users,
365 :     Set<SubmitHost> submitHosts) {
366 :    
367 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
368 :    
369 :     for(UserIdentity user: users) {
370 :     for(SubmitHost submitHost : submitHosts) {
371 :     dataset.addValue(
372 :     DataAggregation.determineUsageBySubmitHost(usageRecords, user, submitHost, QueryPortlet.TYPE_BILLING),
373 :     user.getLocalUserId(),
374 :     submitHost.getStringValue());
375 :     }
376 :     }
377 :    
378 :     return dataset;
379 :     }
380 :    
381 :     /**
382 :     * This method creates a dataset of time usage for users
383 :     * @param usageRecords usageRecords where to extract information
384 :     * @param users from where we are going to calculate the time usage
385 :     * @return the dataset to construct the graph.
386 :     */
387 :     public static DefaultCategoryDataset constructDatasetForTimeUsageVsUsers(
388 :     Set<SmartLMUsageRecordType> usageRecords, Set<UserIdentity> users) {
389 :    
390 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
391 :    
392 :     for(UserIdentity user: users) {
393 :     dataset.addValue(
394 :     DataAggregation.determineUsageForAUser(usageRecords, user, QueryPortlet.TYPE_ACCOUNTING), "category", user.getLocalUserId());
395 :     }
396 :    
397 :     return dataset;
398 :     }
399 :    
400 :     /**
401 :     * This method creates a dataset of billing usage for users
402 :     * @param usageRecords usageRecords where to extract information
403 :     * @param users from where we are going to calculate the time usage
404 :     * @return the dataset to construct the graph.
405 :     */
406 :     public static DefaultCategoryDataset constructDatasetForBillingUsageVsUsers(Set<SmartLMUsageRecordType> usageRecords, Set<UserIdentity> users) {
407 :    
408 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
409 :    
410 :     for(UserIdentity user: users) {
411 :     dataset.addValue(
412 :     DataAggregation.determineUsageForAUser(usageRecords, user, QueryPortlet.TYPE_ACCOUNTING), "category", user.getLocalUserId());
413 :     }
414 :    
415 :     return dataset;
416 :     }
417 :    
418 :     /**
419 :     * This method creates a dataset of billing usage for Departments
420 :     * @param usageRecords usageRecords where to extract information
421 :     * @param accountingGroups from where we are going to calculate the time usage
422 :     * @return the dataset to construct the graph.
423 :     */
424 :     public static DefaultCategoryDataset constructDatasetForTimeUsageVsAccountingGroup(Set<SmartLMUsageRecordType> usageRecords, Set<String> accountingGroups) {
425 :    
426 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
427 :    
428 :     for(String accountingGroup : accountingGroups) {
429 :     dataset.addValue(
430 :     DataAggregation.determineUsageForAnAccountingGroup(usageRecords, accountingGroup, QueryPortlet.TYPE_ACCOUNTING),
431 :     "category",
432 :     accountingGroup);
433 :     }
434 :    
435 :     return dataset;
436 :     }
437 :    
438 :     /**
439 :     * This method creates a Billing dataset of billing usage for Departments
440 :     * @param usageRecords usageRecords where to extract information
441 :     * @param accountingGroups from where we are going to calculate the time usage
442 :     * @return the dataset to construct the graph.
443 :     */
444 :     public static DefaultCategoryDataset constructDatasetForBillingUsageVsAccountingGroup(Set<SmartLMUsageRecordType> usageRecords, Set<String> accountingGroups) {
445 :    
446 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
447 :    
448 :     for(String accountingGroup : accountingGroups) {
449 :     dataset.addValue(
450 :     DataAggregation.determineUsageForAnAccountingGroup(usageRecords, accountingGroup, QueryPortlet.TYPE_BILLING),
451 :     "category",
452 :     accountingGroup);
453 :     }
454 :    
455 :     return dataset;
456 :     }
457 :    
458 :     /**
459 :     * This method creates a dataset of usage for Projects
460 :     * @param usageRecords usageRecords where to extract information
461 :     * @param projectss from where we are going to calculate the time usage
462 :     * @return the dataset to construct the graph.
463 :     */
464 :     public static DefaultCategoryDataset constructDatasetForTimeUsageVsProject(
465 :     Set<SmartLMUsageRecordType>usageRecords, Set<ProjectName> projects) {
466 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
467 :    
468 :     for(ProjectName project : projects) {
469 :     dataset.addValue(DataAggregation.determineUsageForAProject(usageRecords, project, QueryPortlet.TYPE_ACCOUNTING), "category", project.getStringValue());
470 :     }
471 :    
472 :     return dataset;
473 :     }
474 :    
475 :     /**
476 :     * This method creates a dataset of billing usage for Projects
477 :     * @param usageRecords usageRecords where to extract information
478 :     * @param projectss from where we are going to calculate the time usage
479 :     * @return the dataset to construct the graph.
480 :     */
481 :     public static DefaultCategoryDataset constructDatasetForBillingUsageVsProject(
482 :     Set<SmartLMUsageRecordType>usageRecords, Set<ProjectName> projects) {
483 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
484 :    
485 :     for(ProjectName project : projects) {
486 :     dataset.addValue(DataAggregation.determineUsageForAProject(usageRecords, project, QueryPortlet.TYPE_BILLING), "category", project.getStringValue());
487 :     }
488 :    
489 :     return dataset;
490 :     }
491 :    
492 :     /**
493 :     * This method creates a dataset of user usage filtered by projects
494 :     * @param usageRecords sets of usage records
495 :     * @param users list of users
496 :     * @param projects list of projects
497 :     * @return dataset
498 :     */
499 :     public static DefaultCategoryDataset constructDatasetForTimeUsageVsUsersFilterByProjects(
500 :     Set<SmartLMUsageRecordType> usageRecords, Set<UserIdentity> users,
501 :     Set<ProjectName> projects) {
502 :    
503 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
504 :    
505 :     for(UserIdentity user : users) {
506 :     for(ProjectName project : projects) {
507 :     dataset.addValue(
508 :     DataAggregation.determineUsageByProject(usageRecords, user, project, QueryPortlet.TYPE_ACCOUNTING),
509 :     user.getLocalUserId(),
510 :     project.getStringValue());
511 :     }
512 :     }
513 :    
514 :     return dataset;
515 :     }
516 :    
517 :     /**
518 :     * This method creates a dataset of user billing usage filtered by projects
519 :     * @param usageRecords sets of usage records
520 :     * @param users list of users
521 :     * @param projects list of projects
522 :     * @return dataset
523 :     */
524 :     public static DefaultCategoryDataset constructDatasetForBillingUsageVsUsersFilterByProjects(Set<SmartLMUsageRecordType> usageRecords, Set<UserIdentity> users, Set<ProjectName> projects) {
525 :    
526 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
527 :    
528 :     for(UserIdentity user : users) {
529 :     for(ProjectName project : projects) {
530 :     dataset.addValue(
531 :     DataAggregation.determineUsageByProject(usageRecords, user, project, QueryPortlet.TYPE_BILLING),
532 :     user.getLocalUserId(),
533 :     project.getStringValue());
534 :     }
535 :     }
536 :    
537 :     return dataset;
538 :     }
539 :    
540 :     /**
541 :     * This method creates a dataset of project usage filtered by users
542 :     * @param usageRecords sets of usage records
543 :     * @param users list of users
544 :     * @param projects list of projects
545 :     * @return dataset
546 :     */
547 :     public static DefaultCategoryDataset constructDatasetForTimeUsageVsProjectsFilterByUsers(
548 :     Set<SmartLMUsageRecordType> usageRecords, Set<UserIdentity> users,
549 :     Set<ProjectName> projects) {
550 :    
551 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
552 :    
553 :     for(UserIdentity user : users) {
554 :     for(ProjectName project : projects) {
555 :     dataset.addValue(
556 :     DataAggregation.determineUsageByProject(usageRecords, user, project, QueryPortlet.TYPE_ACCOUNTING),
557 :     project.getStringValue(),
558 :     user.getLocalUserId());
559 :     }
560 :     }
561 :    
562 :     return dataset;
563 :     }
564 :    
565 :     /**
566 :     * This method creates a dataset of project billing usage filtered by users
567 :     * @param usageRecords sets of usage records
568 :     * @param users list of users
569 :     * @param projects list of projects
570 :     * @return dataset
571 :     */
572 :     public static DefaultCategoryDataset constructDatasetForBillingUsageVsProjectsFilterByUsers(
573 :     Set<SmartLMUsageRecordType> usageRecords, Set<UserIdentity> users,
574 :     Set<ProjectName> projects) {
575 :    
576 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
577 :    
578 :     for(UserIdentity user : users) {
579 :     for(ProjectName project : projects) {
580 :     dataset.addValue(
581 :     DataAggregation.determineUsageByProject(usageRecords, user, project, QueryPortlet.TYPE_BILLING),
582 :     project.getStringValue(),
583 :     user.getLocalUserId());
584 :     }
585 :     }
586 :    
587 :     return dataset;
588 :     }
589 :    
590 :     /**
591 :     * This method creates a dataset of Products usage filtered by Departments
592 :     * @param usageRecords UsageRecords from where to extract the information
593 :     * @param departments Departments from which we are interested
594 :     * @param products Productos from which we are interested
595 :     * @return the dataset
596 :     */
597 :     public static DefaultCategoryDataset constructDatasetForTimeUsageVsProductsFilterByAccountingGroups(
598 :     Set<SmartLMUsageRecordType> usageRecords, Set<String> accountingGroups,
599 :     Set<ProductType> products) {
600 :    
601 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
602 :    
603 :     for(String accountingGroup : accountingGroups) {
604 :     for(ProductType product : products) {
605 :     dataset.addValue(
606 :     DataAggregation.determineUsageForProductByAccountingGroup(usageRecords, product, accountingGroup, QueryPortlet.TYPE_ACCOUNTING),
607 :     accountingGroup,
608 :     product.getName());
609 :     }
610 :     }
611 :    
612 :     return dataset;
613 :     }
614 :    
615 :     /**
616 :     * This method creates a dataset of Products billing usage filtered by Departments
617 :     * @param usageRecords UsageRecords from where to extract the information
618 :     * @param departments Departments from which we are interested
619 :     * @param products Productos from which we are interested
620 :     * @return the dataset
621 :     */
622 :     public static DefaultCategoryDataset constructDatasetForBillingUsageVsProductsFilterByAccountingGroups(
623 :     Set<SmartLMUsageRecordType> usageRecords, Set<String> accountingGroups,
624 :     Set<ProductType> products) {
625 :    
626 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
627 :    
628 :     for(String accountingGroup : accountingGroups) {
629 :     for(ProductType product : products) {
630 :     dataset.addValue(
631 :     DataAggregation.determineUsageForProductByAccountingGroup(usageRecords, product, accountingGroup, QueryPortlet.TYPE_BILLING),
632 :     accountingGroup,
633 :     product.getName());
634 :     }
635 :     }
636 :    
637 :     return dataset;
638 :     }
639 :    
640 :     /**
641 :     * This method creates a dataset of Products usage filtered by AccountingGroups
642 :     * @param usageRecords UsageRecords from where to extract the information
643 :     * @param departments Departments from which we are interested
644 :     * @param products Products from which we are interested
645 :     * @return the dataset
646 :     */
647 :     public static DefaultCategoryDataset constructDatasetForTimeUsageVsAccountingGroupFilterByProducts(
648 :     Set<SmartLMUsageRecordType> usageRecords, Set<String> accountingGroups,
649 :     Set<ProductType> products) {
650 :    
651 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
652 :    
653 :     for(String accountingGroup : accountingGroups) {
654 :     for(ProductType product : products) {
655 :     dataset.addValue(
656 :     DataAggregation.determineUsageForProductByAccountingGroup(usageRecords, product, accountingGroup, QueryPortlet.TYPE_ACCOUNTING),
657 :     product.getName(),
658 :     accountingGroup);
659 :     }
660 :     }
661 :    
662 :     return dataset;
663 :     }
664 :    
665 :     /**
666 :     * This method creates a dataset of Products billing usage filtered by AccountingGroups
667 :     * @param usageRecords UsageRecords from where to extract the information
668 :     * @param departments Departments from which we are interested
669 :     * @param products Products from which we are interested
670 :     * @return the dataset
671 :     */
672 :     public static DefaultCategoryDataset constructDatasetForBillingUsageVsAccountingGroupFilterByProducts(
673 :     Set<SmartLMUsageRecordType> usageRecords, Set<String> accountingGroups,
674 :     Set<ProductType> products) {
675 :    
676 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
677 :    
678 :     for(String accountingGroup : accountingGroups) {
679 :     for(ProductType product : products) {
680 :     dataset.addValue(
681 :     DataAggregation.determineUsageForProductByAccountingGroup(usageRecords, product, accountingGroup, QueryPortlet.TYPE_BILLING),
682 :     product.getName(),
683 :     accountingGroup);
684 :     }
685 :     }
686 :    
687 :     return dataset;
688 :     }
689 :    
690 :     /**
691 :     * This method creates a dataset of AccountingGroups Filtered by Projects
692 :     * @param usageRecords Usage records from where to extract the information
693 :     * @param accountingGroups
694 :     * @param projects
695 :     * @return the dataset to create a graph
696 :     */
697 :     public static DefaultCategoryDataset constructDatasetForTimeUsageVsAccountingGroupFilterByProjects(
698 :     Set<SmartLMUsageRecordType> usageRecords,
699 :     Set<String> accountingGroups,
700 :     Set<ProjectName> projects) {
701 :    
702 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
703 :    
704 :     for(String accountingGroup : accountingGroups) {
705 :     for(ProjectName project : projects) {
706 :     dataset.addValue(
707 :     DataAggregation.determineUsageForAnAccountingGroupFilterByProject(usageRecords,accountingGroup, project, QueryPortlet.TYPE_ACCOUNTING),
708 :     project.getStringValue(),
709 :     accountingGroup);
710 :     }
711 :     }
712 :    
713 :     return dataset;
714 :     }
715 :    
716 :     /**
717 :     * This method creates a billing dataset of AccountingGroups Filtered by Projects
718 :     * @param usageRecords Usage records from where to extract the information
719 :     * @param accountingGroups
720 :     * @param projects
721 :     * @return the dataset to create a graph
722 :     */
723 :     public static DefaultCategoryDataset constructDatasetForBillingUsageVsAccountingGroupFilterByProjects(
724 :     Set<SmartLMUsageRecordType> usageRecords,
725 :     Set<String> accountingGroups,
726 :     Set<ProjectName> projects) {
727 :    
728 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
729 :    
730 :     for(String accountingGroup : accountingGroups) {
731 :     for(ProjectName project : projects) {
732 :     dataset.addValue(
733 :     DataAggregation.determineUsageForAnAccountingGroupFilterByProject(usageRecords,accountingGroup, project, QueryPortlet.TYPE_BILLING),
734 :     project.getStringValue(),
735 :     accountingGroup);
736 :     }
737 :     }
738 :    
739 :     return dataset;
740 :     }
741 :    
742 :     /**
743 :     * This method creates a dataset of Projectss Filtered by AccountingGroups
744 :     * @param usageRecords Usage records from where to extract the information
745 :     * @param accountingGroups
746 :     * @param projects
747 :     * @return the dataset to create a graph
748 :     */
749 :     public static DefaultCategoryDataset constructDatasetForTimeUsageVsProjectsFilterByAccountingGroups(
750 :     Set<SmartLMUsageRecordType> usageRecords,
751 :     Set<String> accountingGroups,
752 :     Set<ProjectName> projects) {
753 :    
754 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
755 :    
756 :     for(String accountingGroup : accountingGroups) {
757 :     for(ProjectName project : projects) {
758 :     dataset.addValue(
759 :     DataAggregation.determineUsageForAnAccountingGroupFilterByProject(usageRecords,accountingGroup, project, QueryPortlet.TYPE_ACCOUNTING),
760 :     accountingGroup,
761 :     project.getStringValue());
762 :     }
763 :     }
764 :    
765 :     return dataset;
766 :     }
767 :    
768 :     /**
769 :     * This method creates a billing dataset of Projects Filtered by AccountingGroups
770 :     * @param usageRecords Usage records from where to extract the information
771 :     * @param accountingGroups
772 :     * @param projects
773 :     * @return the dataset to create a graph
774 :     */
775 :     public static DefaultCategoryDataset constructDatasetForBillingUsageVsProjectsFilterByAccountingGroups(
776 :     Set<SmartLMUsageRecordType> usageRecords,
777 :     Set<String> accountingGroups,
778 :     Set<ProjectName> projects) {
779 :    
780 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
781 :    
782 :     for(String accountingGroup : accountingGroups) {
783 :     for(ProjectName project : projects) {
784 :     dataset.addValue(
785 :     DataAggregation.determineUsageForAnAccountingGroupFilterByProject(usageRecords,accountingGroup, project, QueryPortlet.TYPE_BILLING),
786 :     accountingGroup,
787 :     project.getStringValue());
788 :     }
789 :     }
790 :    
791 :     return dataset;
792 :     }
793 :    
794 :     /**
795 :     * It creates a dataset of SubmitHosts filter by AccountingGroups
796 :     * @param smartLMUsageRecords
797 :     * @param submitHosts
798 :     * @param accountingGroups
799 :     * @return
800 :     */
801 :     public static DefaultCategoryDataset constructDatasetForTimeUsageVsSubmitHostFilterByAccountingGroup(
802 :     Set<SmartLMUsageRecordType> usageRecords,
803 :     Set<SubmitHost> submitHosts,
804 :     Set<String> accountingGroups) {
805 :    
806 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
807 :    
808 :     for(String accountingGroup : accountingGroups) {
809 :     for(SubmitHost submitHost : submitHosts) {
810 :     dataset.addValue(
811 :     DataAggregation.determineUsageByAccountingGroupFilterBySubmitHost(usageRecords, accountingGroup, submitHost, QueryPortlet.TYPE_ACCOUNTING),
812 :     accountingGroup,
813 :     submitHost.getStringValue());
814 :     }
815 :     }
816 :    
817 :     return dataset;
818 :     }
819 :    
820 :     /**
821 :     * It creates a Billing dataset of SubmitHosts filter by AccountingGroups
822 :     * @param smartLMUsageRecords
823 :     * @param submitHosts
824 :     * @param accountingGroups
825 :     * @return
826 :     */
827 :     public static DefaultCategoryDataset constructDatasetForBillingUsageVsSubmitHostFilterByAccountingGroup(
828 :     Set<SmartLMUsageRecordType> usageRecords,
829 :     Set<SubmitHost> submitHosts,
830 :     Set<String> accountingGroups) {
831 :    
832 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
833 :    
834 :     for(String accountingGroup : accountingGroups) {
835 :     for(SubmitHost submitHost : submitHosts) {
836 :     dataset.addValue(
837 :     DataAggregation.determineUsageByAccountingGroupFilterBySubmitHost(usageRecords, accountingGroup, submitHost, QueryPortlet.TYPE_BILLING),
838 :     accountingGroup,
839 :     submitHost.getStringValue());
840 :     }
841 :     }
842 :    
843 :     return dataset;
844 :     }
845 :    
846 :     /**
847 :     * It creates a dataset of AccountingGroups filter by SubmitHosts
848 :     * @param smartLMUsageRecords
849 :     * @param submitHosts
850 :     * @param accountingGroups
851 :     * @return the usage dataset
852 :     */
853 :     public static DefaultCategoryDataset constructDatasetForTimeUsageVsAccountingGroupFilterBySubmitHost(
854 :     Set<SmartLMUsageRecordType> usageRecords,
855 :     Set<SubmitHost> submitHosts,
856 :     Set<String> accountingGroups) {
857 :    
858 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
859 :    
860 :     for(String accountingGroup : accountingGroups) {
861 :     for(SubmitHost submitHost : submitHosts) {
862 :     dataset.addValue(
863 :     DataAggregation.determineUsageByAccountingGroupFilterBySubmitHost(usageRecords, accountingGroup, submitHost, QueryPortlet.TYPE_ACCOUNTING),
864 :     submitHost.getStringValue(),
865 :     accountingGroup);
866 :     }
867 :     }
868 :    
869 :     return dataset;
870 :     }
871 :    
872 :     /**
873 :     * It creates a billing dataset of AccountingGroups filter by SubmitHosts
874 :     * @param smartLMUsageRecords
875 :     * @param submitHosts
876 :     * @param accountingGroups
877 :     * @return the billing dataset
878 :     */
879 :     public static DefaultCategoryDataset constructDatasetForBillingUsageVsAccountingGroupFilterBySubmitHost(
880 :     Set<SmartLMUsageRecordType> usageRecords,
881 :     Set<SubmitHost> submitHosts,
882 :     Set<String> accountingGroups) {
883 :    
884 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
885 :    
886 :     for(String accountingGroup : accountingGroups) {
887 :     for(SubmitHost submitHost : submitHosts) {
888 :     dataset.addValue(
889 :     DataAggregation.determineUsageByAccountingGroupFilterBySubmitHost(usageRecords, accountingGroup, submitHost, QueryPortlet.TYPE_BILLING),
890 :     submitHost.getStringValue(),
891 :     accountingGroup);
892 :     }
893 :     }
894 :    
895 :     return dataset;
896 :     }
897 :    
898 :     /**
899 :     * It creates a dataset of Products filtered by Projects
900 :     * @param usageRecords UsageRecords from where to extract the information
901 :     * @param projects Projects from which we are interested
902 :     * @param products Products from which we are interested
903 :     * @return the dateset
904 :     */
905 :     public static DefaultCategoryDataset constructDatasetForTimeUsageVsProductsFilterByProjects(
906 :     Set<SmartLMUsageRecordType> usageRecords,
907 :     Set<ProjectName> projects,
908 :     Set<ProductType> products) {
909 :    
910 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
911 :    
912 :     for(ProjectName project : projects) {
913 :     for(ProductType product : products) {
914 :     dataset.addValue(
915 :     DataAggregation.determineUsageByProductFilterByProject(usageRecords, product, project, QueryPortlet.TYPE_ACCOUNTING),
916 :     project.getStringValue(),
917 :     product.getName());
918 :     }
919 :     }
920 :    
921 :     return dataset;
922 :     }
923 :    
924 :     /**
925 :     * It creates a billing dataset of Products filtered by Projects
926 :     * @param usageRecords UsageRecords from where to extract the information
927 :     * @param projects Projects from which we are interested
928 :     * @param products Products from which we are interested
929 :     * @return the dateset
930 :     */
931 :     public static DefaultCategoryDataset constructDatasetForBillingUsageVsProductsFilterByProjects(
932 :     Set<SmartLMUsageRecordType> usageRecords,
933 :     Set<ProjectName> projects,
934 :     Set<ProductType> products) {
935 :    
936 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
937 :    
938 :     for(ProjectName project : projects) {
939 :     for(ProductType product : products) {
940 :     dataset.addValue(
941 :     DataAggregation.determineUsageByProductFilterByProject(usageRecords, product, project, QueryPortlet.TYPE_BILLING),
942 :     project.getStringValue(),
943 :     product.getName());
944 :     }
945 :     }
946 :    
947 :     return dataset;
948 :     }
949 :    
950 :     /**
951 :     * It creates a dataset of Products filtered by Projects
952 :     * @param usageRecords UsageRecords from where to extract the information
953 :     * @param projects Projects from which we are interested
954 :     * @param products Products from which we are interested
955 :     * @return the dateset
956 :     */
957 :     public static DefaultCategoryDataset constructDatasetForTimeUsageVsProjectsFilterByProducts(
958 :     Set<SmartLMUsageRecordType>
959 :     usageRecords,
960 :     Set<ProjectName> projects,
961 :     Set<ProductType> products) {
962 :    
963 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
964 :    
965 :     for(ProjectName project : projects) {
966 :     for(ProductType product : products) {
967 :     dataset.addValue(
968 :     DataAggregation.determineUsageByProductFilterByProject(usageRecords, product, project, QueryPortlet.TYPE_ACCOUNTING),
969 :     product.getName(),
970 :     project.getStringValue());
971 :     }
972 :     }
973 :    
974 :     return dataset;
975 :     }
976 :    
977 :     /**
978 :     * It creates a billing dataset of Products filtered by Projects
979 :     * @param usageRecords UsageRecords from where to extract the information
980 :     * @param projects Projects from which we are interested
981 :     * @param products Products from which we are interested
982 :     * @return the billing dateset
983 :     */
984 :     public static DefaultCategoryDataset constructDatasetForBillingUsageVsProjectsFilterByProducts(
985 :     Set<SmartLMUsageRecordType>
986 :     usageRecords,
987 :     Set<ProjectName> projects,
988 :     Set<ProductType> products) {
989 :    
990 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
991 :    
992 :     for(ProjectName project : projects) {
993 :     for(ProductType product : products) {
994 :     dataset.addValue(
995 :     DataAggregation.determineUsageByProductFilterByProject(usageRecords, product, project, QueryPortlet.TYPE_BILLING),
996 :     product.getName(),
997 :     project.getStringValue());
998 :     }
999 :     }
1000 :    
1001 :     return dataset;
1002 :     }
1003 :    
1004 :     /**
1005 :     * It creates a Dataset of SubmitHosts filtered by Products
1006 :     * @param usageRecords Usage records from where to extract the information
1007 :     * @param submitHosts Hosts from which we are interested
1008 :     * @param products Products from which we are interested
1009 :     * @return the dataset to create the graph
1010 :     */
1011 :     public static DefaultCategoryDataset constructDatasetForTimeUsageVsSubmitHostsFilterByProducts(
1012 :     Set<SmartLMUsageRecordType> usageRecords,
1013 :     Set<SubmitHost> submitHosts,
1014 :     Set<ProductType> products) {
1015 :    
1016 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
1017 :    
1018 :     for(SubmitHost submitHost : submitHosts) {
1019 :     for(ProductType product : products) {
1020 :     dataset.addValue(
1021 :     DataAggregation.determineUsageByProductFilterBySubmitHost(usageRecords, product, submitHost, QueryPortlet.TYPE_ACCOUNTING),
1022 :     product.getName(),
1023 :     submitHost.getStringValue());
1024 :     }
1025 :     }
1026 :     return dataset;
1027 :     }
1028 :    
1029 :     /**
1030 :     * It creates a Billing Dataset of SubmitHosts filtered by Products
1031 :     * @param usageRecords Usage records from where to extract the information
1032 :     * @param submitHosts Hosts from which we are interested
1033 :     * @param products Products from which we are interested
1034 :     * @return the dataset to create the graph
1035 :     */
1036 :     public static DefaultCategoryDataset constructDatasetForBillingUsageVsSubmitHostsFilterByProducts(
1037 :     Set<SmartLMUsageRecordType> usageRecords,
1038 :     Set<SubmitHost> submitHosts,
1039 :     Set<ProductType> products) {
1040 :    
1041 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
1042 :    
1043 :     for(SubmitHost submitHost : submitHosts) {
1044 :     for(ProductType product : products) {
1045 :     dataset.addValue(
1046 :     DataAggregation.determineUsageByProductFilterBySubmitHost(usageRecords, product, submitHost, QueryPortlet.TYPE_BILLING),
1047 :     product.getName(),
1048 :     submitHost.getStringValue());
1049 :     }
1050 :     }
1051 :     return dataset;
1052 :     }
1053 :    
1054 :     /**
1055 :     * It creates a Dataset of Host usage filter by accountingGroups
1056 :     * @param usageRecords
1057 :     * @param hosts
1058 :     * @param accountingGroups
1059 :     * @return the dataset
1060 :     */
1061 :     public static DefaultCategoryDataset constructDatasetForTimeUsageVsHostFilterByAccountingGroup(
1062 :     Set<SmartLMUsageRecordType> usageRecords,
1063 :     Set<Host> hosts,
1064 :     Set<String> accountingGroups) {
1065 :    
1066 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
1067 :    
1068 :     for(Host host : hosts) {
1069 :     for(String accountingGroup : accountingGroups) {
1070 :     dataset.addValue(
1071 :     DataAggregation.determineUsageByAccountingGroupFilterByHost(usageRecords, accountingGroup, host, QueryPortlet.TYPE_ACCOUNTING),
1072 :     accountingGroup,
1073 :     host.getStringValue());
1074 :     }
1075 :     }
1076 :     return dataset;
1077 :     }
1078 :    
1079 :     /**
1080 :     * It creates a Billing Dataset of Host usage filter by accountingGroups
1081 :     * @param usageRecords
1082 :     * @param hosts
1083 :     * @param accountingGroups
1084 :     * @return the dataset
1085 :     */
1086 :     public static DefaultCategoryDataset constructDatasetForBillingUsageVsHostFilterByAccountingGroup(
1087 :     Set<SmartLMUsageRecordType> usageRecords,
1088 :     Set<Host> hosts,
1089 :     Set<String> accountingGroups) {
1090 :    
1091 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
1092 :    
1093 :     for(Host host : hosts) {
1094 :     for(String accountingGroup : accountingGroups) {
1095 :     dataset.addValue(
1096 :     DataAggregation.determineUsageByAccountingGroupFilterByHost(usageRecords, accountingGroup, host, QueryPortlet.TYPE_BILLING),
1097 :     accountingGroup,
1098 :     host.getStringValue());
1099 :     }
1100 :     }
1101 :     return dataset;
1102 :     }
1103 :    
1104 :     /**
1105 :     * It creates a Dataset of AccountingGroups filter by Hosts
1106 :     * @param smartLMUsageRecords
1107 :     * @param hosts
1108 :     * @param accountingGroups
1109 :     * @return
1110 :     */
1111 :     public static DefaultCategoryDataset constructDatasetForTimeUsageVsAccountingGroupFilterByHost(
1112 :     Set<SmartLMUsageRecordType> usageRecords,
1113 :     Set<Host> hosts,
1114 :     Set<String> accountingGroups) {
1115 :    
1116 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
1117 :    
1118 :     for(Host host : hosts) {
1119 :     for(String accountingGroup : accountingGroups) {
1120 :     dataset.addValue(
1121 :     DataAggregation.determineUsageByAccountingGroupFilterByHost(usageRecords, accountingGroup, host, QueryPortlet.TYPE_ACCOUNTING),
1122 :     host.getStringValue(),
1123 :     accountingGroup);
1124 :     }
1125 :     }
1126 :     return dataset;
1127 :     }
1128 :    
1129 :     /**
1130 :     * It creates a Billing Dataset of AccountingGroups filter by Hosts
1131 :     * @param smartLMUsageRecords
1132 :     * @param hosts
1133 :     * @param accountingGroups
1134 :     * @return
1135 :     */
1136 :     public static DefaultCategoryDataset constructDatasetForBillingUsageVsAccountingGroupFilterByHost(
1137 :     Set<SmartLMUsageRecordType> usageRecords,
1138 :     Set<Host> hosts,
1139 :     Set<String> accountingGroups) {
1140 :    
1141 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
1142 :    
1143 :     for(Host host : hosts) {
1144 :     for(String accountingGroup : accountingGroups) {
1145 :     dataset.addValue(
1146 :     DataAggregation.determineUsageByAccountingGroupFilterByHost(usageRecords, accountingGroup, host, QueryPortlet.TYPE_BILLING),
1147 :     host.getStringValue(),
1148 :     accountingGroup);
1149 :     }
1150 :     }
1151 :     return dataset;
1152 :     }
1153 :    
1154 :     /**
1155 :     * It creates a Dataset of Products filtered by SubmitHosts
1156 :     * @param usageRecords Usage records from where to extract the information
1157 :     * @param submitHosts Hosts from which we are interested
1158 :     * @param products Products from which we are interested
1159 :     * @return the dataset to create the graph
1160 :     */
1161 :     public static DefaultCategoryDataset constructDatasetForTimeUsageVsProductsFilterBySubmitHosts(
1162 :     Set<SmartLMUsageRecordType> usageRecords,
1163 :     Set<SubmitHost> submitHosts,
1164 :     Set<ProductType> products) {
1165 :    
1166 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
1167 :    
1168 :     for(SubmitHost submitHost : submitHosts) {
1169 :     for(ProductType product : products) {
1170 :     dataset.addValue(
1171 :     DataAggregation.determineUsageByProductFilterBySubmitHost(usageRecords, product, submitHost, QueryPortlet.TYPE_ACCOUNTING),
1172 :     submitHost.getStringValue(),
1173 :     product.getName());
1174 :     }
1175 :     }
1176 :     return dataset;
1177 :     }
1178 :    
1179 :     /**
1180 :     * It creates a Billing Dataset of Products filtered by SubmitHosts
1181 :     * @param usageRecords Usage records from where to extract the information
1182 :     * @param submitHosts Hosts from which we are interested
1183 :     * @param products Products from which we are interested
1184 :     * @return the dataset to create the graph
1185 :     */
1186 :     public static DefaultCategoryDataset constructDatasetForBillingUsageVsProductsFilterBySubmitHosts(
1187 :     Set<SmartLMUsageRecordType> usageRecords,
1188 :     Set<SubmitHost> submitHosts,
1189 :     Set<ProductType> products) {
1190 :    
1191 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
1192 :    
1193 :     for(SubmitHost submitHost : submitHosts) {
1194 :     for(ProductType product : products) {
1195 :     dataset.addValue(
1196 :     DataAggregation.determineUsageByProductFilterBySubmitHost(usageRecords, product, submitHost, QueryPortlet.TYPE_BILLING),
1197 :     submitHost.getStringValue(),
1198 :     product.getName());
1199 :     }
1200 :     }
1201 :     return dataset;
1202 :     }
1203 :    
1204 :     /**
1205 :     * It creates a Dataset of Hosts filtered by Products
1206 :     * @param usageRecords Usage records from where to extract the information
1207 :     * @param hosts Hosts from which we are interested
1208 :     * @param products Products from which we are interested
1209 :     * @return the datase to create the graph
1210 :     */
1211 :     public static DefaultCategoryDataset constructDatasetForTimeUsageVsHostsFilterByProducts(
1212 :     Set<SmartLMUsageRecordType> usageRecords,
1213 :     Set<Host> hosts,
1214 :     Set<ProductType> products) {
1215 :    
1216 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
1217 :    
1218 :     for(Host host : hosts) {
1219 :     for(ProductType product : products) {
1220 :     dataset.addValue(
1221 :     DataAggregation.determineUsageByProductFilterByHost(usageRecords, product, host, QueryPortlet.TYPE_ACCOUNTING),
1222 :     product.getName(),
1223 :     host.getStringValue());
1224 :     }
1225 :     }
1226 :     return dataset;
1227 :     }
1228 :    
1229 :     /**
1230 :     * It creates a Billing Dataset of Hosts filtered by Products
1231 :     * @param usageRecords Usage records from where to extract the information
1232 :     * @param hosts Hosts from which we are interested
1233 :     * @param products Products from which we are interested
1234 :     * @return the datase to create the graph
1235 :     */
1236 :     public static DefaultCategoryDataset constructDatasetForBillingUsageVsHostsFilterByProducts(
1237 :     Set<SmartLMUsageRecordType> usageRecords,
1238 :     Set<Host> hosts,
1239 :     Set<ProductType> products) {
1240 :    
1241 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
1242 :    
1243 :     for(Host host : hosts) {
1244 :     for(ProductType product : products) {
1245 :     dataset.addValue(
1246 :     DataAggregation.determineUsageByProductFilterByHost(usageRecords, product, host, QueryPortlet.TYPE_BILLING),
1247 :     product.getName(),
1248 :     host.getStringValue());
1249 :     }
1250 :     }
1251 :     return dataset;
1252 :     }
1253 :    
1254 :     /**
1255 :     * It creates a Dataset of Products filtered by Hosts
1256 :     * @param usageRecords Usage records from where to extract the information
1257 :     * @param hosts Hosts from which we are interested
1258 :     * @param products Products from which we are interested
1259 :     * @return the datase to create the graph
1260 :     */
1261 :     public static DefaultCategoryDataset constructDatasetForTimeUsageVsProductsFilterByHosts(
1262 :     Set<SmartLMUsageRecordType> usageRecords,
1263 :     Set<Host> hosts,
1264 :     Set<ProductType> products) {
1265 :    
1266 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
1267 :    
1268 :     for(Host host : hosts) {
1269 :     for(ProductType product : products) {
1270 :     dataset.addValue(
1271 :     DataAggregation.determineUsageByProductFilterByHost(usageRecords, product, host, QueryPortlet.TYPE_ACCOUNTING),
1272 :     host.getStringValue(),
1273 :     product.getName());
1274 :     }
1275 :     }
1276 :     return dataset;
1277 :     }
1278 :    
1279 :     /**
1280 :     * It creates a Billing Dataset of Products filtered by Hosts
1281 :     * @param usageRecords Usage records from where to extract the information
1282 :     * @param hosts Hosts from which we are interested
1283 :     * @param products Products from which we are interested
1284 :     * @return the datase to create the graph
1285 :     */
1286 :     public static DefaultCategoryDataset constructDatasetForBillingUsageVsProductsFilterByHosts(
1287 :     Set<SmartLMUsageRecordType> usageRecords,
1288 :     Set<Host> hosts,
1289 :     Set<ProductType> products) {
1290 :    
1291 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
1292 :    
1293 :     for(Host host : hosts) {
1294 :     for(ProductType product : products) {
1295 :     dataset.addValue(
1296 :     DataAggregation.determineUsageByProductFilterByHost(usageRecords, product, host, QueryPortlet.TYPE_BILLING),
1297 :     host.getStringValue(),
1298 :     product.getName());
1299 :     }
1300 :     }
1301 :     return dataset;
1302 :     }
1303 :    
1304 :     /**
1305 :     * It creates a Dataset of Projects filtered by Hosts
1306 :     * @param usageRecords
1307 :     * @param hosts
1308 :     * @param projects
1309 :     * @return the dataset to create the graph
1310 :     */
1311 :     public static DefaultCategoryDataset constructDatasetForTimeUsageVsProjectFilterByHosts(
1312 :     Set<SmartLMUsageRecordType> usageRecords,
1313 :     Set<Host> hosts,
1314 :     Set<ProjectName> projects) {
1315 :    
1316 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
1317 :    
1318 :     for(Host host : hosts) {
1319 :     for(ProjectName project : projects) {
1320 :     dataset.addValue(
1321 :     DataAggregation.determineUsageByProjectFilterByHost(usageRecords, project, host, QueryPortlet.TYPE_ACCOUNTING),
1322 :     host.getStringValue(),
1323 :     project.getStringValue());
1324 :     }
1325 :     }
1326 :     return dataset;
1327 :     }
1328 :    
1329 :     /**
1330 :     * It creates a Billing Dataset of Projects filtered by Hosts
1331 :     * @param usageRecords
1332 :     * @param hosts
1333 :     * @param projects
1334 :     * @return the dataset to create the graph
1335 :     */
1336 :     public static DefaultCategoryDataset constructDatasetForBillingUsageVsProjectFilterByHosts(
1337 :     Set<SmartLMUsageRecordType> usageRecords,
1338 :     Set<Host> hosts,
1339 :     Set<ProjectName> projects) {
1340 :    
1341 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
1342 :    
1343 :     for(Host host : hosts) {
1344 :     for(ProjectName project : projects) {
1345 :     dataset.addValue(
1346 :     DataAggregation.determineUsageByProjectFilterByHost(usageRecords, project, host, QueryPortlet.TYPE_BILLING),
1347 :     host.getStringValue(),
1348 :     project.getStringValue());
1349 :     }
1350 :     }
1351 :     return dataset;
1352 :     }
1353 :    
1354 :     /**
1355 :     * It creates a Dataset of Hosts filtered by Projects
1356 :     * @param usageRecords
1357 :     * @param hosts
1358 :     * @param projects
1359 :     * @return the dataset to create the graph
1360 :     */
1361 :     public static DefaultCategoryDataset constructDatasetForTimeUsageVsHostFilterByProjects(
1362 :     Set<SmartLMUsageRecordType> usageRecords,
1363 :     Set<Host> hosts,
1364 :     Set<ProjectName> projects) {
1365 :    
1366 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
1367 :    
1368 :     for(Host host : hosts) {
1369 :     for(ProjectName project : projects) {
1370 :     dataset.addValue(
1371 :     DataAggregation.determineUsageByProjectFilterByHost(usageRecords, project, host, QueryPortlet.TYPE_ACCOUNTING),
1372 :     project.getStringValue(),
1373 :     host.getStringValue());
1374 :     }
1375 :     }
1376 :     return dataset;
1377 :     }
1378 :    
1379 :     /**
1380 :     * It creates a Billing Dataset of Hosts filtered by Projects
1381 :     * @param usageRecords
1382 :     * @param hosts
1383 :     * @param projects
1384 :     * @return the dataset to create the graph
1385 :     */
1386 :     public static DefaultCategoryDataset constructDatasetForBillingUsageVsHostFilterByProjects(
1387 :     Set<SmartLMUsageRecordType> usageRecords,
1388 :     Set<Host> hosts,
1389 :     Set<ProjectName> projects) {
1390 :    
1391 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
1392 :    
1393 :     for(Host host : hosts) {
1394 :     for(ProjectName project : projects) {
1395 :     dataset.addValue(
1396 :     DataAggregation.determineUsageByProjectFilterByHost(usageRecords, project, host, QueryPortlet.TYPE_BILLING),
1397 :     project.getStringValue(),
1398 :     host.getStringValue());
1399 :     }
1400 :     }
1401 :     return dataset;
1402 :     }
1403 :    
1404 :     /**
1405 :     * It creates a Dataset of Projects Filtered by SumbitHosts
1406 :     * @param usageRecords
1407 :     * @param submitHosts
1408 :     * @param projects
1409 :     * @return the dataset to create the graph
1410 :     */
1411 :     public static DefaultCategoryDataset constructDatasetForTimeUsageVsProjectFilterBySubmitHosts(
1412 :     Set<SmartLMUsageRecordType> usageRecords,
1413 :     Set<SubmitHost> submitHosts,
1414 :     Set<ProjectName> projects) {
1415 :    
1416 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
1417 :    
1418 :     for(SubmitHost submitHost : submitHosts) {
1419 :     for(ProjectName project : projects) {
1420 :     dataset.addValue(
1421 :     DataAggregation.determineUsageByProjectFilterBySubmitHost(usageRecords, project, submitHost, QueryPortlet.TYPE_ACCOUNTING),
1422 :     submitHost.getStringValue(),
1423 :     project.getStringValue());
1424 :     }
1425 :     }
1426 :     return dataset;
1427 :     }
1428 :    
1429 :     /**
1430 :     * It creates a Billing Dataset of Projects Filtered by SumbitHosts
1431 :     * @param usageRecords
1432 :     * @param submitHosts
1433 :     * @param projects
1434 :     * @return the dataset to create the graph
1435 :     */
1436 :     public static DefaultCategoryDataset constructDatasetForBillingUsageVsProjectFilterBySubmitHosts(
1437 :     Set<SmartLMUsageRecordType> usageRecords,
1438 :     Set<SubmitHost> submitHosts,
1439 :     Set<ProjectName> projects) {
1440 :    
1441 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
1442 :    
1443 :     for(SubmitHost submitHost : submitHosts) {
1444 :     for(ProjectName project : projects) {
1445 :     dataset.addValue(
1446 :     DataAggregation.determineUsageByProjectFilterBySubmitHost(usageRecords, project, submitHost, QueryPortlet.TYPE_BILLING),
1447 :     submitHost.getStringValue(),
1448 :     project.getStringValue());
1449 :     }
1450 :     }
1451 :     return dataset;
1452 :     }
1453 :    
1454 :     /**
1455 :     * It creates a Dataset of SubmitHost Filtered by Projects
1456 :     * @param usageRecords
1457 :     * @param submitHosts
1458 :     * @param projects
1459 :     * @return the dataset to create the graph
1460 :     */
1461 :     public static DefaultCategoryDataset constructDatasetForTimeUsageVsSumitHostFilterByProjects(
1462 :     Set<SmartLMUsageRecordType> usageRecords,
1463 :     Set<SubmitHost> submitHosts,
1464 :     Set<ProjectName> projects) {
1465 :    
1466 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
1467 :    
1468 :     for(SubmitHost submitHost : submitHosts) {
1469 :     for(ProjectName project : projects) {
1470 :     dataset.addValue(
1471 :     DataAggregation.determineUsageByProjectFilterBySubmitHost(usageRecords, project, submitHost, QueryPortlet.TYPE_ACCOUNTING),
1472 :     project.getStringValue(),
1473 :     submitHost.getStringValue());
1474 :     }
1475 :     }
1476 :     return dataset;
1477 :     }
1478 :    
1479 :     /**
1480 :     * It creates a Billing Dataset of SubmitHost Filtered by Projects
1481 :     * @param usageRecords
1482 :     * @param submitHosts
1483 :     * @param projects
1484 :     * @return the dataset to create the graph
1485 :     */
1486 :     public static DefaultCategoryDataset constructDatasetForBillingUsageVsSumitHostFilterByProjects(
1487 :     Set<SmartLMUsageRecordType> usageRecords,
1488 :     Set<SubmitHost> submitHosts,
1489 :     Set<ProjectName> projects) {
1490 :    
1491 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
1492 :    
1493 :     for(SubmitHost submitHost : submitHosts) {
1494 :     for(ProjectName project : projects) {
1495 :     dataset.addValue(
1496 :     DataAggregation.determineUsageByProjectFilterBySubmitHost(usageRecords, project, submitHost, QueryPortlet.TYPE_BILLING),
1497 :     project.getStringValue(),
1498 :     submitHost.getStringValue());
1499 :     }
1500 :     }
1501 :     return dataset;
1502 :     }
1503 :    
1504 :     /**
1505 :     * It creates a Dataset of Hosts time usage
1506 :     * @param smartLMUsageRecords
1507 :     * @param hosts
1508 :     * @return
1509 :     */
1510 :     public static DefaultCategoryDataset constructDatasetForTimeUsageForAHost(
1511 :     Set<SmartLMUsageRecordType> usageRecords,
1512 :     Set<Host> hosts) {
1513 :    
1514 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
1515 :    
1516 :     for(Host host : hosts) {
1517 :     dataset.addValue(DataAggregation.determineUsageForAHost(usageRecords, host, QueryPortlet.TYPE_ACCOUNTING), "category", host.getStringValue());
1518 :    
1519 :     }
1520 :    
1521 :     return dataset;
1522 :     }
1523 :    
1524 :     /**
1525 :     * It creates a Dataset of Hosts time usage
1526 :     * @param smartLMUsageRecords
1527 :     * @param hosts
1528 :     * @return
1529 :     */
1530 :     public static DefaultCategoryDataset constructDatasetForBillingUsageForAHost(
1531 :     Set<SmartLMUsageRecordType> usageRecords,
1532 :     Set<Host> hosts) {
1533 :    
1534 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
1535 :    
1536 :     for(Host host : hosts) {
1537 :     dataset.addValue(DataAggregation.determineUsageForAHost(usageRecords, host, QueryPortlet.TYPE_ACCOUNTING), "category", host.getStringValue());
1538 :    
1539 :     }
1540 :    
1541 :     return dataset;
1542 :     }
1543 :    
1544 :     /**
1545 :     * It creates a Dataset of SubmitHosts time usage
1546 :     * @param usageRecords
1547 :     * @param submitHosts
1548 :     * @return
1549 :     */
1550 :     public static DefaultCategoryDataset constructDatasetForTimeUsageForASubmitHost(
1551 :     Set<SmartLMUsageRecordType> usageRecords,
1552 :     Set<SubmitHost> submitHosts) {
1553 :    
1554 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
1555 :    
1556 :     for(SubmitHost submitHost : submitHosts) {
1557 :     dataset.addValue(DataAggregation.determineUsageForASubmitHost(usageRecords, submitHost, QueryPortlet.TYPE_ACCOUNTING), "category", submitHost.getStringValue());
1558 :     }
1559 :    
1560 :     return dataset;
1561 :     }
1562 :    
1563 :     /**
1564 :     * It creates a Billing Dataset of SubmitHosts time usage
1565 :     * @param usageRecords
1566 :     * @param submitHosts
1567 :     * @return
1568 :     */
1569 :     public static DefaultCategoryDataset constructDatasetForBillingUsageForASubmitHost(
1570 :     Set<SmartLMUsageRecordType> usageRecords,
1571 :     Set<SubmitHost> submitHosts) {
1572 :    
1573 :     DefaultCategoryDataset dataset = new DefaultCategoryDataset();
1574 :    
1575 :     for(SubmitHost submitHost : submitHosts) {
1576 :     dataset.addValue(DataAggregation.determineUsageForASubmitHost(usageRecords, submitHost, QueryPortlet.TYPE_BILLING), "category", submitHost.getStringValue());
1577 :     }
1578 :    
1579 :     return dataset;
1580 :     }
1581 :     }

root@forge.cesga.es
ViewVC Help
Powered by ViewVC 1.0.0  

Powered By FusionForge