View Javadoc
1   package fr.ifremer.reefdb.dto.referential.pmfm;
2   
3   /*-
4    * #%L
5    * Reef DB :: Core
6    * $Id:$
7    * $HeadURL:$
8    * %%
9    * Copyright (C) 2014 - 2022 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 fr.ifremer.quadrige3.ui.core.dto.referential.BaseReferentialDTOBean;
27  import java.util.Collection;
28  import java.util.HashSet;
29  import java.util.Set;
30  import javax.annotation.Generated;
31  
32  @Generated(value = "org.nuiton.eugene.java.SimpleJavaBeanTransformer", date = "Mon May 09 09:01:00 CEST 2022")
33  public abstract class AbstractFractionDTOBean extends BaseReferentialDTOBean implements FractionDTO {
34  
35      private static final long serialVersionUID = 4049638992527897649L;
36  
37      protected String description;
38  
39      protected String comment;
40  
41      protected Set<MatrixDTO> matrixes;
42  
43      @Override
44      public String getDescription() {
45          return description;
46      }
47  
48      @Override
49      public void setDescription(String description) {
50          String oldValue = getDescription();
51          this.description = description;
52          firePropertyChange(PROPERTY_DESCRIPTION, oldValue, description);
53      }
54  
55      @Override
56      public String getComment() {
57          return comment;
58      }
59  
60      @Override
61      public void setComment(String comment) {
62          String oldValue = getComment();
63          this.comment = comment;
64          firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
65      }
66  
67      @Override
68      public MatrixDTO getMatrixes(int index) {
69          MatrixDTO o = getChild(matrixes, index);
70          return o;
71      }
72  
73      @Override
74      public boolean isMatrixesEmpty() {
75          return matrixes == null || matrixes.isEmpty();
76      }
77  
78      @Override
79      public int sizeMatrixes() {
80          return matrixes == null ? 0 : matrixes.size();
81      }
82  
83      @Override
84      public void addMatrixes(MatrixDTO matrixes) {
85          getMatrixes().add(matrixes);
86          firePropertyChange(PROPERTY_MATRIXES, null, matrixes);
87      }
88  
89      @Override
90      public void addAllMatrixes(Collection<MatrixDTO> matrixes) {
91          getMatrixes().addAll(matrixes);
92          firePropertyChange(PROPERTY_MATRIXES, null, matrixes);
93      }
94  
95      @Override
96      public boolean removeMatrixes(MatrixDTO matrixes) {
97          boolean removed = getMatrixes().remove(matrixes);
98          if (removed) {
99              firePropertyChange(PROPERTY_MATRIXES, matrixes, null);
100         }
101         return removed;
102     }
103 
104     @Override
105     public boolean removeAllMatrixes(Collection<MatrixDTO> matrixes) {
106         boolean  removed = getMatrixes().removeAll(matrixes);
107         if (removed) {
108             firePropertyChange(PROPERTY_MATRIXES, matrixes, null);
109         }
110         return removed;
111     }
112 
113     @Override
114     public boolean containsMatrixes(MatrixDTO matrixes) {
115         boolean contains = getMatrixes().contains(matrixes);
116         return contains;
117     }
118 
119     @Override
120     public boolean containsAllMatrixes(Collection<MatrixDTO> matrixes) {
121         boolean  contains = getMatrixes().containsAll(matrixes);
122         return contains;
123     }
124 
125     @Override
126     public Set<MatrixDTO> getMatrixes() {
127     if (matrixes == null) {
128         matrixes = new HashSet<MatrixDTO>();
129     }
130     return matrixes;
131 }
132 
133     @Override
134     public void setMatrixes(Set<MatrixDTO> matrixes) {
135         Set<MatrixDTO> oldValue = getMatrixes();
136         this.matrixes = matrixes;
137         firePropertyChange(PROPERTY_MATRIXES, oldValue, matrixes);
138     }
139 
140 } //AbstractFractionDTOBean