Package org.fao.geonet.csw.common.exceptions

Examples of org.fao.geonet.csw.common.exceptions.InvalidParameterValueEx


  String outputFormat   = request.getAttributeValue("outputFormat");
  String schemaLanguage = request.getAttributeValue("schemaLanguage");

  if (outputFormat != null && !outputFormat.equals("application/xml"))
      throw new InvalidParameterValueEx("outputFormat", outputFormat);

  if (schemaLanguage != null
        && !schemaLanguage.equals(Csw.SCHEMA_LANGUAGE))
    throw new InvalidParameterValueEx("schemaLanguage", schemaLanguage);

  //--- build output

  Element response = new Element(getName() +"Response", Csw.NAMESPACE_CSW);
  response.addNamespaceDeclaration(Csw.NAMESPACE_CSW)
View Full Code Here


  setAttrib(request, "outputFormat",   outputFormat);
  setAttrib(request, "schemaLanguage", schemaLang);

  //--- setup type names
  if (typeNames != null && namespace == null)
    throw new InvalidParameterValueEx("Namespace", "Typename's namespace not declared for "+typeNames+".");
   
  Map<String, String> hmTypeNames = retrieveTypeNames(typeNames, namespace);

  for(Map.Entry<String, String> entry : hmTypeNames.entrySet())
      {
View Full Code Here

//      CSW 2.0.2 testsuite csw:csw-2.0.2-DescribeRecord-tc7.1:   
//        "Pass if all of the following conditions are true: (1) the response
//        entity has &lt;ows:ExceptionReport&gt; as the document element; and (2)
//        ows:Exception/@exceptionCode="InvalidParameterValuePhase" (csw:TypeName not qualified)."
    else if (!typeName.contains(":")) {
      throw new InvalidParameterValueEx("TypeName", "csw:TypeName not qualified for typename: " + typeName);
    }
    // Return no exception but an empty DescribeRecordResponse if no typename found
  }
  return scElements;
    }
View Full Code Here

     * @throws InvalidParameterValueEx hmm
     */
    private String checkOutputFormat(Element request) throws InvalidParameterValueEx {
        String format = request.getAttributeValue("outputFormat");
        if (format != null && !format.equals(defaultOutputFormat)) {
            throw new InvalidParameterValueEx("outputFormat", format);
        }
        else {
            return defaultOutputFormat;
        }
    }
View Full Code Here

                typeName = typeName.trim();
                if(Log.isDebugEnabled(Geonet.CSW_SEARCH)) {
                    Log.debug(Geonet.CSW_SEARCH, "checking typename in query:" + typeName);
                }
                if(!(typeName.equals(cswPrefix + ":Record") || typeName.equals(gmdPrefix + ":MD_Metadata"))) {
                throw new InvalidParameterValueEx("typeNames", "invalid value");
            }
                if(typeName.equals(gmdPrefix + ":MD_Metadata")) {
                    return typeName;
            }
        }
View Full Code Here

        Element query = request.getChild("Query", Csw.NAMESPACE_CSW);
        if(query != null) {
            boolean elementNamePresent = !CollectionUtils.isEmpty(query.getChildren("ElementName", query.getNamespace()));
            boolean elementSetNamePresent = !CollectionUtils.isEmpty(query.getChildren("ElementSetName", query.getNamespace()));
            if(elementNamePresent && elementSetNamePresent) {
                throw new InvalidParameterValueEx("ElementName and ElementSetName", "mutually exclusive");
            }
        }
    }
View Full Code Here

            int value = Integer.parseInt(start);
            if(value >= 1) {
                return value;
            }
            else {
                throw new InvalidParameterValueEx("startPosition", start);
            }
        }
        catch (NumberFormatException x) {
            throw new InvalidParameterValueEx("startPosition", start);
        }
    }
View Full Code Here

            int value = Integer.parseInt(max);
            if (value >= 1) {
                return value;
            }
            else {
                throw new InvalidParameterValueEx("maxRecords", max);
            }
        }
        catch (NumberFormatException x) {
            throw new InvalidParameterValueEx("maxRecords", max);
        }
    }
View Full Code Here

        } else if (outputSchema == OutputSchema.ISO_PROFILE) {
            prefix = "iso";
        } else if (outputSchema == OutputSchema.OWN) {
            prefix = "own";
        } else {
            throw new InvalidParameterValueEx("outputSchema not supported for metadata " + id + " schema.", schema);
        }

    String schemaDir  = schemaManager.getSchemaCSWPresentDir(schema)+ File.separator;
    String styleSheet = schemaDir + prefix +"-"+ elementSetName +".xsl";
View Full Code Here

                    }
                }
                catch (Exception x) {
                    Log.error(Geonet.CSW_SEARCH, x.getMessage());
                    x.printStackTrace();
                    throw new InvalidParameterValueEx("elementName has invalid XPath : " + elementName, x.getMessage());
                }
            }

            if(metadataContainsAllRequestedElementNames == true) {
                if(Log.isDebugEnabled(Geonet.CSW_SEARCH))
View Full Code Here

TOP

Related Classes of org.fao.geonet.csw.common.exceptions.InvalidParameterValueEx

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.