public static List sortByName(List employees) { EDEmployee temp = null; EDEmployee tempA = null; EDEmployee tempB = null; Vector vctA = null; Vector vctB = null; for (int i = 0; i < employees.size() - 1; i++) { for (int j = i + 1; j < employees.size(); j++) { tempA = (EDEmployee) employees.get(i); tempB = (EDEmployee) employees.get(j); vctA = splitName(tempA.getName()); vctB = splitName(tempB.getName()); int compare = compareName(vctA, vctB); if (compare > 0) { temp = tempA; employees.set(i, tempB); employees.set(j, temp); } } } return employees; }
public int compareTo(EDEmployee edEmployee) { int value = 0; if (getDisplayOrder() < edEmployee.getDisplayOrder()) { value = -1; } else if (getDisplayOrder() > edEmployee.getDisplayOrder()) { value = 1; } else { value = 0; } if (value != 0) { return value; } return 0; }
public boolean equals(Object obj) { if (obj == null) { return false; } EDEmployee edEmployee = null; try { edEmployee = (EDEmployee) obj; } catch (ClassCastException cce) { return false; } long pk = edEmployee.getPrimaryKey(); if (getPrimaryKey() == pk) { return true; } else { return false; } }
/** * Converts the soap model instance into a normal model instance. * * @param soapModel the soap model instance to convert * @return the normal model instance */ public static EDEmployee toModel(EDEmployeeSoap soapModel) { EDEmployee model = new EDEmployeeImpl(); model.setUuid(soapModel.getUuid()); model.setId(soapModel.getId()); model.setCreatedDate(soapModel.getCreatedDate()); model.setModifiedDate(soapModel.getModifiedDate()); model.setTitle(soapModel.getTitle()); model.setName(soapModel.getName()); model.setBirthday(soapModel.getBirthday()); model.setHomeSide(soapModel.getHomeSide()); model.setFamily(soapModel.getFamily()); model.setRace(soapModel.getRace()); model.setHome(soapModel.getHome()); model.setHomePhone(soapModel.getHomePhone()); model.setWorkPhone(soapModel.getWorkPhone()); model.setMobilePhone(soapModel.getMobilePhone()); model.setEmail(soapModel.getEmail()); model.setDepartmentId(soapModel.getDepartmentId()); model.setMajorLevel(soapModel.getMajorLevel()); model.setPhilosophism(soapModel.getPhilosophism()); model.setForeignLanguage(soapModel.getForeignLanguage()); model.setJoinDate(soapModel.getJoinDate()); model.setImage(soapModel.getImage()); model.setIsShowTree(soapModel.getIsShowTree()); model.setOtherInfo(soapModel.getOtherInfo()); model.setCompanyId(soapModel.getCompanyId()); model.setGroupId(soapModel.getGroupId()); model.setUserId(soapModel.getUserId()); model.setLanguageId(soapModel.getLanguageId()); model.setDisplayOrder(soapModel.getDisplayOrder()); model.setSex(soapModel.getSex()); model.setStatus(soapModel.getStatus()); model.setShow(soapModel.getShow()); return model; }