API Docs for: 1.3.12
Show:

CSVImport Class

Import methods to handle an CSV file of competencies and a CSV file of relationships and store them in a CASS instance

Item Index

Methods

Methods

analyzeFile

(
  • file
  • success
  • [failure]
)
static

Analyzes a CSV File to return the column names to the user for specifying which columns contain which data. This should be called before import.

Parameters:

  • file Object

    CSV file to be analyzed

  • success Callback1

    Callback triggered after successfully analyzing the CSV file

  • [failure] Callback1 optional
                           Callback triggered if there is an error analyzing the CSV file

    importCompetencies

    (
    • file
    • serverUrl
    • owner
    • nameIndex
    • descriptionIndex
    • scopeIndex
    • idIndex
    • [relations]
    • [sourceIndex]
    • [relationTypeIndex]
    • [destIndex]
    • success
    • [failure]
    • [incremental]
    )
    static

    Method to create competencies (and relationships if the parameters are passed in) based on a CSV file and references to which columns correspond to which pieces of data.

    Parameters:

    • file Object

      CSV File to import competencies from

    • serverUrl String

      URL Prefix for the created competencies (and relationships?)

    • owner EcIdentity

      EcIdentity that will own the created competencies (and relationships?)

    • nameIndex Int

      Index of the column that contains the competency names

    • descriptionIndex Int

      Index of the column that contains the competency descriptions

    • scopeIndex Int

      Index of the column that contains the competency scopes

    • idIndex Int

      Index of the column that contains the old competency ID (Optional, if not exists pass null or negative)

    • [relations] Object optional
                                         CSV File to import relationships from (Optional, if not exists pass null)
    • [sourceIndex] Int optional
                                         Index (in relation file) of the column containing the relationship source competency ID (Optional, if not exists pass null or negative)
    • [relationTypeIndex] Int optional
                                         Index (in relation file) of the column containing the relationship type (Optional, if not exists pass null or negative)
    • [destIndex] Int optional
                                         Index (in relation file) of the column containing the relationship destination competency ID (Optional, if not exists pass null or negative)
    • success Callback2, Array>

      Callback triggered after the competencies (and relationships?) have been created

    • [failure] Callback1 optional
                                         Callback triggered if an error during creating the competencies
    • [incremental] Callback1 optional
                                         Callback triggered incrementally during creation of competencies to indicate progress,
                                         returns an object indicating the number of competencies (and relationships?) created so far

      importRelations

      (
      • serverUrl
      • owner
      • file
      • sourceIndex
      • relationTypeIndex
      • destIndex
      • competencies
      • success
      • failure
      • incremental
      )
      private static

      Handles actually importing the relationships from the relationship CSV file

      Parameters:

      • serverUrl String

        URL Prefix for the created competencies (and relationships?)

      • owner EcIdentity

        EcIdentity that will own the created competencies (and relationships?)

      • file Object

        CSV File to import competencies from

      • sourceIndex Int

        Index (in relation file) of the column containing the relationship source competency ID

      • relationTypeIndex Int

        Index (in relation file) of the column containing the relationship type

      • destIndex Int

        Index (in relation file) of the column containing the relationship destination competency ID

      • competencies Array

        Array of newly created competencies

      • success Callback2, Array>

        Callback triggered after the relationships have been created

      • failure Callback1

        Callback triggered if an error during creating the relationships

      • incremental Callback1

        Callback triggered incrementally during creation to indicate progress

        transformId

        (
        • oldId
        • newObject
        • selectedServer
        )
        private static

        Helper function to transform a competencies oldID to match the new server url

        Parameters:

        • oldId String

          Old ID found in the CSV file

        • newObject EcRemoteLinkedData

          New competency being created

        • selectedServer String

          New URL Prefix that the new competency's ID should match