com.pmease.quickbuild.model
Class Build

java.lang.Object
  extended by com.pmease.quickbuild.model.AbstractEntity
      extended by com.pmease.quickbuild.model.Build
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

@Entity
public class Build
extends AbstractEntity
implements java.lang.Cloneable

See Also:
Serialized Form

Nested Class Summary
static class Build.Status
           
 
Field Summary
static java.lang.String ALL
           
static java.lang.String ARTIFACT_DIR
           
static java.lang.String DISALLOWED_VERSION_CHARS
           
static java.lang.String LATEST
          Special build version constants
static java.lang.String LATEST_FINISHED
           
static java.util.Set<java.lang.String> RESERVED_VERSIONS
           
 
Constructor Summary
Build()
           
 
Method Summary
 Build clone()
           
 java.io.File getArtifactsDir()
           
 java.util.Date getBeginDate()
           
 User getCanceller()
           
 java.lang.String getCancellerName()
           
 Build getChangeBase()
           
 java.util.List<BuildChangeset> getChanges()
           
 java.util.List<BuildChangeset> getChangesSince(Build build)
           
 java.util.List<java.lang.String> getCommitters()
          Get all committers for this build with latest committer comes at top of the list.
 java.util.List<java.lang.String> getCommitters(java.lang.String checkoutPath)
          Get committers of specified checkout path for this build.
 java.util.List<java.lang.String> getCommitters(java.lang.String repositoryPath, boolean exactMatch)
          Get committers of specified path with latest committer comes at the top of the list.
 Configuration getConfiguration()
           
 java.util.Collection<BuildDependence> getDependencies()
          Get dependencies
 java.util.Collection<BuildDependence> getDependents()
          Get dependents
 java.lang.String getDescription()
           
 java.lang.String getDownloadUrl(java.lang.String relativePath, boolean withHost)
          Get download url for specified file path.
 java.lang.Long getDuration()
           
 java.util.Date getEndDate()
           
 java.lang.String getErrorMessage()
           
 java.io.File getLogFile()
           
 BuildLogger getLogger()
           
 java.lang.String getLogUrl()
           
 java.lang.String getLogUrl(java.lang.String stepPathName)
           
 Step getMasterStep()
           
 Build getPrevious()
           
 Build getPreviousFinished()
           
 Build getPreviousRecommended()
           
 Build getPreviousSuccessful()
           
 Build getPromotedFrom()
          Get promotion source of this build.
 java.util.Collection<Build> getPromotedTo()
          Get promotion destinations of this build.
 java.io.File getPublishDir()
           
static java.io.File getPublishDir(java.io.File storageDir, java.lang.Long id)
           
 long getRemainingTime()
          Get remaining time in milliseconds before the build timed out.
 java.util.Map<java.lang.String,java.lang.Object> getReports()
           
 java.util.List<Repository<?>> getRepositories()
           
 Repository<?> getRepository(java.lang.String repositoryName)
          Get repository object of specified name saved in the build.
 java.util.Map<java.lang.String,Repository<?>> getRepositoryCache()
           
 java.util.Map<java.lang.String,RepositoryRuntime> getRepositoryRuntimes()
           
 BuildRequest getRequest()
           
 User getRequester()
           
 java.lang.String getRequesterName()
           
 Build.Status getStatus()
           
 java.util.Date getStatusDate()
           
 Step getStep(StepPath path)
           
 Step getStep(java.lang.String stepPathName)
           
 java.util.Map<StepPath,Step> getStepCache()
           
 java.util.Map<java.lang.String,StepRuntime> getStepRuntimes()
           
 java.util.List<Step> getSteps()
           
 java.lang.String getUrl()
           
 VariableWrapper getVar(java.lang.String varName)
           
 java.util.Map<java.lang.String,VariableWrapper> getVariables()
           
 java.util.HashMap<java.lang.String,java.lang.String> getVariableValues()
           
 java.lang.String getVarValue(java.lang.String varName)
           
 java.lang.String getVersion()
           
 java.lang.Long getWaitDuration()
           
 java.util.Set<java.lang.String> getWaitingNodes()
           
 boolean hasErrors()
           
 boolean isBroken()
           
 boolean isCancelled()
           
 boolean isFailed()
           
 boolean isFinished()
           
 boolean isFixed()
           
 boolean isRecommended()
           
 boolean isRunning()
           
 boolean isScheduled()
           
 boolean isSuccessful()
           
 boolean isTimeout()
           
 java.util.concurrent.locks.Lock lock()
           
static java.lang.String name4latest(java.lang.Long configurationId)
           
