com.atlassian.crowd.migration.legacy
Class XmlMapper

java.lang.Object
  extended by com.atlassian.crowd.migration.GenericMapper
      extended by com.atlassian.crowd.migration.legacy.XmlMapper
Direct Known Subclasses:
AliasMapper, ApplicationMapper, CrowdPropertiesMapper, DirectoryMapper, GroupMapper, MembershipMapper, PropertyMapper, UserMapper

public class XmlMapper
extends GenericMapper

A generic mapper that contains helper methods and attributes to map domain objects to database objects and vice-versa.


Field Summary
protected static java.util.Set<DirectoryType> FULL_BACKUP_DIRECTORY_TYPES
          Types of directories for which users, groups and memberships will need to be backed up
static java.lang.String GENERIC_XML_ACTIVE
           
static java.lang.String GENERIC_XML_ATTRIBUTE
           
static java.lang.String GENERIC_XML_ATTRIBUTE_NAME
           
static java.lang.String GENERIC_XML_ATTRIBUTE_VALUE
           
static java.lang.String GENERIC_XML_ATTRIBUTES
           
static java.lang.String GENERIC_XML_CREATED_DATE
           
static java.lang.String GENERIC_XML_ID
           
static java.lang.String GENERIC_XML_NAME
           
static java.lang.String GENERIC_XML_UPDATED_DATE
           
static java.lang.String LEGACY_GENERIC_XML_ATTRIBUTE_ID
           
static java.lang.String LEGACY_GENERIC_XML_ATTRIBUTE_KEY
           
static java.lang.String LEGACY_GENERIC_XML_ATTRIBUTE_VALUE
           
static java.lang.String LEGACY_GENERIC_XML_ATTRIBUTE_VALUES
           
static java.lang.String LEGACY_GENERIC_XML_CONCEPTION
           
static java.lang.String LEGACY_GENERIC_XML_LASTMODIFIED
           
 
Fields inherited from class com.atlassian.crowd.migration.GenericMapper
DATABASE_DATE_FORMAT, logger, PLUGIN_KEY_PREFIX, XML_DATE_FORMAT
 
Constructor Summary
XmlMapper(org.hibernate.SessionFactory sessionFactory, BatchProcessor batchProcessor)
           
 
Method Summary
protected  void exportInternalEntity(InternalEntity entity, org.dom4j.Element element)
          Exports an internal entity to an XML element.
protected  void exportSingleValuedAttributes(Attributes entity, org.dom4j.Element element)
          Exports Map to an XML element.
