Repository.XFRACAS.ImportXFRACASXML

From ReliaWiki
Revision as of 16:26, 25 August 2015 by Kate Racaza (talk | contribs)
Jump to navigation Jump to search
APIWiki.png


Member of: SynthesisAPI10.Repository


Imports an XML byte array into a desired XFRACAS entity. Returns an Integer that represents the system ID of the byte array.

All XML files must first be in the XFRACAS XML format before they can be successfully imported. To view the XFRACAS formats, see the XFRACAS9/10 Import Business Logic (PDF) document.

Syntax

.XFRACAS.ImportXFRACASXML(entityID, importType, byteData, fileTitle, fileDescription)

Parameters

entityID

Required. Integer. The ID number of the XFRACAS entity to import the data into.

importType

Required. The type of XFRACAS element (e.g., incident, problem, etc.) to import. Can be any XFRACASImportType constant.

byteData

Required. Byte. The byte array of the XML to import.

fileTitle

Required. String. The file title of the XML file byte array to import.

fileDescription

Required. String. A description of the XML to import.


Example

VB.NET

 'Add code to connect to a Synthesis repository. 
 Dim MyRepository As New Repository
 ... 

 'Get a list of XFRACAS entities in the current project in the connected repository. 
 Dim ListOfXFRACASEntities() As NameIdPair
 ListOfXFRACASEntities = MyRepository.XFRACAS.GetAllXFRACASEntities()

 'Search the entities list for the desired entity name, to find the Entity ID 
 Dim DesiredEntityID As Integer
       For Each Entity As NameIdPair In ListOfXFRACASEntities()
           If Entity.Name = "DesiredEntityName"
              DesiredEntityID = Entity.ID
              Exit For
           End If
       Next

 'Define a serializable XML object, and then populate it with values to import. 
 Dim xmlObject As Object = Nothing
  ... 


 'Define the byte array, and then serialize the object to the byte array. 
 Dim byteArray As Byte() = Nothing
 MyRepository.XFRACAS.SerializeXMLObjectToByteArray(byteArray, xmlObject)

 'Import the XML byte array into the desired XFRACAS entity. In this example, we assume that the XML object type describes an Incident. 
 Dim ImportXMLSystemID As Integer
 ImportXMLSystemID = MyRepository.XFRACAS.ImportXFRACASXML(DesiredEntityID, XFRACASImportType.Incident, byteArray, "XMLFileTitle", "XMLFileDescription")