Create an XML file describing columns to import and export

About this task

For each entity that you want to export and import, create an XML file that describes the columns to export and import.

Procedure

  1. Create a new XML file that describes the fields to export from and import into the entity. Name the file EntityNameFlow.xml and save it in configuration > config > resources > exportimport in Studio.

    Use the CPLocationFlow.xml and CPBuildingFlow.xml files as a model for creating additional EntityInfo XML files.

  2. Add the following root element to the file:
    <EntityInfo 
      EntityTypeName="entity.EntityName" 
      ParentEntityTypeName="entity.parentEntityName" 
      ParentEntityColumnPath="EntityName.ID">

    Attribute

    Required?

    Description

    EntityTypeName

    Required

    The name of the entity preceded by:

      entity.

    ParentEntityTypeName

    Optional

    If the parent entity is also to be imported and exported, the name of the parent entity preceded by:

      entity.

    ParentEntityColumnPath

    Optional

    The path that identifies the unique ID column of the parent entity, if a parent entity is specified.

  3. Within the EntityInfo element, add a collection of ColumnInfo child elements. Each ColumnInfo element specifies one column to be exported to and imported from the spreadsheet. The order of the ColumnInfo elements determines the order of the columns in the exported spreadsheet.
    <ColumnInfo 
      ColumnType="pathTypeName"
      ExcludeFromTemplate="true|false"
      FlagsAction="true|false"
      FlagsEntityId="true|false"
      Header="displayKeyPath"
      id="columnName"
      Locked="true|false"
      Path="beanPathToColumnValue"
      RequiredForImport="true|false">

    Attribute

    Required?

    Description

    ColumnType

    Optional

    The full path type name of the column’s data value. If the column type cannot be handled by one of the predefined data column resolvers, you must define a new data column resolver for each such type. Then adjust the ColumnDataResolverFactory class to select the new type when appropriate. Default: String.

    ExcludeFromTemplate

    Optional

    Whether to exclude the column when exporting a template. Default: false.

    FlagsAction

    Optional

    Whether the column specifies the action for the spreadsheet row. Only one column can have this attribute set to true, and this is the Action column, typically exported as the first column in the spreadsheet. All other attributes except Header are ignored. Default: false.

    FlagsEntityId

    Optional

    Whether the column uniquely identifies the entity. Default: false.

    Header

    Required

    The display key path that contains the string that is output as the column header. Using a display key enables the column headers to be localized. Specify the Header value for the Action column as Export.Action.

    PolicyCenter writes the column display keys under Export > Entity, though a display key for that name may already exist at some other location. You can quickly look at all exported column data under the Export node.

    Id

    Optional

    The name identifier of the column upon which other columns are dependent. Used only when another ColumnInfo specifies a Required element with this ColumnInfo as its target. For more information, see Create an XML file describing columns to import and export.

    Locked

    Optional

    Whether the column value cannot be modified. Locked columns are set to read-only and shaded gray in the exported spreadsheet. Default: False.

    Path

    Optional

    Required except when FlagsAction is true. The bean path that accesses the column value of the entity.

    RequiredForImport

    Optional

    Whether the column value must be specified when the spreadsheet is imported. Default: false.

  4. If the entity you are defining is a child of another entity that is to be exported and imported, add a Parent element within the EntityInfo element. Within the Parent element, add a map of the parent’s ColumnInfo elements.
    For example:
    <EntityInfo ...>
    .
    .
    .
      <Parent>
        <ColumnInfo 
          Path="CPLocation.PublicID" 
          Header="Export.CPBuilding.LocationID"
          Locked="true"
          ColumnType="java.lang.String" />
        <ColumnInfo 
          Path="CPLocation.Location.LocationName"
          Header="Export.CPBuilding.LocationName"
          ColumnType="java.lang.String" />
      ...
      </Parent>
    .
    .
    .
    </EntityInfo>
  5. Optionally, add dependent elements.

    A ColumnInfo element can also contain an optional map of Dependent child elements, each of which specifies another column on which the containing ColumnInfo is dependent. Each Dependent element takes a single attribute, purpose, that is a key to the id of a ColumnInfo on which the containing ColumnInfo is dependent. For example:

    <!-- Column that can have dependent columns because it has an id attribute  -->
    <ColumnInfo 
      Path="CPLocation.Location.State"
      Header="Export.CPBuilding.State"
      ColumnType="typekey.State"
      id="stateColumn"
      RequiredForImport="true" />
    .
    .
    .
    <!-- Column that depends on another column -->
    <ColumnInfo 
      Path="ClassCode"
      Header="Export.CPBuilding.ClassCode"
      ColumnType="entity.CPClassCode"
      RequiredForImport="true" >
      <Dependent purpose="State">stateColumn</Dependent>
    </ColumnInfo>