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

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


                entry.addObserver(this);
            }

            fireTableDataChanged();
        } else if (entries.contains(d)) {
            Employee entry = (Employee) d;
            // Ein Eintrag wurde aktualisiert
            int index = entries.indexOf(entry);
            if (entry.isRemoved()) {
                entry.removeObserver(this);
                entries.remove(entry);

                fireTableRowsDeleted(index, index);
            } else if (entry.getDepartment() != null &&
                    object instanceof Department &&
                    !entry.getDepartment().equals(object)) {
                int idx = entries.indexOf(entry);
                if (idx != -1) {
                    Employee e = entries.remove(idx);
                    e.removeObserver(this);
                    fireTableRowsDeleted(idx, idx);
                }
            } else
            // Benachrichtigen der View, falls sich ein Eintrag geändert hat
            {
View Full Code Here


            taComment.setText(object.getComment());

            final List<Employee> employees = logic.getDBControl().getEmployees(project);
            cbEmployees.setModel(new DefaultComboBoxModel(employees.toArray()));
            for (int i = 0; i < employees.size(); i++) {
                Employee employee = employees.get(i);
                if (employee.getId() == object.getEmployeeId()) {
                    cbEmployees.setSelectedIndex(i);
                    break;
                }
            }
View Full Code Here

    @Override
    public void save() {
        object.setComment(taComment.getText());
        object.setNewEnd(dcStart.getDate());

        Employee emp = (Employee) cbEmployees.getModel().getSelectedItem();
        object.setEmployee(emp);
        WorkPackage workPackage = (WorkPackage) cbWorkPackages.getModel().getSelectedItem();
        object.setWorkPackage(workPackage);
        if (add) {
            logic.getDBControl().addModifiedDataObject(object);
View Full Code Here

                        Employee.getTableName(), EmployeeProjectRelation.getTableName(), Department.getTableName(),
                        Company.getTableName(), owner, getTimestampQuery(ts), department);
            }
            ResultSet rs = dbConnector.query(q);
            while (rs.next()) {
                final Employee employee;
                if (stub) {
                    employee = new Employee(sdbc, rs.getLong("id"), rs.getLong("department"));
                } else {
                    employee = new Employee(sdbc, rs);
                    result.add(employee);
                }
                // The company manager has to have a valid department id for the client
                if (employee.getId() == companyManagerId) {
                    employee.setDepartmentId(department);
                }
                result.add(employee);
            }
            rs.close();
View Full Code Here

        DataObject dObj = null;
        if (node != null && node.getUserObject() != null && node.getUserObject() instanceof DataObject) {
            dObj = (DataObject) node.getUserObject();
        }

        final Employee emp = BasicController.getInstance().getLoggedInEmployee();

        if (dObj instanceof Company) {
            setIcon(new ImageIcon(getClass().getResource("/com/art/anette/client/ui/resources/management.png")));
        } else if (dObj instanceof Department) {
            setIcon(new ImageIcon(getClass().getResource("/com/art/anette/client/ui/resources/department.png")));
View Full Code Here

        Logic.lockReading();
        try {
            edtName.setText(workPackage.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

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

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

            if (!add && !emp.contains(department.getManager())) {
View Full Code Here

     * @throws NetworkException     Wird geworfen, wenn die Verbindung zum Server fehlgeschlagen ist.
     */
    public void login(final LoginRequest lr) throws LoginFailedException, NetworkException {
        try {
            logger.info("Trying to login at the server with user " + lr.email + "...");
            Employee e = netControl.login(lr);
            logger.info("...successful logged in");
            employee = e;
            logins.put(lr, e.getId());
            loginData = lr;
            writeIDs();
        } catch (DBDirtyException ex) {
            try {
                logger.info("Database is dirty - cleaning and the retrying...");
                ClientDB cdb = new ClientDB(ex.getId());
                cdb.execute(SQLFormatter.generateQuery("DELETE FROM %s", Employee.getTableName()));
                cdb.execute(SQLFormatter.generateQuery("DELETE FROM %s", Project.getTableName()));
                cdb.execute(SQLFormatter.generateQuery("DELETE FROM %s", Department.getTableName()));
                cdb.execute(SQLFormatter.generateQuery("DELETE FROM %s", WorkPackage.getTableName()));
                cdb.execute(SQLFormatter.generateQuery("DELETE FROM %s", EmployeeProjectRelation.getTableName()));
                cdb.execute(SQLFormatter.generateQuery("DELETE FROM %s", EmployeeWorkPackageRelation.getTableName()));
                cdb.execute(SQLFormatter.generateQuery("DELETE FROM %s", WorkPackageDependsRelation.getTableName()));
                cdb.execute(SQLFormatter.generateQuery("DELETE FROM %s", Task.getTableName()));
                cdb.execute(SQLFormatter.generateQuery("DELETE FROM %s", Duration.getTableName()));
            } catch (SQLException ex1) {
                logger.warning("Failed reading the database!", ex1);
            } catch (IOException ex1) {
                logger.warning("Reading the database file failed!", ex1);
            }

            login(lr);
        } catch (NetworkException ex) {
            if (logins.containsKey(lr)) {
                loginData = lr;
                try {
                    long id = logins.get(lr);
                    ClientDB cdb = new ClientDB(id);
                    ResultSet rs = cdb.query(SQLFormatter.generateQuery("SELECT * FROM %s WHERE id = %d", Employee.getTableName(), id));
                    if (!rs.next()) {
                        logger.warning("The login is known but not available in the local database. Raise an error to refetch from server.");
                        rs.close();
                        throw ex;
                    }
                    employee = new Employee(null, rs);
                    rs.close();
                } catch (SQLException ex1) {
                    logger.warning("Failed reading the database!", ex1);
                    throw ex;
                } catch (IOException ex1) {
View Full Code Here

        this.employeeSelection = employeeSelection;

        Logic.lockReading();
        try {
            for (Iterator<Employee> it = employees.iterator(); it.hasNext();) {
                Employee employee = it.next();
                if (employee.isCompanyManager()) {
                    it.remove();
                }
            }
        } finally {
            Logic.unlockReading();
View Full Code Here

            switch (columnIndex) {
                case TIMESTAMP:
                    Date d = entries.get(rowIndex).getDate();
                    return String.format("<html><i>(%s) </i></html>", DateTimeUtils.formatTime(d));
                case NAME:
                    Employee sender = logic.getDBControl().getEmployee(entries.get(rowIndex).getSender());
                    return String.format("<html><b>%s: </b></html>", sender.getName());
                case MESSAGE:
                    return entries.get(rowIndex).getMsg();

                default:
                    logger.warning("Column Index: " + columnIndex + " not mapped");
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.