org.intermine.web
Class ProfileBinding

java.lang.Object
  extended by org.intermine.web.ProfileBinding

public final class ProfileBinding
extends java.lang.Object

Code for reading and writing Profile objects as XML.


Method Summary
protected static void getIdsFromObject(InterMineObject object, Model model, java.util.Set<java.lang.Integer> idsToSerialise)
          For the given object, add its ID and all IDs of all objects in any of its primary keys to idsToSerialise.
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)
          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)
          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<org.intermine.model.userprofile.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)
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

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)
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 ':'
version - the version number of the xml format, an attribute of the profile manager

getIdsFromObject

protected static void getIdsFromObject(InterMineObject object,
                                       Model model,
                                       java.util.Set<java.lang.Integer> idsToSerialise)
For the given object, add its ID and all IDs of all objects in any of its primary keys to idsToSerialise.

Parameters:
object - the InterMineObject to add
model - the Model to use for looking up ClassDescriptors
idsToSerialise - object ids are added to this Set

unmarshal

public static Profile unmarshal(java.io.Reader reader,
                                ProfileManager profileManager,
                                java.lang.String username,
                                java.lang.String password,
                                java.util.Set<org.intermine.model.userprofile.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