Class ImportObject

java.lang.Object
com.uc4.communication.requests.XMLRequest
com.uc4.communication.requests.ImportObject

public class ImportObject extends XMLRequest
Imports UC4 Objects.

Keep in mind that the size of the XML file must not exceed 30000 KB. Values below this limit may also be defined in the UC4 Variable UC_SYSTEM_SETTINGS.

The importing and exporting functionality is not suitable for mass transports! Use the UC4 Transport Case instead for this purpose.

  • Constructor Details

    • ImportObject

      public ImportObject(File exportFile, IFolder folder, boolean overwriteObject, boolean keepFolderLinks) throws SAXException, IOException
      Creates a request to import UC4 Objects.
      Parameters:
      exportFile - File (XML) containing the objects
      folder - Folder in which the objects should be created
      overwriteObject - If true an existing object with this name will be replaced
      keepFolderLinks - If true, existing folder links will be kept
      Throws:
      IOException - In case of an I/O Error
      SAXException - In case of an invalid file content
    • ImportObject

      public ImportObject(ByteBuffer byteBuffer, IFolder folder, boolean overwriteObject, boolean keepFolderLinks) throws SAXException, IOException
      Creates a request to import UC4 Objects.
      Parameters:
      byteBuffer - ByteBuffer (XML) containing the objects
      folder - Folder in which the objects should be created
      overwriteObject - If true an existing object with this name will be replaced
      keepFolderLinks - If true, existing folder links will be kept
      Throws:
      IOException - In case of an I/O Error
      SAXException - In case of an invalid file content
    • ImportObject

      protected ImportObject(Document doc)
  • Method Details

    • createRequest

      protected void createRequest(com.uc4.util.XMLDocument doc, Element request, ConnectionAttributes sessionInfo)
      Description copied from class: XMLRequest
      Creates the XML Document for the request. This method is used internally.
      Specified by:
      createRequest in class XMLRequest
      Parameters:
      doc - Document, used to create new Elements
      request - Request Element - classes append information to this request element
      sessionInfo - Information about the session
    • exportDocument

      public Document exportDocument()
      Returns an XML DOM which represents the exported object if this instance was created using the ExportObject.getImportRequest() method.
      Returns:
      document
    • handleContent

      protected void handleContent(com.uc4.util.XMLDocument doc, ConnectionAttributes session)
      Description copied from class: XMLRequest
      Sub classes extract the values from the XML document and provide public getter methods.
      Overrides:
      handleContent in class XMLRequest
      Parameters:
      doc - XML Document
      session - Info about the user session
    • getImportMessages

      public String getImportMessages()
      Returns import messages.
      Returns:
      String containing import messages
    • isAllowedInClientZero

      protected boolean isAllowedInClientZero()
      Description copied from class: XMLRequest
      This method is used internally. Tests if this XMLRequest is allowed in client 0. The default implementation returns false, subclasses may override.
      Overrides:
      isAllowedInClientZero in class XMLRequest
      Returns:
      true if this request is allowed in client 0, false otherwise
    • getSrc

      protected String getSrc()
      Description copied from class: XMLRequest
      Returns the request source. This method is used internally.
      Specified by:
      getSrc in class XMLRequest
      Returns:
      Source
    • getResourceList

      public Iterator<UploadBinary> getResourceList()
      Returns an Iterator with items of UploadBinary objects after invoking the ImportObject instance. Use this Iterator to additionally upload all related resource items of each STORE object containing within the import.
      Returns:
      An Iterator containing all resource items of each imported STORE object.
    • addImportedBinary

      public void addImportedBinary(String resname, ByteBuffer buffer)
      When importing via ByteBuffer, add additional files to this request
      Parameters:
      resname - Resource name
      buffer - Content