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] View 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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (download) (annotate)
Wed Jul 28 10:05:51 2010 UTC (13 years, 9 months ago) by dgarcia
File size: 55363 byte(s)
First code commit
package eu.smartlm.abs.portal.graph;

import java.util.Set;

import org.gridforum.x2003.urWg.HostDocument.Host;
import org.gridforum.x2003.urWg.ProjectNameDocument.ProjectName;
import org.gridforum.x2003.urWg.SubmitHostDocument.SubmitHost;
import org.gridforum.x2003.urWg.UserIdentityDocument.UserIdentity;
import org.jfree.data.category.DefaultCategoryDataset;

import eu.smartlm.abs.portal.data.aggregation.DataAggregation;
import eu.smartlm.abs.portal.view.portlet.QueryPortlet;

import eu.smartlm.schemas.x2009.x06.urec.ProductType;
import eu.smartlm.schemas.x2009.x06.urec.SmartLMUsageRecordType;

/**
 * This class is the responsible to build the different graphs taht are going to be shown in the Accounting and Billing Portal
 * @author David García Pérez - CESGA
 *
 */
public class DatasetConstructor {

	/**
	 * This method creates the necessary Dataset to create a graph based on User usage information for some specific set of products
	 * @param usageRecords UsageRecords from where to extract the used hours
	 * @param users list of users that are going to appear in the dataset
	 * @param products list of selected applications to be calculate the hours
	 * @param type accounting or billing
	 * @return the dataset ready to make a graph
	 */
	public static DefaultCategoryDataset constructDatasetForUsageVsUsersFilterByProducts(
			Set<SmartLMUsageRecordType> usageRecords, 
			Set<UserIdentity> users,
			Set<ProductType> products,
			String type) {
		
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(UserIdentity user : users)
			for(ProductType product : products)
				dataset.addValue(DataAggregation.determineUsageByProduct(usageRecords, user, product, type), product.getName(), user.getLocalUserId());
		
		return dataset;
	}
		
	/**
	 * This method creates the necessary Dataset to create a graph based on Product usage information for some specific set of users
	 * @param usageRecords UsageRecords from where to extract the used hours
	 * @param users list of users that are going to appear in the dataset
	 * @param products list of selected applications to be calculate the hours
	 * @param type accounting or billing
	 * @return the dataset ready to make a graph
	 */
	public static DefaultCategoryDataset constructDatasetForUsageVsProductsFilterByUsers(
			Set<SmartLMUsageRecordType> usageRecords, 
			Set<UserIdentity> users,
			Set<ProductType> products,
			String type) {
		
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(UserIdentity user : users)
			for(ProductType product : products)
				dataset.addValue(DataAggregation.determineUsageByProduct(usageRecords, user, product, type), user.getLocalUserId(),	product.getName());
		
		return dataset;
	}

	
	/**
	 * It creates a Dataset to create a graph of Product usage vs time
	 * @param usageRecords usage records from where the usage information is going to be extracted
	 * @param products list of product from where we are interested to know the usage information
	 * @param type accounting and billing
	 * @return the necessary dataset to make the graph
	 */
	public static DefaultCategoryDataset constructDatasetForUsageVsProduct(Set<SmartLMUsageRecordType> usageRecords, Set<ProductType> products,	String type) {
		
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();

		for(ProductType product : products)
			dataset.addValue(DataAggregation.determineUsageForAProduct(usageRecords, product, type), "category", product.getName());
		
		return dataset;
	}
	
	/**
	 * This method creates the necessary Dataset to create a graph based on User usage information for some specific set of accountingGroups
	 * @param usageRecords UsageRecords from where to extract the used hours
	 * @param users list of users that are going to appear in the dataset
	 * @param accountingGroups list of selected applications to be calculate the hours
	 * @param type accounting or billing
	 * @return the dataset ready to make a graph
	 */
	public static DefaultCategoryDataset constructDatasetForUsageVsUsersFilterByAccountingGroups(
			Set<SmartLMUsageRecordType> usageRecords,
			Set<UserIdentity> users, 
			Set<String> accountingGroups,
			String type) {
		
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(UserIdentity user : users) 
			for(String accountingGroup : accountingGroups) 
				dataset.addValue(DataAggregation.determineUsageByAccountingGroup(usageRecords, user, accountingGroup, type), accountingGroup, user.getLocalUserId());
		
		return dataset;
	}
	
	/**
	 * This method creates the necessary Dataset to create a graph based on AccountingGroup usage information for some specific set of Users
	 * @param usageRecords UsageRecords from where to extract the used hours
	 * @param users list of users that are going to appear in the dataset
	 * @param accountingGroups list of selected applications to be calculate the hours
	 * @param type accounting or billing
	 * @return the dataset ready to make a graph
	 */
	public static DefaultCategoryDataset constructDatasetForUsageVsAccountingGroupsFilterByUsers(
			Set<SmartLMUsageRecordType> usageRecords,
			Set<UserIdentity> users, 
			Set<String> accountingGroups,
			String type) {
		
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(UserIdentity user : users)
			for(String accountingGroup : accountingGroups)
				dataset.addValue(
						DataAggregation.determineUsageByAccountingGroup(usageRecords, user, accountingGroup, type),  
						user.getLocalUserId(),
						accountingGroup);
		
		return dataset;
	}
		
	/**
	 * This method creates a dataset of time usage for AccountingGroups filtered by Users
	 * @param usageRecords usageRecords where to extract information
	 * @param departments from where we are going to calculate the time usage
	 * @param users from where we are going to calculate the time usage
	 * @return the dataset to construct the graph.
	 */
	public static DefaultCategoryDataset constructDatasetForTimeUsageVsAccountingGroupFilterByUsers(
			Set<SmartLMUsageRecordType> usageRecords, Set<String> accountingGroups,
			Set<UserIdentity> users) {
		
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(UserIdentity user : users) {
			for(String accountingGroup : accountingGroups) {
					dataset.addValue(
							DataAggregation.determineUsageForAnAccountingGroup(usageRecords, accountingGroup, QueryPortlet.TYPE_ACCOUNTING),
							user.getLocalUserId(), 
							accountingGroup);
			}
		}
		
		return dataset;
	}
	
	/**
	 * This method creates a dataset of billing usage for AccountingGroups filtered by Users
	 * @param usageRecords usageRecords where to extract information
	 * @param departments from where we are going to calculate the time usage
	 * @param users from where we are going to calculate the time usage
	 * @return the dataset to construct the graph.
	 */
	public static DefaultCategoryDataset constructDatasetForBillingUsageVsAccountingGroupFilterByUsers(
			Set<SmartLMUsageRecordType> usageRecords, Set<String> accountingGroups,
			Set<UserIdentity> users) {
		
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(UserIdentity user : users) {
			for(String accountingGroup : accountingGroups) {
				dataset.addValue(
						DataAggregation.determineUsageForAnAccountingGroup(usageRecords, accountingGroup, QueryPortlet.TYPE_BILLING),
						user.getLocalUserId(), 
						accountingGroup);
			}
		}
		
		return dataset;
	}

