Package org.libreplan.business.resources.entities

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


    }

    @Test
    @Transactional
    public void testCantAddCriterionSatisfactionWithOverlap() {
        Criterion criterion = CriterionDAOTest.createValidCriterion();
        Criterion otherCriterion = CriterionDAOTest.createValidCriterion();
        Worker worker = Worker.create("firstName", "surName", "2333232");
        ICriterionType<Criterion> criterionType = createTypeThatMatches(false,
                criterion,otherCriterion);

        Interval intervalA = Interval.range(date(2009,10,14),date(2009,10,26));
View Full Code Here


    }

    @Test
    @Transactional
    public void testCantAddCriterionSatisfactionWithTypeAllowMultipleResource() {
        Criterion criterion = CriterionDAOTest.createValidCriterion();
        Criterion otherCriterion = CriterionDAOTest.createValidCriterion();
        Worker worker = Worker.create("firstName", "surName", "2333232");
        ICriterionType<Criterion> criterionType = createTypeThatMatches(true,
                criterion,otherCriterion);

        Interval intervalA = Interval.range(date(2009,10,8),date(2009,10,25));
View Full Code Here

        assertTrue(worker.canAddSatisfaction(new CriterionWithItsType(
                criterionType, criterion), intervalE));
    }

    public void testAddCriterionSatisfaction() {
        Criterion criterion = CriterionDAOTest.createValidCriterion();
        Worker worker = Worker.create("firstName", "surName", "2333232");
        ICriterionType<Criterion> criterionType = createTypeThatMatches(false,
                criterion);
        CriterionSatisfaction satisfaction = createValid(criterion, worker);
        worker.addSatisfaction(criterionType, satisfaction);
View Full Code Here

    }

    @Test(expected = IllegalStateException.class)
    @Transactional
    public void shouldntAdd() {
        Criterion criterion = CriterionDAOTest.createValidCriterion();
        Worker worker = Worker.create("firstName", "surName", "2333232");
        ICriterionType<?> type = new CriterionTypeBase("prueba","", false, false,
                true) {

            @Override
View Full Code Here

        }
    }

    protected void propagateIndirectCriterionRequirementToOrderLineGroupChildren(
            R orderLineGroup, DirectCriterionRequirement parent) {
        Criterion criterion = parent.getCriterion();
        for (T child : getOrderLineGroupChildren(orderLineGroup)) {
            IndirectCriterionRequirement indirect = IndirectCriterionRequirement
                    .create(parent, criterion);
            addIndirectCriterionRequirement(child, indirect);
            propagateIndirectCriterionRequirement(child, parent);
View Full Code Here

    protected abstract T toOrderElement(S orderLine);

    public boolean existSameCriterionRequirementIntoOrderElement(
            T orderElement, CriterionRequirement newRequirement) {
        Criterion criterion = newRequirement.getCriterion();
        for (CriterionRequirement requirement : getCriterionRequirements(orderElement)) {
            if (requirement.getCriterion().equals(criterion)) {
                return true;
            }
        }
View Full Code Here

    public void copyIndirectCriterionRequirementsFromOriginalToHoursGroup(
            R orderLineGroup,
            DirectCriterionRequirement parent) {

        final List<T> orderElements = getOrderLineGroupChildren(orderLineGroup);
        final Criterion criterion = parent.getCriterion();
        final Set<IndirectCriterionRequirement> originalIndirectCriterionRequirements = parent
                .getOrigin().getChildren();
        final Map<HoursGroup, Map<Criterion, Boolean>> mapHoursGroup =
            createHoursGroupCriterionMap(originalIndirectCriterionRequirements);
View Full Code Here

    public static ResourceEnum inferType(
            Collection<? extends Criterion> criterions) {
        if (criterions.isEmpty()) {
            return ResourceEnum.WORKER;
        }
        Criterion first = criterions.iterator().next();
        return first.getType().getResource();
    }
View Full Code Here

                .runOnTransaction(new IOnTransaction<Resource>() {
                    @Override
                    public Resource execute() {
                        Worker result = givenValidWorker();
                        CriterionType type = createCriterionType("testType");
                        Criterion parent = createCriterion("parent", type);
                        parentCriteron[0] = parent;
                        Criterion child = createCriterion("child", type);
                        child.setParent(parent);
                        addSatisfactionsOn(result,
                                Interval.from(new LocalDate(1970, 1, 1)), child);
                        return result;
                    }
        });
        final Criterion parent = transactionService
                .runOnReadOnlyTransaction(new IOnTransaction<Criterion>() {

                    @Override
                    public Criterion execute() {
                        return criterionDAO
View Full Code Here

    private Criterion createCriterion(String name) {
        return createCriterion(name, createCriterionType(UUID.randomUUID().toString()));
    }

    private Criterion createCriterion(String name, CriterionType type) {
        Criterion result = Criterion.create(name, type);
        criterionDAO.save(result);
        return result;
    }
View Full Code Here

TOP

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

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.