Package org.libreplan.business.resources.entities

Examples of org.libreplan.business.resources.entities.Resource


    public boolean isValidResourceAllocationWorkers() {
        Set<Long> workers = new HashSet<Long>();

        for (ResourceAllocation<?> resourceAllocation : resourceAllocations) {
            if (resourceAllocation instanceof SpecificResourceAllocation) {
                Resource resource = ((SpecificResourceAllocation) resourceAllocation)
                        .getResource();
                if (resource != null) {
                    if (workers.contains(resource.getId())) {
                        return false;
                    } else {
                        workers.add(resource.getId());
                    }
                }
            }
        }
View Full Code Here


                    getGoal());
        }

        @Override
        public AvailabilityTimeLine getAvailability() {
            Resource resource = getAssociatedResource();
            return AvailabilityCalculator.getCalendarAvailabilityFor(resource);
        }
View Full Code Here

        Iterator<Class<?>> iteratorClass = mapResources.keySet().iterator();
        while (iteratorClass.hasNext() && getListMatching().size() < 10) {
            Class<?> className = iteratorClass.next();
            for (int i = 0; getListMatching().size() < 10
                    && i < mapResources.get(className).size(); i++) {
                Resource resource = mapResources.get(className).get(i);

                if (isLimitingResourceAllocation != resource
                        .isLimitingResource()) {
                    continue;
                }
                addResource(className, resource);
            }
View Full Code Here

    public List<PersonalTimesheetDTO> getPersonalTimesheets() {
        User user = UserUtil.getUserFromSession();
        if (!user.isBound()) {
            return Collections.emptyList();
        }
        Resource resource = user.getWorker();
        BaseCalendarModel.forceLoadBaseCalendar(resource.getCalendar());

        LocalDate activationDate = getActivationDate(user.getWorker());
        LocalDate currentDate = new LocalDate();
        return getPersonalTimesheets(user.getWorker(), activationDate,
                currentDate.plusMonths(1), getPersonalTimesheetsPeriodicity());
View Full Code Here

    @Test
    @Transactional
    public void testNavigateRelations() {
        ResourcesCostCategoryAssignment assignment = createValidResourcesCostCategoryAssignment();
        resourcesCostCategoryAssignmentDAO.save(assignment);
        Resource resource = assignment.getResource();

        assertTrue(costCategoryDAO.list(CostCategory.class).contains(assignment.getCostCategory()));
        assertTrue(resource.getResourcesCostCategoryAssignments().contains(assignment));

        assignment.setResource(null);
        assertFalse(resource.getResourcesCostCategoryAssignments().contains(assignment));
    }
View Full Code Here

        for (DayAssignment dayAssignment : dayAssignments) {
            final LocalDate day = dayAssignment.getDay();
            final EffortDuration dayAssignmentDuration = dayAssignment
                    .getDuration();
            Resource resource = dayAssignment.getResource();
            if (map.get(day) == null) {
                map.put(day, new HashMap<Resource, EffortDuration>());
            }
            Map<Resource, EffortDuration> forDay = map.get(day);
            EffortDuration previousDuration = forDay.get(resource);
View Full Code Here

        if (!isPotentiallyValid(gap)) {
            return AllocationSpec.invalidOn(gapOnQueue);
        }
        DateAndHour realStart = DateAndHour.max(earliestPossibleStart, gap
                .getStartTime());
        Resource resource = gapOnQueue.getOriginQueue().getResource();
        List<Integer> hours = gap.getHoursInGapUntilAllocatingAndGoingToTheEnd(
                resource.getCalendar(), realStart,
                earliestPossibleEnd, element.getIntentedTotalHours());
        int total = sum(hours);
        if (total < element.getIntentedTotalHours()) {
            return AllocationSpec.invalidOn(gapOnQueue);
        } else if (total == element.getIntentedTotalHours()) {
View Full Code Here

    }

    private void goToEditPersonalTimeSheet(WorkReport workReport) {
        workReportModel.initEdit(workReport);
        Date date = workReportModel.getFirstWorkReportLine().getDate();
        Resource resource = workReport.getResource();
        personalTimesheetController.goToCreateOrEditFormForResource(
                LocalDate.fromDateFields(date), resource);
    }
View Full Code Here

            throw new RuntimeException(e);
        }
    }

    private String getWorkReportLineName(WorkReportLine workReportLine) {
        final Resource resource = workReportLine.getResource();
        final OrderElement orderElement = workReportLine.getOrderElement();

        if (resource == null || orderElement == null) {
            return ITEM;
        }
        return resource.getShortDescription() + " - " + orderElement.getCode();
    }
View Full Code Here

        Date date = personalTimesheetsDatebox.getValue();
        if (date == null) {
            throw new WrongValueException(personalTimesheetsDatebox,
                    _("Please set a date"));
        }
        Resource resource = (Resource) personalTimesheetsBandboxSearch
                .getSelectedElement();
        if (resource == null) {
            throw new WrongValueException(personalTimesheetsBandboxSearch,
                    _("Please select a worker"));
        }
View Full Code Here

TOP

Related Classes of org.libreplan.business.resources.entities.Resource

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.