ARCHIBUS Web Central

Using the OutManager API

 

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.

1.1. This Transfer Out API is designed to be used by other application level or core JAVA codes.

 

public OutputStream transferOut(String tableName,
        List<String> fieldNames,
        List<RestrictionSqlBase.Immutable> restrictions,
        String title,
        XlsBuilder.FileFormatType format,
        boolean exportDocuments
        ) throws ExceptionBase ;

 

PARAMETERS:

 

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.

 

1.2. This Transfer Out API is designed to be called by other WFR for basic Data transfer action.

 

public void transferOut(String outputFileNameAndPath,
        String tableName,
        List<String> fieldNames,
        AbstractRestrictionDef restriction,
        String title,
        Boolean exportDocuments,) ;

 

PARAMETERS:

 

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.

 

1.3. This function is used to change the document field’s output path.

 

Note: This function is used by both Transfer Out and Transfer In

void setDocumentsRootPath(String documentsPath);

 

PARAMETERS:

 

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.

 

1.4. This function is used to get the document field’s output path.

 

Note: This function is used by both Transfer Out and Transfer In

String getDocumentsRootPath();

 

1.5. This function is used to set the protected field in the output file so the values in columns are read-only.

 

void setProtectedFields (List<String> protectedFields);

 

PARAMETERS:

 

protectedFields: A list of protected field names.

The field name can be with or without table name.

 

1.6. This function is used to retrieve the number of records that has been exported.

 

long nRecordsExported()

 

PARAMETERS:

 

@return counter: long. The number of records exported.

 

1.7. This function is used to reset the number of records that has been exported.

 

long resetCounters()