	/**
	 * This method creates the necessary Dataset to create a graph based on User usage information for some specific set of machines (Host)
	 * @param usageRecords UsageRecords from where to extract to the used hours
	 * @param users list of users that are going to appear in the dataset
	 * @param hosts list of selected hosts machines to be calculate the hours
	 * @return the dataset ready to make a graph
	 */
	public static DefaultCategoryDataset constructDatasetForTimeUsageVsUsersFilterByHosts(
			Set<SmartLMUsageRecordType> usageRecords, Set<UserIdentity> users,
			Set<Host> hosts) {
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(UserIdentity user: users) {
			for(Host host : hosts) {
				dataset.addValue(
						DataAggregation.determineUsageByHost(usageRecords, user, host, QueryPortlet.TYPE_ACCOUNTING),
						host.getStringValue(), 
						user.getLocalUserId());
			}
		}
		
		return dataset;
	}
	
	/**
	 * This method creates the necessary Dataset to create a graph based on User billing usage information for some specific set of machines (Host)
	 * @param usageRecords UsageRecords from where to extract to the used hours
	 * @param users list of users that are going to appear in the dataset
	 * @param hosts list of selected hosts machines to be calculate the hours
	 * @return the dataset ready to make a graph
	 */
	public static DefaultCategoryDataset constructDatasetForBillingUsageVsUsersFilterByHosts(Set<SmartLMUsageRecordType> usageRecords, Set<UserIdentity> users,	Set<Host> hosts) {
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(UserIdentity user: users) {
			for(Host host : hosts) {
				dataset.addValue(
						DataAggregation.determineUsageByHost(usageRecords, user, host, QueryPortlet.TYPE_BILLING),
						host.getStringValue(), 
						user.getLocalUserId());
			}
		}
		
		return dataset;
	}
	
	/**
	 * This method creates the necessary Dataset to create a graph based on Hosts usage information for some specific set of Users
	 * @param usageRecords UsageRecords from where to extract to the used hours
	 * @param hosts list of selected hosts machines to be calculate the hours
	 * @param users list of users that are going to appear in the dataset
	 * @return the dataset ready to make a graph
	 */
	public static DefaultCategoryDataset constructDatasetForTimeUsageVsHostsFilterByUsers(
			Set<SmartLMUsageRecordType> usageRecords, Set<Host> hosts, Set<UserIdentity> users) {
		
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(UserIdentity user: users) {
			for(Host host : hosts) {
				dataset.addValue(
						DataAggregation.determineUsageByHost(usageRecords, user, host, QueryPortlet.TYPE_ACCOUNTING),
						user.getLocalUserId(), 
						host.getStringValue());
			}
		}
		
		return dataset;
	}
	
	/**
	 * This method creates the necessary Dataset to create a graph based on Hosts billing usage information for some specific set of Users
	 * @param usageRecords UsageRecords from where to extract to the used hours
	 * @param hosts list of selected hosts machines to be calculate the hours
	 * @param users list of users that are going to appear in the dataset
	 * @return the dataset ready to make a graph
	 */
	public static DefaultCategoryDataset constructDatasetForBillingUsageVsHostsFilterByUsers(
			Set<SmartLMUsageRecordType> usageRecords, Set<Host> hosts, Set<UserIdentity> users) {
		
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(UserIdentity user: users) {
			for(Host host : hosts) {
				dataset.addValue(
						DataAggregation.determineUsageByHost(usageRecords, user, host, QueryPortlet.TYPE_BILLING),
						user.getLocalUserId(), 
						host.getStringValue());
			}
		}
		
		return dataset;
	}
	
	/**
	 * This method creates the necessary Dataset to create a graph based on User usage information for some specific set of machines (submitHost)
	 * @param usageRecords UsageRecords from where to extract to the used hours
	 * @param users list of users that are going to appear in the dataset
	 * @param submitHosts list of selected submithosts machines to be calculate the hours
	 * @return the dataset ready to make a graph
	 */
	public static DefaultCategoryDataset constructDatasetForTimeUsageVsUsersFilterBySubmitHosts(
			Set<SmartLMUsageRecordType> usageRecords, Set<UserIdentity> users,
			Set<SubmitHost> submitHosts) {
		
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(UserIdentity user: users) {
			for(SubmitHost submitHost : submitHosts) {
				dataset.addValue(
						DataAggregation.determineUsageBySubmitHost(usageRecords, user, submitHost, QueryPortlet.TYPE_ACCOUNTING), 
						submitHost.getStringValue(), 
						user.getLocalUserId());
			}
		}
		
		return dataset;
	}
	
	/**
	 * This method creates the necessary Dataset to create a graph based on User billing usage information for some specific set of machines (submitHost)
	 * @param usageRecords UsageRecords from where to extract to the used hours
	 * @param users list of users that are going to appear in the dataset
	 * @param submitHosts list of selected submithosts machines to be calculate the hours
	 * @return the dataset ready to make a graph
	 */
	public static DefaultCategoryDataset constructDatasetForBillingUsageVsUsersFilterBySubmitHosts(
			Set<SmartLMUsageRecordType> usageRecords, Set<UserIdentity> users,
			Set<SubmitHost> submitHosts) {
		
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(UserIdentity user: users) {
			for(SubmitHost submitHost : submitHosts) {
				dataset.addValue(
						DataAggregation.determineUsageBySubmitHost(usageRecords, user, submitHost, QueryPortlet.TYPE_BILLING), 
						submitHost.getStringValue(), 
						user.getLocalUserId());
			}
		}
		
		return dataset;
	}
	
	/**
	 * This method creates the necessary Dataset to create a graph based on machines (submitHost) usage information for some specific set of User 
	 * @param usageRecords UsageRecords from where to extract to the used hours
	 * @param submitHosts list of selected submithosts machines to be calculate the hours
	 * @param users list of users that are going to appear in the dataset
	 * @return the dataset ready to make a graph
	 */
	public static DefaultCategoryDataset constructDatasetForTimeUsageVsSubmitHostsFilterByUsers(
			Set<SmartLMUsageRecordType> usageRecords, Set<UserIdentity> users,
			Set<SubmitHost> submitHosts) {
		
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(UserIdentity user: users) {
			for(SubmitHost submitHost : submitHosts) {
				dataset.addValue(
						DataAggregation.determineUsageBySubmitHost(usageRecords, user, submitHost, QueryPortlet.TYPE_ACCOUNTING), 
						user.getLocalUserId(), 
						submitHost.getStringValue());
			}
		}
		
		return dataset;
	}
	
