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

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


     */
    protected boolean isAllowedToView(DataObject dObj) {
        if (dObj instanceof Company) {
            return true;
        } else if (dObj instanceof WorkPackage) {
            final WorkPackage wp = (WorkPackage) dObj;
            return existsProject(wp.getProjectId()) && isAllowedToView(wp.getProject());
        } else if (dObj instanceof Task) {
            final Task t = (Task) dObj;
            return existsWorkPackage(t.getWorkPackageId()) && isAllowedToView(t.getWorkPackage());
        } else if (dObj instanceof EmployeeProjectRelation) {
            final EmployeeProjectRelation epr = (EmployeeProjectRelation) dObj;
View Full Code Here


            map.put(wp.getName(), wp);
        }

        for (GanttTask t : tasks) {
            //ProgressUtils.displayProgress(String.format("Importing task %s into project %s", t.getName(), p.getName()), pi.current++);
            WorkPackage wp = map.get(t.getName());
            if (wp != null) { // WorkPackage gefunden
                wp.setStart(t.getStart());
                wp.setEnd(t.getEnd());
                wp.setMilestone(t.isMilestone());
                wp.setCompleted(t.isCompleted());
                info.updatedObjects++;
            } else { // WorkPackage nicht gefunden - neu erstellen
                WorkPackageData wpd = new WorkPackageData();
                wpd.completed = t.isCompleted();
                wpd.milestone = t.isMilestone();
                wpd.name = t.getName();
                wpd.start = t.getStart();
                wpd.end = t.getEnd();
                wpd.project = p.getId();
                wpd.manager = p.getManagerId();
                if (t.getParent() != null) {
                    wpd.parent = matchList.get(t.getParent()).getId();
                }
                wp = ((ClientDBControl) p.getDBControl()).synchroneousCreateWorkPackage(wpd);
                info.newObjects++;
            }

            if (wp != null) {
                // Übereinstimmung wurde gefunden, Abbildung hinzufügen
                matchList.put(t, wp);
                info.importedTasks++;
                // Die Kinder rekursiv updaten / hinzufügen
                //if (!wp.isNew())
                Logic.lockReading();
                List<WorkPackage> subs;
                try {
                    subs = wp.getSubWorkPackages();
                } finally {
                    Logic.unlockReading();
                }
                importTasks(p, subs, t.getChildren(), matchList, info, pi);
            }
View Full Code Here

            result = new ArrayList<DataObject>(Logic.getContainingElems(mdo));

            // Bei dem erweiterten Baum müssen noch die Tasks eingefügt werden
            if (expand && mdo instanceof WorkPackage) {
                WorkPackage wp = (WorkPackage) mdo;
                List<Task> tasks = wp.getTasks(null);

                for (Task task : tasks)
                // Nehme nur sichtbare oder Tasks die dem employee gehören
                {
                    if ((task.isVisible() && !showOnlyOwnTasks) || task.getEmployee().equals(employee)) {
                        result.add(task);
                    }
                }
            }

            // Da ein Projekt alle WPs liefert, werden nur die HauptWPs
            // eingefügt. Die UnterWPs werden erst dann eingefügt, wenn es
            // sich um den HauptWP handelt
            if (mdo instanceof Project) {
                for (int i = 0; i < result.size(); i++) {
                    DataObject dObj = result.get(i);
                    if (dObj instanceof WorkPackage) {
                        WorkPackage workPackage = (WorkPackage) dObj;
                        if (!workPackage.isRoot()) {
                            result.remove(i);
                            i--;
                        }
                    }
                }
View Full Code Here

            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());
        }
        return result;
View Full Code Here

            if (columnIndex < employees.size() + 1) {
                employee = employees.get(columnIndex - 1);
            }

            // null means the sum for this employee
            WorkPackage workPackage = null;
            if (rowIndex < rootWorkPackages.size()) {
                workPackage = rootWorkPackages.get(rowIndex);
            }

            long time = Logic.getTrackedTime(project, workPackage, employee, durationsOfProject);
View Full Code Here

            }
            if (childClass.equals(FTOverride.class)) {
                return user.isCompanyManager();
            }
        } else if (parent instanceof WorkPackage) {
            WorkPackage workPackage = (WorkPackage) parent;
            if (workPackage.isCompletedRec()) {
                return false;
            }
            if (childClass.equals(WorkPackage.class)) {
                final boolean cond1 = !workPackage.isCompleted() && !workPackage.isMilestone();
                return cond1 && workPackage.hasEmployee(user);
            }
            if (childClass.equals(Employee.class)) {
                if (workPackage.isRoot()) {
                    return user.isManager(workPackage.getProject().getDepartment());
                }
                return user.isManager(workPackage);
            }
            if (childClass.equals(Task.class)) {
                return workPackage.getEmployees().contains(user);
            }
        } else if (parent instanceof Task) {
            Task task = (Task) parent;
            if (childClass.equals(Duration.class)) {
                return user.equals(task.getEmployee()) && task.getWorkPackage().isTrackable();
View Full Code Here

            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;
View Full Code Here

    }

    @SuppressWarnings({"SimplifiableIfStatement"})
    public static boolean isAllowedToDelete(Employee user, DataObject obj) {
        if (obj instanceof WorkPackage) {
            WorkPackage workPackage = (WorkPackage) obj;
            if (!workPackage.getTasks(null).isEmpty()) {
                return false;
            }
            if (!workPackage.getSubWorkPackages().isEmpty()) {
                return false;
            }
            if (user.isCompanyManager()) {
                return true;
            }
            if (workPackage.isCompletedRec()) {
                return false;
            }
        }
        if (obj instanceof Task) {
            Task task = (Task) obj;
View Full Code Here

        return user.isAllowedToEdit(obj);
    }

    public static boolean isAllowedToDeleteFrom(Employee user, DataObject child, Object parent) {
        if (parent instanceof WorkPackage) {
            WorkPackage workPackage = (WorkPackage) parent;
            if (workPackage.isCompletedRec()) {
                return false;
            }
        }

        if (parent instanceof WorkPackage && child instanceof Employee) {
            WorkPackage workPackage = (WorkPackage) parent;
            return user.isProjectManager(workPackage.getProject()) || user.isWorkPackageManager(workPackage);
        }
        if (parent instanceof Project && child instanceof Employee) {
            return user.isCompanyManager() || user.isDepartmentManager(user.getDepartment());
        }
        if (parent instanceof Department && child instanceof Employee) {
View Full Code Here

            }

            final List<WorkPackage> workPackages = project.getRootWorkPackages();
            cbWorkPackages.setModel(new DefaultComboBoxModel(workPackages.toArray()));
            for (int i = 0; i < workPackages.size(); i++) {
                WorkPackage workPackage = workPackages.get(i);
                if (workPackage.getId() == object.getWorkPackageId()) {
                    cbWorkPackages.setSelectedIndex(i);
                    break;
                }
            }
        } finally {
View Full Code Here

TOP

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

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.