当前位置: 首页>>代码示例>>Java>>正文


Java ExceptionCode.PARAMETER_MISSING属性代码示例

本文整理汇总了Java中org.geomajas.global.ExceptionCode.PARAMETER_MISSING属性的典型用法代码示例。如果您正苦于以下问题:Java ExceptionCode.PARAMETER_MISSING属性的具体用法?Java ExceptionCode.PARAMETER_MISSING怎么用?Java ExceptionCode.PARAMETER_MISSING使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.geomajas.global.ExceptionCode的用法示例。


在下文中一共展示了ExceptionCode.PARAMETER_MISSING属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execute

@Override
public void execute(GeometryBufferRequest request, GeometryBufferResponse response) throws Exception {
	List<org.geomajas.geometry.Geometry> clientGeometries = request.getGeometries();
	if (clientGeometries == null || clientGeometries.size() == 0) {
		throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "request");
	}

	// Convert to internal, apply buffer and convert back to DTO
	List<org.geomajas.geometry.Geometry> result = new ArrayList<org.geomajas.geometry.Geometry>();
	double buffer = request.getBufferDistance();
	int quadrantSegments = request.getQuadrantSegments();
	for (Geometry clientGeometry : clientGeometries) {
		result.add(converter.toDto(converter.toInternal(clientGeometry).buffer(buffer, quadrantSegments)));
	}
	response.setGeometries(result);
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:16,代码来源:GeometryBufferCommand.java

示例2: execute

@Override
public void execute(GetRasterTilesRequest request, GetRasterTilesResponse response) throws Exception {
	log.debug("request start layer {}, crs {}", request.getLayerId(), request.getCrs());
	String layerId = request.getLayerId();
	if (null == layerId) {
		throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "layer");
	}
	if (null == request.getCrs()) {
		throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "crs");
	}
	if (!securityContext.isLayerVisible(layerId)) {
		throw new GeomajasSecurityException(ExceptionCode.LAYER_NOT_VISIBLE, layerId, securityContext.getUserId());
	}

	log.debug("execute() : bbox {}", request.getBbox());
	List<RasterTile> images = layerService.getTiles(layerId, geoService.getCrs2(request.getCrs()),
			converterService.toInternal(request.getBbox()),	request.getScale());
	log.debug("execute() : returning {} images", images.size());

	response.setRasterData(images);
	if (images.size() > 0) {
		response.setNodeId(layerId + "." + images.get(0).getCode().getTileLevel());
	}
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:24,代码来源:GetRasterTilesCommand.java

示例3: execute

@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);
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:25,代码来源:GetConfigurationCommand.java

示例4: execute

@Override
public void execute(GetMapConfigurationRequest request, GetMapConfigurationResponse response) throws Exception {
	if (null == request.getApplicationId()) {
		throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "applicationId");
	}
	String mapId = request.getMapId();
	if (null == mapId) {
		throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "mapId");
	}

	ClientApplicationInfo application = context.getBean(request.getApplicationId(), ClientApplicationInfo.class);
	for (ClientMapInfo map : application.getMaps()) {
		if (mapId.equals(map.getId())) {
			response.setMapInfo(securityClone(map));
		}
	}
	if (response.getMapInfo() == null) {
		throw new GeomajasException(ExceptionCode.MAP_NOT_FOUND, request.getMapId(), request.getApplicationId());
	}
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:20,代码来源:GetMapConfigurationCommand.java

示例5: execute

@Override
public void execute(final DeleteSearchFavouriteRequest request, final SuccessCommandResponse response)
		throws Exception {
	if (null == request.getSearchFavouriteId()) {
		throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "SearchFavouriteId");
	}

	String user = securityContext.getUserName();
	boolean anonymous = false;
	if (user == null || "".equals(user)) {
		if (settings != null && settings.isAllowAnonymous() && settings.isAnonymousCanEdit()) {
			user = "anonymous";
			anonymous = true;
		} else {
			throw new GeomajasSecurityException(ExceptionCode.CREDENTIALS_MISSING_OR_INVALID, "Need username.");
		}
	}

	try {
		SearchFavourite sf = searchFavouritesService.getSearchFavourite(request.getSearchFavouriteId());
		if (sf == null) {
			response.setSuccess(false);
			response.getErrorMessages().add("No SearchFavourite found with id: " + request.getSearchFavouriteId());
		} else {
			if (anonymous && !user.equals(sf.getCreator())) {
				response.setSuccess(false);
				response.getErrorMessages().add("User Anonymous can only delete his own favourites.");
			} else {
				searchFavouritesService.deleteSearchFavourite(sf);
				response.setSuccess(true);
			}
		}
	} catch (Exception e) { // NOSONAR
		response.setSuccess(false);
		response.getErrorMessages().add(
				"Failed deleting SearchFavourite with id: " + request.getSearchFavouriteId());
	}
}
 