	/**
	 * This method creates the necessary Dataset to create a graph based on machines (submitHost) billing usage information for some specific set of User 
	 * @param usageRecords UsageRecords from where to extract to the used hours
	 * @param submitHosts list of selected submithosts machines to be calculate the hours
	 * @param users list of users that are going to appear in the dataset
	 * @return the dataset ready to make a graph
	 */
	public static DefaultCategoryDataset constructDatasetForBillingUsageVsSubmitHostsFilterByUsers(
			Set<SmartLMUsageRecordType> usageRecords, Set<UserIdentity> users,
			Set<SubmitHost> submitHosts) {
		
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(UserIdentity user: users) {
			for(SubmitHost submitHost : submitHosts) {
				dataset.addValue(
						DataAggregation.determineUsageBySubmitHost(usageRecords, user, submitHost, QueryPortlet.TYPE_BILLING), 
						user.getLocalUserId(), 
						submitHost.getStringValue());
			}
		}
		
		return dataset;
	}

	/**
	 * This method creates a dataset of time usage for users
	 * @param usageRecords usageRecords where to extract information
	 * @param users from where we are going to calculate the time usage
	 * @return the dataset to construct the graph.
	 */
	public static DefaultCategoryDataset constructDatasetForTimeUsageVsUsers(
			Set<SmartLMUsageRecordType> usageRecords, Set<UserIdentity> users) {
		
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(UserIdentity user: users) {
			dataset.addValue(
					DataAggregation.determineUsageForAUser(usageRecords, user, QueryPortlet.TYPE_ACCOUNTING), "category", user.getLocalUserId());
		}
		
		return dataset;
	}
	
	/**
	 * This method creates a dataset of billing usage for users
	 * @param usageRecords usageRecords where to extract information
	 * @param users from where we are going to calculate the time usage
	 * @return the dataset to construct the graph.
	 */
	public static DefaultCategoryDataset constructDatasetForBillingUsageVsUsers(Set<SmartLMUsageRecordType> usageRecords, Set<UserIdentity> users) {
		
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(UserIdentity user: users) {
			dataset.addValue(
					DataAggregation.determineUsageForAUser(usageRecords, user, QueryPortlet.TYPE_ACCOUNTING), "category", user.getLocalUserId());
		}
		
		return dataset;
	}
	
	/**
	 * This method creates a dataset of billing usage for Departments
	 * @param usageRecords usageRecords where to extract information
	 * @param accountingGroups from where we are going to calculate the time usage
	 * @return the dataset to construct the graph.
	 */
	public static DefaultCategoryDataset constructDatasetForTimeUsageVsAccountingGroup(Set<SmartLMUsageRecordType> usageRecords, Set<String> accountingGroups) {
		
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(String accountingGroup : accountingGroups) {
			dataset.addValue(
					DataAggregation.determineUsageForAnAccountingGroup(usageRecords, accountingGroup, QueryPortlet.TYPE_ACCOUNTING), 
					"category", 
					accountingGroup);
		}
		
		return dataset;
	}
	
	/**
	 * This method creates a Billing dataset of billing usage for Departments
	 * @param usageRecords usageRecords where to extract information
	 * @param accountingGroups from where we are going to calculate the time usage
	 * @return the dataset to construct the graph.
	 */
	public static DefaultCategoryDataset constructDatasetForBillingUsageVsAccountingGroup(Set<SmartLMUsageRecordType> usageRecords, Set<String> accountingGroups) {
		
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(String accountingGroup : accountingGroups) {
			dataset.addValue(
					DataAggregation.determineUsageForAnAccountingGroup(usageRecords, accountingGroup, QueryPortlet.TYPE_BILLING), 
					"category", 
					accountingGroup);
		}
		
		return dataset;
	}
	
	/**
	 * This method creates a dataset of usage for Projects
	 * @param usageRecords usageRecords where to extract information
	 * @param projectss from where we are going to calculate the time usage
	 * @return the dataset to construct the graph.
	 */
	public static DefaultCategoryDataset constructDatasetForTimeUsageVsProject(
			Set<SmartLMUsageRecordType>usageRecords, Set<ProjectName> projects) {
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(ProjectName project : projects) {
			dataset.addValue(DataAggregation.determineUsageForAProject(usageRecords, project, QueryPortlet.TYPE_ACCOUNTING), "category", project.getStringValue());
		}
		
		return dataset;
	}
	
	/**
	 * This method creates a dataset of billing usage for Projects
	 * @param usageRecords usageRecords where to extract information
	 * @param projectss from where we are going to calculate the time usage
	 * @return the dataset to construct the graph.
	 */
	public static DefaultCategoryDataset constructDatasetForBillingUsageVsProject(
			Set<SmartLMUsageRecordType>usageRecords, Set<ProjectName> projects) {
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(ProjectName project : projects) {
			dataset.addValue(DataAggregation.determineUsageForAProject(usageRecords, project, QueryPortlet.TYPE_BILLING), "category", project.getStringValue());
		}
		
		return dataset;
	}

	/**
	 * This method creates a dataset of user usage filtered by projects
	 * @param usageRecords sets of usage records
	 * @param users list of users
	 * @param projects list of projects
	 * @return dataset
	 */
	public static DefaultCategoryDataset constructDatasetForTimeUsageVsUsersFilterByProjects(
			Set<SmartLMUsageRecordType> usageRecords, Set<UserIdentity> users,
			Set<ProjectName> projects) {
		
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(UserIdentity user : users) {
			for(ProjectName project : projects) {
				dataset.addValue(
						DataAggregation.determineUsageByProject(usageRecords, user, project, QueryPortlet.TYPE_ACCOUNTING), 
						user.getLocalUserId(), 
						project.getStringValue());
			}
		}
		
		return dataset;
	}
	
	/**
	 * This method creates a dataset of user billing usage filtered by projects
	 * @param usageRecords sets of usage records
	 * @param users list of users
	 * @param projects list of projects
	 * @return dataset
	 */
	public static DefaultCategoryDataset constructDatasetForBillingUsageVsUsersFilterByProjects(Set<SmartLMUsageRecordType> usageRecords, Set<UserIdentity> users, Set<ProjectName> projects) {
		
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(UserIdentity user : users) {
			for(ProjectName project : projects) {
				dataset.addValue(
						DataAggregation.determineUsageByProject(usageRecords, user, project, QueryPortlet.TYPE_BILLING), 
						user.getLocalUserId(), 
						project.getStringValue());
			}
		}
		
		return dataset;
	}
	
