Package com.art.anette.datamodel.dataobjects.simple

Examples of com.art.anette.datamodel.dataobjects.simple.Employee


        try {
            connect(true);

            fireEvent(NetworkEvent.NEType.loggingIn);
            monitor = ProgressUtils.createProgress(lang.getString("ProgressLoggingIn"));
            Employee e = login(lr);
            cdbc.setOwner(e, false);
            monitor.finish();
            monitor = null;
            fireEvent(NetworkEvent.NEType.loggedIn);
            SwingUtilities.invokeLater(new Runnable() {
View Full Code Here


            Object obj = dataResponse.getObjects().get(0);
            if (!(obj instanceof Employee)) {
                fireEvent(NetworkEvent.NEType.loginError);
                throw new LoginFailedException("Login response undefined!");
            }
            Employee employee = (Employee) obj;

            {
                final List<ClientLogRecord> list = SerializingReportHandler.getInstance().read();
                for (ClientLogRecord clientLogRecord : list) {
                    final Response o1 = synchroneousRequest(clientLogRecord);
                    if (!(o1 instanceof VoidResponse)) {
                        fireEvent(NetworkEvent.NEType.loginError);
                        throw new LoginFailedException("Problem sending exception to the server.");
                    }
                }
                SerializingReportHandler.getInstance().clear();
                if (!list.isEmpty()) {
                    logger.info(String.format("Sent %d exceptions to the server.", list.size()));
                }
            }
            setStreams();

            fireEvent(NetworkEvent.NEType.loggedIn, employee.getEmail());
            return employee;

        } else {
            fireEvent(NetworkEvent.NEType.loginError);
            throw new LoginFailedException("Login response undefined!");
View Full Code Here

     */
    private List<Employee> getEmployees(Project p) {
        List<Employee> emps = new LinkedList<Employee>();
        for (EmployeeProjectRelation epr : employeeProjectRelations) {
            if (epr.getRightId() == p.getId()) {
                Employee e = employees.get(epr.getLeftId());
                if (e != null) {
                    emps.add(e);
                }
            }
        }
View Full Code Here

                    throw new DBDirtyException(rs.getLong("id"));
                }
                dbConnector.execute(SQLFormatter.generateQuery("UPDATE %s SET lastlogin = UNIX_TIMESTAMP() WHERE id= %d",
                        Employee.getTableName(), rs.getLong("id")));

                Employee e = new Employee(null, rs);
                rs.close();
                return e;
            } else {
                rs.close();
                throw new LoginFailedException("Incorrect login or password!");
View Full Code Here

            if (rs.next()) {
                throw new RegistrationFailedException("This email is already in system!");
            }
            rs.close();

            Employee e = new Employee(this, 0, 0, data);
            e.setState(Status.NEW);
            dbConnector.execute(e.toSQL(owner));
            rs = dbConnector.query("SELECT LAST_INSERT_ID() as id FROM " + Employee.getTableName());
            rs.next();

            e = new Employee(null, rs.getLong("id"), data);
            rs.close();

            SDBCPool.getInstance().inform(e);
            return e;
View Full Code Here

    @SuppressWarnings({"SynchronizationOnLocalVariableOrMethodParameter"})
    private static void testCommentUpdate(Logic logic) throws InterruptedException {
        final boolean[] success = {false};
        final Object lock = new Object();
        final Employee emp = logic.getDBControl().getEmployee(logic.getEmployee().getId());
        final String newPart = "///" + DateTimeUtils.formatStandardWay(new Date());
        emp.addObserver(new Observer() {
            public void inform(DataObject d) {
                logger.info("++++++++++++++++ inform  " + prettyPrintObjectForLogging(d) + " " + (d == emp));
                if (d.isValid() && d == emp && emp.getComment().endsWith(newPart)) {
                    logger.info("Got the udpated object");
                    success[0] = true;
                    synchronized (lock) {
                        lock.notifyAll();
                    }
                }

            }

            public void stopObservation() {
                throw new InternalError();
            }
        });
        logger.info("Udpating object '" + newPart + "'");
        final String comment = emp.getComment() + "\n" + newPart;
        emp.setComment(limitLines(comment));
        logic.getDBControl().synchronize();

        synchronized (lock) {
            lock.wait(5 * 1000);
        }
View Full Code Here

            Logic.unlockReading();
        }
    }

    private void updateLocked() {
        Employee employee = (Employee) dataObject;
        lblFirstname.setText(employee.getFirstname());
        lblLastname.setText(employee.getLastname());
        lblEmail.setText(employee.getEmail());
        lblPhone.setText(employee.getPhone());

        taComment.setText(employee.getComment());

        Project[] projects = employee.getProjects().toArray(new Project[employee.getProjects().size()]);
        StringBuilder proj = new StringBuilder();
        for (int i = 0; i < projects.length - 1; i++) {
            proj.append(projects[i].getName()).append(", ");
        }
        if (proj.length() > 0) {
            proj.append(projects[projects.length - 1].getName());
        }

        lblProjects.setText(proj.toString());
        lblDepartment.setText(employee.getDepartment().getName());

        if (employee.isCompanyManager()) {
            lblRole.setText(lang.getString("CompanyManager"));
        } else if (employee.isDepartmentManager(employee.getDepartment())) {
            lblRole.setText(String.format(lang.getString("DepartmentManagerOf"),
                    employee.getDepartment().getName()));
        } else {
            StringBuilder role = new StringBuilder();
            if (projects.length >= 1) {
                for (int i = 0; i < projects.length - 1; i++) {
                    role.append(getProjectRole(employee, projects[i])).append(", ");
View Full Code Here

        Logic.lockReading();
        try {
            edtName.setText(project.getName());

            for (Iterator<Employee> it = emp.iterator(); it.hasNext();) {
                Employee employee = it.next();
                if (employee.isCompanyManager()) {
                    it.remove();
                }
            }

            Employee[] employees = emp.toArray(new Employee[emp.size()]);
View Full Code Here

        this.projectSelection = projectSelection;
        this.importMode = importMode;

        Logic.lockReading();
        try {
            Employee user = logic.getEmployee();
            List<Project> projects = new LinkedList<Project>();

            for (Department d : logic.getCompany().getDepartments()) {
                projects.addAll(d.getProjects());
            }

            if (importMode) {
                for (Iterator<Project> it = projects.iterator(); it.hasNext();) {
                    Project p = it.next();
                    if (!user.isAllowedToDelete(p)) {
                        it.remove();
                    }
                }
            }
View Full Code Here

                    return rootWorkPackages.get(rowIndex).getName();
                } else {
                    return "Summe";
                }
            }
            Employee employee = null;
            if (columnIndex < employees.size() + 1) {
                employee = employees.get(columnIndex - 1);
            }

            // null means the sum for this employee
View Full Code Here

TOP

Related Classes of com.art.anette.datamodel.dataobjects.simple.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.