Search in sources :

Example 71 with EnumMap

use of java.util.EnumMap in project BibleMultiConverter by schierlm.

the class SWORDVersification method doImport.

@Override
public void doImport(VersificationSet versifications, String... importArgs) throws Exception {
    org.crosswire.jsword.versification.Versification v11n_kjv = Versifications.instance().getVersification(SystemKJV.V11N_NAME);
    Map<BookID, BibleBook> reverseBookMapping = new EnumMap<>(BookID.class);
    for (Map.Entry<BibleBook, BookID> entry : BookMapping.MAPPING.entrySet()) {
        reverseBookMapping.put(entry.getValue(), entry.getKey());
    }
    for (String versificationName : SWORDVersificationDetector.ALL_V11N_NAMES) {
        System.out.println("--- " + versificationName + " ---");
        org.crosswire.jsword.versification.Versification v11n = Versifications.instance().getVersification(versificationName);
        LinkedHashMap<BookID, int[]> verseCounts = new LinkedHashMap<>();
        for (Iterator<BibleBook> it = v11n.getBookIterator(); it.hasNext(); ) {
            BibleBook bb = (BibleBook) it.next();
            int[] chapters = new int[v11n.getLastChapter(bb)];
            if (chapters.length == 0)
                continue;
            verseCounts.put(BookMapping.MAPPING.get(bb), chapters);
            for (int j = 1; j <= v11n.getLastChapter(bb); j++) {
                chapters[j - 1] = v11n.getLastVerse(bb, j);
            }
        }
        versifications.getVersifications().add(Versification.fromVerseCounts("SWORD_" + versificationName, null, null, verseCounts));
        if (!versificationName.equals(SystemKJV.V11N_NAME) && !missingMappings.contains(versificationName)) {
            buildMapping(versifications, SystemKJV.V11N_NAME, v11n_kjv, versificationName, v11n, reverseBookMapping);
            buildMapping(versifications, versificationName, v11n, SystemKJV.V11N_NAME, v11n_kjv, reverseBookMapping);
        }
    }
}
Also used : BibleBook(org.crosswire.jsword.versification.BibleBook) LinkedHashMap(java.util.LinkedHashMap) BookID(biblemulticonverter.data.BookID) EnumMap(java.util.EnumMap) EnumMap(java.util.EnumMap) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map)

Example 72 with EnumMap

use of java.util.EnumMap in project UVMS-ActivityModule-APP by UnionVMS.

the class FaCatchReportServiceBeanTest method testGetCatchesTableForCatchDetailsScreen.

@Test
@SneakyThrows
public void testGetCatchesTableForCatchDetailsScreen() throws ServiceException {
    FishingActivityQuery query = new FishingActivityQuery();
    List<GroupCriteria> groupByFields = new ArrayList<>();
    groupByFields.add(GroupCriteria.DATE_DAY);
    groupByFields.add(GroupCriteria.FAO_AREA);
    groupByFields.add(GroupCriteria.TERRITORY);
    groupByFields.add(GroupCriteria.EFFORT_ZONE);
    groupByFields.add(GroupCriteria.GFCM_GSA);
    groupByFields.add(GroupCriteria.GFCM_STAT_RECTANGLE);
    groupByFields.add(GroupCriteria.ICES_STAT_RECTANGLE);
    groupByFields.add(GroupCriteria.RFMO);
    groupByFields.add(GroupCriteria.SPECIES);
    query.setGroupByFields(groupByFields);
    Map<SearchFilter, String> searchCriteriaMap = new EnumMap<SearchFilter, String>(SearchFilter.class);
    searchCriteriaMap.put(SearchFilter.TRIP_ID, "NOR-TRP-20160517234053706");
    query.setSearchCriteriaMap(searchCriteriaMap);
    when(faCatchDao.getGroupedFaCatchData(query, Boolean.FALSE)).thenReturn(MapperUtil.getGroupedFaCatchSummaryCustomEntityData());
    when(faCatchDao.getGroupedFaCatchData(query, Boolean.TRUE)).thenReturn(MapperUtil.getGroupedFaCatchSummaryCustomEntityData());
    // when(vesselIdentifiersDao.getLatestVesselIdByTrip("NOR-TRP-20160517234053706")).thenReturn(MapperUtil.getVesselIdentifiersList());
    // Trigger
    FACatchDetailsDTO faCatchDetailsDTO = faCatchReportService.getCatchDetailsScreen("NOR-TRP-20160517234053706");
    Mockito.verify(faCatchDao, Mockito.times(2)).getGroupedFaCatchData(Mockito.any(FishingActivityQuery.class), Mockito.any(Boolean.class));
    // Verify
    assertNotNull(faCatchDetailsDTO);
}
Also used : FishingActivityQuery(eu.europa.ec.fisheries.ers.service.search.FishingActivityQuery) ArrayList(java.util.ArrayList) SearchFilter(eu.europa.ec.fisheries.uvms.activity.model.schemas.SearchFilter) FACatchDetailsDTO(eu.europa.ec.fisheries.ers.service.dto.fareport.summary.FACatchDetailsDTO) EnumMap(java.util.EnumMap) GroupCriteria(eu.europa.ec.fisheries.uvms.activity.model.schemas.GroupCriteria) Test(org.junit.Test) SneakyThrows(lombok.SneakyThrows)

