Search in sources :

Example 11 with GroupCriteria

use of eu.europa.ec.fisheries.uvms.activity.model.schemas.GroupCriteria in project UVMS-ActivityModule-APP by UnionVMS.

the class FaCatchDaoTest method testGetFACatchSummaryReportString.

@Test
public void testGetFACatchSummaryReportString() throws Exception {
    dbSetupTracker.skipNextLaunch();
    FishingActivityQuery query = new FishingActivityQuery();
    Map<SearchFilter, String> searchCriteriaMap = new HashMap<>();
    List<GroupCriteria> groupByFields = new ArrayList<>();
    groupByFields.add(GroupCriteria.DATE_MONTH);
    groupByFields.add(GroupCriteria.SPECIES);
    query.setGroupByFields(groupByFields);
    searchCriteriaMap.put(SearchFilter.SOURCE, "FLUX");
    query.setSearchCriteriaMap(searchCriteriaMap);
    // FACatchSummaryHelper faCatchSummaryHelper = FACatchSummaryHelper.createFACatchSummaryHelper();
    // System.out.println( faCatchSummaryHelper.printJsonstructure(query));
    Map<FaCatchSummaryCustomProxy, List<FaCatchSummaryCustomProxy>> faCatchSummaryCustomEntityListMap = dao.getGroupedFaCatchData(query, false);
    assertNotNull(faCatchSummaryCustomEntityListMap);
}
Also used : FishingActivityQuery(eu.europa.ec.fisheries.ers.service.search.FishingActivityQuery) HashMap(java.util.HashMap) FaCatchSummaryCustomProxy(eu.europa.ec.fisheries.ers.fa.dao.proxy.FaCatchSummaryCustomProxy) ArrayList(java.util.ArrayList) SearchFilter(eu.europa.ec.fisheries.uvms.activity.model.schemas.SearchFilter) ArrayList(java.util.ArrayList) List(java.util.List) GroupCriteria(eu.europa.ec.fisheries.uvms.activity.model.schemas.GroupCriteria) Test(org.junit.Test)

Example 12 with GroupCriteria

use of eu.europa.ec.fisheries.uvms.activity.model.schemas.GroupCriteria in project UVMS-ActivityModule-APP by UnionVMS.

the class FACatchSearchBuilder method createJoinPartOfTheQuery.

protected void createJoinPartOfTheQuery(FishingActivityQuery query, StringBuilder sql, Map<GroupCriteria, GroupCriteriaMapper> groupMAppings, List<GroupCriteria> groupByFieldList) {
    // Below is default JOIN for the query
    sql.append(FA_CATCH_JOIN);
    // Create join part of SQL query
    // Join only required tables based on filter criteria
    createJoinTablesPartForQuery(sql, query);
    // Add joins if not added by activity filtering . Below code will add joins required by FA Catch report joins
    for (GroupCriteria criteria : groupByFieldList) {
        GroupCriteriaMapper mapper = groupMAppings.get(criteria);
        if (sql.indexOf(mapper.getTableJoin()) == -1) {
            appendJoinString(sql, mapper.getTableJoin());
        }
    }
}
Also used : GroupCriteriaMapper(eu.europa.ec.fisheries.ers.service.search.GroupCriteriaMapper) GroupCriteria(eu.europa.ec.fisheries.uvms.activity.model.schemas.GroupCriteria)

Aggregations

GroupCriteria (eu.europa.ec.fisheries.uvms.activity.model.schemas.GroupCriteria)12 GroupCriteriaMapper (eu.europa.ec.fisheries.ers.service.search.GroupCriteriaMapper)6 FaCatchSummaryCustomProxy (eu.europa.ec.fisheries.ers.fa.dao.proxy.FaCatchSummaryCustomProxy)5 ServiceException (eu.europa.ec.fisheries.uvms.commons.service.exception.ServiceException)5 FishingActivityQuery (eu.europa.ec.fisheries.ers.service.search.FishingActivityQuery)4 SearchFilter (eu.europa.ec.fisheries.uvms.activity.model.schemas.SearchFilter)4 ArrayList (java.util.ArrayList)4 EnumMap (java.util.EnumMap)3 Test (org.junit.Test)3 FACatchSummaryHelper (eu.europa.ec.fisheries.ers.service.facatch.FACatchSummaryHelper)2 List (java.util.List)2 SneakyThrows (lombok.SneakyThrows)2 NotNull (org.jetbrains.annotations.NotNull)2 FACatchDetailsDTO (eu.europa.ec.fisheries.ers.service.dto.fareport.summary.FACatchDetailsDTO)1 FACatchSummaryDTO (eu.europa.ec.fisheries.ers.service.dto.fareport.summary.FACatchSummaryDTO)1 FACatchSearchBuilder (eu.europa.ec.fisheries.ers.service.search.builder.FACatchSearchBuilder)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Method (java.lang.reflect.Method)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1