gt:     	for(DiskConf diskConfT : disksConf)
context: /*
  * Claudia Project
  * http://claudia.morfeo-project.org
  *
  * (C) Copyright 2010 Telefonica Investigacion y Desarrollo
  * S.A.Unipersonal (Telefonica I+D)
  *
  * See CREDITS file for info about members and contributors.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the Affero GNU General Public License (AGPL) as 
  * published by the Free Software Foundation; either version 3 of the License, 
  * or (at your option) any later version.
  *
  * This program 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 Affero GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  *
  * If you want to use this software an plan to distribute a
  * proprietary application in any way, and you are not licensing and
  * distributing your source code under AGPL, you probably need to
  * purchase a commercial license of the product. Please contact
  * claudia-support@lists.morfeo-project.org for more information.
  */
  package com.telefonica.claudia.slm.deployment;
  
  import java.util.ArrayList;
  import java.util.HashSet;
  import java.util.Iterator;
  import java.util.List;
  import java.util.Set;
  import java.util.SortedSet;
  import java.util.TreeSet;
  
  import javax.persistence.CascadeType;
  import javax.persistence.Column;
  import javax.persistence.Entity;
  import javax.persistence.EnumType;
  import javax.persistence.Enumerated;
  import javax.persistence.GeneratedValue;
  import javax.persistence.Id;
  import javax.persistence.JoinTable;
  import javax.persistence.ManyToOne;
  import javax.persistence.OneToMany;
  
  import javax.persistence.OneToOne;
  import javax.persistence.Transient;
  import javax.xml.parsers.DocumentBuilder;
  import javax.xml.parsers.DocumentBuilderFactory;
  import javax.xml.parsers.ParserConfigurationException;
  
  import org.hibernate.annotations.CollectionOfElements;
  import org.w3c.dom.Document;
  import org.w3c.dom.Element;
  
  import com.telefonica.claudia.slm.common.SMConfiguration;
  import com.telefonica.claudia.slm.deployment.hwItems.CPUConf;
  import com.telefonica.claudia.slm.deployment.hwItems.DiskConf;
  import com.telefonica.claudia.slm.deployment.hwItems.MemoryConf;
  import com.telefonica.claudia.slm.deployment.hwItems.NICConf;
  import com.telefonica.claudia.slm.deployment.paas.Product;
  import com.telefonica.claudia.slm.deployment.paas.Property;
  import com.telefonica.claudia.slm.maniParser.GetOperationsUtils;
  import com.telefonica.claudia.slm.naming.DirectoryEntry;
  import com.telefonica.claudia.slm.naming.FQN;
  import com.telefonica.claudia.slm.naming.ReservoirDirectory;
  
  @Entity
  @SuppressWarnings("unchecked")
  public class VEE implements Comparable, DirectoryEntry {
      
      public static enum VirtualizationTechnologyType {XEN, VMWARE, KVM};
      
  	@Id
  	@GeneratedValue
  	public long internalId;
  	
      private String veeName = null;
      
  
      
      @ManyToOne
      private ServiceApplication serviceApplication = null;
      
      @OneToOne(cascade={CascadeType.REFRESH, CascadeType.MERGE, CascadeType.PERSIST})
      private FQN veeFQN = null;
      
      @Enumerated(EnumType.STRING)
      private VirtualizationTechnologyType virtType = null;
      
      @OneToMany(cascade=CascadeType.ALL)
      private List<DiskConf> disksConf = new ArrayList<DiskConf>();
      
      @OneToMany(cascade=CascadeType.ALL)
      private List<Product> products = new ArrayList<Product>();
      
      @OneToMany(cascade=CascadeType.ALL)
      private List<CPUConf> cpusConf = new ArrayList<CPUConf>();
      
      @OneToMany(cascade=CascadeType.ALL)
      private List<NICConf> nicsConf = new ArrayList<NICConf>();
      
      @OneToOne(cascade=CascadeType.ALL)
      private MemoryConf memoryConf = null;
      
      @OneToOne(cascade = CascadeType.ALL)
      private VEE balancedBy = null;
      
     
  
      
      private int lastReplicaId = 0;
      private int maxReplicas = 1;    
      private int minReplicas = 1;
      private int initReplicas = minReplicas;
      private int currentReplicas= 0;
      private boolean hotMigrationAllowed = true;
      private boolean coldMigrationAllowed = true;
      private int deploymentOrder = -1;
      private int lbManagementPort = 0;
      private boolean isBalancer = false;
      
      @OneToMany(cascade=CascadeType.ALL)
      @JoinTable(name="ALLOWED_DOMAINS")
      private Set<GeographicDomain> allowedDomains = new HashSet<GeographicDomain>();
      
      @OneToMany(cascade=CascadeType.ALL)
      @JoinTable(name="FORBIDDEN_DOMAINS")
      private Set<GeographicDomain> forbiddenDomains = new HashSet<GeographicDomain>();
      
      @OneToMany(cascade=CascadeType.ALL)
      private Set<ISOImage> isoImages = new HashSet<ISOImage>();
      
      @OneToMany(mappedBy="vee", cascade=CascadeType.ALL)
      private Set<VEEReplica> activeReplicas = new HashSet<VEEReplica>();
      
      @Transient
      private AvailabilityWindow availabilityWindow;
      
      // RESERVOIR attributes
      private String UUID=null;
      
      private boolean migratable;
      
      private double availabilityValue;
      
      @CollectionOfElements
      private List<String> recipes = new ArrayList ();
      
      
      
  	/**
  	 * OVF document that describe the VEE template that will be used to generate virtual machine templates.
  	 * The OVF document contains a collection of identifiers that will be replaced with current values when
  	 * the VEE is being instantiated.
  	 */
      @Column(columnDefinition = "VARCHAR(32672)")
  	private String ovfRepresentation=null;
      
      @Column(columnDefinition = "VARCHAR(32672)")
  	private String password=null;
      
      @Column(columnDefinition = "VARCHAR(32672)")
  	private String username=null;
      
      public VEE() {}
      
      public String getUUID() {
      	return UUID;
      }
      
      public void setUUID(String uuid) {
      	this.UUID = uuid;
      }
      
      public boolean getMigratable() {
      	return migratable;
      }
      
      public void setMigratable(boolean migrat) {
      	this.migratable = migrat;
      }
      
      public double getAvailabilityValue() {
  		return availabilityValue;
  	}
  
  	public void setAvailabilityValue(double availabilityValue) {
  		this.availabilityValue = availabilityValue;
  	}
  
  	public static class AvailabilityWindow {
      	public String unit;
      	public long value;
      }
      
      public VEE(String veeName, ServiceApplication serviceApplication) {
      	if(veeName == null)
      		throw new IllegalArgumentException("VEE name cannot be null");
      	if(serviceApplication == null)
      		throw new IllegalArgumentException("Service application name cannot be null");
          this.veeName = veeName;
          this.serviceApplication = serviceApplication;
      }
      
      public void addDiskConf(DiskConf diskConf) {
  		System.out.println(" +++++ DiskConf " + diskConf.getImageURL() + " added to VEE " + getFQN().toString() + " configuration");
          disksConf.add(diskConf);
      }
      
      public List<DiskConf> getDisksConf() {
          return disksConf;
      }
      
      public void addProduct(Product product) {
  		System.out.println(" +++++ Product " + product.getName());
  		products.add(product);
      }
      
      @OneToMany
      public List<Product> getProducts() {
          return products;
      }
      
      public Product getProductByName(String productin) {
  
      	for (Iterator<Product> it = products.iterator(); it.hasNext(); ) {
      		Product product = it.next();
      		if (product.getName().equals(productin)) {
      			return product;
      		}
      	}
      	return null;
      }
      
      
      
      public void removeDiskConf(DiskConf diskConf){
      	if (disksConf.remove(diskConf))
      		System.out.println(" +++++ DiskConf " + diskConf.getImageURL() + " removed from VEE " + getFQN().toString() + " configuration");
      	System.out.println(" +++++ There are " + disksConf.size() + " disk configurations left in VEE");
  