Example 73 with EnumMap

use of java.util.EnumMap in project UVMS-ActivityModule-APP by UnionVMS.

the class FaCatchReportServiceBeanTest method testGetCatchSummaryReport.

@Test
@SneakyThrows
public void testGetCatchSummaryReport() throws ServiceException {
    FishingActivityQuery query = new FishingActivityQuery();
    List<GroupCriteria> groupByFields = new ArrayList<>();
    groupByFields.add(GroupCriteria.DATE_DAY);
    groupByFields.add(GroupCriteria.FAO_AREA);
    groupByFields.add(GroupCriteria.TERRITORY);
    groupByFields.add(GroupCriteria.EFFORT_ZONE);
    groupByFields.add(GroupCriteria.GFCM_GSA);
    groupByFields.add(GroupCriteria.GFCM_STAT_RECTANGLE);
    groupByFields.add(GroupCriteria.ICES_STAT_RECTANGLE);
    groupByFields.add(GroupCriteria.RFMO);
    groupByFields.add(GroupCriteria.SPECIES);
    query.setGroupByFields(groupByFields);
    Map<SearchFilter, String> searchCriteriaMap = new EnumMap<SearchFilter, String>(SearchFilter.class);
    searchCriteriaMap.put(SearchFilter.TRIP_ID, "NOR-TRP-20160517234053706");
    query.setSearchCriteriaMap(searchCriteriaMap);
    Map<FaCatchSummaryCustomProxy, List<FaCatchSummaryCustomProxy>> groupedData = MapperUtil.getGroupedFaCatchSummaryCustomEntityData();
    when((faCatchDao).getGroupedFaCatchData(any(FishingActivityQuery.class), any(Boolean.class))).thenReturn(groupedData);
    // when(faCatchDao.getGroupedFaCatchData(query,true)).thenReturn(MapperUtil.getGroupedFaCatchSummaryCustomEntityData());
    // when(vesselIdentifiersDao.getLatestVesselIdByTrip("NOR-TRP-20160517234053706")).thenReturn(MapperUtil.getVesselIdentifiersList());
    // Trigger
    FACatchSummaryDTO fACatchSummaryDTO = faCatchReportService.getCatchSummaryReport(query, false);
    Mockito.verify(faCatchDao, Mockito.times(1)).getGroupedFaCatchData(Mockito.any(FishingActivityQuery.class), Mockito.any(Boolean.class));
    // Verify
    assertNotNull(fACatchSummaryDTO);
}
Also used : ArrayList(java.util.ArrayList) SearchFilter(eu.europa.ec.fisheries.uvms.activity.model.schemas.SearchFilter) GroupCriteria(eu.europa.ec.fisheries.uvms.activity.model.schemas.GroupCriteria) FishingActivityQuery(eu.europa.ec.fisheries.ers.service.search.FishingActivityQuery) FaCatchSummaryCustomProxy(eu.europa.ec.fisheries.ers.fa.dao.proxy.FaCatchSummaryCustomProxy) FACatchSummaryDTO(eu.europa.ec.fisheries.ers.service.dto.fareport.summary.FACatchSummaryDTO) ArrayList(java.util.ArrayList) List(java.util.List) EnumMap(java.util.EnumMap) Test(org.junit.Test) SneakyThrows(lombok.SneakyThrows)

Example 74 with EnumMap

use of java.util.EnumMap in project UVMS-ActivityModule-APP by UnionVMS.

the class FishingTripServiceBeanTest method testBuildFishingTripSearchRespose.

