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

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


                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


    @Override
    public List<WorkPackage> getTableEntries() {
        Logic.lockReading();
        List<WorkPackage> onlyParentWorkPackages;
        try {
            Project project = (Project) object;
            List<WorkPackage> allWorkPackages = project.getWorkPackages();
            onlyParentWorkPackages = new LinkedList<WorkPackage>();

            for (WorkPackage w : allWorkPackages) {
                if (w.getParentWorkPackage() == null) {
                    onlyParentWorkPackages.add(w);
View Full Code Here

            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) {
            WorkPackage workPackage = (WorkPackage) obj;
            result = isWorkPackageManager(workPackage);
        } else {
            throw new IllegalArgumentException("Unknown " + obj.getClass());
View Full Code Here

            }
            if (childClass.equals(Employee.class)) {
                return false;
            }
        } else if (parent instanceof Project) {
            Project project = (Project) parent;
            if (childClass.equals(WorkPackage.class)) {
                // Root packages
                return user.isCompanyManager() && !project.isCompleted();
            }
            if (childClass.equals(Employee.class)) {
                return user.isManager(project.getDepartment());
            }
            if (childClass.equals(FTOverride.class)) {
                return user.isCompanyManager();
            }
        } else if (parent instanceof WorkPackage) {
View Full Code Here

            Company company = (Company) obj;
            return user.isManager(company);
        } else if (obj instanceof Department) {
            return user.isCompanyManager();
        } else if (obj instanceof Project) {
            Project project = (Project) obj;
            return user.isManager(project);
        } else if (obj instanceof WorkPackage) {
            WorkPackage workPackage = (WorkPackage) obj;
            if (workPackage.isRoot()) {
                return user.isCompanyManager();
            }
            return user.isManager(workPackage.getProject()) || user.isWorkPackageManager(workPackage);
        } else if (obj instanceof Task) {
            Task task = (Task) obj;
            return task.getEmployeeId() == user.getId() || user.isManager(task.getWorkPackage());
        } else if (obj instanceof Duration) {
            Duration duration = (Duration) obj;
            final Project project = duration.getTask().getWorkPackage().getProject();
            final boolean base = duration.getEmployeeId() == user.getId() || user.isManager(project.getDepartment());
            if (!base) {
                return false;
            }
            //noinspection RedundantIfStatement
            if (!duration.getTask().getWorkPackage().isRangeInside(duration.getStart(), duration.getEnd())) {
View Full Code Here

            return false;
        }

        // The project manager is allowed to change everything except the name
        if (obj instanceof Project) {
            Project project = (Project) obj;
            if ("name".equals(attribute)) {
                return user.isManager(user.getDepartment()) && user.getDepartmentId() == project.getDepartmentId();
            }
        // Only Company Manager is allowed to change disabled flag
        } else if (obj instanceof Employee) {
            Employee emp = (Employee) obj;
            if ("disabled".equals(attribute)) {
View Full Code Here

                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()) {
View Full Code Here

        pd.end = new Date();
        pd.manager = DBControl.DUMMY_EMPLOYEE_ID;
        pd.name = "dummyProject";
        pd.start = new Date();

        Project p = new Project(this, DBControl.DUMMY_PROJECT_ID, pd);
        p.setState(Status.NEW);
        return p;
    }
View Full Code Here

     */
    public Project createProject(Department d) {
        ProjectData pd = new ProjectData();
        pd.department = d.getId();
        pd.manager = owner.getId();
        return new Project(null, counter--, pd);
    }
View Full Code Here

            }

            ResultSet rs = dbConnector.query(q);
            while (rs.next()) {
                if (stub) {
                    result.add(new Project(sdbc, rs.getLong("id"), rs.getLong("department")));
                } else {
                    result.add(new Project(sdbc, rs));
                }
            }
            rs.close();

        } catch (SQLException ex) {
View Full Code Here

TOP

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

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.