static java.lang.String name4latest(java.lang.Long configurationId, Build.Status status)
           
 void publish(java.io.File file, java.lang.String destPath)
          Publish a single file to server.
 void publish(java.lang.String srcDir, java.lang.String filePatterns, java.lang.String destDir)
          Publish a set of files to server.
 java.util.List<java.lang.String> readSourceFile(java.lang.String checkoutPath)
          Get content of the source file whose checkout path matches specified path in workspace.
 java.lang.String renderLogAsHtml()
           
 java.lang.String renderLogAsHtml(boolean showStep)
           
 java.lang.String renderLogAsText()
           
 java.lang.String renderLogAsText(boolean showStep)
           
 java.lang.String renderLogAsText(java.lang.String pattern, int range)
           
 java.lang.String renderLogAsText(java.lang.String pattern, int range, boolean showStep)
           
 void saveLogAsText(java.io.File file)
           
 void saveLogAsText(java.io.File file, boolean showStep)
           
 void setBeginDate(java.util.Date beginDate)
           
 void setCanceller(User canceller)
           
 void setConfiguration(Configuration configuration)
           
 void setDependencies(java.util.Collection<BuildDependence> dependencies)
           
 void setDependents(java.util.Collection<BuildDependence> dependents)
           
 void setDescription(java.lang.String description)
           
 void setDuration(java.lang.Long duration)
           
 void setErrorMessage(java.lang.String errorMessage)
           
 void setJob(BuildAwareJob job)
           
 void setLogger(BuildLogger logger)
           
 void setPromotedFrom(Build promotedFrom)
           
 void setPromotedTo(java.util.Collection<Build> promotedTo)
           
 void setReports(java.util.Map<java.lang.String,java.lang.Object> reports)
           
 void setRequest(BuildRequest request)
           
 void setRequester(User requester)
           
 void setScheduled(boolean scheduled)
           
 void setStatus(Build.Status status)
           
 void setStatusDate(java.util.Date statusDate)
           
 void setVersion(java.lang.String version)
           
 void setWaitDuration(java.lang.Long waitDuration)
           
static java.lang.String version4latest()
           
static java.lang.String version4latest(Build.Status status)
           
 
Methods inherited from class com.pmease.quickbuild.model.AbstractEntity
equals, getId, hashCode, isNew, setId
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DISALLOWED_VERSION_CHARS

public static final java.lang.String DISALLOWED_VERSION_CHARS
See Also:
Constant Field Values

LATEST

public static final java.lang.String LATEST
Special build version constants

See Also:
Constant Field Values

ALL

public static final java.lang.String ALL
See Also:
Constant Field Values

LATEST_FINISHED

public static final java.lang.String LATEST_FINISHED
See Also:
Constant Field Values

ARTIFACT_DIR

public static final java.lang.String ARTIFACT_DIR
See Also:
Constant Field Values

RESERVED_VERSIONS

public static final java.util.Set<java.lang.String> RESERVED_VERSIONS
Constructor Detail

Build

public Build()
Method Detail

getConfiguration

public Configuration getConfiguration()
Get belonging configuration of this build.


setConfiguration

public void setConfiguration(Configuration configuration)

getVersion

public java.lang.String getVersion()
Get version of this build.


setVersion

public void setVersion(java.lang.String version)

setJob

public void setJob(BuildAwareJob job)

getDescription

public java.lang.String getDescription()
Get description of this build.


setDescription

public void setDescription(java.lang.String description)

getStatus

public Build.Status getStatus()
Get status of this build.


setStatus

public void setStatus(Build.Status status)

getStatusDate

public java.util.Date getStatusDate()
Get status date of this build.


setStatusDate

public void setStatusDate(java.util.Date statusDate)

getErrorMessage

public java.lang.String getErrorMessage()
Get error message of the build. null if no error message.


setErrorMessage

public void setErrorMessage(java.lang.String errorMessage)

isSuccessful

public boolean isSuccessful()
Whether or not status of this build is SUCCESSFUL.


isRecommended

public boolean isRecommended()
Whether or not status of this build is RECOMMENDED.


isFailed

public boolean isFailed()
Whether or not status of this build is FAILED.


isCancelled

public boolean isCancelled()
Whether or not status of this build is CANCELLED.


isTimeout

public boolean isTimeout()
Whether or not status of this build is TIMEOUT.


isRunning

public boolean isRunning()
Whether or not status of this build is RUNNING.


isFinished

public boolean isFinished()
Whether or not this build is finished.


getBeginDate

public java.util.Date getBeginDate()
Get begin date of the build. Null will be returned if build is not started yet (is waiting).


setBeginDate

public void setBeginDate(java.util.Date beginDate)

getEndDate

public java.util.Date getEndDate()
Get end date of the build. Null will be returned if build is not finished.


getDuration

public java.lang.Long getDuration()
Get duration of the build in milli-secondes. Null will be returned if build is not finished.


