Package org.adfemg.datacontrol.demo.persist

Examples of org.adfemg.datacontrol.demo.persist.Employee


                    continue;
                }
                long empId = Long.parseLong(empIdStr);
                long deptId = Long.parseLong(deptIdStr);
                Department dept = ofy().load().key(Key.create(Department.class, deptId)).now();
                Employee emp = ofy().load().key(Key.create(Employee.class, empId)).now();
                dept.addEmployee(emp);
            }
            ofy().save().entities(depts).now();
        } catch (Exception e) {
            throw new ServletException(e);
View Full Code Here


    private List<Employee> employees(List<Map<String, String>> values) throws ParseException {
        List<Employee> retval = new ArrayList<Employee>(values.size());
        SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yy");
        for (Map<String,String> val : values) {
            Employee emp = new Employee();
            emp.setId(Long.valueOf(val.get("EMPLOYEE_ID")));
            emp.setFirstName(val.get("FIRST_NAME"));
            emp.setLastName(val.get("LAST_NAME"));
            emp.setEmail(val.get("EMAIL"));
            emp.setPhoneNumber(val.get("PHONE_NUMBER"));
            emp.setHireDate(formatter.parse(val.get("HIRE_DATE")));
            emp.setJob(ofy().load().key(Key.create(Job.class, val.get("JOB_ID"))).now());
            emp.setSalary(Double.parseDouble(val.get("SALARY")));
            String comm = val.get("COMMISSION_PCT").replace(",", ".");
            emp.setCommissionPercentage(comm.isEmpty() ? null : Double.parseDouble(comm));
            //emp.setManager(val.get("MANAGER_ID"));
            //emp.setDepartment(val.get("DEPARTMENT_ID"));
            retval.add(emp);
        }
        return retval;
View Full Code Here

TOP

Related Classes of org.adfemg.datacontrol.demo.persist.Employee

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.