开发者ID:geomajas,项目名称:geomajas-project-client-gwt,代码行数:38,代码来源:DeleteSearchFavouriteCommand.java

示例6: execute

@Override
public void execute(GetCentroidRequest request, GetCentroidResponse response) throws Exception {
	if (request.getGeometries() == null || request.getGeometries().size() == 0) {
		throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "request");
	}

	Map<Geometry, Coordinate> centroids = new HashMap<Geometry, Coordinate>(request.getGeometries().size());
	for (Geometry geometry : request.getGeometries()) {
		com.vividsolutions.jts.geom.Geometry jtsGeom = converter.toInternal(geometry);
		Point centroid = jtsGeom.getCentroid();
		centroids.put(geometry, new Coordinate(centroid.getX(), centroid.getY()));
	}

	response.setCentroids(centroids);
}
 
开发者ID:geomajas,项目名称:geomajas-project-client-gwt,代码行数:15,代码来源:GetCentroidCommand.java

示例7: execute

@Override
public void execute(GetResourceRequest request, GetResourceResponse response) throws Exception {
	String[] resources = request.getResources();
	if (null == resources) {
		throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "resources");
	}
	Map<String, String> result = new HashMap<String, String>();

	for (String resourceName : resources) {
		String url = resourceName;
		boolean process = false;
		if (url.endsWith(PROCESS_SUFFIX)) {
			url = url.substring(0, url.length() - PROCESS_SUFFIX.length());
			process = true;
		}
		Resource resource = context.getResource(url);
		String content;
		if (null != resource && resource.exists()) {
			content = new String(read(resource.getInputStream()), FILE_ENCODING);
			if (process) {
				content = process(content);
			}
			content = Pattern.compile("^.*@extract.*$", Pattern.MULTILINE).matcher(content).replaceAll("");
		} else {
			content = "*** File " + url + " not found.";
		}
		result.put(resourceName, content);
	}
	response.setResources(result);
}
 
开发者ID:geomajas,项目名称:geomajas-project-client-gwt,代码行数:30,代码来源:GetResourceCommand.java

示例8: execute

@Override
public void execute(RasterizeMapRequest request, RasterizeMapResponse response) throws Exception {
	ClientMapInfo mapInfo = request.getClientMapInfo();
	if (null == mapInfo) {
		throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "clientMapInfo");
	}
	MapRasterizingInfo mapRasterizingInfo = (MapRasterizingInfo) mapInfo
			.getWidgetInfo(MapRasterizingInfo.WIDGET_KEY);
	if (mapRasterizingInfo == null) {
		throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "mapRasterizingInfo");
	}
	for (ClientLayerInfo clientLayer : mapInfo.getLayers()) {
		if (clientLayer instanceof ClientVectorLayerInfo) {
			if (null == clientLayer.getWidgetInfo(VectorLayerRasterizingInfo.WIDGET_KEY)) {
				throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "vectorLayerRasterizingInfo ("
						+ clientLayer.getId() + ")");
			}
		} else if (clientLayer instanceof ClientRasterLayerInfo) {
			if (null == clientLayer.getWidgetInfo(RasterLayerRasterizingInfo.WIDGET_KEY)) {
				throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "rasterLayerRasterizingInfo ("
						+ clientLayer.getId() + ")");
			}
		}
	}
	ByteArrayOutputStream mapStream = new ByteArrayOutputStream(MAP_BUFFER_SIZE);
	imageService.writeMap(mapStream, request.getClientMapInfo());
	String mapKey = putInCache(mapStream.toByteArray(), mapRasterizingInfo.getBounds());
	ByteArrayOutputStream legendStream = new ByteArrayOutputStream(MAP_LEGEND_SIZE);
	imageService.writeLegend(legendStream, request.getClientMapInfo());
	String legendKey = putInCache(legendStream.toByteArray(), mapRasterizingInfo.getBounds());
	// remove last '/' from dispatcher URL
	String baseUrl = dispatcherUrlService.getDispatcherUrl().substring(0,
			dispatcherUrlService.getDispatcherUrl().length() - 1);
	response.setMapKey(mapKey);
	response.setMapUrl(baseUrl + RasterizingController.IMAGE_MAPPING + mapKey + ".png");
	response.setLegendKey(legendKey);
	response.setLegendUrl(baseUrl + RasterizingController.IMAGE_MAPPING + legendKey + ".png");
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:38,代码来源:RasterizeMapCommand.java