setDuration

public void setDuration(java.lang.Long duration)

getWaitDuration

public java.lang.Long getWaitDuration()
Get wait duration of the build in milli-secondes. Null will be returned if unknown.


setWaitDuration

public void setWaitDuration(java.lang.Long waitDuration)

getDependents

public java.util.Collection<BuildDependence> getDependents()
Get dependents


setDependents

public void setDependents(java.util.Collection<BuildDependence> dependents)

getDependencies

public java.util.Collection<BuildDependence> getDependencies()
Get dependencies


setDependencies

public void setDependencies(java.util.Collection<BuildDependence> dependencies)

getStepRuntimes

public java.util.Map<java.lang.String,StepRuntime> getStepRuntimes()
Get a map of step path to step runtime information.


getRepositoryRuntimes

public java.util.Map<java.lang.String,RepositoryRuntime> getRepositoryRuntimes()
Get a map of repository path to repository runtime information.


getVariables

public java.util.Map<java.lang.String,VariableWrapper> getVariables()

getPromotedFrom

public Build getPromotedFrom()
Get promotion source of this build.


setPromotedFrom

public void setPromotedFrom(Build promotedFrom)

getPromotedTo

public java.util.Collection<Build> getPromotedTo()
Get promotion destinations of this build.


setPromotedTo

public void setPromotedTo(java.util.Collection<Build> promotedTo)

getPublishDir

public java.io.File getPublishDir()
Get publish directory of this build.


getArtifactsDir

public java.io.File getArtifactsDir()
Get artifacts directory of this build.


getPublishDir

public static java.io.File getPublishDir(java.io.File storageDir,
                                         java.lang.Long id)

getLogFile

public java.io.File getLogFile()

getDownloadUrl

public java.lang.String getDownloadUrl(java.lang.String relativePath,
                                       boolean withHost)
Get download url for specified file path. The path should be relative to the build's directory.


isScheduled

public boolean isScheduled()

setScheduled

public void setScheduled(boolean scheduled)

getChanges

public java.util.List<BuildChangeset> getChanges()
Get change sets of this build. Change sets are sorted with first entry being the most recent change.


getChangesSince

public java.util.List<BuildChangeset> getChangesSince(Build build)
get list of changesets since specified build. Change sets are sorted with the first entry being the most recent change.


readSourceFile

public java.util.List<java.lang.String> readSourceFile(java.lang.String checkoutPath)
Get content of the source file whose checkout path matches specified path in workspace. Content of the source file is the same as when the build is generated.

Parameters:
checkoutPath - the path to a checkout file relative to the workspace.
Returns:
null if no matching source file found.

getCommitters

public java.util.List<java.lang.String> getCommitters(java.lang.String checkoutPath)
Get committers of specified checkout path for this build. The latest committer comes at top of the list. Returned committer name is of the format :

Parameters:
checkoutPath - path of a checkout file relative to the workspace directory (not required to be exist)

getCommitters

public java.util.List<java.lang.String> getCommitters(java.lang.String repositoryPath,
                                                      boolean exactMatch)
Get committers of specified path with latest committer comes at the top of the list. Returned committer name is of the format :


getCommitters

public java.util.List<java.lang.String> getCommitters()
Get all committers for this build with latest committer comes at top of the list. Returned committer name is of the format :

Returns:

getRemainingTime

public long getRemainingTime()
Get remaining time in milliseconds before the build timed out.

Returns:
0 if time out is not set

getRepository

public Repository<?> getRepository(java.lang.String repositoryName)
Get repository object of specified name saved in the build.

Parameters:
repositoryName -
Returns:
null if not found

getStep

public Step getStep(StepPath path)
Get step of specified path. Null if not found.


getStep

public Step getStep(java.lang.String stepPathName)
Get step of specified path name. Null if not found.


getMasterStep

public Step getMasterStep()
Get master step of the build.


getReports

public java.util.Map<java.lang.String,java.lang.Object> getReports()
Get reports data of this build. Key of the map represents report name, and value of the map represents data of that report. This report data can be used to render build notification templates. Refer to documentation of various reports plugin on how to use the report data.


setReports

public void setReports(java.util.Map<java.lang.String,java.lang.Object> reports)

getPrevious

public Build getPrevious()
Get previous build of this build. null will be returned if not found.


getPreviousFinished

public Build getPreviousFinished()
Get previous finished build of this build. null will be returned if not found.


getPreviousSuccessful

public Build getPreviousSuccessful()
Get previous successful build of this build. Null will be returned if not found.


getPreviousRecommended

public Build getPreviousRecommended()
Get previous recommended build of this build. Null will be returned if not found.


getLogUrl

