package eu.smartlm.abs.portal.data.query;
import java.util.Date;
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 eu.smartlm.schemas.x2009.x06.urec.FeatureType;
import eu.smartlm.schemas.x2009.x06.urec.ProductType;
import eu.smartlm.schemas.x2009.x06.urec.SmartLMUsageRecordType;
/**
* This interface defines the different necessary methods to construct the query and retrive the
* data form the Interface to EBS/Portal
* @author David García Pérez - CESGA
*
*/
public interface QueryConstructor {
/**
* Set-ups the url of the connection to get the data
* @param url
* @param cCtx
*/
public void setUpConnection(String url, String rampartRepo, String clientProperties);
/**
* Retrieves a collection of users from the database
* @param startDate delimiters users that have usagerecords starting from this date (null if no filter is applied)
* @param endDate delimiters users that have usagerecords ending from this date (null if no filter is applied)
* @param filterByUsers List of <code>localUserId</code> to reduce the search space (null if no filter is applied)
* @param filterByProduct List of <code>productId</code> to reduce the search space (null if no filter is applied)
* @param filterByProject List of <code>ProjectName</code> to reduce the search space (null if no filter is applied)
* @param filterByHost List of hosts names to reduce the search space (null if no filter is applied)
* @param filterBySubmitHost List of submithost names to reduce the search space (null if no filter is applied)
* @param filterByFeature List of features names to reduce the search space (null if no filter is applied)
* @param filterByAccountingGroups List of accounting groups names to reduce the search space (null if no filter is applied)
* @return a list of users (empty if no user matching the search criteria is found).
*/
public Set<UserIdentity> getListOfUsers(
Date startDate,
Date endDate,
Set<String> filterByUsers,
Set<String> filterByProduct,
Set<String> filterByProject,
Set<String> filterByHost,
Set<String> filterBySubmitHost,
Set<String> filterByFeature,
Set<String> filterByAccountingGroups);
/**
* Retrieves a collection of products from the database
* @param startDate delimiters users that have usagerecords starting from this date (null if no filter is applied)
* @param endDate delimiters users that have usagerecords ending from this date (null if no filter is applied)
* @param filterByUsers List of <code>localUserId</code> to reduce the search space (null if no filter is applied)
* @param filterByProduct List of <code>productId</code> to reduce the search space (null if no filter is applied)
* @param filterByProject List of <code>ProjectName</code> to reduce the search space (null if no filter is applied)
* @param filterByHost List of hosts names to reduce the search space (null if no filter is applied)
* @param filterBySubmitHost List of submithost names to reduce the search space (null if no filter is applied)
* @param filterByFeature List of features names to reduce the search space (null if no filter is applied)
* @param filterByAccountingGroups List of accounting groups names to reduce the search space (null if no filter is applied)
* @return a list of projects (empty if no user matching the search criteria is found).
*/
public Set<ProductType> getListOfProducts(
Date startDate,
Date endDate,
Set<String> filterByUsers,
Set<String> filterByProduct,
Set<String> filterByProject,
Set<String> filterByHost,
Set<String> filterBySubmitHost,
Set<String> filterByFeature,
Set<String> filterByAccountingGroups);
/**
* Retrieves a collection of projects from the database
* @param startDate delimiters users that have usagerecords starting from this date (null if no filter is applied)
* @param endDate delimiters users that have usagerecords ending from this date (null if no filter is applied)
* @param filterByUsers List of <code>localUserId</code> to reduce the search space (null if no filter is applied)
* @param filterByProduct List of <code>productId</code> to reduce the search space (null if no filter is applied)
* @param filterByProject List of <code>ProjectName</code> to reduce the search space (null if no filter is applied)
* @param filterByHost List of hosts names to reduce the search space (null if no filter is applied)
* @param filterBySubmitHost List of submithost names to reduce the search space (null if no filter is applied)
* @param filterByFeature List of features names to reduce the search space (null if no filter is applied)
* @param filterByAccountingGroups List of accounting groups names to reduce the search space (null if no filter is applied)
* @return a list of projects (empty if no user matching the search criteria is found).
*/
public Set<ProjectName> getListOfProjects(
Date startDate,
Date endDate,
Set<String> filterByUsers,
Set<String> filterByProduct,
Set<String> filterByProject,
Set<String> filterByHost,
Set<String> filterBySubmitHost,
Set<String> filterByFeature,
Set<String> filterByAccountingGroups);
/**
* Retrieves a collection of hosts from the database
* @param startDate delimiters users that have usagerecords starting from this date (null if no filter is applied)
* @param endDate delimiters users that have usagerecords ending from this date (null if no filter is applied)
* @param filterByUsers List of <code>localUserId</code> to reduce the search space (null if no filter is applied)
* @param filterByProduct List of <code>productId</code> to reduce the search space (null if no filter is applied)
* @param filterByProject List of <code>ProjectName</code> to reduce the search space (null if no filter is applied)
* @param filterByHost List of hosts names to reduce the search space (null if no filter is applied)
* @param filterBySubmitHost List of submithost names to reduce the search space (null if no filter is applied)
* @param filterByFeature List of features names to reduce the search space (null if no filter is applied)
* @param filterByAccountingGroups List of accounting groups names to reduce the search space (null if no filter is applied)
* @return a list of hosts (empty if no user matching the search criteria is found).
*/
public Set<Host> getListOfHosts(
Date startDate,
Date endDate,
Set<String> filterByUsers,
Set<String> filterByProduct,
Set<String> filterByProject,
Set<String> filterByHost,
Set<String> filterBySubmitHost,
Set<String> filterByFeature,
Set<String> filterByAccountingGroups);
/**
* Retrieves a collection of submithosts from the database
* @param startDate delimiters users that have usagerecords starting from this date (null if no filter is applied)
* @param endDate delimiters users that have usagerecords ending from this date (null if no filter is applied)
* @param filterByUsers List of <code>localUserId</code> to reduce the search space (null if no filter is applied)
* @param filterByProduct List of <code>productId</code> to reduce the search space (null if no filter is applied)
* @param filterByProject List of <code>ProjectName</code> to reduce the search space (null if no filter is applied)
* @param filterByHost List of hosts names to reduce the search space (null if no filter is applied)
* @param filterBySubmitHost List of submithost names to reduce the search space (null if no filter is applied)
* @param filterByFeature List of features names to reduce the search space (null if no filter is applied)
* @param filterByAccountingGroups List of accounting groups names to reduce the search space (null if no filter is applied)
* @return a list of submitHosts (empty if no user matching the search criteria is found).
*/
public Set<SubmitHost> getListOfSubmitHosts(
Date startDate,
Date endDate,
Set<String> filterByUsers,
Set<String> filterByProduct,
Set<String> filterByProject,
Set<String> filterByHost,
Set<String> filterBySubmitHost,
Set<String> filterByFeature,
Set<String> filterByAccountingGroups);
/**
* Retrieves a collection of features from the database
* @param startDate delimiters users that have usagerecords starting from this date (null if no filter is applied)
* @param endDate delimiters users that have usagerecords ending from this date (null if no filter is applied)
* @param filterByUsers List of <code>localUserId</code> to reduce the search space (null if no filter is applied)
* @param filterByProduct List of <code>productId</code> to reduce the search space (null if no filter is applied)
* @param filterByProject List of <code>ProjectName</code> to reduce the search space (null if no filter is applied)
* @param filterByHost List of hosts names to reduce the search space (null if no filter is applied)
* @param filterBySubmitHost List of submithost names to reduce the search space (null if no filter is applied)
* @param filterByFeature List of features names to reduce the search space (null if no filter is applied)
* @param filterByAccountingGroups List of accounting groups names to reduce the search space (null if no filter is applied)
* @return a list of features (empty if no user matching the search criteria is found).
*/
public Set<FeatureType> getListOfSubmitFeatures(
Date startDate,
Date endDate,
Set<String> filterByUsers,
Set<String> filterByProduct,
Set<String> filterByProject,
Set<String> filterByHost,
Set<String> filterBySubmitHost,
Set<String> filterByFeature,
Set<String> filterByAccountingGroups);
/**
* Retrieves a collection of AccountingGroups from the database
* @param startDate delimiters users that have usagerecords starting from this date (null if no filter is applied)
* @param endDate delimiters users that have usagerecords ending from this date (null if no filter is applied)
* @param filterByUsers List of <code>localUserId</code> to reduce the search space (null if no filter is applied)
* @param filterByProduct List of <code>productId</code> to reduce the search space (null if no filter is applied)
* @param filterByProject List of <code>ProjectName</code> to reduce the search space (null if no filter is applied)
* @param filterByHost List of hosts names to reduce the search space (null if no filter is applied)
* @param filterBySubmitHost List of submithost names to reduce the search space (null if no filter is applied)
* @param filterByFeature List of features names to reduce the search space (null if no filter is applied)
* @param filterByAccountingGroups List of accounting groups names to reduce the search space (null if no filter is applied)
* @return a list of accountinggroups (empty if no user matching the search criteria is found).
*/
public Set<String> getListOfAccountingGroups(
Date startDate,
Date endDate,
Set<String> filterByUsers,
Set<String> filterByProduct,
Set<String> filterByProject,
Set<String> filterByHost,
Set<String> filterBySubmitHost,
Set<String> filterByFeature,
Set<String> filterByAccountingGroups);
// This is not exactly to construct the query, but it is the final query constructed by the other methods
/**
* Retrieves a collection of SmartlmUsageRecords from the database (keep in mind that it needs a complete object tree)
* @param startDate delimiters users that have usagerecords starting from this date (null if no filter is applied)
* @param endDate delimiters users that have usagerecords ending from this date (null if no filter is applied)
* @param filterByUsers List of <code>localUserId</code> to reduce the search space (null if no filter is applied)
* @param filterByProduct List of <code>productId</code> to reduce the search space (null if no filter is applied)
* @param filterByProject List of <code>ProjectName</code> to reduce the search space (null if no filter is applied)
* @param filterByHost List of hosts names to reduce the search space (null if no filter is applied)
* @param filterBySubmitHost List of submithost names to reduce the search space (null if no filter is applied)
* @param filterByFeature List of features names to reduce the search space (null if no filter is applied)
* @param filterByAccountingGroups List of accounting groups names to reduce the search space (null if no filter is applied)
* @return a list of SmartLMUsageRecords (empty if no user matching the search criteria is found).
*/
public Set<SmartLMUsageRecordType> getListOfSmartLMUsageRecords(
Date startDate,
Date endDate,
Set<String> filterByUsers,
Set<String> filterByProduct,
Set<String> filterByProject,
Set<String> filterByHost,
Set<String> filterBySubmitHost,
Set<String> filterByFeature,
Set<String> filterByAccountingGroups);
}