com.atlassian.bamboo.migration.stream
Class AbstractProjectMapper

java.lang.Object
  extended by com.atlassian.bamboo.migration.BambooStAXMappingHelperAbstractImpl<T>
      extended by com.atlassian.bamboo.migration.BambooStAXMappingListHelperAbstractImpl<Project>
          extended by com.atlassian.bamboo.migration.stream.AbstractProjectMapper
All Implemented Interfaces:
BambooRootMapper, BambooStAXMappingHelper<Project>, BambooStAXRootMapper
Direct Known Subclasses:
ProjectChainMapper, ProjectMapper

public abstract class AbstractProjectMapper
extends BambooStAXMappingListHelperAbstractImpl<Project>
implements BambooStAXRootMapper


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.atlassian.bamboo.migration.BambooStAXMappingHelper
BambooStAXMappingHelper.None
 
Field Summary
protected  AuthorDao authorDao
           
protected  java.util.Map<java.lang.Long,ExtendedAuthor> authorMap
           
protected  LabelDao labelDao
           
protected  java.util.Map<java.lang.Long,Label> labelMap
           
protected  PlanDao planDao
           
protected  PlanRepositoryLinkDao planRepositoryLinkDao
           
protected  PlanVcsRevisionHistoryStandaloneDao planVcsRevisionHistoryDao
           
protected  ProjectDao projectDao
           
protected  RepositoryDefinitionDao repositoryDefinitionDao
           
protected  net.sf.hibernate.SessionFactory sessionFactory
           
 
Constructor Summary
AbstractProjectMapper(net.sf.hibernate.SessionFactory sessionFactory, BambooStAXListImportStrategy listImportStrategy, ProjectDao projectDao, AuthorDao authorDao, LabelDao labelDao, PlanDao planDao, PlanVcsRevisionHistoryStandaloneDao planVcsRevisionHistoryDao, RepositoryDefinitionDao repositoryDefinitionDao, PlanRepositoryLinkDao planRepositoryLinkDao)
           
 
Method Summary
protected  Project createItemInstance(org.codehaus.staxmate.in.SMInputCursor inputCursor)
          Creates empty instance of the imported object
 void exportData(org.codehaus.staxmate.out.SMOutputElement outputElement, ExportDetailsBean exportDetailsBean)
          Perform data export
protected  void exportProperties(org.codehaus.staxmate.out.SMOutputElement outputElement, Project project, net.sf.hibernate.Session session, ExportDetailsBean exportDetailsBean)
          Export object properties.
 java.lang.String getXmlElementNodeName()
          Returns local name of list element node
 java.lang.String getXmlRootNodeName()
          Returns local name of the XML parent node that will contain exported/imported object's properties
 void importData(org.codehaus.staxmate.in.SMInputCursor inputCursor)
          Perform data import
protected  void importProperties(Project project, org.codehaus.staxmate.in.SMInputCursor inputCursor, net.sf.hibernate.Session session)
          Import properties to the object.
protected  void initialiseAuthorMap()
           
protected  void initialiseLabelMap()
           
 
Methods inherited from class com.atlassian.bamboo.migration.BambooStAXMappingListHelperAbstractImpl
afterImportListItem, beforeImportListItem, createListRootElement, createRootElement, eventEndElementOfListItemSaveObject, exportListXml, exportListXml, flushIfNeeded, importListXml, importListXml
 
Methods inherited from class com.atlassian.bamboo.migration.BambooStAXMappingHelperAbstractImpl
commitClearSession, commitSession, exportXml, exportXml, getSession, getSessionFactory, 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.BambooRootMapper
isShouldExport
 
Methods inherited from interface com.atlassian.bamboo.migration.BambooStAXMappingHelper
exportXml, importXml
 

Field Detail

authorMap

protected java.util.Map<java.lang.Long,ExtendedAuthor> authorMap

labelMap

protected java.util.Map<java.lang.Long,Label> labelMap

planDao

protected final PlanDao planDao

projectDao

protected final ProjectDao projectDao

sessionFactory

protected final net.sf.hibernate.SessionFactory sessionFactory

authorDao

protected final AuthorDao authorDao

labelDao

protected final LabelDao labelDao

planVcsRevisionHistoryDao

protected final PlanVcsRevisionHistoryStandaloneDao planVcsRevisionHistoryDao

repositoryDefinitionDao

