package com.cobalt.cdpipeline.cdresult;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * 
 */
public class CDResult {
	private String projectName, planName;
	private Date lastDeploymentTime, lastUpdate;
	private int numChanges;
	
	private Set<Contributor> contributors;
	private Build currentBuild;
	private List<PipelineStage> pipelineStages; 
	
	/**
	 * Construct a Plan object 
	 * @param projectName
	 * @param planName
	 * @param planKey
	 */
	public CDResult(String projectName, String planName) {
		this.projectName = projectName;
		this.planName = planName;
		
		contributors = new HashSet<Contributor>();
		pipelineStages = new ArrayList<PipelineStage>();
	}
	
	/**
	 * Set lastDeploymentTime to the given date.
	 * Scope identifier left out intentionally for package protection.
	 * 
	 * @param lastDeployment
	 */
	void setLastDeploymentTime(Date lastDeployment) {
		this.lastDeploymentTime = lastDeployment;
	}
	
	/**
	 * Return last deployment date and time.
	 * Return null if there's no deployment yet.
	 * @return
	 */
	public Date getLastDeploymentTime(){
		return this.lastDeploymentTime;
	}
	
	/**
	 * Set lastUpdate time to the given date.
	 * Scope identifier left out intentionally for package protection.
	 * 
	 * @param lastUpdate
	 */
	void setLastUpdateTime(Date lastUpdate) {
		this.lastUpdate = lastUpdate;
	}
	
	/**
	 * Return last update date and time
	 * @return
	 */
	public Date getLastUpdateTime(){
		return this.lastUpdate;
	}
	
	/**
	 * Set number of changes to the given number.
	 * Scope identifier left out intentionally for package protection.
	 * 
	 * @param numChanges
	 */
	void setNumChanges(int numChanges) {
		this.numChanges = numChanges;
	}
	
	/**
	 * Return changes(commits) since last deployment
	 * @return
	 */
	public int getNumChanges(){
		return this.numChanges;
	}
	
	/**
	 * Add given contributor to contributors set.
	 * Scope identifier left out intentionally for package protection.
	 * 
	 * @param contributor
	 */
	void addContributor(Contributor contributor) {
		contributors.add(contributor);
	}
	
	/**
	 * Return all contributors since last deployment
	 * @return
	 */
	public Set<Contributor> getContributors(){
		return this.contributors;
	}
	
	/**
	 * Add given PipelineStage to the pipelineStages list.
	 * Scope identifier left out intentionally for package protection.
	 * 
	 * @param stage
	 */
	void addPipelineStageToList(PipelineStage stage) {
		pipelineStages.add(stage);
	}
	
	/**
	 * Return all pipeline stages of the current build.
	 * @return
	 */
	public List<PipelineStage> getPipelineStages(){
		return this.pipelineStages;
	}
	
	/**
	 * Set current build information with the given Build
	 * @param current
	 */
	void setCurrentBuild(Build current){
		this.currentBuild = current;
	}
	
	/**
	 * Return current build information.
	 * @return
	 */
	public Build getCurrentBuild(){
		return this.currentBuild;
	}
	
	/**
	 * Get project name
	 * @return
	 */
	public String getProjectName() {
		return projectName;
	}
	
	/**
	 * Get plan name
	 * @return
	 */
	public String getPlanName() {
		return planName;
	}
}

@@ -447,43 +447,96 @@
 t a 
-Plan o
+CDResult O
 bject
- 
+.
 %0A%09 * 
-@param
+Access modifier left out intentionally for package
  pro
-jectName
+tection.%0A%09 * 
 %0A%09 *
@@ -544,19 +544,22 @@
 @param p
-lan
+roject
 Name%0A%09 *
@@ -574,25 +574,19 @@
 plan
-Key
+Name
 %0A%09 */%0A%09
-public 
 CDRe
@@ -846,35 +846,34 @@
 n date.%0A%09 * 
-Scope ident
+Access mod
 ifier left o
@@ -1284,35 +1284,34 @@
 n date.%0A%09 * 
-Scope ident
+Access mod
 ifier left o
@@ -1639,35 +1639,34 @@
 number.%0A%09 * 
-Scope ident
+Access mod
 ifier left o
@@ -1997,35 +1997,34 @@
 rs set.%0A%09 * 
-Scope ident
+Access mod
 ifier left o
@@ -2401,19 +2401,18 @@
 %09 * 
-Scope ident
+Access mod
 ifie

Make the construction of CDResult package protected.