Package com.atlassian.bamboo.migration
Class BambooStAXMappingListHelperAbstractImpl<T,I extends T>
java.lang.Object
com.atlassian.bamboo.migration.BambooStAXMappingHelperAbstractImpl<T,I>
com.atlassian.bamboo.migration.BambooStAXMappingListHelperAbstractImpl<T,I>
- Type Parameters:
T
-
- All Implemented Interfaces:
BambooStAXMappingHelper<T,
I>
- Direct Known Subclasses:
AbstractPlanMapper
,AbstractProjectDependencyMapper
,AbstractProjectMapper
,AbstractResultSummaryMapper
,AccessTokenMapper
,AceMapper
,AclMapper
,AgentAssignmentMapper
,ApplicationMapper.DirectoryMappingsMapper
,ApplicationMapper.GroupMappingsMapper
,ArtifactDefinitionMapper
,ArtifactLinkMapper
,ArtifactMapper
,ArtifactSubscriptionMapper
,AuditLogMapper
,AuthorMapper
,BandanaItemMapper
,BuildResultsWarningsSummariesMapper
,BuildResultWarningSummaryMapper
,CapabilitySetMapper
,ChainBuildMapper
,ChainStageMapper
,ChainStageResultMapper
,CommentMapper
,CommitFilesMapper
,CommitMapper
,ConsumedSubscriptionMapper
,CredentialMapper
,CrowdDeletedEntityMapper
,CrowdEntityXmlMapper
,CrowdEntityXmlMapper.SingleValuedAttributesMapper
,CustomDataMapper
,DeploymentProjectItemMapper
,DeploymentProjectMapper
,DeploymentResultMapper
,DeploymentVersionItemMapper
,DeploymentVersionLinkedJiraIssueMapper
,DeploymentVersionMapper
,DeploymentVersionStatusMapper
,DeploymentVersionVcsChangesetMapper
,DeploymentVersionVcsCommitMapper
,DirectoryMapper.PermissionsMapper
,ElasticImageConfigurationMapper
,ElasticInstanceScheduleMapper
,EnvironmentMapper
,EnvironmentRepositoryLinkMapper
,EphemeralAgentTemplateMapper
,ExternalEntityMapper
,GroupMapper.GroupAttributeMapper
,IdGeneratorMapper
,InstantMessagingServerMapper
,LabellingMapper
,LabelMapper
,LinkedJiraIssuesMapper
,LocalGroupMapper
,LocalUserMapper
,MailServerMapper
,PipelineMapper
,PlanBranchPullRequestMapper
,PlanBuildNumbersMapper
,PlanRepositoryLinkMapper
,PlanResultKeyListMapper
,PlanSpecsSourceMapper
,PlanVcsRevisionHistoryMapper
,PropertyEntryMapper
,PullRequestMapper
,QuickFilterMapper
,QuickFilterRuleMapper
,RelevantChangesetsMapper
,RemoteAgentAuthenticationMapper
,RepositoryChangesetMapper
,RepositoryDefinitionMapper
,RssDeploymentProjectPermissionsMapper
,RssProjectPermissionsMapper
,ScriptMapper
,SpecsSourceMapper
,SpecsStateMapper
,StageVariableContextMapper
,StringListMapper
,TestCaseMapper
,TestCaseResultErrorMapper
,TestCaseResultMapper
,TestClassMapper
,TestClassResultMapper
,TrustedApplicationsMapper
,TrustedKeyMapper
,UserMapper.CredentialsRecordsMapper
,UserMapper.UserAttributesMapper
,VariableBaselineItemMapper
,VariableContextBaselineMapper
,VariableContextSnapshotMapper
,VariableDefinitionMapper
,VariableSubstitutionMapper
,VcsBranchMapper
,WebhookTemplateMapper
public abstract class BambooStAXMappingListHelperAbstractImpl<T,I extends T>
extends BambooStAXMappingHelperAbstractImpl<T,I>
Skeleton implementation of StAX based export-import helper class for lists.
The XML representation of such a list is:
valueOfPropertyA
...
...
...
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.atlassian.bamboo.migration.BambooStAXMappingHelper
BambooStAXMappingHelper.None
-
Field Summary
Fields inherited from class com.atlassian.bamboo.migration.BambooStAXMappingHelperAbstractImpl
transactionOperations
-
Constructor Summary
ModifierConstructorDescriptionprotected
BambooStAXMappingListHelperAbstractImpl
(org.hibernate.SessionFactory sessionFactory, BambooStAXListImportStrategy listImportStrategy, org.springframework.transaction.support.TransactionOperations transactionOperations) protected
BambooStAXMappingListHelperAbstractImpl
(org.hibernate.SessionFactory sessionFactory, org.springframework.transaction.support.TransactionOperations transactionOperations) -
Method Summary
Modifier and TypeMethodDescriptionvoid
afterImportListItem
(@NotNull org.codehaus.staxmate.in.SMInputCursor inputCursor, @NotNull List<I> list, I object, long objectIndex, @NotNull org.hibernate.Session session) Called after parser completes parsing all child nodes in list's element node.void
beforeImportListItem
(@NotNull org.codehaus.staxmate.in.SMInputCursor inputCursor, @NotNull List<I> list, @NotNull org.hibernate.Session session) Called when parser reaches the list's element node.protected @NotNull org.codehaus.staxmate.out.SMOutputElement
createListRootElement
(@NotNull org.codehaus.staxmate.out.SMOutputElement outputElement) Creates list root nodeprotected @NotNull org.codehaus.staxmate.out.SMOutputElement
createRootElement
(@NotNull org.codehaus.staxmate.out.SMOutputElement outputElement) Creates list item nodeprotected void
eventEndElementOfListItemSaveObject
(@NotNull org.hibernate.Session session, T object, long objectIndex, long flushSize) final <E extends T>
voidexportListXml
(@NotNull org.codehaus.staxmate.out.SMOutputElement outputElement, @NotNull Iterable<E> iterable, ExportDetailsBean exportDetailsBean) Exports a collection to the XML.<E extends T>
voidexportListXml
(@NotNull org.hibernate.Session session, @NotNull org.codehaus.staxmate.out.SMOutputElement outputElement, @NotNull Iterable<E> iterable, ExportDetailsBean exportDetailsBean) Exports a collection to the XML.protected void
flushIfNeeded
(org.hibernate.Session session, long objectIndex, long flushSize) @NotNull String
@NotNull String
Returns local name of the XML parent node that will contain exported/imported object's propertiesimportListXml
(@NotNull org.codehaus.staxmate.in.SMInputCursor inputCursor) Import list from XMLimportListXml
(@NotNull org.hibernate.Session session, @NotNull org.codehaus.staxmate.in.SMInputCursor inputCursor) Import list from XMLprotected void
importListXmlInTransaction
(org.codehaus.staxmate.in.SMInputCursor inputCursor) Methods inherited from class com.atlassian.bamboo.migration.BambooStAXMappingHelperAbstractImpl
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, importXml
-
Constructor Details
-
BambooStAXMappingListHelperAbstractImpl
protected BambooStAXMappingListHelperAbstractImpl(org.hibernate.SessionFactory sessionFactory, BambooStAXListImportStrategy listImportStrategy, org.springframework.transaction.support.TransactionOperations transactionOperations) -
BambooStAXMappingListHelperAbstractImpl
protected BambooStAXMappingListHelperAbstractImpl(org.hibernate.SessionFactory sessionFactory, org.springframework.transaction.support.TransactionOperations transactionOperations)
-
-
Method Details
-
getXmlElementNodeName
-
getXmlRootNodeName
Description copied from interface:BambooStAXMappingHelper
Returns local name of the XML parent node that will contain exported/imported object's properties- Specified by:
getXmlRootNodeName
in interfaceBambooStAXMappingHelper<T,
I extends T> - Overrides:
getXmlRootNodeName
in classBambooStAXMappingHelperAbstractImpl<T,
I extends T> - Returns:
- local name of the XML parent node
-
beforeImportListItem
public void beforeImportListItem(@NotNull @NotNull org.codehaus.staxmate.in.SMInputCursor inputCursor, @NotNull @NotNull List<I> list, @NotNull @NotNull org.hibernate.Session session) throws Exception Called when parser reaches the list's element node.- Parameters:
inputCursor
- inputCursor pointing to the list's element opening nodelist
- list of elements being importedsession
- Hibernate session object- Throws:
Exception
- when something went wrong
-
afterImportListItem
public void afterImportListItem(@NotNull @NotNull org.codehaus.staxmate.in.SMInputCursor inputCursor, @NotNull @NotNull List<I> list, @NotNull I object, long objectIndex, @NotNull @NotNull org.hibernate.Session session) throws Exception Called after parser completes parsing all child nodes in list's element node.- Parameters:
inputCursor
- cursor pointing to the list's element opening nodelist
- list of elements being importedobject
- object that has been importedobjectIndex
- one-based index of the object being parsedsession
- Hibernate session object- Throws:
Exception
- when something went wrong
-
createListRootElement
@NotNull protected @NotNull org.codehaus.staxmate.out.SMOutputElement createListRootElement(@NotNull @NotNull org.codehaus.staxmate.out.SMOutputElement outputElement) throws XMLStreamException Creates list root node- Parameters:
outputElement
- parent node for list root node- Returns:
- list root node
- Throws:
XMLStreamException
- when something went wrong
-
createRootElement
@NotNull protected @NotNull org.codehaus.staxmate.out.SMOutputElement createRootElement(@NotNull @NotNull org.codehaus.staxmate.out.SMOutputElement outputElement) throws XMLStreamException Creates list item node- Overrides:
createRootElement
in classBambooStAXMappingHelperAbstractImpl<T,
I extends T> - Parameters:
outputElement
- list root node- Returns:
- list item node
- Throws:
XMLStreamException
- when something went wrong
-
exportListXml
public final <E extends T> void exportListXml(@NotNull @NotNull org.codehaus.staxmate.out.SMOutputElement outputElement, @NotNull @NotNull Iterable<E> iterable, ExportDetailsBean exportDetailsBean) throws Exception Exports a collection to the XML.- Parameters:
outputElement
- parent node for collection root nodeiterable
- collection to be exportedexportDetailsBean
-- Throws:
Exception
- when something went wrong
-
exportListXml
public <E extends T> void exportListXml(@NotNull @NotNull org.hibernate.Session session, @NotNull @NotNull org.codehaus.staxmate.out.SMOutputElement outputElement, @NotNull @NotNull Iterable<E> iterable, ExportDetailsBean exportDetailsBean) throws Exception Exports a collection to the XML. If collection is empty collection root not will not be created.- Parameters:
session
- Hibernate session objectoutputElement
- parent node for collection root nodeiterable
- collection to be exportedexportDetailsBean
-- Throws:
Exception
- when something went wrong
-
importListXml
@NotNull public final @NotNull List<I> importListXml(@NotNull @NotNull org.codehaus.staxmate.in.SMInputCursor inputCursor) throws Exception Import list from XML- Parameters:
inputCursor
- parent node for list root node- Returns:
- list of the imported elements
- Throws:
Exception
- when something went wrong
-
importListXml
@NotNull public @NotNull List<I> importListXml(@NotNull @NotNull org.hibernate.Session session, @NotNull @NotNull org.codehaus.staxmate.in.SMInputCursor inputCursor) throws Exception Import list from XML- Parameters:
session
- Hibernate session objectinputCursor
- parent node for list root node- Returns:
- list of the imported elements
- Throws:
Exception
- when something went wrong
-
importListXmlInTransaction
protected void importListXmlInTransaction(org.codehaus.staxmate.in.SMInputCursor inputCursor) -
eventEndElementOfListItemSaveObject
protected void eventEndElementOfListItemSaveObject(@NotNull @NotNull org.hibernate.Session session, @NotNull T object, long objectIndex, long flushSize) throws org.hibernate.HibernateException - Parameters:
session
- Hibernate session objectobject
- object to be savedobjectIndex
- one-based index of the object in the list of object being readflushSize
- number of objects to be saved before session.flush() is executed- Throws:
SQLException
- when something went wrongorg.hibernate.HibernateException
- when something went wrong
-
flushIfNeeded
protected void flushIfNeeded(org.hibernate.Session session, long objectIndex, long flushSize) throws org.hibernate.HibernateException - Throws:
org.hibernate.HibernateException
-