@Test
@SneakyThrows
public void testBuildFishingTripSearchRespose() throws ServiceException, JsonProcessingException {
    FishingActivityQuery query = new FishingActivityQuery();
    Map<SearchFilter, String> searchCriteriaMap = new EnumMap<>(SearchFilter.class);
    searchCriteriaMap.put(SearchFilter.TRIP_ID, "NOR-TRP-20160517234053706");
    searchCriteriaMap.put(SearchFilter.FISHING_TRIP_SCHEME_ID, "EU_TRIP_ID");
    query.setSearchCriteriaMap(searchCriteriaMap);
    SortKey sortKey = new SortKey();
    sortKey.setSortBy(SearchFilter.PERIOD_START);
    sortKey.setReversed(false);
    query.setSorting(sortKey);
    when(fishingActivityDao.getFishingActivityListByQuery(any(FishingActivityQuery.class))).thenReturn(MapperUtil.getFishingActivityEntityList());
    // Trigger
    FishingTripResponse response = fishingTripService.buildFishingTripSearchRespose(MapperUtil.getFishingTripIdSet(), false);
    assertNotNull(response);
}
Also used : FishingActivityQuery(eu.europa.ec.fisheries.ers.service.search.FishingActivityQuery) FishingTripResponse(eu.europa.ec.fisheries.uvms.activity.model.schemas.FishingTripResponse) SearchFilter(eu.europa.ec.fisheries.uvms.activity.model.schemas.SearchFilter) SortKey(eu.europa.ec.fisheries.ers.service.search.SortKey) EnumMap(java.util.EnumMap) Test(org.junit.Test) SneakyThrows(lombok.SneakyThrows)

Example 75 with EnumMap

use of java.util.EnumMap in project UVMS-ActivityModule-APP by UnionVMS.

the class FACatchSummaryPresentationHelper method populateTotalFaCatchMap.

@Override
public void populateTotalFaCatchMap(SummaryTableDTO summaryTableWithTotals, SummaryTableDTO summaryTable) {
    Map<FaCatchTypeEnum, Object> catchTypeEnumMapMap = summaryTable.getSummaryFaCatchType();
    if (MapUtils.isNotEmpty(catchTypeEnumMapMap)) {
        Map<FaCatchTypeEnum, Object> totalCatchTypeMap = summaryTableWithTotals.getSummaryFaCatchType();
        if (MapUtils.isEmpty(totalCatchTypeMap)) {
            totalCatchTypeMap = new EnumMap<>(FaCatchTypeEnum.class);
            summaryTableWithTotals.setSummaryFaCatchType(totalCatchTypeMap);
        }
        // Go through all the catch types and calculate total for each type
        for (Map.Entry<FaCatchTypeEnum, Object> entry : catchTypeEnumMapMap.entrySet()) {
            // key fishSize
            FaCatchTypeEnum catchType = entry.getKey();
            Object value = entry.getValue();
            if (value instanceof Map) {
                // check if already present
                Map<String, Map<String, Double>> fishSizeMap = (Map<String, Map<String, Double>>) totalCatchTypeMap.get(catchType);
                fishSizeMap = populateSpeciesPresentationMapWithTotal((Map<String, Map<String, Double>>) value, fishSizeMap);
                totalCatchTypeMap.put(catchType, fishSizeMap);
            }
        }
    }
}
Also used : FaCatchTypeEnum(eu.europa.ec.fisheries.uvms.activity.model.schemas.FaCatchTypeEnum) EnumMap(java.util.EnumMap) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

EnumMap (java.util.EnumMap)389 Map (java.util.Map)73 ArrayList (java.util.ArrayList)70 List (java.util.List)61 HashMap (java.util.HashMap)60 Test (org.junit.Test)46 IOException (java.io.IOException)38 Collection (java.util.Collection)35 DecodeHintType (com.google.zxing.DecodeHintType)30 HashSet (java.util.HashSet)26 Set (java.util.Set)26 EncodeHintType (com.google.zxing.EncodeHintType)17 File (java.io.File)17 BitMatrix (com.google.zxing.common.BitMatrix)15 BookID (biblemulticonverter.data.BookID)14 Iterator (java.util.Iterator)14 URL (java.net.URL)12 TreeMap (java.util.TreeMap)12 Header (com.jsql.model.bean.util.Header)10 Request (com.jsql.model.bean.util.Request)10