package org.project.neutrino.nfvo.catalogue.nfvo;

import org.project.neutrino.nfvo.catalogue.mano.common.DeploymentFlavour;
import org.project.neutrino.nfvo.catalogue.util.IdGenerator;

import javax.persistence.*;
import java.util.Date;

/**
 * Created by lto on 20/05/15.
 */
@Entity
public class Server {
    @Id
    private String id = IdGenerator.createUUID();
    @Version
    private int version = 0;
    private String name;

    @OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.PERSIST)
    private NFVImage image;
    @OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.PERSIST)
    private DeploymentFlavour flavor;

    private String status;
    private String extendedStatus;
    private String extId;
    private String ip;
    private String floatingIp;

    @Temporal(TemporalType.DATE)
    private Date created;
    @Temporal(TemporalType.DATE)
    private Date updated;

    public String getId() { return id; }

    public int getVersion() { return version; }

    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public void setExtId(String extId) {
        this.extId = extId;
    }

    public String getExtId() {
        return extId;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public String getIp() {
        return ip;
    }

    public Date getUpdated() {
        return updated;
    }

    public void setUpdated(Date updated) {
        this.updated = updated;
    }

    public Date getCreated() {
        return created;
    }

    public void setCreated(Date created) {
        this.created = created;
    }

    public String getExtendedStatus() {
        return extendedStatus;
    }

    public void setExtendedStatus(String extendedStatus) {
        this.extendedStatus = extendedStatus;
    }

    public NFVImage getImage() {
        return image;
    }

    public void setImage(NFVImage image) {
        this.image = image;
    }

    public DeploymentFlavour getFlavor() {
        return flavor;
    }

    public void setFlavor(DeploymentFlavour flavor) {
        this.flavor = flavor;
    }

    public String getFloatingIp() { return floatingIp; }

    public void setFloatingIp(String floatingIp) { this.floatingIp = floatingIp; }

    @Override
    public String toString() {
        return "Server{" +
                "id='" + id + '\'' +
                ", name='" + name + '\'' +
                ", status='" + status + '\'' +
                ", extendedStatus='" + status + '\'' +
                ", version=" + version +
                ", extId='" + extId + '\'' +
                ", ip='" + ip + '\'' +
                ", floatingIp='" + floatingIp + '\'' +
                ", created='" + created + '\'' +
                ", updated='" + updated + '\'' +
                '}';
    }
}


@@ -178,16 +178,63 @@
 nerator;
+%0Aimport org.springframework.util.MultiValueMap;
 %0A%0Aimport
@@ -277,16 +277,65 @@
 il.Date;
+%0Aimport java.util.HashMap;%0Aimport java.util.List;
 %0A%0A/**%0A *
@@ -830,25 +830,48 @@
 private 
-String
+HashMap%3CString,List%3CString%3E%3E
  ip
+s
 ;%0A    pr
@@ -1539,18 +1539,42 @@
 etIp
-(String
+s(HashMap%3CString,List%3CString%3E%3E
  ip
+s
 ) %7B%0A
@@ -1592,13 +1592,15 @@
 s.ip
+s
  = ip
+s
 ;%0A  
@@ -1619,20 +1619,43 @@
 lic 
-String
+HashMap%3CString,List%3CString%3E%3E
  getIp
+s
 () %7B
@@ -1672,16 +1672,17 @@
 eturn ip
+s
 ;%0A    %7D%0A
@@ -2971,16 +2971,17 @@
 , ip
+s
 ='%22 + ip
  + '
@@ -2976,16 +2976,17 @@
 ='%22 + ip
+s
  + '%5C'' 

change ip to list of network_name:List of strings