protected final RepositoryDefinitionDao repositoryDefinitionDao

planRepositoryLinkDao

protected final PlanRepositoryLinkDao planRepositoryLinkDao
Constructor Detail

AbstractProjectMapper

public AbstractProjectMapper(net.sf.hibernate.SessionFactory sessionFactory,
                             @NotNull
                             BambooStAXListImportStrategy listImportStrategy,
                             @NotNull
                             ProjectDao projectDao,
                             AuthorDao authorDao,
                             LabelDao labelDao,
                             @NotNull
                             PlanDao planDao,
                             PlanVcsRevisionHistoryStandaloneDao planVcsRevisionHistoryDao,
                             @NotNull
                             RepositoryDefinitionDao repositoryDefinitionDao,
                             @NotNull
                             PlanRepositoryLinkDao planRepositoryLinkDao)
Method Detail

initialiseAuthorMap

protected void initialiseAuthorMap()

initialiseLabelMap

protected void initialiseLabelMap()

getXmlRootNodeName

@NotNull
public java.lang.String 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 interface BambooStAXMappingHelper<Project>
Specified by:
getXmlRootNodeName in interface BambooStAXRootMapper
Overrides:
getXmlRootNodeName in class BambooStAXMappingListHelperAbstractImpl<Project>
Returns:
local name of the XML parent node

getXmlElementNodeName

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

Overrides:
getXmlElementNodeName in class BambooStAXMappingListHelperAbstractImpl<Project>
Returns:
local name of list element node

importProperties

protected void importProperties(@NotNull
                                Project project,
                                @NotNull
                                org.codehaus.staxmate.in.SMInputCursor inputCursor,
                                @NotNull
                                net.sf.hibernate.Session session)
                         throws java.lang.Exception
Description copied from class: BambooStAXMappingHelperAbstractImpl
Import properties to the object. Due to nature of XML parsing this method is called for each child node in the node that was passed to importXml method

Overrides:
importProperties in class BambooStAXMappingHelperAbstractImpl<Project>
Parameters:
project - object being imported
inputCursor - input cursor pointing to the child node of node that was passed to importXml method
session - Hibernate session object
Throws:
java.lang.Exception - when something went wrong

exportProperties

protected void exportProperties(@NotNull
                                org.codehaus.staxmate.out.SMOutputElement outputElement,
                                @NotNull
                                Project project,
                                @NotNull
                                net.sf.hibernate.Session session,
                                ExportDetailsBean exportDetailsBean)
                         throws java.lang.Exception
Description copied from class: BambooStAXMappingHelperAbstractImpl
Export object properties. Implementing classed should override this method to export custom properties.

Overrides:
exportProperties in class BambooStAXMappingHelperAbstractImpl<Project>
Parameters:
outputElement - the parent node
project - object being exported
session - Hibernate session object
Throws:
java.lang.Exception - when something went wrong

createItemInstance

@NotNull
protected Project createItemInstance(org.codehaus.staxmate.in.SMInputCursor inputCursor)
                              throws java.lang.Exception
Description copied from class: BambooStAXMappingHelperAbstractImpl
Creates empty instance of the imported object

Specified by:
createItemInstance in class BambooStAXMappingHelperAbstractImpl<Project>
Parameters:
inputCursor - input cursor that points to the parent node containing object properties
Returns:
empty instance of the imported object
Throws:
javax.xml.stream.XMLStreamException - when something went wrong
java.lang.Exception

exportData

public void exportData(@NotNull
                       org.codehaus.staxmate.out.SMOutputElement outputElement,
                       ExportDetailsBean exportDetailsBean)
                throws java.lang.Exception
Description copied from interface: BambooStAXRootMapper
Perform data export

Specified by:
exportData in interface BambooStAXRootMapper
Parameters:
outputElement - parent node for mapper's root node, usually root element of the XML file
Throws:
java.lang.Exception - when something went wrong

importData

public void importData(@NotNull
                       org.codehaus.staxmate.in.SMInputCursor inputCursor)
                throws java.lang.Exception
Description copied from interface: BambooStAXRootMapper
Perform data import

Specified by:
importData in interface BambooStAXRootMapper
Parameters:
inputCursor - mapper's root node, usually child of root element of the XML file
Throws:
java.lang.Exception - when something went wrong


Copyright © 2013 Atlassian Software Systems Pty Ltd. All Rights Reserved.