Package com.art.anette.datamodel.dataobjects.managed

Examples of com.art.anette.datamodel.dataobjects.managed.Department


        try {
            String q = SQLFormatter.generateQuery("SELECT * FROM %s ", Department.getTableName());
            ResultSet rs = dbConnector.query(q);
            while (rs.next()) {
                result.add(new Department(null, rs));
            }
            rs.close();

        } catch (SQLException ex) {
            logger.severe(null, ex);
View Full Code Here


        boolean result;

        if (obj instanceof Company) {
            result = isCompanyManager();
        } else if (obj instanceof Department) {
            Department department = (Department) obj;
            result = isCompanyManager() || isDepartmentManager(department);
        } else if (obj instanceof Project) {
            Project project = (Project) obj;
            result = isCompanyManager() || getId() == project.getManagerId() || (getDepartmentId() == project.getDepartmentId() && isDepartmentManager(getDepartment()));
        } else if (obj instanceof WorkPackage) {
View Full Code Here

            }
            if (childClass.equals(Employee.class)) {
                return false;
            }
        } else if (parent instanceof Department) {
            Department department = (Department) parent;
            if (childClass.equals(Project.class)) {
                return user.isManager(department);
            }
            if (childClass.equals(Employee.class)) {
                return false;
View Full Code Here

            ResultSet rs = dbConnector.query("SELECT * FROM " + Company.getTableName());
            if (rs.next()) {
                company = new Company(this, rs);
            } else {
                company = getDummyCompany();
                final Department d = getDummyDepartment();
                final Employee e = getDummyEmployee();
                final Project project = getDummyProject();
                final WorkPackage workPackage = getRootWorkPackage();
                dbConnector.execute("SET REFERENTIAL_INTEGRITY FALSE;",
                        e.toSQL(owner), company.toSQL(owner), d.toSQL(owner), project.toSQL(owner), workPackage.toSQL(owner),
                        "SET REFERENTIAL_INTEGRITY TRUE;");
            }

            employees = new HashMap<Long, Employee>();
            rs = dbConnector.query("SELECT * FROM " + Employee.getTableName());
            while (rs.next()) {
                employees.put(rs.getLong("id"), new Employee(this, rs));
            }

            departments = new HashMap<Long, Department>();
            rs = dbConnector.query("SELECT * FROM " + Department.getTableName());
            while (rs.next()) {
                departments.put(rs.getLong("id"), new Department(this, rs));
            }

            projects = new HashMap<Long, Project>();
            rs = dbConnector.query("SELECT * FROM " + Project.getTableName());
            while (rs.next()) {
                projects.put(rs.getLong("id"), new Project(this, rs));
            }

            workPackages = new HashMap<Long, WorkPackage>();
            rs = dbConnector.query("SELECT * FROM " + WorkPackage.getTableName());
            while (rs.next()) {
                workPackages.put(rs.getLong("id"), new WorkPackage(this, rs));
            }

            tasks = new HashMap<List<Long>, Task>();
            rs = dbConnector.query("SELECT * FROM " + Task.getTableName());
            while (rs.next()) {
                Task t = new Task(this, rs);
                tasks.put(t.getPrimaryKey(), t);
            }

            durations = new HashMap<List<Long>, Duration>();
            rs = dbConnector.query("SELECT * FROM " + Duration.getTableName());
            while (rs.next()) {
                Duration d = new Duration(this, rs);
                durations.put(d.getPrimaryKey(), d);
            }

            employeeProjectRelations = new RelationList<Employee, Project, EPRData, EmployeeProjectRelation>();
            rs = dbConnector.query("SELECT * FROM " + EmployeeProjectRelation.getTableName());
            while (rs.next()) {
                employeeProjectRelations.add(new EmployeeProjectRelation(this, rs));
            }

            ftOverrides = new HashMap<Long, FTOverride>();
            rs = dbConnector.query("SELECT * FROM " + FTOverride.getTableName());
            while (rs.next()) {
                ftOverrides.put(rs.getLong("id"), new FTOverride(this, rs));
            }

            employeeWorkPackageRelations =
                    new RelationList<Employee, WorkPackage, EWPRData, EmployeeWorkPackageRelation>();
            rs = dbConnector.query("SELECT * FROM " + EmployeeWorkPackageRelation.getTableName());
            while (rs.next()) {
                employeeWorkPackageRelations.add(new EmployeeWorkPackageRelation(this, rs));
            }

            workPackageDependsRelations = new RelationList<WorkPackage, WorkPackage, WPDRData, WorkPackageDependsRelation>();
            rs = dbConnector.query("SELECT * FROM " + WorkPackageDependsRelation.getTableName());
            while (rs.next()) {
                workPackageDependsRelations.add(new WorkPackageDependsRelation(this, rs));
            }

            checkReferentialIntegrity();

            rs = dbConnector.query(SQLFormatter.generateQuery("SELECT * FROM %s WHERE timestamp = 0 AND employee = %d", Task.getTableName(), owner.getId()));
            while (rs.next()) {
                syncUp.addObject(new Task(null, rs));
            }


            rs = dbConnector.query(SQLFormatter.generateQuery("SELECT * FROM %s WHERE timestamp = 0 AND employee = %d", Duration.getTableName(), owner.getId()));
            while (rs.next()) {
                syncUp.addObject(new Duration(null, rs));
            }


            rs = dbConnector.query(SQLFormatter.generateQuery("SELECT * FROM %s WHERE timestamp = -1 AND employee = %d", Task.getTableName(), owner.getId()));
            while (rs.next()) {
                if (owner.getId() == company.getManagerId()) {
                    ProgressUtils.errorMessage("You want to remove objects as a company manager from off-line data. This is not supported.");
                    System.exit(1);
                }
                Task t = new Task(null, rs);
                t.setState(Status.REMOVED);
                syncUp.addObject(t);
            }

            rs = dbConnector.query(SQLFormatter.generateQuery("SELECT * FROM %s WHERE timestamp = -1 AND employee = %d", Duration.getTableName(), owner.getId()));
            while (rs.next()) {
                if (owner.getId() == company.getManagerId()) {
                    ProgressUtils.errorMessage("You want to remove objects as a company manager from off-line data. This is not supported.");
                    System.exit(1);
                }
                Duration d = new Duration(null, rs);
                d.setState(Status.REMOVED);
                syncUp.addObject(d);
            }

            syncUp.addObject(createTimestampTable());
            synchronize();
View Full Code Here

    private Department getDummyDepartment() {
        DepartmentData dd = new DepartmentData();
        dd.name = "dummyDep";
        dd.manager = DBControl.DUMMY_EMPLOYEE_ID;
        Department d = new Department(this, DBControl.DUMMY_DEPARTMENT_ID, dd);
        d.setState(Status.NEW);
        return d;
    }
View Full Code Here

     * Erzeugt ein neues Department ohne es in die Maps/Listen einzutragen.
     *
     * @return neues Department
     */
    public Department createDepartment() {
        return new Department(null, counter--, new DepartmentData());
    }
View Full Code Here

                    "SELECT department FROM %s WHERE id = %d" +
                    ") AND %s LIMIT 1", Department.getTableName(), Employee.getTableName(), owner, getTimestampQuery(ts));
            ResultSet rs = dbConnector.query(q);
            while (rs.next()) {
                if (stub) {
                    result.add(new Department(sdbc, rs.getLong("id")));
                } else {
                    result.add(new Department(sdbc, rs));
                }
            }
            rs.close();

        } catch (SQLException ex) {
View Full Code Here

    /**
     * Die Daten der Abteilung werden ausgelesen und angezeigt.
     */
    @Override
    protected void update() {
        Department department = (Department) dataObject;

        lblName.setText(department.getName());
        lblManager.setText(department.getManager().toString());

        pbProgress.setValue(Logic.getProgress(department));
        pbTimeProgress.setValue(Logic.getTimeProgress(department));
    }
View Full Code Here

    @Override
    public List<Project> getTableEntries() {
        Logic.lockReading();
        List<Project> projects;
        try {
            Department department = (Department) object;
            projects = department.getProjects();

            for (Project p : projects) {
                p.addObserver(this);
            }
        } finally {
View Full Code Here

TOP

Related Classes of com.art.anette.datamodel.dataobjects.managed.Department

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.