org.jenkins.plugins.audit2db.internal.data
Class BuildDetailsHibernateRepository

java.lang.Object
  extended by org.jenkins.plugins.audit2db.internal.data.AbstractHibernateRepository
      extended by org.jenkins.plugins.audit2db.internal.data.BuildDetailsHibernateRepository
All Implemented Interfaces:
BuildDetailsRepository

public class BuildDetailsHibernateRepository
extends AbstractHibernateRepository
implements BuildDetailsRepository

Hibernate-based implementation of the BuildDetailsRepository interface.

Author:
Marco Scata

Constructor Summary
BuildDetailsHibernateRepository(org.hibernate.SessionFactory sessionFactory)
           
 
Method Summary
 List<BuildDetails> getBuildDetails(String masterHostName, Date fromDate, Date toDate)
          Retrieves the build details for all job instances that ran on the specified Jenkins master or all the slaves registered with that master, between two dates for al projects.
 List<BuildDetails> getBuildDetails(String masterHostName, String projectName, Date fromDate, Date toDate)
          Retrieves the build details for all job instances that ran on the specified Jenkins master or all the slaves registered with that master, between two dates and for a specific project.
 List<BuildDetails> getBuildDetailsByDateRange(Date start, Date end)
          Retrieves previously saved build details whose start date or end date fall between the given range.
 List<BuildDetails> getBuildDetailsByDurationRange(long min, long max)
          Retrieves previously saved build details whose duration in seconds falls between the given range.
 List<BuildDetails> getBuildDetailsByFullName(String fullName)
          Retrieves previously saved build details that match the given full name.
 BuildDetails getBuildDetailsById(String id)
          Retrieves previously saved build details that match the given id.
 List<BuildDetails> getBuildDetailsByName(String name)
          Retrieves previously saved build details that match the given name.
 List<BuildDetails> getBuildDetailsByParams(String masterHostName, String paramName, String paramValue, Date fromDate, Date toDate)
          Retrieves previously saved build details that were executed using the given parameter values.
 List<BuildDetails> getBuildDetailsByUserId(String userId)
          Retrieves previously saved build details that match the given user id.
 List<BuildDetails> getBuildDetailsByUserName(String userName)
          Retrieves previously saved build details that match the given user name.
 BuildDetails getBuildDetailsForBuild(hudson.model.AbstractBuild<?,?> build)
          Retrieves the build details for the given Jenkins build.
 BuildNode getBuildNodeByUrl(String url)
          Retrieves the build node that matches the given url.
 List<String> getProjectNames(String masterHostName, Date fromDate, Date toDate)
          Retrieves a list of all the projects registered with the specified Jenkins master that have had job instances executed between the specified dates.
 List<String> getProjectNames(String masterHostName, String pattern, Date fromDate, Date toDate)
          Retrieves the names of all projects on the given Jenkins master, filtered by name pattern and date range.
 Object saveBuildDetails(BuildDetails details)
          Creates a new entity in the repository with the given build details.
 void saveBuildDetailsList(List<BuildDetails> details)
          Creates new entities in the repository according to the given list of build details.
 void updateBuildDetails(BuildDetails details)
          Updates a previously saved build using the given build details.
 
Methods inherited from class org.jenkins.plugins.audit2db.internal.data.AbstractHibernateRepository
getHibernateTemplate, getSessionFactory, getTransactionManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BuildDetailsHibernateRepository

public BuildDetailsHibernateRepository(org.hibernate.SessionFactory sessionFactory)
Method Detail

getBuildNodeByUrl

public BuildNode getBuildNodeByUrl(String url)
Description copied from interface: BuildDetailsRepository
Retrieves the build node that matches the given url.

Specified by:
getBuildNodeByUrl in interface BuildDetailsRepository
Parameters:
url - the node url (unique).
Returns:
the matching node if found, otherwise null.
See Also:
BuildDetailsRepository.getBuildNodeByUrl(String)

saveBuildDetails

public Object saveBuildDetails(BuildDetails details)
Description copied from interface: BuildDetailsRepository
Creates a new entity in the repository with the given build details.