public java.lang.String getLogUrl(java.lang.String stepPathName)
Get log file url of specified step path name. Build log url will be returned if the step path name is specified as null.


getLogUrl

public java.lang.String getLogUrl()
Get full build log file URL.


getUrl

public java.lang.String getUrl()
Get dashboard URL of this build.


lock

public java.util.concurrent.locks.Lock lock()

hasErrors

public boolean hasErrors()
Whether or not this build has errors. A build may has errors even if it is successful. This can occur if some steps are failed but success condition of the containing composite step ignores these failures.


getRepositories

public java.util.List<Repository<?>> getRepositories()
Get all repositories used in the build. This is somewhat slow as QuickBuild has to merge repository definition information kept in configuration with repository runtime information recorded in build. Call getRepositoryRuntimes() instead if all you want to get is repository runtime information, as it will be much fast.


getSteps

public java.util.List<Step> getSteps()
Get all steps used in the build. This is somewhat slow as QuickBuild needs to merge step definiton information kept in configuration with step runtime information recorded in build. Call getStepRuntimes() instead if all you want to get is step runtime information, as this will be much fast.


getStepCache

public java.util.Map<StepPath,Step> getStepCache()

getRepositoryCache

public java.util.Map<java.lang.String,Repository<?>> getRepositoryCache()

getVariableValues

public java.util.HashMap<java.lang.String,java.lang.String> getVariableValues()

getVar

public VariableWrapper getVar(java.lang.String varName)
Get variable of specified name. Null if not found.


getVarValue

public java.lang.String getVarValue(java.lang.String varName)
Get variable value of specified name. Null if not found.


renderLogAsHtml

public java.lang.String renderLogAsHtml(boolean showStep)
Render whole log as html. Passed parameter controls whether or not to render step information.


renderLogAsHtml

public java.lang.String renderLogAsHtml()

renderLogAsText

public java.lang.String renderLogAsText(boolean showStep)
Render whole log as text. Passed parameter controls whether or not to render step information.


renderLogAsText

public java.lang.String renderLogAsText()

saveLogAsText

public void saveLogAsText(java.io.File file,
                          boolean showStep)
Save build log as text into specified file. The first parameter specified the file to save, and the second paraemter controls whether or not to render step information.


saveLogAsText

public void saveLogAsText(java.io.File file)

renderLogAsText

public java.lang.String renderLogAsText(java.lang.String pattern,
                                        int range,
                                        boolean showStep)
Render portion of the build log around specified pattern with specified range. The first param should be a Java pattern matching lines of the log, and the second param should be a range indicating how many lines (both before and after) around the matched line should be read. The third parameter controls whether or not to render step information


renderLogAsText

public java.lang.String renderLogAsText(java.lang.String pattern,
                                        int range)

publish

public void publish(java.lang.String srcDir,
                    java.lang.String filePatterns,
                    java.lang.String destDir)
Publish a set of files to server.

Parameters:
srcDir - source directory to publish files from. A non-absolute path is considered to be relative to current workspace directory. A null value means the workspace directory itself.
filePatterns - patterns of files to be published under the source directory. For example, to publish all files recursively, just specify **\/*. Null value means to publish all files under the source directory.
destDir - this path specifies a relative path under the build publish directory at server. Published files will be placed under this path. A null value means the build publish directory itself.

publish

public void publish(java.io.File file,
                    java.lang.String destPath)
Publish a single file to server.

Parameters:
file - the file to publish.
destPath - destination path of the file at server. This path should be relative to the build publish directory.

getRequester

public User getRequester()

setRequester

public void setRequester(User requester)

getRequesterName

public java.lang.String getRequesterName()

getCanceller

public User getCanceller()

setCanceller

public void setCanceller(User canceller)

getCancellerName

public java.lang.String getCancellerName()

getRequest

public BuildRequest getRequest()

setRequest

public void setRequest(BuildRequest request)

version4latest

public static java.lang.String version4latest(Build.Status status)

version4latest

public static java.lang.String version4latest()

name4latest

public static java.lang.String name4latest(java.lang.Long configurationId,
                                           Build.Status status)

name4latest

public static java.lang.String name4latest(java.lang.Long configurationId)

isBroken

public boolean isBroken()
Whether or not the build is broken. A build is considered broken if previous is successful but now is failed.


isFixed

public boolean isFixed()
Whether or not the build is fixed. A build is considered fixed if previous is failed but now is successful.


getLogger

public BuildLogger getLogger()

setLogger

public void setLogger(BuildLogger logger)

clone

public Build clone()
Overrides:
clone in class java.lang.Object

getChangeBase

public Build getChangeBase()

getWaitingNodes

public java.util.Set<java.lang.String> getWaitingNodes()


Copyright © 2005-2010 PMEase Inc. All Rights Reserved.