コード例 #1
0
  private void appendFunctionImports(
      final XMLStreamWriter writer,
      final List<EdmFunctionImport> functionImports,
      final String containerNamespace)
      throws XMLStreamException {
    for (EdmFunctionImport functionImport : functionImports) {
      writer.writeStartElement(XML_FUNCTION_IMPORT);
      writer.writeAttribute(XML_NAME, functionImport.getName());

      String functionFQNString;
      FullQualifiedName functionFqn = functionImport.getFunctionFqn();
      if (namespaceToAlias.get(functionFqn.getNamespace()) != null) {
        functionFQNString =
            namespaceToAlias.get(functionFqn.getNamespace()) + "." + functionFqn.getName();
      } else {
        functionFQNString = functionFqn.getFullQualifiedNameAsString();
      }
      writer.writeAttribute(XML_FUNCTION, functionFQNString);

      EdmEntitySet returnedEntitySet = functionImport.getReturnedEntitySet();
      if (returnedEntitySet != null) {
        writer.writeAttribute(
            XML_ENTITY_SET, containerNamespace + "." + returnedEntitySet.getName());
      }
      // Default is false and we do not write the default
      if (functionImport.isIncludeInServiceDocument()) {
        writer.writeAttribute(
            XML_INCLUDE_IN_SERVICE_DOCUMENT, "" + functionImport.isIncludeInServiceDocument());
      }
      writer.writeEndElement();
    }
  }
コード例 #2
0
 private void writeFunctionImports(final JsonGenerator gen, final EdmEntityContainer container)
     throws IOException {
   for (EdmFunctionImport edmFunctionImport : container.getFunctionImports()) {
     if (edmFunctionImport.isIncludeInServiceDocument()) {
       writeElement(
           gen, FUNCTION_IMPORT, edmFunctionImport.getName(), edmFunctionImport.getName());
     }
   }
 }