	/**
	 * This method creates a dataset of project usage filtered by users
	 * @param usageRecords sets of usage records
	 * @param users list of users
	 * @param projects list of projects
	 * @return dataset
	 */
	public static DefaultCategoryDataset constructDatasetForTimeUsageVsProjectsFilterByUsers(
			Set<SmartLMUsageRecordType> usageRecords, Set<UserIdentity> users,
			Set<ProjectName> projects) {
		
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(UserIdentity user : users) {
			for(ProjectName project : projects) {
				dataset.addValue(
						DataAggregation.determineUsageByProject(usageRecords, user, project, QueryPortlet.TYPE_ACCOUNTING), 
						project.getStringValue(), 
						user.getLocalUserId());
			}
		}
		
		return dataset;
	}
	
	/**
	 * This method creates a dataset of project billing usage filtered by users
	 * @param usageRecords sets of usage records
	 * @param users list of users
	 * @param projects list of projects
	 * @return dataset
	 */
	public static DefaultCategoryDataset constructDatasetForBillingUsageVsProjectsFilterByUsers(
			Set<SmartLMUsageRecordType> usageRecords, Set<UserIdentity> users,
			Set<ProjectName> projects) {
		
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(UserIdentity user : users) {
			for(ProjectName project : projects) {
				dataset.addValue(
						DataAggregation.determineUsageByProject(usageRecords, user, project, QueryPortlet.TYPE_BILLING), 
						project.getStringValue(), 
						user.getLocalUserId());
			}
		}
		
		return dataset;
	}
	
	/**
	 * This method creates a dataset of Products usage filtered by Departments
	 * @param usageRecords UsageRecords from where to extract the information
	 * @param departments Departments from which we are interested
	 * @param products Productos from which we are interested
	 * @return the dataset
	 */
	public static DefaultCategoryDataset constructDatasetForTimeUsageVsProductsFilterByAccountingGroups(
			Set<SmartLMUsageRecordType> usageRecords, Set<String> accountingGroups,
			Set<ProductType> products) {
		
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(String accountingGroup : accountingGroups) {
			for(ProductType product : products) {
				dataset.addValue(
						DataAggregation.determineUsageForProductByAccountingGroup(usageRecords,  product, accountingGroup, QueryPortlet.TYPE_ACCOUNTING), 
						accountingGroup, 
						product.getName());
			}
		}
		
		return dataset;
	}
	
	/**
	 * This method creates a dataset of Products billing usage filtered by Departments
	 * @param usageRecords UsageRecords from where to extract the information
	 * @param departments Departments from which we are interested
	 * @param products Productos from which we are interested
	 * @return the dataset
	 */
	public static DefaultCategoryDataset constructDatasetForBillingUsageVsProductsFilterByAccountingGroups(
			Set<SmartLMUsageRecordType> usageRecords, Set<String> accountingGroups,
			Set<ProductType> products) {
		
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(String accountingGroup : accountingGroups) {
			for(ProductType product : products) {
				dataset.addValue(
						DataAggregation.determineUsageForProductByAccountingGroup(usageRecords,  product, accountingGroup, QueryPortlet.TYPE_BILLING), 
						accountingGroup, 
						product.getName());
			}
		}
		
		return dataset;
	}
	
	/**
	 * This method creates a dataset of Products usage filtered by AccountingGroups
	 * @param usageRecords UsageRecords from where to extract the information
	 * @param departments Departments from which we are interested
	 * @param products Products from which we are interested
	 * @return the dataset
	 */
	public static DefaultCategoryDataset constructDatasetForTimeUsageVsAccountingGroupFilterByProducts(
			Set<SmartLMUsageRecordType> usageRecords, Set<String> accountingGroups,
			Set<ProductType> products) {
		
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(String accountingGroup : accountingGroups) {
			for(ProductType product : products) {
				dataset.addValue(
						DataAggregation.determineUsageForProductByAccountingGroup(usageRecords, product, accountingGroup, QueryPortlet.TYPE_ACCOUNTING), 
						product.getName(), 
						accountingGroup);
			}
		}
		
		return dataset;
	}

	/**
	 * This method creates a dataset of Products billing usage filtered by AccountingGroups
	 * @param usageRecords UsageRecords from where to extract the information
	 * @param departments Departments from which we are interested
	 * @param products Products from which we are interested
	 * @return the dataset
	 */
	public static DefaultCategoryDataset constructDatasetForBillingUsageVsAccountingGroupFilterByProducts(
			Set<SmartLMUsageRecordType> usageRecords, Set<String> accountingGroups,
			Set<ProductType> products) {
		
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(String accountingGroup : accountingGroups) {
			for(ProductType product : products) {
				dataset.addValue(
						DataAggregation.determineUsageForProductByAccountingGroup(usageRecords, product, accountingGroup, QueryPortlet.TYPE_BILLING), 
						product.getName(), 
						accountingGroup);
			}
		}
		
		return dataset;
	}
	
	/**
	 * This method creates a dataset of AccountingGroups Filtered by Projects
	 * @param usageRecords Usage records from where to extract the information
	 * @param accountingGroups 
	 * @param projects
	 * @return the dataset to create a graph
	 */
	public static DefaultCategoryDataset constructDatasetForTimeUsageVsAccountingGroupFilterByProjects(
			Set<SmartLMUsageRecordType> usageRecords,
			Set<String> accountingGroups, 
			Set<ProjectName> projects) {
		
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(String accountingGroup : accountingGroups) {
			for(ProjectName project : projects) {
				dataset.addValue(
						DataAggregation.determineUsageForAnAccountingGroupFilterByProject(usageRecords,accountingGroup, project, QueryPortlet.TYPE_ACCOUNTING), 
						project.getStringValue(), 
						accountingGroup);
			}
		}
		
		return dataset;
	}
	
	/**
	 * This method creates a billing dataset of AccountingGroups Filtered by Projects
	 * @param usageRecords Usage records from where to extract the information
	 * @param accountingGroups 
	 * @param projects
	 * @return the dataset to create a graph
	 */
	public static DefaultCategoryDataset constructDatasetForBillingUsageVsAccountingGroupFilterByProjects(
			Set<SmartLMUsageRecordType> usageRecords,
			Set<String> accountingGroups, 
			Set<ProjectName> projects) {
		
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(String accountingGroup : accountingGroups) {
			for(ProjectName project : projects) {
				dataset.addValue(
						DataAggregation.determineUsageForAnAccountingGroupFilterByProject(usageRecords,accountingGroup, project, QueryPortlet.TYPE_BILLING), 
						project.getStringValue(), 
						accountingGroup);
			}
		}
		
		return dataset;
	}

