Class ProfileBinding


  • public final class ProfileBinding
    extends java.lang.Object
    Code for reading and writing Profile objects as XML.
    Author:
    Kim Rutherford, Richard Smith
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void marshal​(Profile profile, ObjectStore os, javax.xml.stream.XMLStreamWriter writer, boolean writeUserAndPassword, boolean writeQueries, boolean writeTemplates, boolean writeBags, boolean writeTags, boolean onlyConfigTags, int version, java.util.Map<java.lang.String,​java.util.List<FieldDescriptor>> classKeys)
      Convert a Profile to XML and write XML to given writer.
      static void marshal​(Profile profile, ObjectStore os, javax.xml.stream.XMLStreamWriter writer, int version, java.util.Map<java.lang.String,​java.util.List<FieldDescriptor>> classkeys)
      Convert a Profile to XML and write XML to given writer.
      static Profile unmarshal​(java.io.Reader reader, ProfileManager profileManager, java.lang.String username, java.lang.String password, java.util.Set<Tag> tags, ObjectStoreWriter osw, int version)
      Read a Profile from an XML stream Reader.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • marshal

        public static void marshal​(Profile profile,
                                   ObjectStore os,
                                   javax.xml.stream.XMLStreamWriter writer,
                                   int version,
                                   java.util.Map<java.lang.String,​java.util.List<FieldDescriptor>> classkeys)
        Convert a Profile to XML and write XML to given writer.
        Parameters:
        profile - the UserProfile
        os - the ObjectStore to use when looking up the ids of objects in bags
        writer - the XMLStreamWriter to write to
        version - the version number of the xml format, an attribute of the profile manager
        classkeys - the classKey
      • marshal

        public static void marshal​(Profile profile,
                                   ObjectStore os,
                                   javax.xml.stream.XMLStreamWriter writer,
                                   boolean writeUserAndPassword,
                                   boolean writeQueries,
                                   boolean writeTemplates,
                                   boolean writeBags,
                                   boolean writeTags,
                                   boolean onlyConfigTags,
                                   int version,
                                   java.util.Map<java.lang.String,​java.util.List<FieldDescriptor>> classKeys)
        Convert a Profile to XML and write XML to given writer.
        Parameters:
        profile - the UserProfile
        os - the ObjectStore to use when looking up the ids of objects in bags
        writer - the XMLStreamWriter to write to
        writeUserAndPassword - write username and password
        writeQueries - save saved queries
        writeTemplates - write saved templates
        writeBags - write saved bags
        writeTags - write saved tags
        onlyConfigTags - if true, only save tags that contain a ':'
        classKeys - has to be setted if you save bags
        version - the version number of the xml format, an attribute of the profile manager
      • unmarshal

        public static Profile unmarshal​(java.io.Reader reader,
                                        ProfileManager profileManager,
                                        java.lang.String username,
                                        java.lang.String password,
                                        java.util.Set<Tag> tags,
                                        ObjectStoreWriter osw,
                                        int version)
        Read a Profile from an XML stream Reader. Note that Tags from the XML are stored immediately using the ProfileManager.
        Parameters:
        reader - contains the Profile XML
        profileManager - the ProfileManager to pass to the Profile constructor
        username - default username - used if there is no username in the XML
        password - default password
        tags - a set to populate with user tags
        osw - an ObjectStoreWriter for the production database, to write bags
        version - the version of the XML format, an attribute on the ProfileManager
        Returns:
        the new Profile