package at.ac.tuwien.inso.dto;

import at.ac.tuwien.inso.entity.Semester;

//finished transformation on 8.1.
public class SemesterDto {

	private Long id;

	private String label;


    public SemesterDto(String label) {
        this.label = label;
    }
	
	public Long getId() {
		return id;
	}
	
	public void setId(Long id) {
		this.id = id;
	}

	public String getLabel() {
		return label;
	}

	public void setLabel(String label) {
		this.label = label;
	}

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

		SemesterDto semester = (SemesterDto) o;

		if (id != null ? !id.equals(semester.id) : semester.id != null) return false;
		return label != null ? label.equals(semester.label) : semester.label == null;

	}

	@Override
	public String toString() {
		return "SemesterDto{" +
				"id=" + id +
				", label='" + label + '\'' +
				'}';
	}	
	
	/**
	 * sets the label to a new Semester instance. The Id will not be persisted.
	 * @return
	 */
	public Semester toEntity(){
		Semester semesterEntity = new Semester(label);
		semesterEntity.setId(id);
		return semesterEntity;
	}

}

@@ -25,16 +25,43 @@
 o.dto;%0A%0A
+import java.util.Objects;%0A%0A
 import a
@@ -93,16 +93,62 @@
 emester;
+%0Aimport at.ac.tuwien.inso.entity.SemesterType;
 %0A%0A//fini
@@ -235,296 +235,544 @@
 ate 
-String label;%0A%0A%0A    public SemesterDto(String label) %7B%0A        this.label = label;%0A    %7D%0A%09%0A%09public Long getId() %7B%0A%09%09return id;%0A%09%7D%0A%09%0A%09public void setId(Long id) %7B%0A%09%09this.id = id;%0A%09%7D%0A%0A%09public String getLabel() %7B%0A%09%09return label;%0A%09%7D%0A%0A%09public void setLabel(String label) %7B%0A%09%09this.label = label
+int year;%0A%0A%09private SemesterType type;%0A%0A%09public SemesterDto() %7B%0A%09%7D%0A%0A%09public SemesterDto(int year, SemesterType type) %7B%0A%09%09this.year = year;%0A%09%09this.type = type;%0A%09%7D%0A%0A%09public Long getId() %7B%0A%09%09return id;%0A%09%7D%0A%09%0A%09public void setId(Long id) %7B%0A%09%09this.id = id;%0A%09%7D%0A%0A%09public String getLabel() %7B%0A%09%09return getYear() + %22 %22 + getType();%0A%09%7D%0A%0A%09public int getYear() %7B%0A%09%09return year;%0A%09%7D%0A%0A%09public void setYear(int year) %7B%0A%09%09this.year = year;%0A%09%7D%0A%0A%09public SemesterType getType() %7B%0A%09%09return type;%0A%09%7D%0A%0A%09public void setType(SemesterType type) %7B%0A%09%09this.type = type
 ;%0A%09%7D
@@ -823,38 +823,8 @@
 ) %7B%0A
-%09%09if (this == o) return true;%0A
 %09%09if
@@ -866,16 +866,21 @@
 lass()) 
+%7B%0A%09%09%09
 return f
@@ -884,16 +884,20 @@
 n false;
+%0A%09%09%7D
 %0A%0A%09%09Seme
@@ -904,24 +904,20 @@
 sterDto 
-semester
+that
  = (Seme
@@ -935,300 +935,213 @@
 %0A%0A%09%09
-if (id != null ? !id.equals(semester.id) : semester.id != null) return false;%0A%09%09return label != null ? label.equals(semester.label) : semester.label == null;%0A%0A%09%7D%0A%0A%09@Override%0A%09public String toString() %7B%0A%09%09return %22SemesterDto%7B%22 +%0A%09%09%09%09%22id=%22 + id +%0A%09%09%09%09%22, label='%22 + label + '%5C'' +%0A%09%09%09%09'%7D'
+return getYear() == that.getYear() && Objects.equals(getId(), that.getId()) && getType() == that.getType();%0A%09%7D%0A%0A%09@Override%0A%09public int hashCode() %7B%0A%09%09return Objects.hash(getId(), getYear(), getType())
 ;%0A%09%7D
-%09%0A%09
+%0A
 %0A%09/*
@@ -1306,21 +1306,26 @@
 emester(
-label
+year, type
 );%0A%09%09sem

Refactor SemesterDto