package sg.ncl.service.experiment.data.jpa.entities;

import sg.ncl.common.jpa.AbstractEntity;
import sg.ncl.service.experiment.domain.Experiment;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

/**
 * @author Christopher Zhong
 */
@Entity
@Table(name = "experiments")
public class ExperimentEntity extends AbstractEntity implements Experiment {

    @Id
    @GeneratedValue
    @Column(name = "id", nullable = false, unique = true, updatable = false)
    private Long id;

    @Column(name = "team_id", nullable = false, updatable = false)
    private String teamId;

    @Column(name = "name", nullable = false)
    private String name;

    @Column(name = "description", nullable = false)
    private String description;

    @Column(name = "ns_file", nullable = false)
    private String nsFile;

    @Column(name = "idle_swap", nullable = false)
    private Integer idleSwap;

    @Column(name = "max_duration", nullable = false)
    private Integer maxDuration;

    @Override
    public Long getId() {
        return id;
    }

    void setId(final Long id) {
        this.id = id;
    }

    @Override
    public boolean equals(final Object o) {
        if (this == o) { return true; }
        if (o == null || getClass() != o.getClass()) { return false; }

        final Experiment that = (Experiment) o;

        return getId() == null ? that.getId() == null : getId().equals(that.getId());
    }

    @Override
    public int hashCode() {
        return getId() == null ? 0 : getId().hashCode();
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("ExperimentEntity{");
        sb.append("id='").append(id).append('\'');
        sb.append(", super=").append(super.toString());
        sb.append('}');
        return sb.toString();
    }

    @Override
    public String getTeamId() {
        return teamId;
    }

    public void setTeamId(String teamId) {
        this.teamId = teamId;
    }

    @Override
    public String getName() {
        return name;
    }

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

    @Override
    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @Override
    public String getNsFile() {
        return nsFile;
    }

    public void setNsFile(String nsFile) {
        this.nsFile = nsFile;
    }

    @Override
    public Integer getIdleSwap() {
        return idleSwap;
    }

    public void setIdleSwap(Integer idleSwap) {
        this.idleSwap = idleSwap;
    }

    @Override
    public Integer getMaxDuration() {
        return maxDuration;
    }

    public void setMaxDuration(Integer maxDuration) {
        this.maxDuration = maxDuration;
    }
}

@@ -1215,710 +1215,8 @@
  %7D%0A%0A
-    @Override%0A    public boolean equals(final Object o) %7B%0A        if (this == o) %7B return true; %7D%0A        if (o == null %7C%7C getClass() != o.getClass()) %7B return false; %7D%0A%0A        final Experiment that = (Experiment) o;%0A%0A        return getId() == null ? that.getId() == null : getId().equals(that.getId());%0A    %7D%0A%0A    @Override%0A    public int hashCode() %7B%0A        return getId() == null ? 0 : getId().hashCode();%0A    %7D%0A%0A    @Override%0A    public String toString() %7B%0A        final StringBuilder sb = new StringBuilder(%22ExperimentEntity%7B%22);%0A        sb.append(%22id='%22).append(id).append('%5C'');%0A        sb.append(%22, super=%22).append(super.toString());%0A        sb.append('%7D');%0A        return sb.toString();%0A    %7D
 %0A%0A  
@@ -2211,11 +2211,1017 @@
 n;%0A    %7D
+%0A%0A    @Override%0A    public boolean equals(final Object o) %7B%0A        if (this == o) %7B return true; %7D%0A        if (o == null %7C%7C getClass() != o.getClass()) %7B return false; %7D%0A%0A        final Experiment that = (Experiment) o;%0A%0A        return getId() == null ? that.getId() == null : getId().equals(that.getId());%0A    %7D%0A%0A    @Override%0A    public int hashCode() %7B%0A        return getId() == null ? 0 : getId().hashCode();%0A    %7D%0A%0A    @Override%0A    public String toString() %7B%0A        final StringBuilder sb = new StringBuilder(%22ExperimentEntity%7B%22);%0A        sb.append(%22id='%22).append(id).append('%5C'');%0A        sb.append(%22, teamId=%22).append(teamId);%0A        sb.append(%22, name=%22).append(name);%0A        sb.append(%22, description=%22).append(description);%0A        sb.append(%22, nsFile=%22).append(nsFile);%0A        sb.append(%22, idleSwap=%22).append(idleSwap);%0A        sb.append(%22, maxDuration=%22).append(maxDuration);%0A        sb.append(%22, super=%22).append(super.toString());%0A        sb.append('%7D');%0A        return sb.toString();%0A    %7D
 %0A%7D%0A

Add toString method