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 usageRecords, Set users, Set 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 usageRecords, Set users, Set 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 usageRecords, Set 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 usageRecords, Set users, Set 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 usageRecords, Set users, Set 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 usageRecords, Set accountingGroups, Set 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 usageRecords, Set accountingGroups, Set 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 usageRecords, Set users, Set 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 usageRecords, Set users, Set 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 usageRecords, Set hosts, Set 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 usageRecords, Set hosts, Set 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 usageRecords, Set users, Set 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 usageRecords, Set users, Set 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 usageRecords, Set users, Set 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 usageRecords, Set users, Set 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 usageRecords, Set 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 usageRecords, Set 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 usageRecords, Set 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 usageRecords, Set 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( SetusageRecords, Set 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( SetusageRecords, Set 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 usageRecords, Set users, Set 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 usageRecords, Set users, Set 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 usageRecords, Set users, Set 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 usageRecords, Set users, Set 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 usageRecords, Set accountingGroups, Set 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 usageRecords, Set accountingGroups, Set 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 usageRecords, Set accountingGroups, Set 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 usageRecords, Set accountingGroups, Set 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 usageRecords, Set accountingGroups, Set 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 usageRecords, Set accountingGroups, Set 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 usageRecords, Set accountingGroups, Set 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 usageRecords, Set accountingGroups, Set 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 usageRecords, Set submitHosts, Set 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 usageRecords, Set submitHosts, Set 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 usageRecords, Set submitHosts, Set 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 usageRecords, Set submitHosts, Set 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 usageRecords, Set projects, Set 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 usageRecords, Set projects, Set 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 usageRecords, Set projects, Set 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 usageRecords, Set projects, Set 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 usageRecords, Set submitHosts, Set 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 usageRecords, Set submitHosts, Set 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 usageRecords, Set hosts, Set 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 usageRecords, Set hosts, Set 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 usageRecords, Set hosts, Set 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 usageRecords, Set hosts, Set 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 usageRecords, Set submitHosts, Set 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 usageRecords, Set submitHosts, Set 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 usageRecords, Set hosts, Set 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 usageRecords, Set hosts, Set 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 usageRecords, Set hosts, Set 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 usageRecords, Set hosts, Set 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 usageRecords, Set hosts, Set 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 usageRecords, Set hosts, Set 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 usageRecords, Set hosts, Set 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 usageRecords, Set hosts, Set 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 usageRecords, Set submitHosts, Set 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 usageRecords, Set submitHosts, Set 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 usageRecords, Set submitHosts, Set 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 usageRecords, Set submitHosts, Set 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 usageRecords, Set 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 usageRecords, Set 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 usageRecords, Set 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 usageRecords, Set submitHosts) { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); for(SubmitHost submitHost : submitHosts) { dataset.addValue(DataAggregation.determineUsageForASubmitHost(usageRecords, submitHost, QueryPortlet.TYPE_BILLING), "category", submitHost.getStringValue()); } return dataset; } }