Portus Version 2012-12-17
 —  Administration  —

Portus DataViews


Create a DataView from scratch

  1. A vanilla Portus DataView is created with an Eclipse "New Wizard", start it with File -> New -> Other (or use the shortcut Ctrl+N) to bring up the list of available wizards. Select Other-> Portus DataView from this list. Click Next.

  2. Enter or select a Destination folder, specify a name for the DataView file, click Finish to create it.

    graphics/conxrd11.png

  3. You have now created an "empty" (i.e. no fields defined yet) Portus DataView file in the selected folder.

    graphics/conxrd12.png

  4. For information on actually editing the DataView, adding fields etc., please continue reading at Edit a Portus DataView

Top of page

Opening a Portus DataView for editing

  1. Open a "local" file, contained in an Eclipse project within the active workspace...

  2. Open a "remote" DataView file, directly on the server, without importing it into a workspace / project first, by right-clicking the DataView name in the Configuration View to bring up the context menu, then select "edit DataView"

    graphics/conxrd12b.png

Top of page

Editing a Portus DataView

  1. For the purpose we will open an empty DataView file and populate it with all information required to be able to start issuing requests against an Adabas Resource (= Adabas file on an Adabas database). This tutorial will be based on the Adabas "Employees" demo file.

    DataViews are not tied to a specific "resource type", the same mapping can be used to access an Adabas file or a SQL table. There are, however, elements of a DataView which are only meaningful in the context of a specific resource type, for example "special descriptors" (super-, sub-, ...) for Adabas.

    graphics/conxrd12.png

  2. The display areas relevant for editing the DataView file are

    In case the "Properties" view somehow got hidden, right-click into the edit window and select "Show Properties View" from the context menu.

    The result should look like this:

    graphics/conxrd20.png

  3. First of all, enter the Root element name: The (XML) "structure" or "set" name under which items (records) for a Resource linked to this DataView will be referred to. E.g.: AdabasEmployees

    Enter the Group element name, this is the Portus "record name". (E.g.: Employee).

    Changes applied to name fields in the Properties view are reflected in the editor's tree view immediately.

    Important:
    The 'Root' and 'Group' element names may NOT be identical, as this would lead to duplicate XML element names and thus 'loops' in the schema.

    graphics/conxrd21.png

  4. We can start adding the actual DataView Definition elements now, right-click on the root element in the editor window, from the context menu appearing now select add field.

    graphics/conxrd22.png

  5. A new element ("Field") has been added with all properties set to initial values.

    The first field we are going to add is the "personnel Id", set the properties as follows:

    graphics/conxrd25.png

  6. Add a few more fields with the following attributes:

    graphics/conxrd25a.png

    graphics/conxrd25b.png

    graphics/conxrd25c.png

    Next we are going to define the "address line" field, which is a MU (multiple value) field. MU fields are defined like a "flat" field, with the exception of the max Occurs Property being set to a value >0

    graphics/conxrd26.png

  7. Lastly, we will define a PE (periodic group), the structure of the "income" group of the "Employees" file:

    So we first add the "group field" income. Only the xml Name, int. name (internal name = Adabas field name) and max Occurs properties are relevant here.

    graphics/conxrd27.png

    To actually turn the income field to a PE group field, right-click it, select add subfield

    graphics/conxrd27b.png

    PE Sub Field properties are equivalent to those of "regular" fields. Define the three PE-fields as follows:

    graphics/conxrd27d.png

    graphics/conxrd27e.png

    max Occurs >0 on the PE-field level denotes a MU within a PE.

    graphics/conxrd27f.png

  8. The "view" to the "Employees" file is now complete. Save the DataView by selecting the Save button or Ctrl+S.

    graphics/conxrd28.png

  9. Export the DataView to the target Portus server.

Top of page

Editing "special" fields

The following "special" fields can be defined for a DataView

  1. In the DataView editor window, click on the "Special fields" tab to add special fields

    graphics/conxrd70.png

  2. Right-click into the empty editor area, select "add special field"

    graphics/conxrd70a.png

  3. For example we define a special field called "dept_person" with an "internal name" (the Adabas short name) of "S2", being of type "superDescriptor"

    graphics/conxrd71.png

  4. Click on the "Add subfield" button, a new field element will appear in the subfield table

    graphics/conxrd72.png

  5. Click on the field value under the "Referenced field" heading, select the field to be added from the list of fields in the dropdown-box. Here we select the "dept" field

    graphics/conxrd73.png

    Initial "Offset" and "Length" values will be derieved from the selected field's definition

  6. Select the "name" field as the second subfield just like the "dept" field, the result should look like this

    graphics/conxrd74.png

Top of page

Enhanced Type Conversion

This facility allows the conversion of a string value to an integer equivalent and visa versa. This is analogous to an enumeration i.e. for Jan substitute 1, Feb substitute 2 etc.

In the DataView editor window, select the field.

In the Properties View 2 items need to be changed

  1. Open the Format dropdown list and select substitution.

  2. Set the Format Mask field to the value of the enumeration string. This should be in the format strvalue1=num1, strvalue=num2, strvalue3=num3 e.g.

    Jan=1,Feb=2,Mar=3,Apr=4,May=5,Jun=6,Jul=7,Aug=8,Sep=9,Oct=10,Nov=11,Dec=12

    graphics/conxrdenh.png

To save select Ctrl+S or close the DataView editor.

Right-click on the Service and select 'Refresh Service'.

Top of page

Exporting a DataView to a Portus server

Whether you created a new one or imported and edited an existing DataView, you will now need to export it to the Portus server. DataViews are stored in the "xrd" subdirectory of the server configuration directory.

To export a Portus DataView to a Portus server execute one of the the following procedures:

Using the server based export function

  1. Select Export Resource Definitions from the context menu of the server you wish to export to.

    graphics/conxrd30a.png

  2. Select the DataView to be exported from the file selection dialog, click OK

  3. The newly added DataView appears in the list

Using the configuration based export function

  1. On the configuration view select export DataView to server from the context menu of a Resource definition pointing to the DataView to be exported.

    graphics/conxrd35a.png

  2. Select the DataView to be exported from the file selection dialog, click OK

  3. You are now asked if the DataView is to be activated immediately.

    Reply Yes if you want to use the newly exported DataView immediately, that is as soon as all requests currently using that DataView have completed, the new copy will be used for all subsequent requests.

    A successful export will be indicated by a message in the status line.

Top of page

Importing an existing Portus DataView

To import an existing DataView:

  1. From the Portus Configuration View's "DataViews / ..." tab, select the elements and right click. Select "Import Service Definition(s) from server"

    graphics/conxrd60.png

  2. Select the destination folder and click "Import"

    graphics/conxrd61.png

Top of page

Creating a XML Schema for a DataView

An XML Schema ( XSD) can be used to express a schema: a set of rules to which an XML document must conform in order to be considered 'valid' according to that schema. In Portus an XML Schema can be used to validate the input coming from the user. This validation occurs at a very early stage of the processing, so this can be a useful method of enforcing data rules in Portus in a fast and efficient manner. For more information about the structure, rules and possibilities refer to the W3C XML Schema Specification

There is a one-to-one relationship between the DataView and the XML Schema. For example, if a personnel_id field is present in the DataView, the XML Schema can be used to enforce rules that this field must be an integer of at least, and not more than, 8 digits.

A XML Schema for a DataView can be created

An XML Schema will be created at the same level as the DataView.

Important:
The filenames of the DataView and XML Schema must be identical, the only difference being the file extenstion ( xrd versus xsd )

You may now export this XML Schema and/or the DataView to the server.

Top of page