src/main/java/ru/indvdum/mywork/openjpa/model/WorkId.java
changeset 8 56338d6d58c2
parent 7 aaae4f8055f4
equal deleted inserted replaced
7:aaae4f8055f4 8:56338d6d58c2
     1 package ru.indvdum.mywork.openjpa.model;
     1 package ru.indvdum.mywork.openjpa.model;
     2 
     2 
       
     3 import javax.persistence.Embeddable;
       
     4 
       
     5 /**
       
     6  * @author indvdum
       
     7  * 17.08.2011 15:00:35
       
     8  *
       
     9  */
       
    10 @Embeddable
     3 public class WorkId{
    11 public class WorkId{
     4 	
    12 	
     5 	public Integer day;
    13 	public Integer dayId;
     6 	public Integer task;
    14 	public Integer taskId;
     7 	
    15 	
     8 	@Override
    16 	@Override
     9 	public boolean equals(Object obj) {
    17 	public boolean equals(Object obj) {
    10 		if (this == obj)
    18 		if (this == obj)
    11 			return true;
    19 			return true;
    13 			return false;
    21 			return false;
    14 		if (!(obj instanceof WorkId))
    22 		if (!(obj instanceof WorkId))
    15 			return false;
    23 			return false;
    16 		final WorkId other = (WorkId) obj;
    24 		final WorkId other = (WorkId) obj;
    17 		return (
    25 		return (
    18 				this.day == other.day 
    26 				this.dayId == other.dayId 
    19 				&& this.task == other.task 
    27 				&& this.taskId == other.taskId 
    20 				|| (
    28 				|| (
    21 						this.day != null 
    29 						this.dayId != null 
    22 						&& this.day.equals(other.day) 
    30 						&& this.dayId.equals(other.dayId) 
    23 						&& this.task != null 
    31 						&& this.taskId != null 
    24 						&& this.task.equals(other.task)
    32 						&& this.taskId.equals(other.taskId)
    25 						)
    33 						)
    26 				);
    34 				);
    27 	}
    35 	}
    28 
    36 
    29 	@Override
    37 	@Override
    30 	public int hashCode() {
    38 	public int hashCode() {
    31 		return day ^ task;
    39 		return dayId ^ taskId;
    32 	}
    40 	}
    33 
    41 
    34 }
    42 }