com.atlassian.bamboo.migration
Class BambooStAXMappingListHelperAbstractImpl<T>

java.lang.Object
  extended by com.atlassian.bamboo.migration.BambooStAXMappingHelperAbstractImpl<T>
      extended by com.atlassian.bamboo.migration.BambooStAXMappingListHelperAbstractImpl<T>
Type Parameters:
T -
All Implemented Interfaces:
BambooStAXMappingHelper<T>
Direct Known Subclasses:
AbstractPlanMapper, AbstractProjectDependencyMapper, AbstractProjectMapper, AceMapper, AclMapper, ArtifactMapper, AuthorMapper, BandanaItemMapper, BuildRequirementMapper, BuildResultSummaryMapper, CapabilitySetMapper, ChainBuildMapper, ChainResultMapper, ChainStageMapper, CommentMapper, CommitFilesMapper, CommitMapper, CustomBuildDataMapper, ElasticImageConfigurationMapper, ElasticInstanceScheduleMapper, GroupMapper, GroupMemberMapper, InstantMessagingServerMapper, JiraIssuesMapper, JiraServerMapper, LabellingMapper, LabelMapper, LinkedJiraIssuesMapper, LoginInformationMapper, PipelineMapper, TestCaseMapper, TestCaseResultErrorMapper, TestCaseResultMapper, TestClassMapper, TestClassResultMapper, UserMapper

public abstract class BambooStAXMappingListHelperAbstractImpl<T>
extends BambooStAXMappingHelperAbstractImpl<T>

Skeleton implementation of StAX based export-import helper class for lists. The XML representation of such a list is: valueOfPropertyA ... ... ...


Constructor Summary
protected BambooStAXMappingListHelperAbstractImpl(net.sf.hibernate.SessionFactory sessionFactory)
           
 
Method Summary
 void afterImportListItem(org.codehaus.staxmate.in.SMInputCursor inputCursor, java.util.List<T> list, T object, long objectIndex, net.sf.hibernate.Session session)
          Called after parser completes parsing all child nodes in list's element node.
 void beforeImportListItem(org.codehaus.staxmate.in.SMInputCursor inputCursor, java.util.List<T> list, net.sf.hibernate.Session session)
          Called when parser reaches the list's element node.
protected  org.codehaus.staxmate.out.SMOutputElement createListRootElement(org.codehaus.staxmate.out.SMOutputElement outputElement)
          Creates list root node
protected  org.codehaus.staxmate.out.SMOutputElement createRootElement(org.codehaus.staxmate.out.SMOutputElement outputElement)
          Creates list item node
protected  void eventEndElementOfListItemSaveObject(net.sf.hibernate.Session session, T object, long objectIndex, long flushSize)
           
 void exportListXml(net.sf.hibernate.Session session, org.codehaus.staxmate.out.SMOutputElement outputElement, java.lang.Iterable<T> iterable)
          Exports a collection to the XML.
 void exportListXml(org.codehaus.staxmate.out.SMOutputElement outputElement, java.lang.Iterable<T> iterable)
          Exports a collection to the XML.
 java.lang.String getXmlElementNodeName()
          Returns local name of list element node
 java.util.List<T> importListXml(net.sf.hibernate.Session session, org.codehaus.staxmate.in.SMInputCursor inputCursor)
          Import list from XML
 java.util.List<T> importListXml(org.codehaus.staxmate.in.SMInputCursor inputCursor)
          Import list from XML
 void setListImportStrategy(BambooStAXListImportStrategy listImportStrategy)
           
 
Methods inherited from class com.atlassian.bamboo.migration.BambooStAXMappingHelperAbstractImpl
commitClearSession, commitSession, createItemInstance, exportProperties, exportXml, exportXml, getSession, getSessionFactory, importProperties, importXml, importXml, saveBambooObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.atlassian.bamboo.migration.BambooStAXMappingHelper
exportXml, getXmlRootNodeName, importXml
 

Constructor Detail

BambooStAXMappingListHelperAbstractImpl

protected BambooStAXMappingListHelperAbstractImpl(net.sf.hibernate.SessionFactory sessionFactory)
Method Detail

beforeImportListItem

public void beforeImportListItem(@NotNull
                                 org.codehaus.staxmate.in.SMInputCursor inputCursor,
                                 @NotNull
                                 java.util.List<T> list,
                                 @NotNull
                                 net.sf.hibernate.Session session)
                          throws java.lang.Exception