	/**
	 * This method creates a dataset of Projectss Filtered by AccountingGroups
	 * @param usageRecords Usage records from where to extract the information
	 * @param accountingGroups 
	 * @param projects
	 * @return the dataset to create a graph
	 */
	public static DefaultCategoryDataset constructDatasetForTimeUsageVsProjectsFilterByAccountingGroups(
			Set<SmartLMUsageRecordType> usageRecords,
			Set<String> accountingGroups, 
			Set<ProjectName> projects) {

		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(String accountingGroup : accountingGroups) {
			for(ProjectName project : projects) {
				dataset.addValue(
						DataAggregation.determineUsageForAnAccountingGroupFilterByProject(usageRecords,accountingGroup, project, QueryPortlet.TYPE_ACCOUNTING), 
						accountingGroup,
						project.getStringValue());
			}
		}
		
		return dataset;
	}
	
	/**
	 * This method creates a billing dataset of Projects Filtered by AccountingGroups
	 * @param usageRecords Usage records from where to extract the information
	 * @param accountingGroups 
	 * @param projects
	 * @return the dataset to create a graph
	 */
	public static DefaultCategoryDataset constructDatasetForBillingUsageVsProjectsFilterByAccountingGroups(
			Set<SmartLMUsageRecordType> usageRecords,
			Set<String> accountingGroups, 
			Set<ProjectName> projects) {

		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(String accountingGroup : accountingGroups) {
			for(ProjectName project : projects) {
				dataset.addValue(
						DataAggregation.determineUsageForAnAccountingGroupFilterByProject(usageRecords,accountingGroup, project, QueryPortlet.TYPE_BILLING), 
						accountingGroup,
						project.getStringValue());
			}
		}
		
		return dataset;
	}
	
	/**
	 * It creates a dataset of SubmitHosts filter by AccountingGroups
	 * @param smartLMUsageRecords
	 * @param submitHosts
	 * @param accountingGroups
	 * @return
	 */
	public static DefaultCategoryDataset constructDatasetForTimeUsageVsSubmitHostFilterByAccountingGroup(
			Set<SmartLMUsageRecordType> usageRecords,
			Set<SubmitHost> submitHosts, 
			Set<String> accountingGroups) {

		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(String accountingGroup : accountingGroups) {
			for(SubmitHost submitHost : submitHosts) {
				dataset.addValue(
						DataAggregation.determineUsageByAccountingGroupFilterBySubmitHost(usageRecords, accountingGroup, submitHost, QueryPortlet.TYPE_ACCOUNTING), 
						accountingGroup,
						submitHost.getStringValue());
			}
		}
		
		return dataset;
	}
	
	/**
	 * It creates a Billing dataset of SubmitHosts filter by AccountingGroups
	 * @param smartLMUsageRecords
	 * @param submitHosts
	 * @param accountingGroups
	 * @return
	 */
	public static DefaultCategoryDataset constructDatasetForBillingUsageVsSubmitHostFilterByAccountingGroup(
			Set<SmartLMUsageRecordType> usageRecords,
			Set<SubmitHost> submitHosts, 
			Set<String> accountingGroups) {

		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(String accountingGroup : accountingGroups) {
			for(SubmitHost submitHost : submitHosts) {
				dataset.addValue(
						DataAggregation.determineUsageByAccountingGroupFilterBySubmitHost(usageRecords, accountingGroup, submitHost, QueryPortlet.TYPE_BILLING), 
						accountingGroup,
						submitHost.getStringValue());
			}
		}
		
		return dataset;
	}

	/**
	 * It creates a dataset of AccountingGroups filter by SubmitHosts
	 * @param smartLMUsageRecords
	 * @param submitHosts
	 * @param accountingGroups
	 * @return the usage dataset
	 */
	public static DefaultCategoryDataset constructDatasetForTimeUsageVsAccountingGroupFilterBySubmitHost(
			Set<SmartLMUsageRecordType> usageRecords,
			Set<SubmitHost> submitHosts, 
			Set<String> accountingGroups) {

		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(String accountingGroup : accountingGroups) {
			for(SubmitHost submitHost : submitHosts) {
				dataset.addValue(
						DataAggregation.determineUsageByAccountingGroupFilterBySubmitHost(usageRecords, accountingGroup, submitHost, QueryPortlet.TYPE_ACCOUNTING), 
						submitHost.getStringValue(),
						accountingGroup);
			}
		}
		
		return dataset;
	}
	
	/**
	 * It creates a billing dataset of AccountingGroups filter by SubmitHosts
	 * @param smartLMUsageRecords
	 * @param submitHosts
	 * @param accountingGroups
	 * @return the billing dataset
	 */
	public static DefaultCategoryDataset constructDatasetForBillingUsageVsAccountingGroupFilterBySubmitHost(
			Set<SmartLMUsageRecordType> usageRecords,
			Set<SubmitHost> submitHosts, 
			Set<String> accountingGroups) {

		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(String accountingGroup : accountingGroups) {
			for(SubmitHost submitHost : submitHosts) {
				dataset.addValue(
						DataAggregation.determineUsageByAccountingGroupFilterBySubmitHost(usageRecords, accountingGroup, submitHost, QueryPortlet.TYPE_BILLING), 
						submitHost.getStringValue(),
						accountingGroup);
			}
		}
		
		return dataset;
	}
	
	/**
	 * It creates a dataset of Products filtered by Projects
	 * @param usageRecords UsageRecords from where to extract the information
	 * @param projects Projects from which we are interested
	 * @param products Products from which we are interested
	 * @return the dateset
	 */
	public static DefaultCategoryDataset constructDatasetForTimeUsageVsProductsFilterByProjects(
			Set<SmartLMUsageRecordType> usageRecords,
			Set<ProjectName> projects, 
			Set<ProductType> products) {
		
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(ProjectName project : projects) {
			for(ProductType product : products) {
				dataset.addValue(
						DataAggregation.determineUsageByProductFilterByProject(usageRecords, product, project, QueryPortlet.TYPE_ACCOUNTING),
						project.getStringValue(),
						product.getName());
			}
		}
		
		return dataset;
	}
	
	/**
	 * It creates a billing dataset of Products filtered by Projects
	 * @param usageRecords UsageRecords from where to extract the information
	 * @param projects Projects from which we are interested
	 * @param products Products from which we are interested
	 * @return the dateset
	 */
	public static DefaultCategoryDataset constructDatasetForBillingUsageVsProductsFilterByProjects(
			Set<SmartLMUsageRecordType> usageRecords,
			Set<ProjectName> projects, 
			Set<ProductType> products) {
		
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(ProjectName project : projects) {
			for(ProductType product : products) {
				dataset.addValue(
						DataAggregation.determineUsageByProductFilterByProject(usageRecords, product, project, QueryPortlet.TYPE_BILLING),
						project.getStringValue(),
						product.getName());
			}
		}
		
		return dataset;
	}
	
