Package org.libreplan.business.resources.entities

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


    @Override
    public CriterionType findPredefined(CriterionType criterionType) {
        Validate.notNull(criterionType);
        Validate.notNull(criterionType.getPredefinedTypeInternalName());
        CriterionType result = findByName(criterionType.getName());
        if (result != null) {
            return result;
        }
        return uniqueByInternalName(criterionType);
    }
View Full Code Here


    }

    @Override
    public void removeByName(CriterionType criterionType) {
        try {
            CriterionType reloaded = findUniqueByName(criterionType);
            remove(reloaded.getId());
        } catch (InstanceNotFoundException ex) {
            throw new RuntimeException(ex);
        }
    }
View Full Code Here

            @Override
            public Map<CriterionType, Set<Criterion>> execute() {
                Map<CriterionType, Set<Criterion>> result = new LinkedHashMap<CriterionType, Set<Criterion>>();
                for (Criterion criterion : criterionDAO
                        .getAllSortedByTypeAndName()) {
                    CriterionType key = criterion.getType();
                    if (klassTheCriterionTypeMustBeRelatedWith
                            .isAssignableFrom(key.getResource().asClass())) {
                        if (!result.containsKey(key)) {
                            result.put(key, new LinkedHashSet<Criterion>());
                        }
                        result.get(key).add(criterion);
                    }
View Full Code Here

        this.initValid(criterionRequirement);
        this.setNewObject(isNewObject);

        if (!isNewObject) {
            Criterion criterion = criterionRequirement.getCriterion();
            CriterionType type = criterion.getType();
            setCriterionWithItsType(new CriterionWithItsType(type, criterion));
        }
    }
View Full Code Here

                2000);
        Set<ConstraintViolation<OrderElement>> invalidValues = orderElementValidator
                .validate(orderElement);
        assertTrue(invalidValues.isEmpty());

        CriterionType type = CriterionType.create("", "");
        type.setResource(ResourceEnum.WORKER);
        Criterion criterion = Criterion.create(type);
        CriterionRequirement requirement = DirectCriterionRequirement
                .create(criterion);
        requirement.setOrderElement(orderElement);
        orderElement.addDirectCriterionRequirement(requirement);
View Full Code Here

        container1.add(container2);
        OrderLine line = OrderLine.createOrderLineWithUnfixedPercentage(100);
        line.useSchedulingDataFor(mockedOrderVersion);
        container2.add(line);

        CriterionType type = CriterionType.create("", "");
        type.setResource(ResourceEnum.WORKER);
        CriterionRequirement requirement = DirectCriterionRequirement
                .create(Criterion.create(type));
        order.addDirectCriterionRequirement(requirement);

        assertThat(container2.getCriterionRequirements().size(), equalTo(1));
View Full Code Here

    private List<FilterPair> fillWithFirstTenFiltersCriterions() {
        SortedMap<CriterionType, List<Criterion>> mapCriterions = getCriterionsMap();
        Iterator<CriterionType> iteratorCriterionType = mapCriterions.keySet()
                .iterator();
        while (iteratorCriterionType.hasNext() && getListMatching().size() < 10) {
            CriterionType type = iteratorCriterionType.next();
            for (int i = 0; getListMatching().size() < 10
                    && i < mapCriterions.get(type).size(); i++) {
                Criterion criterion = mapCriterions.get(type).get(i);
                addCriterion(type, criterion);
            }
View Full Code Here

    }

    @Test
    @Transactional
    public void testSaveCriterionType() {
        CriterionType criterionType = createValidCriterionType();
        criterionTypeDAO.save(criterionType);
        assertTrue(criterionTypeDAO.exists(criterionType.getId()));
    }
View Full Code Here

    }

    @Test
    @Transactional
    public void testCriterionTypeCanBeSavedTwice() throws ValidationException {
        CriterionType criterionType = createValidCriterionType();
        criterionTypeDAO.save(criterionType);
        criterionTypeDAO.save(criterionType);
        assertTrue(criterionTypeDAO.exists(criterionType.getId())
                || criterionTypeDAO
                        .existsOtherCriterionTypeByName(criterionType));
    }
View Full Code Here

    public void testCannotSaveTwoDifferentCriterionTypesWithTheSameName() {
        IOnTransaction<Void> createTypeWithRepeatedName = new IOnTransaction<Void>() {

            @Override
            public Void execute() {
                CriterionType criterionType = createValidCriterionType("bla",
                        "");
                criterionTypeDAO.save(criterionType);
                return null;
            }
        };
View Full Code Here

TOP

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

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.