Package org.libreplan.business.common.exceptions

Examples of org.libreplan.business.common.exceptions.ValidationException$InstantiatedInvalidValue


                StringUtils.trim(workerDTO.surname),
                StringUtils.trim(workerDTO.nif));

        } else {

            throw new ValidationException(MessageFormat.format(
                    "Incompatible update: stored resource is not of type: {0}",
                    resourceDTO.getEntityType()));
        }

    }
View Full Code Here


    private static void checkResourceDTOType(ResourceDTO resourceDTO) {

        if (!(resourceDTO instanceof MachineDTO) &&
            !(resourceDTO instanceof WorkerDTO)) {

            throw new ValidationException(MessageFormat.format(
                    "Service does not manage resource of type: {0}",
                    resourceDTO.getEntityType()));

        }
View Full Code Here

    @Override
    @Transactional
    public void confirmSave() throws ValidationException {
        if (scenarioDAO.thereIsOtherWithSameName(scenario)) {
            throw new ValidationException(_("Could not save the scenario"),
                    invalidValue(_("{0} already exists", scenario.getName()),
                            "name", scenario.getName(), scenario));
        }

        scenarioDAO.save(scenario);
View Full Code Here

    throws ValidationException {

        if (!canAddSatisfaction(satisfaction, satisfactions)) {
            String message = getReasonForNotAddingSatisfaction(satisfaction
                    .getCriterion().getType());
            throw new ValidationException(invalidValue(message, "resource",
                    this, satisfaction));
        }
    }
View Full Code Here

         */
        for (CriterionDTOWithParentCode criterionWrapper : criterionWrappers) {

            /* Step 3 requires each criterion DTO to have a code. */
            if (StringUtils.isBlank(criterionWrapper.dto.code)) {
                throw new ValidationException("missing code in a criterion");
            }

            try {
                Criterion criterion = criterionType.getCriterionByCode(
                    criterionWrapper.dto.code);
View Full Code Here

        ExpenseSheet expense = ExpenseSheet.create();
        expense.setCode(null);
        try {
        expenseSheetDAO.save(expense);
        } catch (DataIntegrityViolationException e) {
            throw new ValidationException(e.getMessage());
        }
    }
View Full Code Here

    private void ckeckUniqueQualityForm(QualityForm qualityForm)
            throws ValidationException, IllegalArgumentException {
        Validate.notNull(qualityForm);
        for (TaskQualityForm taskQualityForm : getTaskQualityForms()) {
            if (qualityForm.equals(taskQualityForm.getQualityForm())) {
                throw new ValidationException(ValidationException.invalidValue(
                        _("Quality form already exists"), "name",
                        qualityForm.getName(), qualityForm));
            }
        }
    }
View Full Code Here

    public void transfer(Order order) throws ValidationException {
        Scenario sourceScenario = getSourceScenario();
        Scenario destinationScenario = getDestinationScenario();

        if (sourceScenario == null) {
            throw new ValidationException(
                    _("Please select a source scenario"));
        }
        if (destinationScenario == null) {
            throw new ValidationException(
                    _("Please, select a destination scenario"));
        }

        if (sourceScenario.getId().equals(destinationScenario.getId())) {
            throw new ValidationException(
                    _("Source and destination scenarios should be different"));
        }

        orderDAO.save(order);
        OrderVersion sourceOrderVersion = order
                .getOrderVersionFor(sourceScenario);
        if (sourceOrderVersion == null) {
            throw new RuntimeException(
                    "Project version must not be null for source scenario");
        }

        OrderVersion destinationOrderVersion = order
                .getOrderVersionFor(destinationScenario);
        if ((destinationOrderVersion != null)
                && (sourceOrderVersion.getId().equals(destinationOrderVersion
                        .getId()))) {
            throw new ValidationException(
                    _("Project version is the same in source and destination scenarios"));
        }

        order.useSchedulingDataFor(sourceOrderVersion);
View Full Code Here

                    baseCalendars.add(toBaseCalendar(calendarDTO, parent));

                } else {

                    throw new ValidationException("Parent calendar not found");

                }

            }
        }
View Full Code Here

        List<BaseCalendar> calendars = baseCalendarDAO.findByName(name);

        if (calendars.size() == 0) {
            return name;
        } else {
            throw new ValidationException(_("Calendar name already in use"));
        }

    }
View Full Code Here

TOP

Related Classes of org.libreplan.business.common.exceptions.ValidationException$InstantiatedInvalidValue

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.