@Test public void testConvertApplication() throws Exception { GetConfigurationRequest request = new GetConfigurationRequest(); request.setApplicationId(APP_ID); GetConfigurationResponse response = (GetConfigurationResponse) dispatcher.execute( GetConfigurationRequest.COMMAND, request, null, "en"); if (response.isError()) { response.getErrors().get(0).printStackTrace(); } Assert.assertFalse(response.isError()); ClientApplicationInfo appInfo = response.getApplication(); Assert.assertNotNull(appInfo); Assert.assertEquals(APP_ID, appInfo.getId()); Assert.assertEquals(96, appInfo.getScreenDpi()); Assert.assertNotNull(appInfo.getWidgetInfo()); Assert.assertNotNull(appInfo.getWidgetInfo("mapSelect")); Assert.assertNull(appInfo.getWidgetInfo("layerTree")); Assert.assertEquals("map1, map2", ((ClientApplicationInfo.DummyClientWidgetInfo) appInfo.getWidgetInfo("mapSelect")).getDummy()); verifyMap(appInfo.getMaps().get(2)); }
@Override public void execute(GetConfigurationRequest request, GetConfigurationResponse response) throws Exception { if (null == request.getApplicationId()) { throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "applicationId"); } ClientApplicationInfo original = context.getBean(request.getApplicationId(), ClientApplicationInfo.class); if (original == null) { throw new GeomajasException(ExceptionCode.APPLICATION_NOT_FOUND, request.getApplicationId()); } ClientApplicationInfo client = new ClientApplicationInfo(); client.setId(original.getId()); if (!(original.getUserData() instanceof ServerSideOnlyInfo)) { client.setUserData(original.getUserData()); } client.setWidgetInfo(mapConfigurationCommand.securityClone(original.getWidgetInfo())); client.setScreenDpi(original.getScreenDpi()); List<ClientMapInfo> maps = new ArrayList<ClientMapInfo>(); client.setMaps(maps); for (ClientMapInfo map : original.getMaps()) { maps.add(mapConfigurationCommand.securityClone(map)); } response.setApplication(client); }
GetConfigurationCommand implements CommandHasRequest<GetConfigurationRequest, GetConfigurationResponse> { @Override public void execute(GetConfigurationRequest request, GetConfigurationResponse response) throws Exception { if (null == request.getApplicationId()) { throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "applicationId"); } ClientApplicationInfo original = context.getBean(request.getApplicationId(), ClientApplicationInfo.class); if (original == null) { throw new GeomajasException(ExceptionCode.APPLICATION_NOT_FOUND, request.getApplicationId()); } ClientApplicationInfo client = new ClientApplicationInfo(); client.setId(original.getId()); if (!(original.getUserData() instanceof ServerSideOnlyInfo)) { client.setUserData(original.getUserData()); } client.setWidgetInfo(mapConfigurationCommand.securityClone(original.getWidgetInfo())); client.setScreenDpi(original.getScreenDpi()); List<ClientMapInfo> maps = new ArrayList<ClientMapInfo>(); client.setMaps(maps); for (ClientMapInfo map : original.getMaps()) { maps.add(mapConfigurationCommand.securityClone(map)); } response.setApplication(client); } }
GetConfigurationCommand implements CommandHasRequest<GetConfigurationRequest, GetConfigurationResponse> { @Override public void execute(GetConfigurationRequest request, GetConfigurationResponse response) throws Exception { if (null == request.getApplicationId()) { throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "applicationId"); } ClientApplicationInfo original = context.getBean(request.getApplicationId(), ClientApplicationInfo.class); if (original == null) { throw new GeomajasException(ExceptionCode.APPLICATION_NOT_FOUND, request.getApplicationId()); } ClientApplicationInfo client = new ClientApplicationInfo(); client.setId(original.getId()); if (!(original.getUserData() instanceof ServerSideOnlyInfo)) { client.setUserData(original.getUserData()); } client.setWidgetInfo(mapConfigurationCommand.securityClone(original.getWidgetInfo())); client.setScreenDpi(original.getScreenDpi()); List<ClientMapInfo> maps = new ArrayList<ClientMapInfo>(); client.setMaps(maps); for (ClientMapInfo map : original.getMaps()) { maps.add(mapConfigurationCommand.securityClone(map)); } response.setApplication(client); }  }
GetConfigurationCommand implements CommandHasRequest<GetConfigurationRequest, GetConfigurationResponse> { @Override public void execute(GetConfigurationRequest request, GetConfigurationResponse response) throws Exception { if (null == request.getApplicationId()) { throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "applicationId"); } ClientApplicationInfo original = context.getBean(request.getApplicationId(), ClientApplicationInfo.class); if (original == null) { throw new GeomajasException(ExceptionCode.APPLICATION_NOT_FOUND, request.getApplicationId()); } ClientApplicationInfo client = new ClientApplicationInfo(); client.setId(original.getId()); if (!(original.getUserData() instanceof ServerSideOnlyInfo)) { client.setUserData(original.getUserData()); } client.setWidgetInfo(mapConfigurationCommand.securityClone(original.getWidgetInfo())); client.setScreenDpi(original.getScreenDpi()); List<ClientMapInfo> maps = new ArrayList<ClientMapInfo>(); client.setMaps(maps); for (ClientMapInfo map : original.getMaps()) { maps.add(mapConfigurationCommand.securityClone(map)); } response.setApplication(client); }  @Override GetConfigurationRequest getEmptyCommandRequest(); @Override GetConfigurationResponse getEmptyCommandResponse(); @Override void execute(GetConfigurationRequest request, GetConfigurationResponse response); }
GetConfigurationCommand implements CommandHasRequest<GetConfigurationRequest, GetConfigurationResponse> { @Override public void execute(GetConfigurationRequest request, GetConfigurationResponse response) throws Exception { if (null == request.getApplicationId()) { throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "applicationId"); } ClientApplicationInfo original = context.getBean(request.getApplicationId(), ClientApplicationInfo.class); if (original == null) { throw new GeomajasException(ExceptionCode.APPLICATION_NOT_FOUND, request.getApplicationId()); } ClientApplicationInfo client = new ClientApplicationInfo(); client.setId(original.getId()); if (!(original.getUserData() instanceof ServerSideOnlyInfo)) { client.setUserData(original.getUserData()); } client.setWidgetInfo(mapConfigurationCommand.securityClone(original.getWidgetInfo())); client.setScreenDpi(original.getScreenDpi()); List<ClientMapInfo> maps = new ArrayList<ClientMapInfo>(); client.setMaps(maps); for (ClientMapInfo map : original.getMaps()) { maps.add(mapConfigurationCommand.securityClone(map)); } response.setApplication(client); }  @Override GetConfigurationRequest getEmptyCommandRequest(); @Override GetConfigurationResponse getEmptyCommandResponse(); @Override void execute(GetConfigurationRequest request, GetConfigurationResponse response);  }