	/**
	 * It creates a dataset of Products filtered by Projects
	 * @param usageRecords UsageRecords from where to extract the information
	 * @param projects Projects from which we are interested
	 * @param products Products from which we are interested
	 * @return the dateset
	 */
	public static DefaultCategoryDataset constructDatasetForTimeUsageVsProjectsFilterByProducts(
			Set<SmartLMUsageRecordType> 
			usageRecords,
			Set<ProjectName> projects, 
			Set<ProductType> products) {

		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(ProjectName project : projects) {
			for(ProductType product : products) {
				dataset.addValue(
						DataAggregation.determineUsageByProductFilterByProject(usageRecords, product, project, QueryPortlet.TYPE_ACCOUNTING),
						product.getName(),
						project.getStringValue());
			}
		}
		
		return dataset;
	}
	
	/**
	 * It creates a billing dataset of Products filtered by Projects
	 * @param usageRecords UsageRecords from where to extract the information
	 * @param projects Projects from which we are interested
	 * @param products Products from which we are interested
	 * @return the billing dateset
	 */
	public static DefaultCategoryDataset constructDatasetForBillingUsageVsProjectsFilterByProducts(
			Set<SmartLMUsageRecordType> 
			usageRecords,
			Set<ProjectName> projects, 
			Set<ProductType> products) {

		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(ProjectName project : projects) {
			for(ProductType product : products) {
				dataset.addValue(
						DataAggregation.determineUsageByProductFilterByProject(usageRecords, product, project, QueryPortlet.TYPE_BILLING),
						product.getName(),
						project.getStringValue());
			}
		}
		
		return dataset;
	}

	/**
	 * It creates a Dataset of SubmitHosts filtered by Products
	 * @param usageRecords Usage records from where to extract the information
	 * @param submitHosts Hosts from which we are interested
	 * @param products Products from which we are interested
	 * @return the dataset to create the graph
	 */
	public static DefaultCategoryDataset constructDatasetForTimeUsageVsSubmitHostsFilterByProducts(
			Set<SmartLMUsageRecordType> usageRecords, 
			Set<SubmitHost> submitHosts,
			Set<ProductType> products) {

		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(SubmitHost submitHost : submitHosts) {
			for(ProductType product : products) {
				dataset.addValue(
						DataAggregation.determineUsageByProductFilterBySubmitHost(usageRecords, product, submitHost, QueryPortlet.TYPE_ACCOUNTING),
						product.getName(),
						submitHost.getStringValue());
			}
		}
		return dataset;
	}
	
	/**
	 * It creates a Billing Dataset of SubmitHosts filtered by Products
	 * @param usageRecords Usage records from where to extract the information
	 * @param submitHosts Hosts from which we are interested
	 * @param products Products from which we are interested
	 * @return the dataset to create the graph
	 */
	public static DefaultCategoryDataset constructDatasetForBillingUsageVsSubmitHostsFilterByProducts(
			Set<SmartLMUsageRecordType> usageRecords, 
			Set<SubmitHost> submitHosts,
			Set<ProductType> products) {

		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(SubmitHost submitHost : submitHosts) {
			for(ProductType product : products) {
				dataset.addValue(
						DataAggregation.determineUsageByProductFilterBySubmitHost(usageRecords, product, submitHost, QueryPortlet.TYPE_BILLING),
						product.getName(),
						submitHost.getStringValue());
			}
		}
		return dataset;
	}
	
	/**
	 * It creates a Dataset of Host usage filter by accountingGroups
	 * @param usageRecords
	 * @param hosts
	 * @param accountingGroups
	 * @return the dataset
	 */
	public static DefaultCategoryDataset constructDatasetForTimeUsageVsHostFilterByAccountingGroup(
			Set<SmartLMUsageRecordType> usageRecords, 
			Set<Host> hosts,
			Set<String> accountingGroups) {

		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(Host host : hosts) {
			for(String accountingGroup : accountingGroups) {
				dataset.addValue(
						DataAggregation.determineUsageByAccountingGroupFilterByHost(usageRecords, accountingGroup, host, QueryPortlet.TYPE_ACCOUNTING),
						accountingGroup,
						host.getStringValue());
			}
		}
		return dataset;
	}
	
	/**
	 * It creates a Billing Dataset of Host usage filter by accountingGroups
	 * @param usageRecords
	 * @param hosts
	 * @param accountingGroups
	 * @return the dataset
	 */
	public static DefaultCategoryDataset constructDatasetForBillingUsageVsHostFilterByAccountingGroup(
			Set<SmartLMUsageRecordType> usageRecords, 
			Set<Host> hosts,
			Set<String> accountingGroups) {

		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(Host host : hosts) {
			for(String accountingGroup : accountingGroups) {
				dataset.addValue(
						DataAggregation.determineUsageByAccountingGroupFilterByHost(usageRecords, accountingGroup, host, QueryPortlet.TYPE_BILLING),
						accountingGroup,
						host.getStringValue());
			}
		}
		return dataset;
	}

	/**
	 * It creates a Dataset of AccountingGroups filter by Hosts
	 * @param smartLMUsageRecords
	 * @param hosts
	 * @param accountingGroups
	 * @return
	 */
	public static DefaultCategoryDataset constructDatasetForTimeUsageVsAccountingGroupFilterByHost(
			Set<SmartLMUsageRecordType> usageRecords, 
			Set<Host> hosts,
			Set<String> accountingGroups) {
		
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(Host host : hosts) {
			for(String accountingGroup : accountingGroups) {
				dataset.addValue(
						DataAggregation.determineUsageByAccountingGroupFilterByHost(usageRecords, accountingGroup, host, QueryPortlet.TYPE_ACCOUNTING),
						host.getStringValue(),
						accountingGroup);
			}
		}
		return dataset;
	}
	
	/**
	 * It creates a Billing Dataset of AccountingGroups filter by Hosts
	 * @param smartLMUsageRecords
	 * @param hosts
	 * @param accountingGroups
	 * @return
	 */
	public static DefaultCategoryDataset constructDatasetForBillingUsageVsAccountingGroupFilterByHost(
			Set<SmartLMUsageRecordType> usageRecords, 
			Set<Host> hosts,
			Set<String> accountingGroups) {
		
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(Host host : hosts) {
			for(String accountingGroup : accountingGroups) {
				dataset.addValue(
						DataAggregation.determineUsageByAccountingGroupFilterByHost(usageRecords, accountingGroup, host, QueryPortlet.TYPE_BILLING),
						host.getStringValue(),
						accountingGroup);
			}
		}
		return dataset;
	}

