FileCenter

The SDK API integrates a module of documents publishing that lets handle, directly from the Process extensions (or any other system inside the portal) , the FileCenter elements and the defined links between them.

The communication between Process and FileCenter is transparent via the SDK.

This layer simplifies the realization of administrative tasks such as:

  • the creation of libraries,folders,documents;
  • the association between folders and documents;
  • the association between the elements created and the categories;
  • the implementation of security on the created elements.

This API can be fully integrated with the one of the workflow and the library module.

Classes diagram

This classes’ diagram represents the main relations that exist between every classe of the publication system.

Library overview Library overview

Table of elements correspondence

Functional term Technical term SDK term JDO term Description
Documents library ContentStore ILibrary DataStore Disk space enabling to store all the documents published in FileCenter. Several libraries may exist on a same server.
Document type Document type IResourceDefinition DocumentDefinition Definition element of a FileCenter document It describes,via its properties,what the document would have as values in its document sheet.
Properties, document attributes Properties IProperty. PropertyDefinition Definition element of a property (type, default value, values list)
Category Category ICategory CategoryNode Recursive element linked to folders or documents
Folder, order Folder IFolder FolderNode FileCenter documents container Element controlled by the security
Document File IFile DocumentNode Document containing the document sheet and one or several attached files.
Attached file Attached file IAttachment ContentNode The document attached file.

General tasks with the library module

Use the SDK API library module

The following code indicates how to use the publication API. The method initialize() is used to position a certain number of parameters. In most cases, this method will get the null value as argument, because inside the Process system every needed property is positioned.

public void general_useModule() {
	// creation of an object of publication module
	ILibraryModule libraryModule = Modules.getLibraryModule();
	
	try {
		// ...
	} catch( Exception e ) {
		// if an error has occurred
		getNavigator().processErrors( e );
	} finally {
		Modules.releaseModule(libraryModule);
	}
}

Recover a context to use the SDK API

The context notion enables to run processing with a user account. Several cases are displayed. Their using depends on the execution context and the available objects.

public void general_getContext( ILibraryModule libraryModule ) throws Exception {
	// 1st case : retrieving the context from a user object
	IUser user = libraryModule.getUserByLogin( "sysadmin" );
	IContext userContext = libraryModule.getContext( user );

	// 2nd case: retrieving the context from an external ID
	IContext externalIDContext = libraryModule.getContext( libraryModule.getLoggedOnUser() );

	// 3rd case : retrieving the context from a login
	IContext loginContext = libraryModule.getContextByLogin( "sysadmin" );
}

Use the transactions

In numerous cases, we need to gather several processing in a same transaction. Each module has its own transactional mechanism.

The following example shows how to use this transactional mechanism from the library module.

public void general_useTransaction( IContext context, ILibraryModule libraryModule ) {
	try {
		// starting a transaction
		libraryModule.beginTransaction( this );

		// doing something
		// ...

		// validating the transaction
		libraryModule.commitTransaction( this );
	} catch( Exception e ) {
		// if an error has occurred, canceling the previous processing
		libraryModule.rollbackTransaction( this );
	}
}

Request the system

The publication module offers a request system based on JDO. In the following example we use a search-type controller (SearchController) to request the database and retrieve IFile objects.

public void general_useSearch( ILibraryModule libraryModule ) throws LibraryModuleException {
	try {
		ISearchController searchController = libraryModule.getSearchController();
		Collection<IFile> files = (Collection<IFile>)searchController.findElements( IFile.class, "(status == 0)", null );

		for ( IFile iFile: files ) {
			System.out.println( iFile.getName() );
		}
	} catch( Exception e ) {
		getNavigator().processErrors( e, true );
	}
}