These APIs are used to transfer data records from one table in the database into an output stream or a file stored on the server. These APIs also provide the option to export the document files stored in the afm_docs table and save them into specified server folders.
public OutputStream transferOut(String tableName,
List<String> fieldNames,
List<RestrictionSqlBase.Immutable> restrictions,
String title,
XlsBuilder.FileFormatType format,
boolean exportDocuments
) throws ExceptionBase ;
tableName: String. Specify the table to export.
If the table name is empty or it does not exist in ARCHIBUS schema, an exception will be thrown.
fieldNames: A list of String. Specify the field names to export.
If the field name list is empty, then all the fields of the specified table will be exported. If one or more field names do not exist in ARCHIBUS schema, an exception will be thrown.
restrictions: A List of RestrictionSqlBase.Immutable.
Specify the restrictions for the records to be exported.
For example:
List<RestrictionSqlBase.Immutable> restrictions = new
ArrayList<RestrictionSqlBase.Immutable>();
RestrictionParsedImpl rest = new RestrictionParsedImpl();
rest.addClause(TestTransferField.tableName, TestTransferField.acIdFieldName,
"PROPERTIES WW INC. - 001");
restrictions.add(rest);
The restriction should be applicable to the corresponding tableName
, otherwise an exception will be thrown.
title: String. The title for the output Excel or CSV file.
format: XlsBuilder.FileFormatType: either CSV or XLS.
exportDocuments: Boolean.
If set to True, the function will export the documents related with ARCHIBUS document field(s) from the database into a server folder. If set to false, no documents will be exported. The default is false.
public void transferOut(String outputFileNameAndPath,
String tableName,
List<String> fieldNames,
AbstractRestrictionDef restriction,
String title,
Boolean exportDocuments,) ;
outputFileNameAndPath: String.
Specify the file name that the output content will be saved to. If the file does not exist or the file extension is not .csv or .xls, an exception will throw.
tableName: String. Specify the table to export.
If the table name is empty or it does not exist in ARCHIBUS schema, an exception will be thrown.
fieldNames: A list of String. Specify the field names to export.
If the field name list is empty, then all the fields of the specified table will be exported. If one or more field names do not exist in ARCHIBUS schema, an exception will be thrown.
restriction: A List of RestrictionSqlBase.Immutable.
Specify the restrictions for the records to be exported.
For example:
List<RestrictionSqlBase.Immutable> restrictions = new
ArrayList<RestrictionSqlBase.Immutable>();
RestrictionParsedImpl rest = new RestrictionParsedImpl();
rest.addClause(TestTransferField.tableName, TestTransferField.acIdFieldName,
"PROPERTIES WW INC. - 001");
restrictions.add(rest);
The restriction should be applicable to the corresponding tableName, otherwise an exception will be thrown.
title: String. The title for the output Excel or CSV file.
isExportDocuments: Boolean.
If set to True, the function will export the documents related with ARCHIBUS document field(s) from the database as a list of OutputStream. If set to false, no documents will be exported. The default is false.
Note: This function is used by both Transfer Out and Transfer In
void setDocumentsRootPath(String documentsPath);
documentsPath: String.
Specify the folder where the documents related with ARCHIBUS document field(s) resides. The default folder will be:
/projects/users/{user_name}/
This path will be attached to {APP_SERVER_ROOT} folder as the physical folder to store the exported documents.
This parameter only takes effect when isExportDocuments is true.
If the path does not exist, a new path will be created. An exception will be thrown if the path can’t be created or is read-only.
Note: This function is used by both Transfer Out and Transfer In
String getDocumentsRootPath();
void setProtectedFields (List<String> protectedFields)
;
protectedFields: A list of protected field names.
The field name can be with or without table name.
long nRecordsExported()
@return counter: long. The number of records exported.
long resetCounters()