IViewController interface

The IViewController interface enables to simply build SQL request based on functional elements.

The methods of the IViewController interface

public interface IViewController extends IController {
	// constraints
	void addEqualsConstraint( String name, Object value );
	void addNotEqualsConstraint( String name, Object value );
	void addGreaterConstraint( String name, Object value );
	void addGreaterOrEqualConstraint( String name, Object value );
	void addLessConstraint( String name, Object value );
	void addLessOrEqualsConstraint( String name, Object value );
	void addLikeConstraint( String name, Object value );
	void addNotLikeConstraint( String name, Object value );
	void addInConstraint( String name, Object value );
	void addNotInConstraint( String name, Object value );

	// parameters
	void setStart( int start );
	void setCount( int count );
	void setOrderBy( String orderBy, Class orderByType, boolean ascendant );
	void setStatus( int status );

	// evaluation
	Collection evaluate();
	Collection evaluate( ICatalog catalog );
	Collection evaluate( IWorkflowContainer workflowContainer );
	Collection evaluate( IWorkflow workflow );
	Collection evaluate( ITask task );

	// size evaluation
	int evaluateSize();
	int evaluateSize( ICatalog catalog );
	int evaluateSize( IWorkflowContainer workflowContainer );
	int evaluateSize( IWorkflow workflow );
	int evaluateSize( ITask task );
	
	// set secured mode
	void setSecurityApplied( boolean securityApplied );
	
	// allow to search within the system catalogs
	void setAllowSystemCatalogs( boolean allowSystemCatalogs );
}

Construction of a “functional” request

Example of code using the IViewController class to build and execute a request.

// retrieving an application as request scope
ICatalog catalog = workflowModule.getCatalog( context, "Education" );

IViewController viewController = workflowModule.getViewController();

viewController.setOrderBy( "sys_Reference", String.class, true );

// positioning some constrains 
viewController.addEqualsConstraint( "sys_Creator", context.getUser() );
viewController.addLessConstraint( "sys_CreationDate", new Date());
viewController.addEqualsConstraint( "fldDocumentVersion", "2.0" );
viewController.addEqualsConstraint( "DocumentState", "Applicable" );

// evaluating the view and retrieving process documents.
Collection instances = viewController.evaluate(catalog);
for ( Iterator iterator = instances.iterator() ; iterator.hasNext() ; ) {
	IWorkflowInstance workflowInstance = (IWorkflowInstance)iterator.next();
	LOGGER.info( workflowInstance.getName() + " : " +
	workflowInstance.getValue( "DocumentState" ) );
}