	/**
	 * It creates a Dataset of Products filtered by SubmitHosts
	 * @param usageRecords Usage records from where to extract the information
	 * @param submitHosts Hosts from which we are interested
	 * @param products Products from which we are interested
	 * @return the dataset to create the graph
	 */
	public static DefaultCategoryDataset constructDatasetForTimeUsageVsProductsFilterBySubmitHosts(
			Set<SmartLMUsageRecordType> usageRecords, 
			Set<SubmitHost> submitHosts,
			Set<ProductType> products) {

		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(SubmitHost submitHost : submitHosts) {
			for(ProductType product : products) {
				dataset.addValue(
						DataAggregation.determineUsageByProductFilterBySubmitHost(usageRecords, product, submitHost, QueryPortlet.TYPE_ACCOUNTING),
						submitHost.getStringValue(),
						product.getName());
			}
		}
		return dataset;
	}
	
	/**
	 * It creates a Billing Dataset of Products filtered by SubmitHosts
	 * @param usageRecords Usage records from where to extract the information
	 * @param submitHosts Hosts from which we are interested
	 * @param products Products from which we are interested
	 * @return the dataset to create the graph
	 */
	public static DefaultCategoryDataset constructDatasetForBillingUsageVsProductsFilterBySubmitHosts(
			Set<SmartLMUsageRecordType> usageRecords, 
			Set<SubmitHost> submitHosts,
			Set<ProductType> products) {

		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(SubmitHost submitHost : submitHosts) {
			for(ProductType product : products) {
				dataset.addValue(
						DataAggregation.determineUsageByProductFilterBySubmitHost(usageRecords, product, submitHost, QueryPortlet.TYPE_BILLING),
						submitHost.getStringValue(),
						product.getName());
			}
		}
		return dataset;
	}

	/**
	 * It creates a Dataset of Hosts filtered by Products
	 * @param usageRecords Usage records from where to extract the information
	 * @param hosts Hosts from which we are interested
	 * @param products Products from which we are interested
	 * @return the datase to create the graph
	 */
	public static DefaultCategoryDataset constructDatasetForTimeUsageVsHostsFilterByProducts(
			Set<SmartLMUsageRecordType> usageRecords, 
			Set<Host> hosts,
			Set<ProductType> products) {

		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(Host host : hosts) {
			for(ProductType product : products) {
				dataset.addValue(
						DataAggregation.determineUsageByProductFilterByHost(usageRecords, product, host, QueryPortlet.TYPE_ACCOUNTING),
						product.getName(),
						host.getStringValue());
			}
		}
		return dataset;
	}
	
	/**
	 * It creates a Billing Dataset of Hosts filtered by Products
	 * @param usageRecords Usage records from where to extract the information
	 * @param hosts Hosts from which we are interested
	 * @param products Products from which we are interested
	 * @return the datase to create the graph
	 */
	public static DefaultCategoryDataset constructDatasetForBillingUsageVsHostsFilterByProducts(
			Set<SmartLMUsageRecordType> usageRecords, 
			Set<Host> hosts,
			Set<ProductType> products) {

		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(Host host : hosts) {
			for(ProductType product : products) {
				dataset.addValue(
						DataAggregation.determineUsageByProductFilterByHost(usageRecords, product, host, QueryPortlet.TYPE_BILLING),
						product.getName(),
						host.getStringValue());
			}
		}
		return dataset;
	}

	/**
	 * It creates a Dataset of Products filtered by Hosts
	 * @param usageRecords Usage records from where to extract the information
	 * @param hosts Hosts from which we are interested
	 * @param products Products from which we are interested
	 * @return the datase to create the graph
	 */
	public static DefaultCategoryDataset constructDatasetForTimeUsageVsProductsFilterByHosts(
			Set<SmartLMUsageRecordType> usageRecords, 
			Set<Host> hosts,
			Set<ProductType> products) {
		
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(Host host : hosts) {
			for(ProductType product : products) {
				dataset.addValue(
						DataAggregation.determineUsageByProductFilterByHost(usageRecords, product, host, QueryPortlet.TYPE_ACCOUNTING),
						host.getStringValue(),
						product.getName());
			}
		}
		return dataset;
	}
	
	/**
	 * It creates a Billing Dataset of Products filtered by Hosts
	 * @param usageRecords Usage records from where to extract the information
	 * @param hosts Hosts from which we are interested
	 * @param products Products from which we are interested
	 * @return the datase to create the graph
	 */
	public static DefaultCategoryDataset constructDatasetForBillingUsageVsProductsFilterByHosts(
			Set<SmartLMUsageRecordType> usageRecords, 
			Set<Host> hosts,
			Set<ProductType> products) {
		
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(Host host : hosts) {
			for(ProductType product : products) {
				dataset.addValue(
						DataAggregation.determineUsageByProductFilterByHost(usageRecords, product, host, QueryPortlet.TYPE_BILLING),
						host.getStringValue(),
						product.getName());
			}
		}
		return dataset;
	}

	/**
	 * It creates a Dataset of Projects filtered by Hosts
	 * @param usageRecords
	 * @param hosts
	 * @param projects
	 * @return the dataset to create the graph
	 */
	public static DefaultCategoryDataset constructDatasetForTimeUsageVsProjectFilterByHosts(
			Set<SmartLMUsageRecordType> usageRecords, 
			Set<Host> hosts,
			Set<ProjectName> projects) {

		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(Host host : hosts) {
			for(ProjectName project : projects) {
				dataset.addValue(
						DataAggregation.determineUsageByProjectFilterByHost(usageRecords, project, host, QueryPortlet.TYPE_ACCOUNTING),
						host.getStringValue(),
						project.getStringValue());
			}
		}
		return dataset;
	}
	
	/**
	 * It creates a Billing Dataset of Projects filtered by Hosts
	 * @param usageRecords
	 * @param hosts
	 * @param projects
	 * @return the dataset to create the graph
	 */
	public static DefaultCategoryDataset constructDatasetForBillingUsageVsProjectFilterByHosts(
			Set<SmartLMUsageRecordType> usageRecords, 
			Set<Host> hosts,
			Set<ProjectName> projects) {

		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(Host host : hosts) {
			for(ProjectName project : projects) {
				dataset.addValue(
						DataAggregation.determineUsageByProjectFilterByHost(usageRecords, project, host, QueryPortlet.TYPE_BILLING),
						host.getStringValue(),
						project.getStringValue());
			}
		}
		return dataset;
	}

	/**
	 * It creates a Dataset of Hosts filtered by Projects
	 * @param usageRecords
	 * @param hosts
	 * @param projects
	 * @return the dataset to create the graph
	 */
	public static DefaultCategoryDataset constructDatasetForTimeUsageVsHostFilterByProjects(
			Set<SmartLMUsageRecordType> usageRecords, 
			Set<Host> hosts,
			Set<ProjectName> projects) {

		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(Host host : hosts) {
			for(ProjectName project : projects) {
				dataset.addValue(
						DataAggregation.determineUsageByProjectFilterByHost(usageRecords, project, host, QueryPortlet.TYPE_ACCOUNTING),
						project.getStringValue(),
						host.getStringValue());
			}
		}
		return dataset;
	}