Called when parser reaches the list's element node.

Parameters:
inputCursor - inputCursor pointing to the list's element opening node
list - list of elements being imported
session - Hibernate session object
Throws:
java.lang.Exception - when something went wrong

afterImportListItem

public void afterImportListItem(@NotNull
                                org.codehaus.staxmate.in.SMInputCursor inputCursor,
                                @NotNull
                                java.util.List<T> list,
                                @NotNull
                                T object,
                                long objectIndex,
                                @NotNull
                                net.sf.hibernate.Session session)
                         throws java.lang.Exception
Called after parser completes parsing all child nodes in list's element node.

Parameters:
inputCursor - cursor pointing to the list's element opening node
list - list of elements being imported
object - object that has been imported
objectIndex - one-based index of the object being parsed
session - Hibernate session object
Throws:
java.lang.Exception - when something went wrong

createListRootElement

@NotNull
protected org.codehaus.staxmate.out.SMOutputElement createListRootElement(@NotNull
                                                                                  org.codehaus.staxmate.out.SMOutputElement outputElement)
                                                                   throws javax.xml.stream.XMLStreamException
Creates list root node

Parameters:
outputElement - parent node for list root node
Returns:
list root node
Throws:
javax.xml.stream.XMLStreamException - when something went wrong

createRootElement

@NotNull
protected org.codehaus.staxmate.out.SMOutputElement createRootElement(@NotNull
                                                                              org.codehaus.staxmate.out.SMOutputElement outputElement)
                                                               throws javax.xml.stream.XMLStreamException
Creates list item node

Overrides:
createRootElement in class BambooStAXMappingHelperAbstractImpl<T>
Parameters:
outputElement - list root node
Returns:
list item node
Throws:
javax.xml.stream.XMLStreamException - when something went wrong

exportListXml

public final void exportListXml(@NotNull
                                org.codehaus.staxmate.out.SMOutputElement outputElement,
                                @NotNull
                                java.lang.Iterable<T> iterable)
                         throws java.lang.Exception
Exports a collection to the XML.

Parameters:
outputElement - parent node for collection root node
iterable - collection to be exported
Throws:
java.lang.Exception - when something went wrong

exportListXml

public void exportListXml(@NotNull
                          net.sf.hibernate.Session session,
                          @NotNull
                          org.codehaus.staxmate.out.SMOutputElement outputElement,
                          @NotNull
                          java.lang.Iterable<T> iterable)
                   throws java.lang.Exception
Exports a collection to the XML. If collection is empty collection root not will not be created.

Parameters:
session - Hibernate session object
outputElement - parent node for collection root node
iterable - collection to be exported
Throws:
java.lang.Exception - when something went wrong

importListXml

@NotNull
public final java.util.List<T> importListXml(@NotNull
                                                     org.codehaus.staxmate.in.SMInputCursor inputCursor)
                                      throws java.lang.Exception
Import list from XML

Parameters:
inputCursor - parent node for list root node
Returns:
list of the imported elements
Throws:
java.lang.Exception - when something went wrong

importListXml

@NotNull
public java.util.List<T> importListXml(@NotNull
                                               net.sf.hibernate.Session session,
                                               @NotNull
                                               org.codehaus.staxmate.in.SMInputCursor inputCursor)
                                throws java.lang.Exception
Import list from XML

Parameters:
session - Hibernate session object
inputCursor - parent node for list root node
Returns:
list of the imported elements
Throws:
java.lang.Exception - when something went wrong

eventEndElementOfListItemSaveObject

protected void eventEndElementOfListItemSaveObject(@NotNull
                                                   net.sf.hibernate.Session session,
                                                   @NotNull
                                                   T object,
                                                   long objectIndex,
                                                   long flushSize)
                                            throws net.sf.hibernate.HibernateException,
                                                   java.sql.SQLException
Parameters:
session - Hibernate session object
object - object to be saved
objectIndex - one-based index of the object in the list of object being read
flushSize - number of objects to be saved before session.flush() is executed
Throws:
java.sql.SQLException - when something went wrong
net.sf.hibernate.HibernateException - when something went wrong

setListImportStrategy

public void setListImportStrategy(@NotNull
                                  BambooStAXListImportStrategy listImportStrategy)

getXmlElementNodeName

@NotNull
public java.lang.String getXmlElementNodeName()
Returns local name of list element node

Returns:
local name of list element node


Copyright © 2010 Atlassian. All Rights Reserved.