use of eu.europa.ec.fisheries.ers.service.dto.config.ActivityConfigDTO in project UVMS-ActivityModule-APP by UnionVMS.
the class ActivityConfigServiceBeanTest method testSaveUserConfig.
@Test
public void testSaveUserConfig() throws Exception {
String updatedConfig = adminConfig;
ActivityConfigDTO updatedConfigDto = getConfiguration(updatedConfig);
String userJson = preferenceConfigService.saveUserConfig(updatedConfigDto, userConfig);
assertEquals(getJson(updatedConfigDto), userJson);
}
use of eu.europa.ec.fisheries.ers.service.dto.config.ActivityConfigDTO in project UVMS-ActivityModule-APP by UnionVMS.
the class ActivityConfigServiceBeanTest method testResetUserConfig.
@Test
public void testResetUserConfig() throws Exception {
String resetConfig = "{\n" + " \"fishingActivityConfig\": {\n" + " \"summaryReport\": {\n" + " \n" + " }\n" + " }\n" + " }";
ActivityConfigDTO activityConfigDTO = getConfiguration(resetConfig);
String userJson = preferenceConfigService.resetUserConfig(activityConfigDTO, userConfig);
ActivityConfigDTO updated = getConfiguration(userJson);
assertNull(updated.getFishingActivityConfig().getSummaryReport());
}
use of eu.europa.ec.fisheries.ers.service.dto.config.ActivityConfigDTO in project UVMS-ActivityModule-APP by UnionVMS.
the class ActivityConfigServiceBean method saveUserConfig.
@Override
@SneakyThrows
public /**
* {@inheritDoc}
*/
String saveUserConfig(ActivityConfigDTO updatedConfig, String userConfig) throws ServiceException {
ActivityConfigDTO usmUserConfig = getConfiguration(userConfig);
ActivityConfigDTO mergedConfig = PreferenceConfigMapper.INSTANCE.mergeUserPreference(usmUserConfig, updatedConfig);
return getJson(mergedConfig);
}
use of eu.europa.ec.fisheries.ers.service.dto.config.ActivityConfigDTO in project UVMS-ActivityModule-APP by UnionVMS.
the class MapperUtil method getSourceActivityConfigDTO.
public static ActivityConfigDTO getSourceActivityConfigDTO() {
ActivityConfigDTO activityConfigDTO = new ActivityConfigDTO();
FishingActivityConfigDTO fishingActivityConfig = new FishingActivityConfigDTO();
SummaryReportDTO summaryReport = new SummaryReportDTO();
summaryReport.setValues(Arrays.asList("Report1", "Report2", "Report3"));
summaryReport.setOrder(Arrays.asList("Report1", "Report2", "Report3"));
fishingActivityConfig.setSummaryReport(summaryReport);
activityConfigDTO.setFishingActivityConfig(fishingActivityConfig);
return activityConfigDTO;
}
use of eu.europa.ec.fisheries.ers.service.dto.config.ActivityConfigDTO in project UVMS-ActivityModule-APP by UnionVMS.
the class ActivityConfigServiceBean method getConfiguration.
private ActivityConfigDTO getConfiguration(String configString) throws IOException {
if (configString == null || configString.isEmpty()) {
return new ActivityConfigDTO();
}
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
return mapper.readValue(configString, ActivityConfigDTO.class);
}
Aggregations