Write feed body.

@param entities The list of entities to fill in the XML stream. It can not {@code null}.
@throws ODataRenderException In case it is not possible to write to the XML stream.
16274
public void writeBodyFeed(List<?> entities) throws ODataRenderException {
        checkNotNull(entities);
        try {
            for (Object entity : entities) {
                writeEntry(entity, true);
            }
        } catch (XMLStreamException | IllegalAccessException | NoSuchFieldException | ODataEdmException e) {
            LOG.error("Not possible to marshall feed stream XML");
            throw new ODataRenderException("Not possible to marshall feed stream XML: ", e);
        }
    }
1235122
@Override
    public void writeData(String tableName, EntityMetadata m, Object entity, Object rowId,
            List<RelationHolder> relations, boolean showQuery) throws IOException
    {
        HTableInterface hTable = gethTable(tableName);

        MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(
                m.getPersistenceUnit());

        EntityType entityType = metaModel.entity(m.getEntityClazz());

        Set<Attribute> attributes = entityType.getAttributes();

        if (metaModel.isEmbeddable(m.getIdAttribute().getBindableJavaType()))
        {
            rowId = KunderaCoreUtils.prepareCompositeKey(m, rowId);
        }

        HBaseDataWrapper columnWrapper = new HBaseDataWrapper(rowId, new java.util.HashMap<String, Attribute>(),
                entity, null);
        List<HBaseDataWrapper> persistentData = new ArrayList<HBaseDataHandler.HBaseDataWrapper>(attributes.size());

        Map<String, HBaseDataWrapper> columnWrappers = preparePersistentData(tableName, m.getTableName(), entity,
                rowId, metaModel, attributes, columnWrapper, persistentData, showQuery);

        writeColumnData(hTable, entity, columnWrappers);

        for (HBaseDataWrapper wrapper : persistentData)
        {
            hbaseWriter.writeColumns(hTable, wrapper.getColumnFamily(), wrapper.getRowKey(), wrapper.getColumns(),
                    wrapper.getValues(), wrapper.getEntity());
        }

        // Persist relationships as a column in newly created Column family by
        // Kundera
        boolean containsEmbeddedObjectsOnly = columnWrapper.getColumns().isEmpty() && persistentData.isEmpty();

        if (relations != null && !relations.isEmpty())
        {
            hbaseWriter.writeRelations(hTable, rowId, containsEmbeddedObjectsOnly, relations, m.getTableName());
        }

        // add discriminator column
        String discrColumn = ((AbstractManagedType) entityType).getDiscriminatorColumn();
        String discrValue = ((AbstractManagedType) entityType).getDiscriminatorValue();

        // No need to check for empty or blank, as considering it as valid name
        // for nosql!
        if (discrColumn != null && discrValue != null)
        {
            List<RelationHolder> discriminator = new ArrayList<RelationHolder>(1);
            discriminator.add(new RelationHolder(discrColumn, discrValue));
            hbaseWriter.writeRelations(hTable, rowId, containsEmbeddedObjectsOnly, discriminator, m.getTableName());
        }

        puthTable(hTable);
    }
1094844
@Override
    public void writeXML(XMLOutput xmlOutput) throws IOException {
        xmlOutput.openCloseTag(
                ELEMENT_NAME,
                new XMLAttributeList().addAttribute("sequence", String.valueOf(sequence))
                .addAttribute("timestamp", String.valueOf(timestamp)).addAttribute("release", releaseName)
                .addAttribute("codeSize", String.valueOf(codeSize))
                .addAttribute("numClasses", String.valueOf(numClasses)));
    }
603630
@Override
  public void write(Fields fields) throws IOException {
    delegateFieldsConsumer.write(fields);
    write(state.fieldInfos, fields);
  }
906886
@Override
    public void writeEnc(Writer w) throws IOException
    {
        w.write("<!ENTITY ");
        w.write(mName);
        String pubId = getPublicId();
        if (pubId != null) {
            w.write("PUBLIC \"");
            w.write(pubId);
            w.write("\" ");
        } else {
            w.write("SYSTEM ");
        }
        w.write('"');
        w.write(getSystemId());
        w.write("\" NDATA ");
        w.write(mNotationId);
        w.write('>');
    }
93678
public static void writeXML(DocumentFragment fragment, OutputStream stream) throws IOException {
		assert fragment != null : AssertMessages.notNullParameter(0);
		assert stream != null : AssertMessages.notNullParameter(1);
		writeNode(fragment, stream);
	}
603157
public void xmlWriteOn(FormattedWriter writer) throws IOException
  {
    super.xmlWriteOn(writer);
    
    writer.newLine();
    writer.taggedValue("subscriberID", _subState.getSubscriberID());

    writer.newLine();
    writer.startTag("topics");
    writer.indent();

    String[] topics = _subState.getTopics();

    if (topics != null)
    {
      for (int i = 0; i < topics.length; i++)
      {
        writer.newLine();
        writer.taggedValue("topic", topics[i]);
      }
    }

    writer.outdent();
    writer.newLine();
    writer.endTag("topics");
    writer.newLine();
    writer.taggedValue("toBeDeleted", toBeDeleted);
  }
929183
private void writeObject(final ObjectOutputStream out) throws IOException {
        out.defaultWriteObject();
        out.writeInt(table.length);

        // Have to use null-terminated list because size might shrink
        // during iteration

        for (final Object o : entrySet()) {
            final Map.Entry entry = (Map.Entry) o;
            out.writeObject(entry.getKey());
            out.writeObject(entry.getValue());
        }
        out.writeObject(null);
    }
898503
public void writeBodyTag(Writer out)
         throws IOException
    {
        if (!writtenBodyTag)
        {
            writtenBodyTag = true;          
            out.write("<body "+attributes()+">\n");
        }
    }
688762
@Override
    protected void onPersist(EntityMetadata entityMetadata, Object entity, Object id, List<RelationHolder> relations)
    {
        String tableName = HBaseUtils.getHTableName(entityMetadata.getSchema(), entityMetadata.getTableName());
        try
        {
            handler.writeData(tableName, entityMetadata, entity, id, relations, showQuery);
        }
        catch (IOException e)
        {
            throw new PersistenceException(e);
        }
    }
173428
public void writeMetadataDocument() throws ODataRenderException {

        try {
            xmlWriter.writeStartElement(EDMX_NS, EDMX);
            xmlWriter.writeNamespace(EDMX_PREFIX, EDMX_NS);
            xmlWriter.writeAttribute(VERSION, ODATA_VERSION);
            xmlWriter.writeStartElement(EDMX_NS, EDMX_DATA_SERVICES);

            boolean entityContinerWritten = false;
            // Loop over all the schemas present in the Entity Data Model
            for (Schema schema : entityDataModel.getSchemas()) {
                xmlWriter.writeStartElement(SCHEMA);
                xmlWriter.writeDefaultNamespace(EDM_NS);
                xmlWriter.writeAttribute(NAMESPACE, schema.getNamespace());
                for (Type type : schema.getTypes()) {
                    switch (type.getMetaType()) {
                        case ENTITY:
                            entityTypeWriter.write((EntityType) type);
                            break;
                        case COMPLEX:
                            complexTypeWriter.write((ComplexType) type);
                            break;
                        case ENUM:
                            enumTypeWriter.write((EnumType) type);
                            break;
                        default:
                            LOG.error("Unexpected type: {}", type.getFullyQualifiedName());
                            throw new ODataRenderException("Unexpected type: " + type.getFullyQualifiedName());
                    }
                }
                if (!entityContinerWritten) {
                    writeEntityContainer(entityDataModel.getEntityContainer());
                    entityContinerWritten = true;
                }

                // End of <Schema> element
                xmlWriter.writeEndElement();
            }

            xmlWriter.writeEndElement();
        } catch (XMLStreamException e) {
            LOG.error("Not possible to start stream XML");
            throw new ODataRenderException("Not possible to start stream XML: ", e);
        }
    }
675775
public void write(EntitySet entitySet) throws XMLStreamException {

        LOG.debug("Writing entity set {} of type {}", entitySet.getName(), entitySet.getTypeName());

        xmlWriter.writeStartElement(ENTITY_SET);
        xmlWriter.writeAttribute(NAME, entitySet.getName());
        xmlWriter.writeAttribute(ENTITY_TYPE, entitySet.getTypeName());
        for (NavigationPropertyBinding navPropertyBinding : entitySet.getNavigationPropertyBindings()) {
            xmlWriter.writeStartElement(NAVIGATION_PROPERTY_BINDING);
            xmlWriter.writeAttribute(PATH, navPropertyBinding.getPath());
            xmlWriter.writeAttribute(TARGET, navPropertyBinding.getTarget());
            xmlWriter.writeEndElement();
        }
        xmlWriter.writeEndElement();
    }
977493
private void writeName(JsonGenerator jsonGenerator, Object entity) throws IOException {
        jsonGenerator.writeFieldName(NAME);
        if (entity instanceof EntitySet) {
            jsonGenerator.writeObject(((EntitySet) entity).getName());
        } else {
            jsonGenerator.writeObject(((Singleton) entity).getName());
        }
    }
525917
@Override
    public ODataEntity<?> readFrom(Class<ODataEntity<?>> type,
            Type genericType, Annotation[] annotations, MediaType mediaType,
            MultivaluedMap<String, String> httpHeaders, InputStream entityStream)
            throws IOException {

        ODataEntity<?> result = null;
        String responseType = mediaType.getParameters().get("type");
        try {
            if (responseType == null || responseType.equals("feed")) {
                List<ODataEntity<?>> feedContents = null;
                synchronized (unmarshaller) {
                    feedContents = unmarshaller.unmarshalFeed(entityStream,
                            type);
                }
                return feedContents.get(0);
            } else if (responseType.equals("entry")) {
                synchronized (unmarshaller) {
                    result = unmarshaller.unmarshalEntry(entityStream, type);
                }
            } else {
                throw new RuntimeException();
            }
        } catch (JAXBException e) {
            throw new RuntimeException(e);
        } catch (ServiceException e) {
            throw new RuntimeException(e);
        }

        return result;
    }
463976
void writeInterfaces(final XMLExtendedStreamWriter writer, final ModelNode modelNode) throws XMLStreamException {
        writer.writeStartElement(Element.INTERFACES.getLocalName());
        final Set<String> interfaces = modelNode.keys();
        for (String ifaceName : interfaces) {
            final ModelNode iface = modelNode.get(ifaceName);
            writer.writeStartElement(Element.INTERFACE.getLocalName());
            writeAttribute(writer, Attribute.NAME, ifaceName);
            // <any-* /> is just handled at the root
            if (iface.get(Element.ANY_ADDRESS.getLocalName()).asBoolean(false)) {
                writer.writeEmptyElement(Element.ANY_ADDRESS.getLocalName());
            } else {
                // Write the other criteria elements
                writeInterfaceCriteria(writer, iface, false);
            }
            writer.writeEndElement();
        }
        writer.writeEndElement();
    }
626294
public void write(Writer out)
         throws IOException
    {
        for (int i=0; i <elements.size() ; i++)
        {
            Object element = elements.get(i);
          
            if (element instanceof Element)
                ((Element)element).write(out);
            else if (element==null)
                out.write("null");
            else 
                out.write(element.toString());
        }
    }
279810
@Override
    public void writeXML(XMLOutput xmlOutput) throws IOException {
        xmlOutput.openTag(ELEMENT_NAME, new XMLAttributeList().addAttribute("class", className));
        for (Iterator<String> i = featureIterator(); i.hasNext();) {
            String feature = i.next();
            xmlOutput.openCloseTag(FEATURE_ELEMENT_NAME, new XMLAttributeList().addAttribute("value", feature));
        }
        xmlOutput.closeTag(ELEMENT_NAME);
    }