View Javadoc
1   package net.sumaris.core.extraction.vo.trip;
2   
3   /*-
4    * #%L
5    * SUMARiS:: Core Extraction
6    * %%
7    * Copyright (C) 2018 - 2019 SUMARiS Consortium
8    * %%
9    * This program is free software: you can redistribute it and/or modify
10   * it under the terms of the GNU General Public License as
11   * published by the Free Software Foundation, either version 3 of the
12   * License, or (at your option) any later version.
13   * 
14   * This program is distributed in the hope that it will be useful,
15   * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17   * GNU General Public License for more details.
18   * 
19   * You should have received a copy of the GNU General Public
20   * License along with this program.  If not, see
21   * <http://www.gnu.org/licenses/gpl-3.0.html>.
22   * #L%
23   */
24  
25  import com.google.common.collect.ImmutableList;
26  import lombok.AccessLevel;
27  import lombok.Data;
28  import lombok.experimental.FieldDefaults;
29  import net.sumaris.core.extraction.vo.AggregationContextVO;
30  import net.sumaris.core.extraction.vo.ExtractionPmfmInfoVO;
31  import net.sumaris.core.vo.filter.TripFilterVO;
32  import org.apache.commons.lang3.StringUtils;
33  
34  import java.util.Date;
35  import java.util.List;
36  
37  /**
38   * @author Ludovic Pecquot <ludovic.pecquot>
39   * @author Benoit Lavenier <benoit.lavenier@e-is.pro>
40   */
41  @Data
42  @FieldDefaults(level = AccessLevel.PRIVATE)
43  public abstract class AggregationTripContextVO extends AggregationContextVO {
44  
45      TripFilterVO tripFilter;
46  
47      List<ExtractionPmfmInfoVO> pmfmInfos;
48  
49      public Date getStartDate() {
50          return tripFilter != null ? tripFilter.getStartDate() : null;
51      }
52  
53      public Date getEndDate() {
54          return tripFilter != null ? tripFilter.getEndDate() : null;
55      }
56  
57      public List<String> getProgramLabels() {
58          return tripFilter != null && StringUtils.isNotBlank(tripFilter.getProgramLabel()) ? ImmutableList.of(tripFilter.getProgramLabel()) : null;
59      }
60  
61      public List<Integer> getRecorderDepartmentIds() {
62          return tripFilter != null && tripFilter.getRecorderDepartmentId() != null ? ImmutableList.of(tripFilter.getRecorderDepartmentId()) : null;
63      }
64  
65      public List<Integer> getVesselIds() {
66          return tripFilter != null && tripFilter.getVesselId() != null ? ImmutableList.of(tripFilter.getVesselId()) : null;
67      }
68  
69      public List<Integer> getLocationIds() {
70          return tripFilter != null && tripFilter.getLocationId() != null ? ImmutableList.of(tripFilter.getLocationId()) : null;
71      }
72  
73  }