Package org.libreplan.business.common.exceptions

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


        if (directAdvanceAssignment == null) {
            try {
                directAdvanceAssignment = orderElement
                        .addSubcontractorAdvanceAssignment();
            } catch (DuplicateValueTrueReportGlobalAdvanceException e) {
                throw new ValidationException(
                        MessageFormat
                                .format("More than one progress marked as report global for task {0}",
                                        orderElement.getCode()));
            } catch (DuplicateAdvanceAssignmentForOrderElementException e) {
                throw new ValidationException(MessageFormat.format(
                        "Duplicate progress assignment for task {0}",
                        orderElement.getCode()));
            }
        }
        return directAdvanceAssignment;
View Full Code Here


                TypeOfWorkHours typeOfWorkHours = Registry
                        .getTypeOfWorkHoursDAO().findUniqueByCode(
                                hourCostDTO.type);
                hourCost.setType(typeOfWorkHours);
            } catch (InstanceNotFoundException e) {
                throw new ValidationException(
                        "There is no type of work hours with this code");
            }
        }
        return hourCost;
    }
View Full Code Here

         */
        for (HourCostDTO hourCostDTO : costCategoryDTO.hourCostDTOs) {

            /* Step 1.1: requires each hour cost DTO to have a code. */
            if (StringUtils.isBlank(hourCostDTO.code)) {
                throw new ValidationException("missing code in a hour cost");
            }

            try {
                HourCost hourCost = costCategory
                        .getHourCostByCode(hourCostDTO.code);
View Full Code Here

                TypeOfWorkHours typeOfWorkHours = Registry
                        .getTypeOfWorkHoursDAO().findUniqueByCode(
                                hourCostDTO.type);
                hourCost.setType(typeOfWorkHours);
            } catch (InstanceNotFoundException e) {
                throw new ValidationException(
                        "There is no type of work hours with this code");
            }
        }
    }
View Full Code Here

        }
        child.setCodeAutogenerated(generateCode);

        final MaterialCategory materialCategory = findMaterialCategory(child);
        if (materialCategory != null) {
            throw new ValidationException(invalidValue(
                    _("{0} already exists", materialCategory.getName()),
                    "name", materialCategory.getName(), materialCategory));
        }

        child.setParent(parent);
View Full Code Here

        List<Material> allMaterials = MaterialCategory
                .getAllMaterialsWithoutAutogeneratedCodeFrom(categories);
        Map<String, Material> byCode = new HashMap<String, Material>();
        for (Material each : allMaterials) {
            if (byCode.containsKey(each.getCode())) {
                throw new ValidationException(sameCodeMessage(each, byCode
                        .get(each.getCode())));
            }
            byCode.put(each.getCode(), each);
        }
    }
View Full Code Here

        // check if exist at least one sequence for each entity
        for (EntityNameEnum entityName : EntityNameEnum.values()) {
            String entity = entityName.getDescription();
            List<EntitySequence> sequences = entitySequences.get(entityName);
            if (sequences.isEmpty()) {
                throw new ValidationException(_(
                        "At least one {0} sequence is needed", entity));
            }

            if (!isAnyActive(sequences)) {
                throw new ValidationException(_(
                        "At least one {0} sequence must be active", entity));
            }
            if (!checkConstraintPrefixNotRepeated(sequences)) {
                throw new ValidationException(_(
                        "The {0} sequence prefixes cannot be repeated",
                        entityName.getDescription()));
            }
        }
    }
View Full Code Here

                .findEntitySquencesNotIn(sequences);
        for (final EntitySequence entitySequence : toRemove) {
            try {
                entitySequenceDAO.remove(entitySequence);
            } catch (InstanceNotFoundException e) {
                throw new ValidationException(
                        _("Some sequences to be removed do not exist"));
            } catch (IllegalArgumentException e) {
                throw new ValidationException(e.getMessage());
            }
        }
    }
View Full Code Here

        for (TaskQualityFormItem item : taskQualityForm
                .getTaskQualityFormItems()) {

            if ((!taskQualityForm.isByItems())
                    && (!taskQualityForm.isCorrectConsecutivePassed(item))) {
                throw new ValidationException(
                        invalidValue(
                        _("cannot be checked until the previous item is checked before"),
                        "passed", item.getName(), taskQualityForm));

            }
            if ((!taskQualityForm.isByItems())
                    && (!taskQualityForm.isCorrectConsecutiveDate(item))) {
                throw new ValidationException(invalidValue(
                        _("must be after the previous date"),
                        "date", item.getName(), taskQualityForm));
            }

            if (!item.isIfDateCanBeNullConstraint()) {
                throw new ValidationException(invalidValue(
                        _("date not specified"), "date",
                        item.getName(), taskQualityForm));
            }
        }
    }
View Full Code Here

            }
        }
    }

    private void showMessageDeleteSpread() throws ValidationException {
        throw new ValidationException(
                _("Quality form cannot be removed as it is spreading progress"));
    }
View Full Code Here

TOP

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

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.