API Docs for: 1.3.12
Show:

ASNImport Class

Import methods to handle an ASN JSON file containing a framework, competencies and relationships, and store them in a CASS instance

Item Index

Methods

analyzeFile

(
  • file
  • success
  • [failure]
)
static

Analyzes an ASN File for competencies and relationships.

This should be called before import, the success callback returns an object indicating the number of competencies and relationships found.

Parameters:

  • file Object

    ASN JSON file

  • success Callback1

    Callback triggered on successful analysis of file

  • [failure] Callback1 optional
                           Callback triggered if there is an error during analysis of the file

    asnJsonPrime

    (
    • obj
    • key
    )
    private static

    Recursive function that looks through the file and saves each competency object in a map for use during importing. It also counts the number of competencies and relationships that it finds

    Parameters:

    • obj Object

      The current JSON object we're examining for comepetencies and reationships

    • key String

      The ASN identifier of the current object

    createCompetencies

    (
    • serverUrl
    • owner
    • success
    • failure
    • [incremental]
    )
    private static

    Handles creating the competencies found during analysis, iterates through the competency ASN objects saved and creates them in the CASS repository at the URL given.

    Parameters:

    • serverUrl String

      URL Prefix for the competencies to be imported

    • owner EcIdentity

      EcIdentity that will own the new competencies

    • success Callback0

      Callback triggered after the competencies are created

    • failure Callback1

      Callback triggered if an error occurs while creating the competencies

    • [incremental] Callback1 optional
                             Callback triggered incrementally during the creation of competencies to indicate progress

      createFramework

      (
      • serverUrl
      • owner
      • success
      • failure
      )
      private static

      Handles creating the framework if the createFramework flag was set

      Parameters:

      • serverUrl String

        URL Prefix for the framework to be imported

      • owner EcIdentity

        EcIdentity that will own the new framework

      • success Callback2, EcFramework>

        Callback triggered after the framework is created

      • failure Callback1

        Callback triggered if there is an error during the creation of framework

        createRelationships

        (
        • serverUrl
        • owner
        • node
        • nodeId
        • success
        • failure
        • incremental
        )
        private static

        Handles creating the relationships from the file analyzed earlier. Recursively travels through looking for the hasChild field and creates relationships based off of that.

        Parameters:

        • serverUrl String

          URL Prefix for the relationships to be imported

        • owner EcIdentity

          EcIdentity that will own the new relationships

        • node Object
        • nodeId String
        • success Callback0

          Callback triggered after the relationships are created

        • failure Callback1

          Callback triggered if an error occurs while creating the relationships

        • incremental Callback1

          Callback triggered incrementally during the creation of relationships to indicate progress

          importCompetencies

          (
          • serverUrl
          • owner
          • createFramework
          • success
          • failure
          • [incremental]
          )
          static

          Method to import the competencies from an ASN JSON file, should be called after analyzing the file

          Parameters:

          • serverUrl String

            URL Prefix for the competencies to be imported

          • owner EcIdentity

            EcIdentity that will own the new competencies

          • createFramework Boolean

            Flag to create a framework and include the competencies and relationships created

          • success Callback2, EcFramework>

            Callback triggered after the competencies (and framework?) are created

          • failure Callback1

            Callback triggered if an error occurs while creating the competencies

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

            lookThroughSource

            (
            • obj
            )
            private static

            Does the actual legwork of looking for competencies and relationships.

            This function finds the framework information, and pulls out the competency objects array to be scanned by asnJsonPrime

            Parameters:

            • obj Object

              ASN JSON Object from file that contains framework information and competencies/relationships