Specified by:
saveBuildDetails in interface BuildDetailsRepository
Parameters:
details - the details to save.
Returns:
the entity id.
See Also:
BuildDetailsRepository.saveBuildDetails(org.jenkins.plugins.audit2db.model.BuildDetails)

saveBuildDetailsList

public void saveBuildDetailsList(List<BuildDetails> details)
Description copied from interface: BuildDetailsRepository
Creates new entities in the repository according to the given list of build details.

Specified by:
saveBuildDetailsList in interface BuildDetailsRepository
Parameters:
details - the collection of details to save.
See Also:
BuildDetailsRepository.saveBuildDetailsList(List)

getBuildDetailsById

public BuildDetails getBuildDetailsById(String id)
Description copied from interface: BuildDetailsRepository
Retrieves previously saved build details that match the given id.

Specified by:
getBuildDetailsById in interface BuildDetailsRepository
Parameters:
id - the build details id.
Returns:
the matching build details if found, otherwise null.
See Also:
BuildDetailsRepository.getBuildDetailsById(String)

getBuildDetailsByName

public List<BuildDetails> getBuildDetailsByName(String name)
Description copied from interface: BuildDetailsRepository
Retrieves previously saved build details that match the given name.

Specified by:
getBuildDetailsByName in interface BuildDetailsRepository
Parameters:
name - the build name
Returns:
a list of matching build details if found, otherwise an empty list.
See Also:
BuildDetailsRepository.getBuildDetailsByName(java.lang.String)

getBuildDetailsByFullName

public List<BuildDetails> getBuildDetailsByFullName(String fullName)
Description copied from interface: BuildDetailsRepository
Retrieves previously saved build details that match the given full name.

Specified by:
getBuildDetailsByFullName in interface BuildDetailsRepository
Returns:
a list of matching build details if found, otherwise an empty list.
See Also:
BuildDetailsRepository.getBuildDetailsByFullName(java.lang.String)

getBuildDetailsByDateRange

public List<BuildDetails> getBuildDetailsByDateRange(Date start,
                                                     Date end)
Description copied from interface: BuildDetailsRepository
Retrieves previously saved build details whose start date or end date fall between the given range. The range is inclusive.

Specified by:
getBuildDetailsByDateRange in interface BuildDetailsRepository
Parameters:
start - the start date.
end - the end date.
Returns:
a list of matching build details if found, otherwise an empty list.
See Also:
BuildDetailsRepository.getBuildDetailsByDateRange(java.util.Date, java.util.Date)

getBuildDetailsByDurationRange

public List<BuildDetails> getBuildDetailsByDurationRange(long min,
                                                         long max)
Description copied from interface: BuildDetailsRepository
Retrieves previously saved build details whose duration in seconds falls between the given range. The range is inclusive.

Specified by:
getBuildDetailsByDurationRange in interface BuildDetailsRepository
Parameters:
min - the minimum duration in seconds.
max - the maximum duration in seconds.
Returns:
a list of matching build details if found, otherwise an empty list.
See Also:
org.jenkins.plugins.audit2db.data.BuildDetailsRepository#getBuildDetailsByDuration(long)

getBuildDetailsByUserId

public List<BuildDetails> getBuildDetailsByUserId(String userId)
Description copied from interface: BuildDetailsRepository
Retrieves previously saved build details that match the given user id.

Specified by:
getBuildDetailsByUserId in interface BuildDetailsRepository
Parameters:
userId - the user id to match.
Returns:
a list of matching build details if found, otherwise an empty list.
See Also:
BuildDetailsRepository.getBuildDetailsByUserId(java.lang.String)

getBuildDetailsByUserName

public List<BuildDetails> getBuildDetailsByUserName(String userName)
Description copied from interface: BuildDetailsRepository
Retrieves previously saved build details that match the given user name.

Specified by:
getBuildDetailsByUserName in interface BuildDetailsRepository
Parameters:
userName - the user name to match.
Returns:
a list of matching build details if found, otherwise an empty list.
See Also:
BuildDetailsRepository.getBuildDetailsByUserName(java.lang.String)

getBuildDetailsByParams

public List<BuildDetails> getBuildDetailsByParams(String masterHostName,
                                                  String paramName,
                                                  String paramValue,
                                                  Date fromDate,
                                                  Date toDate)
