/**
*
*/
package com.cin.dto;
import java.io.Serializable;
import com.cin.entity.Education;
/**
* @author arunsanjay
*
*/
public class EducationDTO implements Serializable {
private static final long serialVersionUID = 1L;
private String education;
private String eduenroll;
public EducationDTO() {
}
public EducationDTO(Education pEducationEntity) {
setEducation( pEducationEntity.getEducation() );
setEduenroll( pEducationEntity.getEduenroll() );
}
public boolean isAssociates(){
if(this.education.contains("Associates")) {
return true;
} else {
return false;
}
}
public boolean isBachelors() {
if(this.education.contains("Bachelor")) {
return true;
}
return false;
}
public boolean isDoctorate() {
if(this.education.contains("Doctorate")) {
return true;
}
return false;
}
public boolean isMasters() {
if(this.education.contains("Masters")) {
return true;
}
return false;
}
public boolean isProfesssional() {
if(this.education.contains("Prof")) {
return true;
}
return false;
}
public boolean hasCollageDegree() {
boolean hasCollageDegree =
this.isAssociates() ||
this.isBachelors() ||
this.isDoctorate() ||
this.isMasters() ||
this.isProfesssional();
return hasCollageDegree;
}
/**
* @return the education
*/
public String getEducation() {
return education;
}
/**
* @param education the education to set
*/
public void setEducation(String education) {
if( education == null ){
this.education = null;
} else {
this.education = education.trim();
}
}
/**
* @return the eduenroll
*/
public String getEduenroll() {
return eduenroll;
}
/**
* @param eduenroll the eduenroll to set
*/
public void setEduenroll(String eduenroll) {
if( eduenroll == null ){
this.eduenroll = null;
} else {
this.eduenroll = eduenroll.trim();
}
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((education == null) ? 0 : education.hashCode());
result = prime * result
+ ((eduenroll == null) ? 0 : eduenroll.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof EducationDTO)) {
return false;
}
EducationDTO other = (EducationDTO) obj;
if (education == null) {
if (other.education != null) {
return false;
}
} else if (!education.equals(other.education)) {
return false;
}
if (eduenroll == null) {
if (other.eduenroll != null) {
return false;
}
} else if (!eduenroll.equals(other.eduenroll)) {
return false;
}
return true;
}
public Education toEJB(int ssn){
Education ejb = new Education();
ejb.setSsn(ssn);
ejb.setEducation(education);
ejb.setEduenroll(eduenroll);
return ejb;
}
}