#region License Information
/* HeuristicLab
* Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
*
* This file is part of HeuristicLab.
*
* HeuristicLab is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* HeuristicLab is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with HeuristicLab. If not, see .
*/
#endregion
using System;
using System.Collections.Generic;
using HeuristicLab.Common;
using HeuristicLab.Core;
namespace HeuristicLab.Clients.Hive.CloudManager.Model {
public class Deployment : Item {
public string Name { get; set; }
public string DeploymentSlot { get; set; }
public string PrivateID { get; set; }
public string Status { get; set; }
public string Label { get; set; }
public string Url { get; set; }
public string Configuration { get; set; }
public List RoleInstanceList { get; set; }
public UpgradeStatus UpgradeStatus { get; set; }
public int UpgradeDomainCount;
public List RoleList { get; set; }
public Subscription Subscription { get; set; }
public bool Modified { get; set; }
public int NewInstanceCount { get; set; }
public Deployment() {
this.Modified = false;
}
public Deployment(Deployment original, Cloner cloner) {
this.Name = original.Name;
this.DeploymentSlot = original.DeploymentSlot;
this.PrivateID = original.PrivateID;
this.Status = original.Status;
this.Label = original.Label;
this.Url = original.Label;
this.Configuration = original.Configuration;
this.RoleInstanceList = new List(original.RoleInstanceList);
this.UpgradeStatus = cloner.Clone(original.UpgradeStatus);
this.UpgradeDomainCount = original.UpgradeDomainCount;
this.RoleList = new List(original.RoleList);
this.Subscription = cloner.Clone(original.Subscription);
this.Modified = original.Modified;
this.NewInstanceCount = original.NewInstanceCount;
}
public override bool Equals(object obj) {
if (obj == null)
return false;
Deployment dep = obj as Deployment;
if ((this.Name == dep.Name))
return true;
else
return false;
}
public override string ToString() {
return string.Format("Deployment: Name={0}, DeploymentSlot={1}, Label={2}, Status={3}", Name, DeploymentSlot, Label, Status);
}
public override IDeepCloneable Clone(Cloner cloner) {
return new Deployment(this, cloner);
}
public void Merge(Deployment deployment) {
if (!this.Equals(deployment)) {
throw new ArgumentException("Objects must be equal to be merged.", "subscription");
}
this.Name = deployment.Name;
this.DeploymentSlot = deployment.DeploymentSlot;
this.PrivateID = deployment.PrivateID;
this.Status = deployment.Status;
this.Label = deployment.Label;
this.Url = deployment.Label;
this.Configuration = deployment.Configuration;
this.RoleInstanceList = deployment.RoleInstanceList;
this.UpgradeStatus = deployment.UpgradeStatus;
this.UpgradeDomainCount = deployment.UpgradeDomainCount;
this.RoleList = deployment.RoleList;
this.Subscription = deployment.Subscription;
//this.Modified = deployment.Modified;
//this.NewInstanceCount = deployment.NewInstanceCount;
if (!this.Modified) {
this.Modified = deployment.Modified;
this.NewInstanceCount = deployment.NewInstanceCount;
}
}
}
}