Repository.XFRACAS.ImportXFRACASXMLString: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 2: Line 2:
Uploads an import file bytestream for processing and returns the system ID
Uploads an import file bytestream for processing and returns the system ID
== Method Syntax ==
== Method Syntax ==
{{APIName|'''ImportXFRACASXMLString'''(}}
{{APIName|Public Function '''ImportXFRACASXMLString'''(}}
{{APIPrefix|ByVal}}
{{APIPrefix|ByVal}}
{{APIName|entityID }}
{{APIName|entityID }}
Line 43: Line 43:


== Usage Example ==
== Usage Example ==
{{APIComment| Code Block}}
        '{{APIComment|Declare a new repository connection class.}}
        {{APIPrefix|Private WithEvents MyRepository As [[New Repository]]}}<br>
        '{{APIComment|Connect to the desired Synthesis repository.}}
        {{APIPrefix|Dim}} Success {{APIPrefix|As Boolean}} = {{APIPrefix|False}}
        Success = MyRepository.[[Repository.ConnectToSQLRepository|ConnectToSQLRepository]]("SQLServerPath", "SQLDatabaseName")<br>
        '{{APIComment|Set the Desired Entity ID to import into.}}
        {{APIPrefix|Dim}} DesiredEntityID {{APIPrefix|As Integer}}
        DesiredEntityID = '{{APIComment|Set the entity ID}}<br>
        '{{APIComment|Define an XML string}}
        {{APIPrefix|Dim}} xmlString {{APIPrefix|As String}} = {{APIPrefix|Nothing}}
        '{{APIComment|populate the xmlString with the XML text}}<br>
        '{{APIComment|Import the XML byte array into the entity desired.  In this example, we assume the XML string type describes an Incident.}}
        {{APIPrefix|Dim}} ImportXMLSystemID {{APIPrefix|As Integer}}
        ImportXMLSystemID = MyRepository.[[Repository.ImportXFRACASXMLString|ImportXFRACASXMLString]](DesiredEntityID, [[XFRACASImportType]].Incident, xmlString, "XMLFileTitle", "XMLFileDescription")
==========old code===
{{APIComment|Declare a new repository connection class.}}
{{APIComment|Declare a new repository connection class.}}
         Private WithEvents MyRepository As New Repository
         Private WithEvents MyRepository As [[New Repository]]


{{APIComment|Connect to the desired Synthesis repository.}}
{{APIComment|Connect to the desired Synthesis repository.}}
         Dim Success As Boolean = False
         Dim Success As Boolean = False
         Success = MyRepository.ConnectToSQLRepository("SQLServerPath", "SQLDatabaseName")
         Success = MyRepository.[[Repository.ConnectToSQLRepository|ConnectToSQLRepository]]("SQLServerPath", "SQLDatabaseName")
 
{{APIComment|Get the list of XFRACAS Entities in the current project in the connected repository.}}
        Dim ListOfXFRACASEntities() As [[NameIdPair Class|NameIdPair]]
        ListOfXFRACASEntities = MyRepository.GetAllXFRACASEntities()


{{APIComment|Search the Entities for the desired Entity name, to find the Entity ID}}
{{APIComment|Set the Desired Entity ID to import into.}}
         Dim DesiredEntityID As Integer
         Dim DesiredEntityID As Integer
         For Each Entity As NameIdPair In ListOfXFRACASEntities()
         DesiredEntityID = '{{APIComment|Set the entity ID}}
            If Entity.Name = "DesiredEntityName"
              DesiredEntityID = Entity.ID
              Exit For
            End If
        Next


{{APIComment|Define an XML string.}}
{{APIComment|Define an XML string.}}
Line 69: Line 79:
{{APIComment|Import the XML byte array into the entity desired.  In this example, we assume the XML string type describes an Incident.}}
{{APIComment|Import the XML byte array into the entity desired.  In this example, we assume the XML string type describes an Incident.}}
         Dim ImportXMLSystemID As Integer
         Dim ImportXMLSystemID As Integer
         ImportXMLSystemID = MyRepository.ImportXFRACASXMLString(DesiredEntityID, XFRACASImportType.Incident, xmlString, "XMLFileTitle", "XMLFileDescription")
         ImportXMLSystemID = MyRepository.[[Repository.ImportXFRACASXMLString|ImportXFRACASXMLString]](DesiredEntityID, [[XFRACASImportType]].Incident, xmlString, "XMLFileTitle", "XMLFileDescription")

Revision as of 20:48, 17 October 2013


Uploads an import file bytestream for processing and returns the system ID

Method Syntax

Public Function ImportXFRACASXMLString( ByVal entityID As Integer , ByVal ImportType As XFRACASImportType, ByVal xmlString As String , ByVal fileTitle As String , ByVal fileDescription As String ) As Integer
Uploads an import file bytestream for processing and returns the system ID of the uploaded

Parameters

entityID The ID of the entity to import into.

ImportType The type of XFRACAS Import to utilize.

xmlString The string consisting of the XML to import.

fileTitle The file title of the XML file byte array to import.

fileDescription A description of the XML to import.

Usage Example

Code Block

       ' Declare a new repository connection class. 
       Private WithEvents MyRepository As New Repository
' Connect to the desired Synthesis repository. Dim Success As Boolean = False Success = MyRepository.ConnectToSQLRepository("SQLServerPath", "SQLDatabaseName")
' Set the Desired Entity ID to import into. Dim DesiredEntityID As Integer DesiredEntityID = ' Set the entity ID
' Define an XML string Dim xmlString As String = Nothing ' populate the xmlString with the XML text
' Import the XML byte array into the entity desired. In this example, we assume the XML string type describes an Incident. Dim ImportXMLSystemID As Integer ImportXMLSystemID = MyRepository.ImportXFRACASXMLString(DesiredEntityID, XFRACASImportType.Incident, xmlString, "XMLFileTitle", "XMLFileDescription")


=======old code

Declare a new repository connection class.

       Private WithEvents MyRepository As New Repository

Connect to the desired Synthesis repository.

       Dim Success As Boolean = False
       Success = MyRepository.ConnectToSQLRepository("SQLServerPath", "SQLDatabaseName")

Set the Desired Entity ID to import into.

       Dim DesiredEntityID As Integer
       DesiredEntityID = ' Set the entity ID 

Define an XML string.

       Dim xmlString As String = Nothing
       'populate the xmlString with the XML text

Import the XML byte array into the entity desired. In this example, we assume the XML string type describes an Incident.

       Dim ImportXMLSystemID As Integer
       ImportXMLSystemID = MyRepository.ImportXFRACASXMLString(DesiredEntityID, XFRACASImportType.Incident, xmlString, "XMLFileTitle", "XMLFileDescription")