(ATS4-DEV07) How to Build a Custom Search Panel for Accelrys
ELN David Pirkle
Principal Software Engineer, R & D
The information on the roadmap and future software development efforts are intended to outline general product direction and should not be relied on in making a purchasing decision.
• Searching capabilities within Accelrys ELN
Demo
Overview of Notebook Searching
• Available searches – Standard – Advanced – Full Text – Properties – Chemistry
• These return Vault object types that can be displayed in the accompanying grid: – Document – DocumentTemplate – Form – Folder
• Queries can be saved for future use • Custom searches with accompanying user interfaces can be added
Developing a Search Extension
• Create the search extension assembly by implementing the IQueryBuilderGrid interface
• Add information to the SearchExtensionService.SearchExtensions Application Permission to let the system know about the new search type
• When finished with development, publish the assembly for the new search type to Vault
The Development Environment
• Create a Visual Studio project to build a class assembly
– Set the target platform to .NET 3.5
– Set the target CPU to x86
– While debugging, set the build output directory to the ADM deployment directory
– Sign the assembly
• An implementation of the IQueryBuilderGrid interface
Demo
The IQueryBuilderGrid Interface
• Implement the methods required by the IQueryBuilderGrid interface: – UserControl returns the search panel UI (use lazy initialization)
– DisplayName returns the text to display in the Name dropdown menu
– IsInputValid validates query before it is executed
– ExecuteQueryRequest allows the UI to trigger a search
– BuildQuery() returns the Query the user has specified
– IsQueryCompatible used to find a panel to load a query
– LoadQuery() loads a saved query into the UI
– Configuration used for admin-supplied configuration (described later)
• Possible ways to create the Query
Demo
Building the Query
• Query – Container of information necessary to generate a SQL query to send to Vault – Includes QueryConditions, QueryClauses and a SQLGenerator – “select” fields either defined programmatically or generated by the SQLGenerator
• QueryCondition (derived from QueryClause) – Generates the “from” and “where” portions of a SQL statement using QueryViews, QueryFields and
QueryComparisonOperators
• QueryView and QueryField – Generates the “from” portion of a SQL statement – Can be generated and passed into the QueryCondition or the QueryCondition can generate them
using the names of the view and fields
• QueryComparisonOperators – Used in QueryConditions to generate the “where” portion of the SQL statement
• QueryConditionExtensions – Simplify the use of QueryConditions
SQL Generators
• Derive from the abstract base class QuerySQLGenerator • VaultContentQuerySQLGenerator - the default
– Retrieves information about a Vault object or the parent of an object – Retrieved information limited to VaultObject_obj View – Used by the advanced query builder
• ChemistryQuerySQLGenerator – Used specifically with the chemistry query builder
• VaultObjectPropertiesQuerySQLGenerator – Can be used to search any of the Views
• PropertiesQuerySQLGenerator – Similar to VaultObjectPropertiesQuerySQLGenerator but knows how to separate Quantities into
QueryConditions for both value and unit – For use with the search grid, the VaultObject_obj fields to select are (in the following order):
SourceRepositoryID, DocumentID, VaultID
Search Extension Configuration
• Modify the SearchExtensionService.SearchExtensions application permission
– Add to SearchExtensionTypes to let the SearchExtensionService know a new search type exists
– Specify the assembly-qualified name of the search extension class as the “class”
– (Optional) Add a configuration data node using as the Name the “key” supplied in SearchExtensionTypes
Search Extension Configuration
Search Extension Configuration
Publishing the Search Extension
• Assemblies are stored in Vault by “fully-qualified assembly name” – Meaning it includes version information
– Need to change the assembly version numbers before publishing the new assembly
• Can’t un-publish an assembly – To “undo” a publish, you need to advance the version number and publish
again
– Also update the version number in the permission configuration
– Use a source control system to maintain old source code versions
• See the Accelrys ELN Developer’s Guide section on “Publishing a Custom .NET Assembly”
• Presented the way in which the search panel in Accelrys ELN can be extended – Create an assembly containing a class that implements the
IQueryBuilderGrid interface – Configure a new search extension in the
SearchExtensionService.SearchExtensions application permission – Publish the assembly to Vault
• Resource – Accelrys ELN Developer’s Guide
• Section entitled “Creating a New Search Type” • Section entitled “Publishing a Custom .NET Assembly”
Summary