Repository.XFRACAS.ImportXFRACASXML: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 4: Line 4:
<onlyinclude>Imports an XML byte array into a desired XFRACAS entity. Returns an '''Integer''' that represents the system ID of the byte array.</onlyinclude>
<onlyinclude>Imports an XML byte array into a desired XFRACAS entity. Returns an '''Integer''' that represents the system ID of the byte array.</onlyinclude>


All XML files must first be in the XFRACAS XML format before they can be successfully imported. To view the XFRACAS formats, see the [http://www.synthesisplatform.net/XFRACAS/en/XML_XFRACAS9_and_10.pdf XFRACAS9/10 Import Business Logic] (PDF) document.
You must have admin privileges in the XFRACAS entity in order to import data into it. In addition, the XML file must be in XFRACAS format in order to be successfully imported. The [http://www.synthesisplatform.net/XFRACAS/en/XML_XFRACAS9_and_10.pdf XFRACAS9/10 Import Business Logic] (PDF) document provides a complete description of the format.
 
Once the XML file has been uploaded for processing, use the [[Repository.XFRACAS.ProcessXfracasImports|ProcessXfracasImports]] method to process the XML file.


== Syntax ==
== Syntax ==
Line 34: Line 36:


== Example ==
== Example ==
This example assumes that the repository has connections to existing XFRACAS entities.
  '''VB.NET'''
  '''VB.NET'''
   
   
  {{APIComment|'Add code to connect to a Synthesis repository.}}
  {{APIComment|'Add code to connect to the Synthesis repository.}}
  {{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository
  {{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository
{{APIComment|...}}
  {{APIComment|...}}
{{APIComment|'Get a list of XFRACAS entities in the current project in the connected repository.}}
  {{APIPrefix|Dim}} ListOfXFRACASEntities() {{APIPrefix|As}} NameIdPair
  ListOfXFRACASEntities = MyRepository.XFRACAS.GetAllXFRACASEntities()
{{APIComment|'Search the entities list for the desired entity name, to find the Entity ID}}
  {{APIPrefix|Dim}} DesiredEntityID {{APIPrefix|As Integer}}
        For Each Entity {{APIPrefix|As}} NameIdPair In ListOfXFRACASEntities()
            If Entity.Name = {{APIString|"DesiredEntityName"}}
              DesiredEntityID = Entity.ID
              Exit For
            End If
        Next
   
   
  {{APIComment|'Define a serializable XML object, and then populate it with values to import.}}
  {{APIComment|'Define a serializable XML object, and then populate it with values to import.}}
  {{APIPrefix|Dim}} xmlObject {{APIPrefix|As Object}} = {{APIPrefix|Nothing}}
  {{APIPrefix|Dim}} xmlObject {{APIPrefix|As Object}} = {{APIPrefix|Nothing}}
   {{APIComment|...}}
   {{APIComment|...}}
   
   
{{APIComment|'Define the byte array, and then serialize the object to the byte array.}}
  {{APIPrefix|Dim}} byteArray {{APIPrefix|As}} Byte() = {{APIPrefix|Nothing}}
  MyRepository.XFRACAS.SerializeXMLObjectToByteArray(byteArray, xmlObject)
   
   
  {{APIComment|'Define the byte array, and then serialize the object to the byte array.}}
  {{APIComment|'Import the XML byte array into XFRACAS entity ID# 10.}}
  {{APIPrefix|Dim}} byteArray {{APIPrefix|As}} Byte() = {{APIPrefix|Nothing}}
  {{APIPrefix|Dim}} ImportXMLSystemID {{APIPrefix|As Integer}}
  MyRepository.XFRACAS.SerializeXMLObjectToByteArray(byteArray, xmlObject)
  ImportXMLSystemID = MyRepository.XFRACAS.ImportXFRACASXML(10, XFRACASImportType.Incident, byteArray, {{APIString|"XMLFileTitle"}}, {{APIString|"XMLFileDescription"}})
   
   
  {{APIComment|'Import the XML byte array into the desired XFRACAS entity. In this example, we assume that the XML object type describes an Incident.}}
  {{APIComment|'Process the imported file.}}
  {{APIPrefix|Dim}} ImportXMLSystemID {{APIPrefix|As Integer}}
  MyRepository.XFRACAS.ProcessXfracasImports()
  ImportXMLSystemID = MyRepository.XFRACAS.[[Repository.ImportXFRACASXML|ImportXFRACASXML]](DesiredEntityID, [[XFRACASImportType]].Incident, byteArray, {{APIString|"XMLFileTitle"}}, {{APIString|"XMLFileDescription"}})

Revision as of 23:47, 26 October 2015

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.

You must have admin privileges in the XFRACAS entity in order to import data into it. In addition, the XML file must be in XFRACAS format in order to be successfully imported. The XFRACAS9/10 Import Business Logic (PDF) document provides a complete description of the format.

Once the XML file has been uploaded for processing, use the ProcessXfracasImports method to process the XML file.

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

This example assumes that the repository has connections to existing XFRACAS entities.

VB.NET

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

 '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 XFRACAS entity ID# 10. 
  Dim ImportXMLSystemID As Integer
  ImportXMLSystemID = MyRepository.XFRACAS.ImportXFRACASXML(10, XFRACASImportType.Incident, byteArray, "XMLFileTitle", "XMLFileDescription")

 'Process the imported file. 
  MyRepository.XFRACAS.ProcessXfracasImports()