示例9: postConstruct

@PostConstruct
protected void postConstruct() throws GeomajasException {
	if (null == baseWmsUrl) {
		throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "baseWmsUrl");
	}

	crs = geoService.getCrs2(getLayerInfo().getCrs());

	// calculate resolutions
	List<ScaleInfo> scales = layerInfo.getZoomLevels();
	if (scales != null) {
		List<Double> r = new ArrayList<Double>();
		for (ScaleInfo scale : scales) {
			r.add(1. / scale.getPixelPerUnit());
		}

		// sort in decreasing order !!!
		Collections.sort(r);
		Collections.reverse(r);

		int level = 0;
		for (double resolution : r) {
			resolutions
					.add(new Resolution(resolution, level++, layerInfo.getTileWidth(), layerInfo.getTileHeight()));
		}
	}
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:27,代码来源:WmsLayer.java

示例10: execute

@Override
public void execute(SearchFeatureRequest request, SearchFeatureResponse response) throws Exception {
	String layerId = request.getLayerId();
	if (null == layerId) {
		throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "layer");
	}
	String crs = request.getCrs();
	if (null == crs) {
		throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "crs");
	}

	Filter filter = createFilter(request, layerId);
	log.debug("filter to apply : {}", filter);

	List<InternalFeature> features = layerService.getFeatures(layerId, geoService.getCrs(request.getCrs()), filter,
			null, request.getFeatureIncludes(), request.getOffSet(), request.getMax());
	response.setLayerId(layerId);
	int max = request.getMax();
	if (max == SearchFeatureRequest.MAX_UNLIMITED) {
		max = features.size();
	}
	if (max > features.size()) {
		max = features.size();
	}
	Feature[] maxList = new Feature[max];
	for (int i = 0; i < max; i++) {
		Feature feature = converter.toDto(features.get(i));
		feature.setCrs(crs);
		maxList[i] = feature;
	}
	response.setFeatures(maxList);
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:32,代码来源:SearchFeatureCommand.java

示例11: execute

@Override
public void execute(SearchAttributesRequest request, SearchAttributesResponse response) throws Exception {
	String layerId = request.getLayerId();
	if (null == layerId) {
		throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "layer");
	}

	Filter filter = Filter.INCLUDE;
	if (request.getFilter() != null) {
		filter = filterService.parseFilter(request.getFilter());
	}

	List<Attribute<?>> attributes = layerService.getAttributes(layerId, request.getAttributePath(), filter);
	response.setAttributes(attributes);
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:15,代码来源:SearchAttributesCommand.java

示例12: execute

@Override
public void execute(GeometryConvexHullRequest request, GeometryConvexHullResponse response) throws Exception {
	List<org.geomajas.geometry.Geometry> clientGeometries = request.getGeometries();
	if (clientGeometries == null || clientGeometries.size() == 0) {
		throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "request");
	}
	
	// Convert to internal, apply ConvexHull and convert back to DTO
	List<org.geomajas.geometry.Geometry> result = new ArrayList<org.geomajas.geometry.Geometry>();
	for (Geometry clientGeometry : clientGeometries) {
		result.add(converter.toDto(new ConvexHull(converter.toInternal(clientGeometry)).getConvexHull()));
	}
	response.setGeometries(result);
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:14,代码来源:GeometryConvexHullCommand.java

示例13: execute

