/** Returns the list of requested sections (never null or emtpy) */ protected Set<Sections> getSections(GetCapabilitiesRequest request) { List<String> sectionNames = request.getSections(); if (sectionNames == null || sectionNames.isEmpty()) { return ALL_SECTIONS; } Set<Sections> sections = new HashSet<>(); for (String sectionName : sectionNames) { try { Sections section = Sections.valueOf(sectionName); sections.add(section); } catch (IllegalArgumentException e) { WFSException exception = new WFSException( request, "Unknown section " + sectionName, "InvalidParameterValue"); exception.setLocator("sections"); throw exception; } } if (sections.contains(Sections.All)) { return ALL_SECTIONS; } return sections; }
private void validateValue(TransactionElement element, Property property, Class<?> binding) { Object value = property.getValue(); // was it a null? If so, assume valid (already checked for nulls before) if (value == null // parsed as null || (value instanceof String && ((String) value).trim().isEmpty()) // as an empty string || (value instanceof Map && ((Map) value).isEmpty()) // or the usual map that the parser creates ) { return; } // see if the datastore machinery will be able to convert Object converted = Converters.convert(value, binding); if (converted == null) { String propertyName = property.getName().getLocalPart(); WFSException e = new WFSException( element, "Invalid value for property " + propertyName, WFSException.INVALID_VALUE); e.setLocator(propertyName); throw e; } }
"Stored query '" + storedQueryId + "' does not" + " exist.", ServiceException.INVALID_PARAMETER_VALUE); exception.setLocator("STOREDQUERY_ID"); throw exception;
"ResourceId is incosistent with " + "typenames"); exception.setCode(ServiceException.INVALID_PARAMETER_VALUE); exception.setLocator(locator); throw exception;
public DescribeStoredQueriesResponseType run(DescribeStoredQueriesType request) throws WFSException { Wfs20Factory factory = Wfs20Factory.eINSTANCE; DescribeStoredQueriesResponseType response = factory.createDescribeStoredQueriesResponseType(); List<StoredQueryProvider> providers = GeoServerExtensions.extensions(StoredQueryProvider.class); if (request.getStoredQueryId().isEmpty()) { for (StoredQuery query : storedQueryProvider.listStoredQueries()) { describeStoredQuery(query, response); } } else { for (URI id : request.getStoredQueryId()) { StoredQuery query = storedQueryProvider.getStoredQuery(id.toString()); if (query == null) { WFSException exception = new WFSException( request, "No such stored query: " + id, ServiceException.INVALID_PARAMETER_VALUE); exception.setLocator("STOREDQUERY_ID"); throw exception; } describeStoredQuery(query, response); } } return response; }
"No such stored query: " + storedQueryId, ServiceException.INVALID_PARAMETER_VALUE); exception.setLocator("STOREDQUERY_ID"); throw exception;
"No such stored query: " + storedQueryId, ServiceException.INVALID_PARAMETER_VALUE); exception.setLocator("STOREDQUERY_ID"); throw exception;
public ExecutionStatusType run(DropStoredQueryType request) throws WFSException { if (request.getId() == null) { throw new WFSException(request, "No stored query id specified"); } StoredQuery query = storedQueryProvider.getStoredQuery(request.getId()); if (query != null) { storedQueryProvider.removeStoredQuery(query); } else { WFSException exception = new WFSException( request, String.format("Stored query %s does not exist.", request.getId()), ServiceException.INVALID_PARAMETER_VALUE); // CITE tests vagary, the XML uses "id" and KVP uses "STOREDQUERY_ID", the CITE tests // mandate "id" // in all bindings exception.setLocator("id"); throw exception; } Wfs20Factory factory = Wfs20Factory.eINSTANCE; ExecutionStatusType response = factory.createExecutionStatusType(); response.setStatus("OK"); return response; } }
"Invalid language " + queryExpressionTextType.getLanguage(), ServiceException.INVALID_PARAMETER_VALUE); e.setLocator("language"); throw e;
public CreateStoredQueryResponseType run(CreateStoredQueryType request) throws WFSException { for (StoredQueryDescriptionType sqd : request.getStoredQueryDefinition()) { if (storedQueryProvider.getStoredQuery(sqd.getId()) != null) { WFSException e = new WFSException( request, "Stored query already exists", WFSException.DUPLICATE_STORED_QUERY_ID_VALUE); e.setLocator(sqd.getId()); throw e; } validateStoredQuery(request, sqd); try { storedQueryProvider.createStoredQuery(sqd); } catch (Exception e) { throw new WFSException(request, "Error occured creating stored query", e); } } Wfs20Factory factory = Wfs20Factory.eINSTANCE; CreateStoredQueryResponseType response = factory.createCreateStoredQueryResponseType(); response.setStatus("OK"); return response; }
&& (e.getLocator() == null || "GetFeature".equalsIgnoreCase(e.getLocator()))) { e.setLocator(query.getHandle());