com.orchestranetworks.service
Class ImportSpec

java.lang.Object
  extended bycom.orchestranetworks.service.ImportSpec

public class ImportSpec
extends Object

Defines the features of an import.

For being valid, an instance of this class must at least define a XML source and a target adaptation. The XML document used as source must be a subset or a complete document that conforms to the schema associated to the target adaptation instance.

Usage

Here is a code sample for importing a CSV table:

 private ImportSpec getImportSpecForCSV(
    File csvFile,
    AdaptationTable table,
    Header headerType)
 {
    ExportImportCSVSpec csvSpec = new ExportImportCSVSpec();
    csvSpec.setHeader(headerType);
    
    ImportSpec importSpec = new ImportSpec();
    importSpec.setSourceFile(csvFile);
    importSpec.setTargetAdaptationTable(table);
    importSpec.setCSVSpec(csvSpec);
    return importSpec;
 }

Specification:

The complete specification of XML Imports is available in the reference document XML Imports.

See Also:
ProcedureContext.doImport(ImportSpec)

Constructor Summary
ImportSpec()
           
 
Method Summary
 ExportImportCSVSpec getCSVSpec()
          Returns the specific features that have been specified so as to perform a CSV import, null if an XML import is to be made.
 ImportSpecMode getImportMode()
          Returns the import mode.
 File getSourceFile()
           
 InputStream getSourceStream()
           
 Adaptation getTargetAdaptation()
           
 boolean isCloseStreamWhenFinished()
           
 void setCloseStreamWhenFinished(boolean closeStreamWhenFinished)
          Specifies that the import process must close the stream at the end.
 void setCSVSpec(ExportImportCSVSpec csvSpec)
          Specifies the specific features so as to perform a CSV import instead of an XML import.
 void setImportMode(ImportSpecMode mode)
          Specifies the import mode : 'insert', 'insert or update', 'update only'.
 void setSourceFile(File aSource)
          Specifies the XML document that serves as the source of the import.
 void setSourceStream(InputStream aSource)
          Specifies that the import process must read the document from the stream specified.
 void setTargetAdaptation(Adaptation aTarget)
          Specifies the target of the import.
 void setTargetAdaptationTable(AdaptationTable aTargetTable)
          Specifies the target table of the import.
 String toString()
           
 String toStringInfo()
          Returns information about the main attributes of this instance.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ImportSpec

public ImportSpec()
Method Detail

getTargetAdaptation

public Adaptation getTargetAdaptation()
See Also:
setTargetAdaptation(Adaptation)

setTargetAdaptation

public void setTargetAdaptation(Adaptation aTarget)
Specifies the target of the import. In the case of a specific table import, the method 'setTargetAdaptationTable(AdaptationTable)' must be used instead.

Parameters:
aTarget - the adaptation that will be updated with the imported XML content.

setTargetAdaptationTable

public void setTargetAdaptationTable(AdaptationTable aTargetTable)
Specifies the target table of the import. This method must be used instead of 'setTargetAdaptation(Adaptation)', in the case of a specific table import.

Parameters:
aTargetTable - the adaptation table that will be updated with the imported CSV content.

getImportMode

public ImportSpecMode getImportMode()
Returns the import mode.

See Also:
setImportMode(ImportSpecMode)

setImportMode

public void setImportMode(ImportSpecMode mode)
Specifies the import mode : 'insert', 'insert or update', 'update only'.

If not specified, the 'insert' mode is used.


getSourceFile

public File getSourceFile()
See Also:
setSourceFile(File)

setSourceFile

public void setSourceFile(File aSource)
Specifies the XML document that serves as the source of the import.

Parameters:
aSource - the XML document to import.

getSourceStream

public InputStream getSourceStream()
See Also:
setSourceStream(InputStream)

setSourceStream

public void setSourceStream(InputStream aSource)
Specifies that the import process must read the document from the stream specified.

The source stream is a more general alternative than the source file.

It is up to the caller of this method to provide a buffered input stream (if needed for performance).

Parameters:
aSource - the stream containing the XML content to import.

isCloseStreamWhenFinished

public boolean isCloseStreamWhenFinished()
See Also:
setCloseStreamWhenFinished(boolean)

setCloseStreamWhenFinished

public void setCloseStreamWhenFinished(boolean closeStreamWhenFinished)
Specifies that the import process must close the stream at the end.

If not set, this property is true.


getCSVSpec

public ExportImportCSVSpec getCSVSpec()
Returns the specific features that have been specified so as to perform a CSV import, null if an XML import is to be made.

See Also:
setCSVSpec(ExportImportCSVSpec)

setCSVSpec

public void setCSVSpec(ExportImportCSVSpec csvSpec)
Specifies the specific features so as to perform a CSV import instead of an XML import.

If not specified, the XML import is performed.


toStringInfo

public String toStringInfo()
Returns information about the main attributes of this instance.


toString

public String toString()


(report a bug)
EBX.Platform 4.8.4 [0722]
Copyright Orchestra Networks 2000-2010. All rights reserved.