	/**
	 * It creates a Billing Dataset of Hosts filtered by Projects
	 * @param usageRecords
	 * @param hosts
	 * @param projects
	 * @return the dataset to create the graph
	 */
	public static DefaultCategoryDataset constructDatasetForBillingUsageVsHostFilterByProjects(
			Set<SmartLMUsageRecordType> usageRecords, 
			Set<Host> hosts,
			Set<ProjectName> projects) {

		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(Host host : hosts) {
			for(ProjectName project : projects) {
				dataset.addValue(
						DataAggregation.determineUsageByProjectFilterByHost(usageRecords, project, host, QueryPortlet.TYPE_BILLING),
						project.getStringValue(),
						host.getStringValue());
			}
		}
		return dataset;
	}
	
	/**
	 * It creates a Dataset of Projects Filtered by SumbitHosts
	 * @param usageRecords
	 * @param submitHosts
	 * @param projects
	 * @return the dataset to create the graph
	 */
	public static DefaultCategoryDataset constructDatasetForTimeUsageVsProjectFilterBySubmitHosts(
			Set<SmartLMUsageRecordType> usageRecords,
			Set<SubmitHost> submitHosts, 
			Set<ProjectName> projects) {
		
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(SubmitHost submitHost : submitHosts) {
			for(ProjectName project : projects) {
				dataset.addValue(
						DataAggregation.determineUsageByProjectFilterBySubmitHost(usageRecords, project, submitHost, QueryPortlet.TYPE_ACCOUNTING),
						submitHost.getStringValue(),
						project.getStringValue());
			}
		}
		return dataset;
	}
	
	/**
	 * It creates a Billing Dataset of Projects Filtered by SumbitHosts
	 * @param usageRecords
	 * @param submitHosts
	 * @param projects
	 * @return the dataset to create the graph
	 */
	public static DefaultCategoryDataset constructDatasetForBillingUsageVsProjectFilterBySubmitHosts(
			Set<SmartLMUsageRecordType> usageRecords,
			Set<SubmitHost> submitHosts, 
			Set<ProjectName> projects) {
		
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(SubmitHost submitHost : submitHosts) {
			for(ProjectName project : projects) {
				dataset.addValue(
						DataAggregation.determineUsageByProjectFilterBySubmitHost(usageRecords, project, submitHost, QueryPortlet.TYPE_BILLING),
						submitHost.getStringValue(),
						project.getStringValue());
			}
		}
		return dataset;
	}

	/**
	 * It creates a Dataset of SubmitHost Filtered by Projects
	 * @param usageRecords
	 * @param submitHosts
	 * @param projects
	 * @return the dataset to create the graph
	 */
	public static DefaultCategoryDataset constructDatasetForTimeUsageVsSumitHostFilterByProjects(
			Set<SmartLMUsageRecordType> usageRecords,
			Set<SubmitHost> submitHosts, 
			Set<ProjectName> projects) {
		
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(SubmitHost submitHost : submitHosts) {
			for(ProjectName project : projects) {
				dataset.addValue(
						DataAggregation.determineUsageByProjectFilterBySubmitHost(usageRecords, project, submitHost, QueryPortlet.TYPE_ACCOUNTING),
						project.getStringValue(),
						submitHost.getStringValue());
			}
		}
		return dataset;
	}
	
	/**
	 * It creates a Billing Dataset of SubmitHost Filtered by Projects
	 * @param usageRecords
	 * @param submitHosts
	 * @param projects
	 * @return the dataset to create the graph
	 */
	public static DefaultCategoryDataset constructDatasetForBillingUsageVsSumitHostFilterByProjects(
			Set<SmartLMUsageRecordType> usageRecords,
			Set<SubmitHost> submitHosts, 
			Set<ProjectName> projects) {
		
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(SubmitHost submitHost : submitHosts) {
			for(ProjectName project : projects) {
				dataset.addValue(
						DataAggregation.determineUsageByProjectFilterBySubmitHost(usageRecords, project, submitHost, QueryPortlet.TYPE_BILLING),
						project.getStringValue(),
						submitHost.getStringValue());
			}
		}
		return dataset;
	}

	/**
	 * It creates a Dataset of Hosts time usage
	 * @param smartLMUsageRecords
	 * @param hosts
	 * @return
	 */
	public static DefaultCategoryDataset constructDatasetForTimeUsageForAHost(
			Set<SmartLMUsageRecordType> usageRecords, 
			Set<Host> hosts) {
		
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(Host host : hosts) {
			dataset.addValue(DataAggregation.determineUsageForAHost(usageRecords, host, QueryPortlet.TYPE_ACCOUNTING), "category", host.getStringValue());
			
		}
		
		return dataset;
	}
	
	/**
	 * It creates a Dataset of Hosts time usage
	 * @param smartLMUsageRecords
	 * @param hosts
	 * @return
	 */
	public static DefaultCategoryDataset constructDatasetForBillingUsageForAHost(
			Set<SmartLMUsageRecordType> usageRecords, 
			Set<Host> hosts) {
		
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(Host host : hosts) {
			dataset.addValue(DataAggregation.determineUsageForAHost(usageRecords, host, QueryPortlet.TYPE_ACCOUNTING), "category", host.getStringValue());
			
		}
		
		return dataset;
	}

	/**
	 * It creates a Dataset of SubmitHosts time usage
	 * @param usageRecords
	 * @param submitHosts
	 * @return
	 */
	public static DefaultCategoryDataset constructDatasetForTimeUsageForASubmitHost(
			Set<SmartLMUsageRecordType> usageRecords,
			Set<SubmitHost> submitHosts) {
		
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(SubmitHost submitHost : submitHosts) {
			dataset.addValue(DataAggregation.determineUsageForASubmitHost(usageRecords, submitHost, QueryPortlet.TYPE_ACCOUNTING), "category", submitHost.getStringValue());	
		}
		
		return dataset;
	}
	
	/**
	 * It creates a Billing Dataset of SubmitHosts time usage
	 * @param usageRecords
	 * @param submitHosts
	 * @return
	 */
	public static DefaultCategoryDataset constructDatasetForBillingUsageForASubmitHost(
			Set<SmartLMUsageRecordType> usageRecords,
			Set<SubmitHost> submitHosts) {
		
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		for(SubmitHost submitHost : submitHosts) {
			dataset.addValue(DataAggregation.determineUsageForASubmitHost(usageRecords, submitHost, QueryPortlet.TYPE_BILLING), "category", submitHost.getStringValue());	
		}
		
		return dataset;
	}
}

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

Powered By FusionForge