@Override
public void execute(GetVectorTileRequest request, GetVectorTileResponse response) throws Exception {
	String layerId = request.getLayerId();
	log.debug("request start layer {}, crs {}", layerId, request.getCrs());
	if (null == layerId) {
		throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "layer");
	}
	if (null == request.getCrs()) {
		throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "crs");
	}

	response.setTile(converter.toDto(layerService.getTile(request)));
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:13,代码来源:GetVectorTileCommand.java

示例14: dtoGeometryCriterionToFilters

private Map<VectorLayer, Filter> dtoGeometryCriterionToFilters(GeometryCriterion criterion, Crs mapCrs)
		throws GeomajasException {
	if (mapCrs == null) {
		throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "mapCrs");
	}

	Map<VectorLayer, Filter> filters = new LinkedHashMap<VectorLayer, Filter>();
	Filter f;
	Geometry mapGeom = converter.toInternal(criterion.getGeometry());

	for (String serverLayerId : criterion.getServerLayerIds()) {
		VectorLayer vl = configurationService.getVectorLayer(serverLayerId);
		if (vl == null) {
			throw new GeomajasException(ExceptionCode.LAYER_NOT_FOUND, serverLayerId);
		}

		// Transform geometry to layer CRS:
		Geometry layerGeometry = geoService.transform(mapGeom, mapCrs, vectorLayerService.getCrs(vl));

		switch (criterion.getOperator()) {
			case SearchByLocationRequest.QUERY_INTERSECTS:
				f = filterService.createIntersectsFilter(layerGeometry, vl.getFeatureModel()
						.getGeometryAttributeName());
				break;
			case SearchByLocationRequest.QUERY_CONTAINS:
				f = filterService.createContainsFilter(layerGeometry, vl.getFeatureModel()
						.getGeometryAttributeName());
				break;

			case SearchByLocationRequest.QUERY_TOUCHES:
				f = filterService.createTouchesFilter(layerGeometry, vl.getFeatureModel()
						.getGeometryAttributeName());
				break;

			case SearchByLocationRequest.QUERY_WITHIN:
				f = filterService
						.createWithinFilter(layerGeometry, vl.getFeatureModel().getGeometryAttributeName());
				break;

			default:
				throw new GeomajasException(ExceptionCode.ATTRIBUTE_UNKNOWN, "QueryType");
		}

		filters.put(vl, f);
	}
	return filters;
}
 
开发者ID:geomajas,项目名称:geomajas-project-client-gwt,代码行数:47,代码来源:DtoSearchConverterServiceImpl.java

示例15: execute

@Override
public void execute(final FeatureSearchRequest request, final FeatureSearchResponse response) throws Exception {
	if (request.getCriterion() == null) {
		throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "criterion");
	}
	if (null == request.getMapCrs()) {
		throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "mapCrs");
	}
	if (!request.getCriterion().isValid()) {
		throw new GeomajasException(ExceptionCode.UNEXPECTED_PROBLEM, "criterion is not valid");
	}

	String mapCrsCode = request.getMapCrs();
	Crs mapCrs = geoService.getCrs2(request.getMapCrs());

	Map<VectorLayer, Filter> filters = dtoSearchConverterService.dtoCriterionToFilters(request.getCriterion(),
			mapCrs);

	Map<String, String> layerFilters = request.getLayerFilters();

	for (Entry<VectorLayer, Filter> entry : filters.entrySet()) {
		String layerId = entry.getKey().getId();
		if (securityContext.isLayerVisible(layerId)) {
			Filter f = entry.getValue();
			if (layerFilters.containsKey(layerId)) {
				String layerFilter = layerFilters.get(layerId);
				f = filterService.createAndFilter(filterService.parseFilter(layerFilter), f);
			}

			List<InternalFeature> temp = layerService.getFeatures(layerId, mapCrs, f, null,
					request.getFeatureIncludes(), 0, request.getMax());
			if (temp.size() > 0) {
				List<Feature> features = new ArrayList<Feature>();
				for (InternalFeature feature : temp) {
					Feature dto = dtoConverterService.toDto(feature);
					dto.setCrs(mapCrsCode);
					features.add(dto);
				}
				response.addLayer(layerId, features);
			}
		}
	}
}
 
开发者ID:geomajas,项目名称:geomajas-project-client-gwt,代码行数:43,代码来源:FeatureSearchCommand.java


注:本文中的org.geomajas.global.ExceptionCode.PARAMETER_MISSING属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。