
function GlobalObjective(Index, ID, ObjectiveProgressStatus, SatisfiedStatus, MeasureStatus, NormalizedMeasure){
	
	Debug.AssertError("Global Objective not created with all parameters (is the call missing the index?).", (NormalizedMeasure === null || NormalizedMeasure === undefined));
	
	this.Index = Index;
	this.ID = ID; 
	this.ProgressStatus = ObjectiveProgressStatus;
	this.SatisfiedStatus = SatisfiedStatus;
	this.MeasureStatus = MeasureStatus;
	this.NormalizedMeasure = NormalizedMeasure;

	this.DataState = DATA_STATE_CLEAN;
}

GlobalObjective.prototype.GetXml = GlobalObjective_GetXml;
GlobalObjective.prototype.Clone = GlobalObjective_Clone;
GlobalObjective.prototype.SetDirtyData = GlobalObjective_SetDirtyData;
GlobalObjective.prototype.ResetState = GlobalObjective_ResetState;

function GlobalObjective_GetXml(registrationId){

	var ServerFormat = new ServerFormater();
	
	var xml = new XmlElement("GlobalObjective");

	xml.AddAttribute("RegistrationId", registrationId);
	xml.AddAttribute("RegistrationObjectiveId", this.Index);
	
	xml.AddAttribute("Identifier", this.ID);
	xml.AddAttribute("ProgressStatus", ServerFormat.ConvertBoolean(this.ProgressStatus));
	xml.AddAttribute("SatisfiedStatus", ServerFormat.ConvertBoolean(this.SatisfiedStatus));
	xml.AddAttribute("MeasureStatus", ServerFormat.ConvertBoolean(this.MeasureStatus));
	xml.AddAttribute("NormalizedMeasure", this.NormalizedMeasure);
	
	return xml.toString();
	
}


function GlobalObjective_Clone(){
	var myClone = new GlobalObjective(this.Index, this.ID, this.ProgressStatus, this.SatisfiedStatus, this.MeasureStatus, this.NormalizedMeasure);
	return myClone;
}

function GlobalObjective_SetDirtyData(){
	this.DataState = DATA_STATE_DIRTY;
}

function GlobalObjective_ResetState(){
	this.ProgressStatus = false;
	this.SatisfiedStatus = false;
	this.MeasureStatus = false;
	this.NormalizedMeasure = 0;
	this.SetDirtyData();
}
