Search in sources :

Example 6 with ActivityConfigDTO

use of eu.europa.ec.fisheries.ers.service.dto.config.ActivityConfigDTO in project UVMS-ActivityModule-APP by UnionVMS.

the class ActivityConfigServiceBean method resetUserConfig.

@Override
@SneakyThrows
public /**
 * {@inheritDoc}
 */
String resetUserConfig(ActivityConfigDTO resetConfig, String userConfig) throws ServiceException {
    ActivityConfigDTO usmUserConfig = getConfiguration(userConfig);
    ActivityConfigDTO mergedConfig = PreferenceConfigMapper.INSTANCE.resetUserPreference(usmUserConfig, resetConfig);
    return getJson(mergedConfig);
}
Also used : ActivityConfigDTO(eu.europa.ec.fisheries.ers.service.dto.config.ActivityConfigDTO) SneakyThrows(lombok.SneakyThrows)

Example 7 with ActivityConfigDTO

use of eu.europa.ec.fisheries.ers.service.dto.config.ActivityConfigDTO in project UVMS-ActivityModule-APP by UnionVMS.

the class MapperUtil method getTargetActivityConfigDTO.

public static ActivityConfigDTO getTargetActivityConfigDTO() {
    ActivityConfigDTO activityConfigDTO = new ActivityConfigDTO();
    FishingActivityConfigDTO fishingActivityConfig = new FishingActivityConfigDTO();
    SummaryReportDTO summaryReport = new SummaryReportDTO();
    summaryReport.setValues(Arrays.asList("Report1", "Report2", "Report3", "Report3", "Report4"));
    summaryReport.setOrder(Arrays.asList("Report1", "Report2", "Report3", "Report3", "Report4"));
    fishingActivityConfig.setSummaryReport(summaryReport);
    activityConfigDTO.setFishingActivityConfig(fishingActivityConfig);
    return activityConfigDTO;
}
Also used : FishingActivityConfigDTO(eu.europa.ec.fisheries.ers.service.dto.config.FishingActivityConfigDTO) ActivityConfigDTO(eu.europa.ec.fisheries.ers.service.dto.config.ActivityConfigDTO) FishingActivityConfigDTO(eu.europa.ec.fisheries.ers.service.dto.config.FishingActivityConfigDTO) SummaryReportDTO(eu.europa.ec.fisheries.ers.service.dto.config.SummaryReportDTO)

Example 8 with ActivityConfigDTO

use of eu.europa.ec.fisheries.ers.service.dto.config.ActivityConfigDTO in project UVMS-ActivityModule-APP by UnionVMS.

the class PreferenceConfigMapperTest method testMergeUserPreference.

@Test
public void testMergeUserPreference() {
    ActivityConfigDTO merged = PreferenceConfigMapper.INSTANCE.mergeUserPreference(getTargetActivityConfigDTO(), getSourceActivityConfigDTO());
    assertEquals(getSourceActivityConfigDTO().getFishingActivityConfig().getSummaryReport().getOrder(), merged.getFishingActivityConfig().getSummaryReport().getOrder());
    assertEquals(getSourceActivityConfigDTO().getFishingActivityConfig().getSummaryReport().getValues(), merged.getFishingActivityConfig().getSummaryReport().getValues());
}
Also used : ActivityConfigDTO(eu.europa.ec.fisheries.ers.service.dto.config.ActivityConfigDTO) MapperUtil.getSourceActivityConfigDTO(eu.europa.ec.fisheries.ers.service.util.MapperUtil.getSourceActivityConfigDTO) MapperUtil.getTargetActivityConfigDTO(eu.europa.ec.fisheries.ers.service.util.MapperUtil.getTargetActivityConfigDTO) Test(org.junit.Test)

Example 9 with ActivityConfigDTO

use of eu.europa.ec.fisheries.ers.service.dto.config.ActivityConfigDTO in project UVMS-ActivityModule-APP by UnionVMS.

the class PreferenceConfigMapperTest method testResetUserPreference.

@Test
public void testResetUserPreference() {
    ActivityConfigDTO updated = PreferenceConfigMapper.INSTANCE.resetUserPreference(getTargetActivityConfigDTO(), getSourceActivityConfigDTO());
    assertNotNull(updated.getFishingActivityConfig());
    assertNull(updated.getFishingActivityConfig().getSummaryReport());
}
Also used : ActivityConfigDTO(eu.europa.ec.fisheries.ers.service.dto.config.ActivityConfigDTO) MapperUtil.getSourceActivityConfigDTO(eu.europa.ec.fisheries.ers.service.util.MapperUtil.getSourceActivityConfigDTO) MapperUtil.getTargetActivityConfigDTO(eu.europa.ec.fisheries.ers.service.util.MapperUtil.getTargetActivityConfigDTO) Test(org.junit.Test)

Example 10 with ActivityConfigDTO

use of eu.europa.ec.fisheries.ers.service.dto.config.ActivityConfigDTO in project UVMS-ActivityModule-APP by UnionVMS.

the class ActivityConfigServiceBeanTest method testGetUserConfig.

@Test
public void testGetUserConfig() throws Exception {
    ActivityConfigDTO userConfigDto = preferenceConfigService.getUserConfig(userConfig, adminConfig);
    ActivityConfigDTO admin = getConfiguration(adminConfig);
    ActivityConfigDTO user = getConfiguration(userConfig);
    assertEquals(user.getFishingActivityConfig().getSummaryReport().getValues(), userConfigDto.getFishingActivityConfig().getSummaryReport().getValues());
    assertEquals(user.getFishingActivityConfig().getSummaryReport().getOrder(), userConfigDto.getFishingActivityConfig().getSummaryReport().getOrder());
}
Also used : ActivityConfigDTO(eu.europa.ec.fisheries.ers.service.dto.config.ActivityConfigDTO) Test(org.junit.Test)

Aggregations

ActivityConfigDTO (eu.europa.ec.fisheries.ers.service.dto.config.ActivityConfigDTO)13 Test (org.junit.Test)7 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 FishingActivityConfigDTO (eu.europa.ec.fisheries.ers.service.dto.config.FishingActivityConfigDTO)2 SummaryReportDTO (eu.europa.ec.fisheries.ers.service.dto.config.SummaryReportDTO)2 MapperUtil.getSourceActivityConfigDTO (eu.europa.ec.fisheries.ers.service.util.MapperUtil.getSourceActivityConfigDTO)2 MapperUtil.getTargetActivityConfigDTO (eu.europa.ec.fisheries.ers.service.util.MapperUtil.getTargetActivityConfigDTO)2 SneakyThrows (lombok.SneakyThrows)2