INTRODUCTION TO BUSINESS VIEW LAYER
This Chapter describes functionality available in Compiere to create Business Views. The purpose is to support third party Reporting tools, including Jasper and Crystal Reports. While these or any other tool that can access the database can report on the data, the main challenges in doing this is maintaining the data access security defined in Compiere, identifying the data relationships and resolving the foreign key relationships. The Business View Layer addresses these challenges in a manner that is transparent to the end user.
The Business Views reside in a separate database schema from the Compiere Application. This schema is created as part of the installation / migration process.
BUSINESS VIEW TERMINOLOGY
A Business View is an intuitive business focused view exposing the key entities in your database. This allows users to focus on extracting business information with a familiar and easy to understand view of the data source rather than trying to identify the complexities of database schemas and access.
Business View Layer
A Business View layer is metadata that consists of the business views and infrastructure for secured access to these business views. This data can then be used for creating native or third party reports for consumption by decision support systems. The Business View Layer is capable of accessing and information from the Compiere database and applying the defined security rules to expose information as intuitive business views for external report writers while enforcing all security defined in the base Compiere application. Additionally, these views also resolve all foreign key relationships so the data meaningful to the user is displayed.
A Data Source Layer is definition of a data repositories. It could consist of a Table or View, Report View or Report and Process that is defined in Compiere. In the future other data sources may include third party application databases, web services, and/or flat text files. A data source defines the metadata for the Compiere Business View. This Business View can then published in a separate database (BVL) schema.
Setup the Role
A Compiere role must be set up to define users with Business View Layer Privileges. To begin, login to Compiere with the Administrator Role and open the Role window to define those Roles which will have access to the Business View Layer along with the Name and Password which will be used for access. Spaces are not allowed in either the Name or Password.
Open the BVL tab of the Role window in order to enable the BVL user.
Enter the Name and the Password into the respective fields that apply. This is the name and password that will be used to connect to the previously created BVL schema. All security grants and restrictions will be applied to the Business View Layer.
Leave the Active check box selected
Select a User/Contact if you want to allow access for just a specific user. If this field is left blank, all users who are assigned this role will have access
Click 'Save' to store the information and continue.
The BVL Access tab allows you to specify which business views a Role can access.
Select the BVL Access tab from the Role window.
You will find the Business Views, the Entity Types, and the accessibility options will display.
Business View Creation
You can create a Business View from pre-existing entities in Compiere or you can create a new Business View.
To create a Business View in Compiere, you will first have to login with the System Administrator Role.
Once you are logged into Compiere as the System Administrator, open the Business View window from the Main Menu.
Provide a Name for the Business View in the name field.
Optionally, include a Description for this Business View in the Description field.
Select a Functional Domain. This allows you to classify your Business Views.
Entity Type will default to User maintained. Update this field, if appropriate to associate it with your own entity type.
Business View Source
Next you will want to select a Data Source for the Business View.
Open the Source tab of the Business View window.
Provide a Name for the Business View Source in the Name field.
Select a Source Type using the drop menu for the Source Type field. The value selected here, Table or View, Report View or Report & Process will restrict the values available for selection and change the field label in the next field
Select a Report View (or Table or Process) from the drop list box.
Leave the Active check box selected.
Then click the 'Create Fields for Business View' button to import the source definitions into the Business View.
Click 'OK' at the Compiere Information prompt to proceed with this process.
Compiere will return the results. The Results will be listed as items under Source Mapping.
The Field Sequence tab allows you to arrange the sequencing of the fields.
To add an element to the included items, select an item from the list of the Excluded Items and move it to the Included Items list by clicking on the Right arrow.
Change the sequence of an element by selecting it and using the "Up and Down" arrows.
To remove an element from the list of Included Items, select the item to remove and click on the Left arrow.
Once all Field Sequence changes are complete; click 'Save' to store your changes.
The field tab allows you to change the name of the fields as necessary.
Simply click the Edit button next to the field you would like to modify in order to open the Business View field in the Single record view and make your changes.
Business View Publishing
To publish the business view end points to the Database Schema, open the Publish tab.
Provide the Name of the Business View in the DB View Name field. The Name cannot contain any spaces.
Then click the Create Business View in DB button to export this Business View to the Database Schema.
Click 'OK' at the Compiere Information prompt to proceed with this process.
Compiere will return the Results and the view will be available in the Database Schema.
When the Business View is published, all Roles (where the Manual indicator is not selected) will be granted access to the Business View based on the data access level of source and the data access level of the Role.
Securing Business Views
Business Views inherently respect the security of their source Compiere entity - such as a table, view, report view or report and process. Organization and tenant rules are always respected with no further setup.
If the source of a business view is a table, then table access, column access and row level access should be defined for that table - specified in the normal Compiere mechanism via the Role Data Access window. If the source is a view, data access should be defined for that view in the same manner as done for a table. If the source is a report view, then data access should be defined for the table or view that supports it.
This process applies to the seven business views that have been seeded in Compiere 3.1.
The information exposed and represented by the Business View Layer can be used in native Compiere reports, or externally in reports developed in third party applications, (e.g., Jasper, Crystal, Microsoft Excel), and web services.
This means that once data is exposed via the Business View Layer, it can be used by Compiere and other applications to generate reports, an excel spreadsheet, or securely expose data to other enterprise systems via web services.
For more information on third party applications, refer to the Integration with Integration with Third Party Reporting Tools.