class 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");
		}

		// the data is explicitly copied as this assures the security is considered when copying.
		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);
	}

}