ref #7348 moving RegistrationDTO related classes from cdm-vaadin to cdmlib-services
[cdmlib.git] / cdmlib-services / src / main / java / eu / etaxonomy / cdm / api / service / exception / RegistrationValidationException.java
1 /**
2 * Copyright (C) 2017 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
5 *
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
8 */
9 package eu.etaxonomy.cdm.api.service.exception;
10
11 import java.util.ArrayList;
12 import java.util.List;
13
14 /**
15 * @author a.kohlbecker
16 * @since Mar 23, 2017
17 *
18 */
19 @SuppressWarnings("serial")
20 public class RegistrationValidationException extends Exception {
21
22 List<String> problems = new ArrayList<>();
23
24 /**
25 * @param message
26 */
27 public RegistrationValidationException(String message, List<String> problems) {
28 super(message);
29 this.problems = problems;
30 }
31
32 @Override
33 public String getMessage() {
34 StringBuffer sb = new StringBuffer(super.getMessage()).append(" - Problems:");
35 problems.forEach(p -> sb.append("- ").append(p).append("\n"));
36 return sb.toString();
37 }
38
39 public List<String> getProblems() {
40 return problems;
41 }
42
43
44 }