View Javadoc
1   package fr.ifremer.quadrige3.core.exception;
2   
3   /*-
4    * #%L
5    * Quadrige3 Core :: Quadrige3 Core Shared
6    * $Id:$
7    * $HeadURL:$
8    * %%
9    * Copyright (C) 2017 Ifremer
10   * %%
11   * This program is free software: you can redistribute it and/or modify
12   * it under the terms of the GNU Affero General Public License as published by
13   * the Free Software Foundation, either version 3 of the License, or
14   * (at your option) any later version.
15   * 
16   * This program is distributed in the hope that it will be useful,
17   * but WITHOUT ANY WARRANTY; without even the implied warranty of
18   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19   * GNU General Public License for more details.
20   * 
21   * You should have received a copy of the GNU Affero General Public License
22   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
23   * #L%
24   */
25  
26  import java.util.Collection;
27  
28  /**
29   * Created by ludovic.pecquot@e-is.pro on 27/09/17.
30   */
31  public class SaveForbiddenException extends QuadrigeTechnicalException {
32  
33      private Type type;
34      private Collection<String> objectIds;
35  
36      /**
37       * <p>Constructor for SaveForbiddenException.</p>
38       *
39       * @param message a {@link String} object.
40       */
41      public SaveForbiddenException(Type type, String message, Collection<String> objectIds) {
42          super(message);
43          this.objectIds = objectIds;
44          this.type = type;
45      }
46  
47      public Type getType() {
48          return type;
49      }
50  
51      public Collection<String> getObjectIds() {
52          return objectIds;
53      }
54  
55      @Override
56      public String getMessage() {
57          return super.getMessage() + (objectIds != null ? " : " + objectIds.toString() : "");
58      }
59  
60      public enum Type {
61          PERMISSION,
62          ATTACHED_DATA
63      }
64  }