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, AbstractResultSummaryMapper, AceMapper, AclMapper, ArtifactDefinitionMapper, ArtifactLinkMapper, ArtifactMapper, ArtifactSubscriptionMapper, AuditLogMapper, AuthorMapper, BandanaItemMapper, BuildRequirementMapper, CapabilitySetMapper, ChainBuildMapper, ChainStageMapper, CommentMapper, CommitFilesMapper, CommitMapper, ConsumedSubscriptionMapper, CustomBuildDataMapper, ElasticImageConfigurationMapper, ElasticInstanceScheduleMapper, ExternalEntityMapper, GroupMapper, GroupMemberMapper, InstantMessagingServerMapper, JiraIssuesMapper, LabellingMapper, LabelMapper, LegacyJiraServerMapper, LinkedJiraIssuesMapper, LocalGroupMapper, LocalUserMapper, LoginInformationMapper, MailServerMapper, PipelineMapper, PlanRepositoryLinkMapper, PlanVcsRevisionHistoryMapper, PropertyEntryMapper, RelevantChangesetsMapper, RemoteAgentAuthenticationMapper, RepositoryChangesetMapper, RepositoryDefinitionMapper, TestCaseMapper, TestCaseResultErrorMapper, TestCaseResultMapper, TestClassMapper, TestClassResultMapper, TrustedApplicationsMapper, UserMapper, VariableContextSnapshotMapper, VariableDefinitionMapper, VariableSubstitutionMapper, VcsBranchMapper

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)
           
protected BambooStAXMappingListHelperAbstractImpl(net.sf.hibernate.SessionFactory sessionFactory, BambooStAXListImportStrategy listImportStrategy)
           
 
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)
           
<E extends T>
void
exportListXml(net.sf.hibernate.Session session, org.codehaus.staxmate.out.SMOutputElement outputElement, java.lang.Iterable<E> iterable, ExportDetailsBean exportDetailsBean)
          Exports a collection to the XML.
<E extends T>
void
exportListXml(org.codehaus.staxmate.out.SMOutputElement outputElement, java.lang.Iterable<E> iterable, ExportDetailsBean exportDetailsBean)
          Exports a collection to the XML.
protected  void flushIfNeeded(net.sf.hibernate.Session session, long objectIndex, long flushSize)
           
 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
 
Methods inherited from class com.atlassian.bamboo.migration.BambooStAXMappingHelperAbstractImpl
commitClearSession, commitSession, createItemInstance, exportProperties, exportXml, exportXml, getSession, getSessionFactory, importProperties, importXml, importXml, isShouldExport, 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,
                                                  @NotNull
                                                  BambooStAXListImportStrategy listImportStrategy)

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 <E extends T> void exportListXml(@NotNull
                                              org.codehaus.staxmate.out.SMOutputElement outputElement,
                                              @NotNull
                                              java.lang.Iterable<E> iterable,
                                              ExportDetailsBean exportDetailsBean)
                         throws java.lang.Exception
Exports a collection to the XML.

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

exportListXml

public <E extends T> void exportListXml(@NotNull
                                        net.sf.hibernate.Session session,
                                        @NotNull
                                        org.codehaus.staxmate.out.SMOutputElement outputElement,
                                        @NotNull
                                        java.lang.Iterable<E> iterable,
                                        ExportDetailsBean exportDetailsBean)
                   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
exportDetailsBean -
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

flushIfNeeded

protected void flushIfNeeded(net.sf.hibernate.Session session,
                             long objectIndex,
                             long flushSize)
                      throws net.sf.hibernate.HibernateException
Throws:
net.sf.hibernate.HibernateException

getXmlElementNodeName

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

Returns:
local name of list element node


Copyright © 2012 Atlassian. All Rights Reserved.