protected  java.util.List<Directory> findAllExportableDirectories()
          Finds all directories that have user/group/membership data that need to be exported (ie.
 DirectoryManager getDirectoryManager()
           
protected  InternalEntityTemplate getInternalEntityTemplateFromXml(org.dom4j.Element element)
          Constructs an InternalEntityTemplate from an XML element.
protected  java.util.Map<java.lang.String,java.lang.String> getSingleValuedAttributesMapFromXml(org.dom4j.Element element)
          Constructs an Map of attributes from an XML element.
 void setDirectoryManager(DirectoryManager directoryManager)
           
 
Methods inherited from class com.atlassian.crowd.migration.GenericMapper
addEntities, addEntity, addEntityViaMerge, addEntityViaSave, getAttributeValue, getDateAsFormattedString, getDateFromDatabase, getDateFromXml, getDirectoryTypeFromLegacyCode, getNameFromLegacyCode, getOperationTypeFromLegacyPermissionName, getSessionFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GENERIC_XML_ID

public static final java.lang.String GENERIC_XML_ID
See Also:
Constant Field Values

GENERIC_XML_NAME

public static final java.lang.String GENERIC_XML_NAME
See Also:
Constant Field Values

GENERIC_XML_CREATED_DATE

public static final java.lang.String GENERIC_XML_CREATED_DATE
See Also:
Constant Field Values

GENERIC_XML_UPDATED_DATE

public static final java.lang.String GENERIC_XML_UPDATED_DATE
See Also:
Constant Field Values

GENERIC_XML_ACTIVE

public static final java.lang.String GENERIC_XML_ACTIVE
See Also:
Constant Field Values

GENERIC_XML_ATTRIBUTES

public static final java.lang.String GENERIC_XML_ATTRIBUTES
See Also:
Constant Field Values

GENERIC_XML_ATTRIBUTE

public static final java.lang.String GENERIC_XML_ATTRIBUTE
See Also:
Constant Field Values

GENERIC_XML_ATTRIBUTE_NAME

public static final java.lang.String GENERIC_XML_ATTRIBUTE_NAME
See Also:
Constant Field Values

GENERIC_XML_ATTRIBUTE_VALUE

public static final java.lang.String GENERIC_XML_ATTRIBUTE_VALUE
See Also:
Constant Field Values

LEGACY_GENERIC_XML_CONCEPTION

public static final java.lang.String LEGACY_GENERIC_XML_CONCEPTION
See Also:
Constant Field Values

LEGACY_GENERIC_XML_LASTMODIFIED

public static final java.lang.String LEGACY_GENERIC_XML_LASTMODIFIED
See Also:
Constant Field Values

LEGACY_GENERIC_XML_ATTRIBUTE_ID

public static final java.lang.String LEGACY_GENERIC_XML_ATTRIBUTE_ID
See Also:
Constant Field Values

LEGACY_GENERIC_XML_ATTRIBUTE_VALUES

public static final java.lang.String LEGACY_GENERIC_XML_ATTRIBUTE_VALUES
See Also:
Constant Field Values

LEGACY_GENERIC_XML_ATTRIBUTE_VALUE

public static final java.lang.String LEGACY_GENERIC_XML_ATTRIBUTE_VALUE
See Also:
Constant Field Values

LEGACY_GENERIC_XML_ATTRIBUTE_KEY

public static final java.lang.String LEGACY_GENERIC_XML_ATTRIBUTE_KEY
See Also:
Constant Field Values

FULL_BACKUP_DIRECTORY_TYPES

protected static final java.util.Set<DirectoryType> FULL_BACKUP_DIRECTORY_TYPES
Types of directories for which users, groups and memberships will need to be backed up

Constructor Detail

XmlMapper

public XmlMapper(org.hibernate.SessionFactory sessionFactory,
                 BatchProcessor batchProcessor)
Method Detail

exportInternalEntity

protected void exportInternalEntity(InternalEntity entity,
                                    org.dom4j.Element element)
Exports an internal entity to an XML element.

This exports: id, name, createdDate, updatedDate and active.

Parameters:
entity - entity to export.
element - XML element to export to.

exportSingleValuedAttributes

protected void exportSingleValuedAttributes(Attributes entity,
                                            org.dom4j.Element element)
Exports Map to an XML element.

Only use this for entities with simple attributes (Directory, Application) and not complex attributes (User, Group).

Parameters:
entity - entity with single valued attributes.
element - XML element to export to.

getInternalEntityTemplateFromXml

protected InternalEntityTemplate getInternalEntityTemplateFromXml(org.dom4j.Element element)
Constructs an InternalEntityTemplate from an XML element.

This imports: id, name, createdDate, updatedDate and active.

Parameters:
element - XML element to import from.
Returns:
InternalEntityTemplate holding the values.

getSingleValuedAttributesMapFromXml

protected java.util.Map<java.lang.String,java.lang.String> getSingleValuedAttributesMapFromXml(org.dom4j.Element element)
Constructs an Map of attributes from an XML element.

This imports attributes with single values.

Parameters:
element - XML element to import from.
Returns:
Map holding the attributes.

findAllExportableDirectories

protected java.util.List<Directory> findAllExportableDirectories()
Finds all directories that have user/group/membership data that need to be exported (ie. Internal + Delegating).

Returns:
list of directories that require exporting internal data.

getDirectoryManager

public DirectoryManager getDirectoryManager()

setDirectoryManager

public void setDirectoryManager(DirectoryManager directoryManager)


Copyright © 2012 Atlassian. All Rights Reserved.