Description copied from interface: BuildDetailsRepository
Retrieves previously saved build details that were executed using the given parameter values.

Specified by:
getBuildDetailsByParams in interface BuildDetailsRepository
Parameters:
masterHostName - the host name of the Jenkins master.
paramName - the parameter name.
paramValue - the parameter value.
fromDate - the start (inclusive) of the date range.
toDate - the end (inclusive) of the date range.
Returns:
a list of build details matching the specified criteria. Never null.
See Also:
BuildDetailsRepository.getBuildDetailsByParams(String, String, String, Date, Date)

updateBuildDetails

public void updateBuildDetails(BuildDetails details)
Description copied from interface: BuildDetailsRepository
Updates a previously saved build using the given build details.

Specified by:
updateBuildDetails in interface BuildDetailsRepository
Parameters:
details - the updated build details.
See Also:
BuildDetailsRepository.updateBuildDetails(org.jenkins.plugins.audit2db.model.BuildDetails)

getBuildDetailsForBuild

public BuildDetails getBuildDetailsForBuild(hudson.model.AbstractBuild<?,?> build)
Description copied from interface: BuildDetailsRepository
Retrieves the build details for the given Jenkins build.

Specified by:
getBuildDetailsForBuild in interface BuildDetailsRepository
Parameters:
build - a reference to the Jenkins build.
Returns:
the relevant build details if found, otherwise null.
See Also:
BuildDetailsRepository.getBuildDetailsForBuild(AbstractBuild)

getProjectNames

public List<String> getProjectNames(String masterHostName,
                                    Date fromDate,
                                    Date toDate)
Description copied from interface: BuildDetailsRepository
Retrieves a list of all the projects registered with the specified Jenkins master that have had job instances executed between the specified dates.

Specified by:
getProjectNames in interface BuildDetailsRepository
Parameters:
masterHostName - the host name of the Jenkins master.
fromDate - the start (inclusive) of the date range.
toDate - the end (inclusive) of the date range.
Returns:
a list of project names, never null.

getProjectNames

public List<String> getProjectNames(String masterHostName,
                                    String pattern,
                                    Date fromDate,
                                    Date toDate)
Retrieves the names of all projects on the given Jenkins master, filtered by name pattern and date range. The name pattern accepts wildcards. A null name pattern will match all names.

Specified by:
getProjectNames in interface BuildDetailsRepository
Parameters:
masterHostName - the host name of the Jenkins master.
pattern - the pattern used to match project names.
fromDate - the start (inclusive) of the date range.
toDate - the end (inclusive) of the date range.
Returns:
a list of project names, never null.

getBuildDetails

public List<BuildDetails> getBuildDetails(String masterHostName,
                                          Date fromDate,
                                          Date toDate)
Description copied from interface: BuildDetailsRepository
Retrieves the build details for all job instances that ran on the specified Jenkins master or all the slaves registered with that master, between two dates for al projects.

Specified by:
getBuildDetails in interface BuildDetailsRepository
Parameters:
masterHostName - the host name of the Jenkins master.
fromDate - the start (inclusive) of the date range.
toDate - the end (inclusive) of the date range.
Returns:
a list of build details matching the specified criteria. Never null.

getBuildDetails

public List<BuildDetails> getBuildDetails(String masterHostName,
                                          String projectName,
                                          Date fromDate,
                                          Date toDate)
Description copied from interface: BuildDetailsRepository
Retrieves the build details for all job instances that ran on the specified Jenkins master or all the slaves registered with that master, between two dates and for a specific project.

Specified by:
getBuildDetails in interface BuildDetailsRepository
Parameters:
masterHostName - the host name of the Jenkins master.
projectName - the name of the project that was executed.
fromDate - the start (inclusive) of the date range.
toDate - the end (inclusive) of the date range.
Returns:
a list of build details matching the specified criteria. Never null.
See Also:
org.jenkins.plugins.audit2db.data.AuditReportsRepository#getBuildDetails(java.lang.String, java.sql.Date, java.sql.Date)


Copyright © 2004-2013. All Rights Reserved.