
org.apache.maven.continuum.model.project.BuildResult Maven / Gradle / Ivy
The newest version!
/*
=================== DO NOT EDIT THIS FILE ====================
Generated by Modello
any modifications will be overwritten.
==============================================================
*/
package org.apache.maven.continuum.model.project;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
import org.apache.continuum.model.project.ProjectScmRoot;
import org.apache.continuum.model.release.ContinuumReleaseResult;
import org.apache.continuum.model.repository.AbstractPurgeConfiguration;
import org.apache.continuum.model.repository.DirectoryPurgeConfiguration;
import org.apache.continuum.model.repository.DistributedDirectoryPurgeConfiguration;
import org.apache.continuum.model.repository.LocalRepository;
import org.apache.continuum.model.repository.RepositoryPurgeConfiguration;
import org.apache.maven.continuum.model.scm.ChangeFile;
import org.apache.maven.continuum.model.scm.ChangeSet;
import org.apache.maven.continuum.model.scm.ScmResult;
import org.apache.maven.continuum.model.system.Installation;
import org.apache.maven.continuum.model.system.NotificationAddress;
import org.apache.maven.continuum.model.system.Profile;
import org.apache.maven.continuum.model.system.SystemConfiguration;
import org.apache.maven.continuum.project.ContinuumProjectState;
/**
*
* This class is a single continuum build.
*
*
* @version $Revision$ $Date$
*/
@SuppressWarnings( "all" )
public class BuildResult
implements java.io.Serializable
{
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* Field project.
*/
private Project project;
/**
* Field buildDefinition.
*/
private BuildDefinition buildDefinition = null;
/**
* Field id.
*/
private int id = 0;
/**
* Field buildNumber.
*/
private int buildNumber = 0;
/**
* Field username.
*/
private String username;
/**
* Field state.
*/
private int state = 0;
/**
* Field trigger.
*/
private int trigger = 0;
/**
* Field startTime.
*/
private long startTime = 0L;
/**
* Field endTime.
*/
private long endTime = 0L;
/**
* Field error.
*/
private String error;
/**
* Field success.
*/
private boolean success = false;
/**
* Field exitCode.
*/
private int exitCode = 0;
/**
* Field scmResult.
*/
private ScmResult scmResult;
/**
* Field modifiedDependencies.
*/
private java.util.List modifiedDependencies;
/**
* Field lastChangedDate.
*/
private long lastChangedDate = 0L;
/**
* Field buildUrl.
*/
private String buildUrl = "";
//-----------/
//- Methods -/
//-----------/
/**
* Method addModifiedDependency.
*
* @param projectDependency
*/
public void addModifiedDependency( ProjectDependency projectDependency )
{
getModifiedDependencies().add( projectDependency );
} //-- void addModifiedDependency( ProjectDependency )
/**
* Method breakProjectAssociation.
*
* @param project
*/
public void breakProjectAssociation( Project project )
{
if ( this.project != project )
{
throw new IllegalStateException( "project isn't associated." );
}
this.project = null;
} //-- void breakProjectAssociation( Project )
/**
* Method createProjectAssociation.
*
* @param project
*/
public void createProjectAssociation( Project project )
{
if ( this.project != null )
{
breakProjectAssociation( this.project );
}
this.project = project;
} //-- void createProjectAssociation( Project )
/**
* Method equals.
*
* @param other
* @return boolean
*/
public boolean equals( Object other )
{
if ( this == other )
{
return true;
}
if ( !( other instanceof BuildResult ) )
{
return false;
}
BuildResult that = (BuildResult) other;
boolean result = true;
result = result && id == that.id;
return result;
} //-- boolean equals( Object )
/**
* Get the buildDefinition field.
*
* @return BuildDefinition
*/
public BuildDefinition getBuildDefinition()
{
return this.buildDefinition;
} //-- BuildDefinition getBuildDefinition()
/**
* Get the buildNumber field.
*
* @return int
*/
public int getBuildNumber()
{
return this.buildNumber;
} //-- int getBuildNumber()
/**
* Get the buildUrl field.
*
* @return String
*/
public String getBuildUrl()
{
return this.buildUrl;
} //-- String getBuildUrl()
/**
* Get the endTime field.
*
* @return long
*/
public long getEndTime()
{
return this.endTime;
} //-- long getEndTime()
/**
* Get the error field.
*
* @return String
*/
public String getError()
{
return this.error;
} //-- String getError()
/**
* Get the exitCode field.
*
* @return int
*/
public int getExitCode()
{
return this.exitCode;
} //-- int getExitCode()
/**
* Get the id field.
*
* @return int
*/
public int getId()
{
return this.id;
} //-- int getId()
/**
* Get the lastChangedDate field.
*
* @return long
*/
public long getLastChangedDate()
{
return this.lastChangedDate;
} //-- long getLastChangedDate()
/**
* Method getModifiedDependencies.
*
* @return List
*/
public java.util.List getModifiedDependencies()
{
if ( this.modifiedDependencies == null )
{
this.modifiedDependencies = new java.util.ArrayList();
}
return this.modifiedDependencies;
} //-- java.util.List getModifiedDependencies()
/**
* Get the project field.
*
* @return Project
*/
public Project getProject()
{
return this.project;
} //-- Project getProject()
/**
* Get the scmResult field.
*
* @return ScmResult
*/
public ScmResult getScmResult()
{
return this.scmResult;
} //-- ScmResult getScmResult()
/**
* Get the startTime field.
*
* @return long
*/
public long getStartTime()
{
return this.startTime;
} //-- long getStartTime()
/**
* Get the state field.
*
* @return int
*/
public int getState()
{
return this.state;
} //-- int getState()
/**
* Get the trigger field.
*
* @return int
*/
public int getTrigger()
{
return this.trigger;
} //-- int getTrigger()
/**
* Get the username field.
*
* @return String
*/
public String getUsername()
{
return this.username;
} //-- String getUsername()
/**
* Method hashCode.
*
* @return int
*/
public int hashCode()
{
int result = 17;
result = 37 * result + (int) id;
return result;
} //-- int hashCode()
/**
* Get the success field.
*
* @return boolean
*/
public boolean isSuccess()
{
return this.success;
} //-- boolean isSuccess()
/**
* Method removeModifiedDependency.
*
* @param projectDependency
*/
public void removeModifiedDependency( ProjectDependency projectDependency )
{
getModifiedDependencies().remove( projectDependency );
} //-- void removeModifiedDependency( ProjectDependency )
/**
* Set the buildDefinition field.
*
* @param buildDefinition
*/
public void setBuildDefinition( BuildDefinition buildDefinition )
{
this.buildDefinition = buildDefinition;
} //-- void setBuildDefinition( BuildDefinition )
/**
* Set the buildNumber field.
*
* @param buildNumber
*/
public void setBuildNumber( int buildNumber )
{
this.buildNumber = buildNumber;
} //-- void setBuildNumber( int )
/**
* Set the buildUrl field.
*
* @param buildUrl
*/
public void setBuildUrl( String buildUrl )
{
this.buildUrl = buildUrl;
} //-- void setBuildUrl( String )
/**
* Set the endTime field.
*
* @param endTime
*/
public void setEndTime( long endTime )
{
this.endTime = endTime;
} //-- void setEndTime( long )
/**
* Set the error field.
*
* @param error
*/
public void setError( String error )
{
this.error = error;
} //-- void setError( String )
/**
* Set the exitCode field.
*
* @param exitCode
*/
public void setExitCode( int exitCode )
{
this.exitCode = exitCode;
} //-- void setExitCode( int )
/**
* Set the id field.
*
* @param id
*/
public void setId( int id )
{
this.id = id;
} //-- void setId( int )
/**
* Set the lastChangedDate field.
*
* @param lastChangedDate
*/
public void setLastChangedDate( long lastChangedDate )
{
this.lastChangedDate = lastChangedDate;
} //-- void setLastChangedDate( long )
/**
* Set the modifiedDependencies field.
*
* @param modifiedDependencies
*/
public void setModifiedDependencies( java.util.List modifiedDependencies )
{
this.modifiedDependencies = modifiedDependencies;
} //-- void setModifiedDependencies( java.util.List )
/**
* Set the project field.
*
* @param project
*/
public void setProject( Project project )
{
if ( this.project != null )
{
this.project.breakBuildResultAssociation( this );
}
this.project = project;
if ( project != null )
{
this.project.createBuildResultAssociation( this );
}
} //-- void setProject( Project )
/**
* Set the scmResult field.
*
* @param scmResult
*/
public void setScmResult( ScmResult scmResult )
{
this.scmResult = scmResult;
} //-- void setScmResult( ScmResult )
/**
* Set the startTime field.
*
* @param startTime
*/
public void setStartTime( long startTime )
{
this.startTime = startTime;
} //-- void setStartTime( long )
/**
* Set the state field.
*
* @param state
*/
public void setState( int state )
{
this.state = state;
} //-- void setState( int )
/**
* Set the success field.
*
* @param success
*/
public void setSuccess( boolean success )
{
this.success = success;
} //-- void setSuccess( boolean )
/**
* Set the trigger field.
*
* @param trigger
*/
public void setTrigger( int trigger )
{
this.trigger = trigger;
} //-- void setTrigger( int )
/**
* Set the username field.
*
* @param username
*/
public void setUsername( String username )
{
this.username = username;
} //-- void setUsername( String )
/**
* Method toString.
*
* @return String
*/
public java.lang.String toString()
{
StringBuilder buf = new StringBuilder( 128 );
buf.append( "id = '" );
buf.append( getId() );
buf.append( "'" );
return buf.toString();
} //-- java.lang.String toString()
public String getElapsedTime()
{
return getTimeDifference( startTime, getSystemTime() );
}
public String getDurationTime()
{
return getTimeDifference( startTime, endTime );
}
private long getSystemTime()
{
return java.util.Calendar.getInstance().getTime().getTime();
}
private String getTimeDifference( long startTime, long endTime )
{
long start = startTime;
long end = endTime;
if ( start == 0 )
{
return "";
}
if ( end == 0 )
{
end = getSystemTime();
}
int timeInSeconds = (int) ( ( end - start ) / 1000 );
int days, hours, minutes, seconds;
days = timeInSeconds / 86400;
timeInSeconds = timeInSeconds - ( days * 86400 );
hours = timeInSeconds / 3600;
timeInSeconds = timeInSeconds - ( hours * 3600 );
minutes = timeInSeconds / 60;
timeInSeconds = timeInSeconds - ( minutes * 60 );
seconds = timeInSeconds;
String elapsedTime = "";
if ( days > 0 )
{
elapsedTime = days + " d ";
elapsedTime += hours + " h ";
elapsedTime += minutes + " min ";
elapsedTime += seconds + " sec";
}
else
{
if ( hours > 0 )
{
elapsedTime = hours + " h ";
elapsedTime += minutes + " min ";
elapsedTime += seconds + " sec";
}
else
{
if ( minutes > 0 )
{
elapsedTime = minutes + " min ";
elapsedTime += seconds + " sec";
}
else
{
elapsedTime = seconds + " sec";
}
}
}
return elapsedTime;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy