Package org.eclipse.persistence.oxm.record

Examples of org.eclipse.persistence.oxm.record.OutputStreamRecord


                }else{
                  session = xmlContext.getSession(object.getClass());
                  xmlDescriptor = getDescriptor(object.getClass(), session);
                }
           
                OutputStreamRecord record;
                if (isFormattedOutput()) {
                  record = new FormattedOutputStreamRecord();                 
                } else {
                  record = new OutputStreamRecord();                 
                }
                      
                record.setMarshaller(this);
                record.setOutputStream(outputStream);
           
                //if this is a simple xml root, the session and descriptor will be null
                if (!(isXMLRoot && ((XMLRoot)object).getObject() instanceof Node) && ((session == null) || !xmlContext.getDocumentPreservationPolicy(session).shouldPreserveDocument())) {
                    marshal(object, record, session, xmlDescriptor, isXMLRoot);   
                } else {
                    try {
                        Node xmlDocument = null;
                        if(isXMLRoot && session == null) {
                            xmlDocument = (Node)((XMLRoot)object).getObject();
                        } else {
                            xmlDocument = objectToXMLNode(object, session, xmlDescriptor, isXMLRoot);
                        }
                        record.setSession(session);
                        if (isFragment()) {
                            record.node(xmlDocument, xmlDescriptor.getNamespaceResolver());
                        } else {
                            record.startDocument(encoding, version);
                            record.node(xmlDocument, record.getNamespaceResolver());
                            record.endDocument();
                        }
                    } catch (XMLPlatformException e) {
                        throw XMLMarshalException.marshalException(e);
                    }
                }
                record.flush();
            }else{
              OutputStreamWriter writer = new OutputStreamWriter(outputStream, encoding);
                marshal(object, writer);
                writer.flush();
            }
View Full Code Here


                            Class objectClass = object.getClass();
                            session = xmlContext.getSession(objectClass);
                            xmlDescriptor = getDescriptor(objectClass, session);
                  }
              }
                OutputStreamRecord record;
                if (isFormattedOutput()) {
                  record = new FormattedOutputStreamRecord();                 
                } else {
                  record = new OutputStreamRecord();                 
                }
                      
                record.setMarshaller(this);
                record.setOutputStream(outputStream);
           
                //if this is a simple xml root, the session and descriptor will be null
                if (!(isXMLRoot && ((XMLRoot)object).getObject() instanceof Node) && ((session == null) || !xmlContext.getDocumentPreservationPolicy(session).shouldPreserveDocument())) {
                    marshal(object, record, session, xmlDescriptor, isXMLRoot);   
                } else {
                    try {
                        Node xmlDocument = null;
                        if(isXMLRoot && session == null) {
                            xmlDocument = (Node)((XMLRoot)object).getObject();
                        } else {
                            xmlDocument = objectToXMLNode(object, session, xmlDescriptor, isXMLRoot);
                        }
                        record.setSession(session);
                        if (isFragment()) {
                            record.node(xmlDocument, xmlDescriptor.getNamespaceResolver());
                        } else {
                            record.startDocument(encoding, version);
                            record.node(xmlDocument, record.getNamespaceResolver());
                            record.endDocument();
                        }
                    } catch (XMLPlatformException e) {
                        throw XMLMarshalException.marshalException(e);
                    }
                }
                record.flush();
            }else{
              OutputStreamWriter writer = new OutputStreamWriter(outputStream, encoding);
                marshal(object, writer);
                writer.flush();
            }
View Full Code Here

                }else{
                  session = xmlContext.getSession(object.getClass());
                  xmlDescriptor = getDescriptor(object.getClass(), session);
                }
           
                OutputStreamRecord record;
                if (isFormattedOutput()) {
                  record = new FormattedOutputStreamRecord();                 
                } else {
                  record = new OutputStreamRecord();                 
                }
                      
                record.setMarshaller(this);
                record.setOutputStream(outputStream);
           
                //if this is a simple xml root, the session and descriptor will be null
                if (!(isXMLRoot && ((XMLRoot)object).getObject() instanceof Node) && ((session == null) || !xmlContext.getDocumentPreservationPolicy(session).shouldPreserveDocument())) {
                    marshal(object, record, session, xmlDescriptor, isXMLRoot);   
                } else {
                    try {
                        Node xmlDocument = null;
                        if(isXMLRoot && session == null) {
                            xmlDocument = (Node)((XMLRoot)object).getObject();
                        } else {
                            xmlDocument = objectToXMLNode(object, session, xmlDescriptor, isXMLRoot);
                        }
                        record.setSession(session);
                        if (isFragment()) {
                            record.node(xmlDocument, xmlDescriptor.getNamespaceResolver());
                        } else {
                            record.startDocument(encoding, version);
                            record.node(xmlDocument, record.getNamespaceResolver());
                            record.endDocument();
                        }
                    } catch (XMLPlatformException e) {
                        throw XMLMarshalException.marshalException(e);
                    }
                }
View Full Code Here

                            Class objectClass = object.getClass();
                            session = xmlContext.getSession(objectClass);
                            xmlDescriptor = getDescriptor(objectClass, session);
                  }
              }
                OutputStreamRecord record;
                if (isFormattedOutput()) {
                  record = new FormattedOutputStreamRecord();                 
                } else {
                  record = new OutputStreamRecord();                 
                }
                      
                record.setMarshaller(this);
                record.setOutputStream(outputStream);
           
                //if this is a simple xml root, the session and descriptor will be null
                if (!(isXMLRoot && ((XMLRoot)object).getObject() instanceof Node) && ((session == null) || !xmlContext.getDocumentPreservationPolicy(session).shouldPreserveDocument())) {
                    marshal(object, record, session, xmlDescriptor, isXMLRoot);   
                } else {
                    try {
                        Node xmlDocument = null;
                        String rootUri = null;
                        String rootLocalName = null;
                        if(isXMLRoot && session == null) {
                            xmlDocument = (Node)((XMLRoot)object).getObject();
                            rootUri = ((XMLRoot)object).getNamespaceURI();
                            rootLocalName = ((XMLRoot)object).getLocalName();
                        } else {
                            xmlDocument = objectToXMLNode(object, session, xmlDescriptor, isXMLRoot);
                        }
                        record.setSession(session);
                        if (isFragment()) {
                            if(xmlDescriptor == null){
                                record.node(xmlDocument, null, rootUri, rootLocalName );
                            }else{
                                record.node(xmlDocument, xmlDescriptor.getNamespaceResolver(), rootUri, rootLocalName );
                            }
                        } else {
                            record.startDocument(encoding, version);
                            record.node(xmlDocument, record.getNamespaceResolver(), rootUri, rootLocalName);
                            record.endDocument();
                        }
                    } catch (XMLPlatformException e) {
                        throw XMLMarshalException.marshalException(e);
                    }
                }
                record.flush();
            }else{
              OutputStreamWriter writer = new OutputStreamWriter(outputStream, encoding);
                marshal(object, writer);
                writer.flush();
            }
View Full Code Here

                }else{
                  session = xmlContext.getSession(object.getClass());
                  xmlDescriptor = getDescriptor(object.getClass(), session);
                }
           
                OutputStreamRecord record;
                if (isFormattedOutput()) {
                  record = new FormattedOutputStreamRecord();                 
                } else {
                  record = new OutputStreamRecord();                 
                }
                      
                record.setMarshaller(this);
                record.setOutputStream(outputStream);
           
                //if this is a simple xml root, the session and descriptor will be null
                if (!(isXMLRoot && ((XMLRoot)object).getObject() instanceof Node) && ((session == null) || !xmlContext.getDocumentPreservationPolicy(session).shouldPreserveDocument())) {
                    marshal(object, record, session, xmlDescriptor, isXMLRoot);   
                } else {
                    try {
                        Node xmlDocument = null;
                        if(isXMLRoot && session == null) {
                            xmlDocument = (Node)((XMLRoot)object).getObject();
                        } else {
                            xmlDocument = objectToXMLNode(object, session, xmlDescriptor, isXMLRoot);
                        }
                        record.setSession(session);
                        if (isFragment()) {
                            record.node(xmlDocument, xmlDescriptor.getNamespaceResolver());
                        } else {
                            record.startDocument(encoding, version);
                            record.node(xmlDocument, record.getNamespaceResolver());
                            record.endDocument();
                        }
                    } catch (XMLPlatformException e) {
                        throw XMLMarshalException.marshalException(e);
                    }
                }
                record.flush();
            }else{
              OutputStreamWriter writer = new OutputStreamWriter(outputStream, encoding);
                marshal(object, writer);
                writer.flush();
            }
View Full Code Here

                }else{
                  session = xmlContext.getSession(object.getClass());
                  xmlDescriptor = getDescriptor(object.getClass(), session);
                }
           
                OutputStreamRecord record;
                if (isFormattedOutput()) {
                  record = new FormattedOutputStreamRecord();                 
                } else {
                  record = new OutputStreamRecord();                 
                }
                      
                record.setMarshaller(this);
                record.setOutputStream(outputStream);
           
                //if this is a simple xml root, the session and descriptor will be null
                if (!(isXMLRoot && ((XMLRoot)object).getObject() instanceof Node) && ((session == null) || !xmlContext.getDocumentPreservationPolicy(session).shouldPreserveDocument())) {
                    marshal(object, record, session, xmlDescriptor, isXMLRoot);   
                } else {
                    try {
                        Node xmlDocument = null;
                        if(isXMLRoot && session == null) {
                            xmlDocument = (Node)((XMLRoot)object).getObject();
                        } else {
                            xmlDocument = objectToXMLNode(object, session, xmlDescriptor, isXMLRoot);
                        }
                        record.setSession(session);
                        if (isFragment()) {
                            record.node(xmlDocument, xmlDescriptor.getNamespaceResolver());
                        } else {
                            record.startDocument(encoding, version);
                            record.node(xmlDocument, record.getNamespaceResolver());
                            record.endDocument();
                        }
                    } catch (XMLPlatformException e) {
                        throw XMLMarshalException.marshalException(e);
                    }
                }
View Full Code Here

                            Class objectClass = object.getClass();
                            session = xmlContext.getSession(objectClass);
                            xmlDescriptor = getDescriptor(objectClass, session);
                  }
              }
                OutputStreamRecord record;
                if (isFormattedOutput()) {
                  record = new FormattedOutputStreamRecord();                 
                } else {
                  record = new OutputStreamRecord();                 
                }
                      
                record.setMarshaller(this);
                record.setOutputStream(outputStream);
           
                //if this is a simple xml root, the session and descriptor will be null
                if (!(isXMLRoot && ((XMLRoot)object).getObject() instanceof Node) && ((session == null) || !xmlContext.getDocumentPreservationPolicy(session).shouldPreserveDocument())) {
                    marshal(object, record, session, xmlDescriptor, isXMLRoot);   
                } else {
                    try {
                        Node xmlDocument = null;
                        if(isXMLRoot && session == null) {
                            xmlDocument = (Node)((XMLRoot)object).getObject();
                        } else {
                            xmlDocument = objectToXMLNode(object, session, xmlDescriptor, isXMLRoot);
                        }
                        record.setSession(session);
                        if (isFragment()) {                           
                            record.node(xmlDocument, xmlDescriptor.getNamespaceResolver());
                        } else {
                            record.startDocument(encoding, version);
                            record.node(xmlDocument, record.getNamespaceResolver());
                            record.endDocument();
                        }
                    } catch (XMLPlatformException e) {
                        throw XMLMarshalException.marshalException(e);
                    }
                }
                record.flush();
            }else{
              OutputStreamWriter writer = new OutputStreamWriter(outputStream, encoding);
                marshal(object, writer);
                writer.flush();
            }
View Full Code Here

                }else{
                  session = xmlContext.getSession(object.getClass());
                  xmlDescriptor = getDescriptor(object.getClass(), session);
                }
           
                OutputStreamRecord record;
                if (isFormattedOutput()) {
                  record = new FormattedOutputStreamRecord();                 
                } else {
                  record = new OutputStreamRecord();                 
                }
                      
                record.setMarshaller(this);
                record.setOutputStream(outputStream);
           
                //if this is a simple xml root, the session and descriptor will be null
                if (!(isXMLRoot && ((XMLRoot)object).getObject() instanceof Node) && ((session == null) || !xmlContext.getDocumentPreservationPolicy(session).shouldPreserveDocument())) {
                    marshal(object, record, session, xmlDescriptor, isXMLRoot);   
                } else {
                    try {
                        Node xmlDocument = null;
                        if(isXMLRoot && session == null) {
                            xmlDocument = (Node)((XMLRoot)object).getObject();
                        } else {
                            xmlDocument = objectToXMLNode(object, session, xmlDescriptor, isXMLRoot);
                        }
                        record.setSession(session);
                        if (isFragment()) {
                            record.node(xmlDocument, xmlDescriptor.getNamespaceResolver());
                        } else {
                            record.startDocument(encoding, version);
                            record.node(xmlDocument, record.getNamespaceResolver());
                            record.endDocument();
                        }
                    } catch (XMLPlatformException e) {
                        throw XMLMarshalException.marshalException(e);
                    }
                }
                record.flush();
            }else{
              OutputStreamWriter writer = new OutputStreamWriter(outputStream, encoding);
                marshal(object, writer);
                writer.flush();
            }
View Full Code Here

                }else{
                  session = xmlContext.getSession(object.getClass());
                  xmlDescriptor = getDescriptor(object.getClass(), session);
                }
           
                OutputStreamRecord record;
                if (isFormattedOutput()) {
                  record = new FormattedOutputStreamRecord();                 
                } else {
                  record = new OutputStreamRecord();                 
                }
                      
                record.setMarshaller(this);
                record.setOutputStream(outputStream);
           
                //if this is a simple xml root, the session and descriptor will be null
                if (!(isXMLRoot && ((XMLRoot)object).getObject() instanceof Node) && ((session == null) || !xmlContext.getDocumentPreservationPolicy(session).shouldPreserveDocument())) {
                    marshal(object, record, session, xmlDescriptor, isXMLRoot);   
                } else {
                    try {
                        Node xmlDocument = null;
                        if(isXMLRoot && session == null) {
                            xmlDocument = (Node)((XMLRoot)object).getObject();
                        } else {
                            xmlDocument = objectToXMLNode(object, session, xmlDescriptor, isXMLRoot);
                        }
                        record.setSession(session);
                        if (isFragment()) {
                            record.node(xmlDocument, xmlDescriptor.getNamespaceResolver());
                        } else {
                            record.startDocument(encoding, version);
                            record.node(xmlDocument, record.getNamespaceResolver());
                            record.endDocument();
                        }
                    } catch (XMLPlatformException e) {
                        throw XMLMarshalException.marshalException(e);
                    }
                }
View Full Code Here

            }
        } else {
            if(mediaType.isApplicationJSON()) {
                marshalRecord = new JSONWriterRecord(outputStream, callbackName);
            } else {
                marshalRecord = new OutputStreamRecord();
                ((OutputStreamRecord)marshalRecord).setOutputStream(outputStream);
            }
        }

        marshalStreamOrWriter(object, marshalRecord, session, xmlDescriptor, isXMLRoot);
View Full Code Here

TOP

Related Classes of org.eclipse.persistence.oxm.record.OutputStreamRecord

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.