private void writeEntitySets(final JsonGenerator gen, final EdmEntityContainer container) throws IOException { for (EdmEntitySet edmEntitySet : container.getEntitySets()) { if (edmEntitySet.isIncludeInServiceDocument()) { writeElement(gen, null, edmEntitySet.getName(), edmEntitySet.getName()); } } }
@Override protected void loadAllEntitySets() { List<? extends EntitySet> localEntitySets = xmlEntityContainer.getEntitySets(); if (localEntitySets != null) { for (EntitySet entitySet : localEntitySets) { EdmEntitySet edmSet; final FullQualifiedName entityType = new EdmTypeInfo.Builder() .setTypeExpression(entitySet.getEntityType()) .setDefaultNamespace(entityContainerName.getNamespace()) .build() .getFullQualifiedName(); if (entitySet instanceof org.apache.olingo.client.api.edm.xml.v4.EntitySet) { edmSet = new EdmEntitySetImpl( edm, this, entitySet.getName(), entityType, (org.apache.olingo.client.api.edm.xml.v4.EntitySet) entitySet); } else { edmSet = new EdmEntitySetProxy(edm, this, entitySet.getName(), entityType, xmlMetadata); } entitySets.put(edmSet.getName(), edmSet); } } }
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(); } }
private void appendEntitySets(final XMLStreamWriter writer, final List<EdmEntitySet> entitySets) throws XMLStreamException { for (EdmEntitySet entitySet : entitySets) { writer.writeStartElement(XML_ENTITY_SET); writer.writeAttribute(XML_NAME, entitySet.getName()); writer.writeAttribute( XML_ENTITY_TYPE, getAliasedFullQualifiedName(entitySet.getEntityType(), false)); if (!entitySet.isIncludeInServiceDocument()) { writer.writeAttribute( XML_INCLUDE_IN_SERVICE_DOCUMENT, "" + entitySet.isIncludeInServiceDocument()); } appendNavigationPropertyBindings(writer, entitySet); writer.writeEndElement(); } }