Suche Home Einstellungen Anmelden Hilfe  

prev next Up Title Contents Index

2.8.1 Defining the Attributes


Required attributes are defined by means of the attribute HW_ReqChildAttr. One instance of this attribute is necessary for each attribute definition in the child object. Note that it is possible to have more than one instance of the same attribute type, but with different values (e.g. in the case of the Title attribute). One instance of HW_ReqChildAttr is required for each instance of the attribute.

Note: The attributes defined by HW_ReqChildAttr are only given to the children objects of the collection where they are defined when the children objects are newly uploaded. If an object is moved, copied or duplicated into the collection, it does not get the defined attributes.

PROPAGATION OF REQUIRED ATTRIBUTES

Note that when inserting a container into the container with the HW_ReqChildAttr attributes, all the HW_ReqChildAttr attribute definitions are copied to the new container object. This guarantees that the attributes are propagated to objects in deeper container levels.

EXAMPLE

For example, the set of attributes in the container object might be defined as follows:

HW_ReqChildAttr=<Definition of Description attribute>

HW_ReqChildAttr=<Definition of Title attribute in English>

HW_ReqChildAttr=<Definition of Title attribute in German>

As can be seen here, this declaration defines a Description attribute and two Title attributes in different languages for the children objects. Though not shown here, the attribute definition allows several different specifications for each attribute, such as its name and type, whether or not it is required, and what its value should be. The syntax for the value of HW_ReqChildAttr is explained below.

2.8.1.1 Definition Syntax

The value of HW_ReqChildAttr specifies various information for each attribute declaration: Thus, the value of HW_ReqChildAttr is a list of declarations that looks like the following:

type-def name-def [necessity-def] [default-def] [caption-def] [enum-def] [range-def] [prompt-def]

Note: The declarations must be in the order shown above.

NOTES ON SYNTAX

Note the following about the syntax below:

SYNTAX OF DEFINITIONS

The meaning of the declarations and their syntax is explained below:

TYPE DEFINITION

type-def = (Type: type )

Possible values: integer, float, string or boolean.

Purpose: Defines the type of value the attribute can have.

Example: (Type: boolean)

NAME DEFINITION

name-def = (Name: name )

Purpose: Defines the name of the attribute to be added to the new object. Note that this is different from the caption of the attribute, which appears in the interface.

NECESSITY DEFINITION

necessity-def = (Necessity: necessity )

Possible values: required, optional

Purpose: Specifies whether or not the attribute is required. If its value is "required", then the client is not allowed to accept an empty value as input. If the value is "optional", then an attribute value does not have to be entered, in which case the attribute is not added to the new object.

Example: (Necessity: optional)

DEFAULT DEFINITION

default-def = (Default: <literal of type> )

Possible values: any literal value that corresponds to the type declared for the attribute, or a reference to an attribute in the parent collection.

Purpose: This specification gives the default value for the attribute. This can either be an actual value or a construct that takes the value from an attribute in the parent collection.

Examples of literal values:

To reference the value of an object attribute use the following syntax:

(Default: %%attr-name%%)

Example of referencing an attribute value:

(Default: %%DocAuthor%%)

gives the specified attribute in the child object the value of the attribute DocAuthor in the parent object.

Note: References to HW_ReqChildAttr are not allowed.

Note: If an attribute with multiple values is referenced then one value is randomly selected.

The reference can also be used as part of the value of the Default declaration, e.g.:

(Default: This document is %%status%%)

CAPTION DEFINITION

caption-def = (Caption: 1*caption )

Possible values: The caption definition consists of one or more texts, each with a language declaration.

Purpose: The Caption appears in the user interface and provides the user with information about the meaning of the attribute or the value to be entered. Captions can be in multiple languages.

Example: (Caption: (en:"Project Number")(ge:"Projektnummer"))

ENUMERATION DEFINITION

enum-def = (Values: 1*named-value )

named-value = Value [caption-def]

Value = anything Type can have

caption-def = (Caption: 1*caption)

Purpose: This enumeration specification defines all possible values for the attribute. Each value can be associated with a caption to improve the input user interface.

Example: (Values:(1(Caption:(en:"one")(ge:"eins"))))

Note: Values of type "string" must be enclosed in quotes.

RANGE DEFINITION

range-def = (Range: value - value )

Purpose: This defines the range of possible values for the attribute, corresponding to the Type definition.

Example: If Type is integer, then the Range definition might look like

(Range: 1 - 100)

PROMPT DEFINITION

prompt-def = (Prompt: bval )

Possible values: true, false

Purpose: The prompt definition tells whether or not there should be user interaction when giving a child object a required attribute. When the prompt definition is false, there is no user interaction when adding the attribute. In this case "required" attributes (see Necessity Definition) are added with their defined default value. If no default value is specified, then a warning appears and the attribute is not added. "Optional" attributes are added only if a default value is specified, otherwise they are not added and there is no warning. When the prompt definition is "true", the client presents a user interface to input the value of the attribute. This is also the default behavior if no prompt definition is supplied.

Example: (Prompt: true)

FULL REQUIRED ATTRIBUTE DEFINITION

Here is an example of a complete required attribute definition:

HW_ReqChildAttr=(Type: integer)(Name: ProjectNr)(Necessity: optional)(Default: 1)(Caption: (en:"Project Number")(ge:"Projektnummer"))(Range: 1 - 100) (Values:(1(Caption:(en:"one")(ge:"eins"))))

2.8.1.2 Attributes that are not User-Definable

Certain Hyperwave attributes are defined and maintained by the server and cannot be set or changed by users. Thus the following attributes cannot be defined in a required attributes definition:

2.8.1.3 Setting Required Child Attributes

Now that we have discussed the details of Required Child Attributes declaration and syntax, let us look at how to set required attributes for collections on Hyperwave Information Server.

TO SET REQUIRED CHILD ATTRIBUTES

  1. Log onto the server by clicking on Login.
  2. Click on Authoring to switch to authoring mode.
  3. Click on the checkbox next to the collection for which you want to set Required Child Attributes.
  4. Click on Modify in the menu bar, and from the Modify menu choose Attributes.
  5. In the dialog box that appears (Modify Attributes, Figure 2) click on the More button to access more modify options.
  6. In the blank text field at the bottom of the dialog box (under the listbox labeled Description), enter "HW_ReqChildAttr" as the Attribute Name. In the text box to the right of this, enter the Type and Name definitions and any other variants you wish to set. Be sure to use the correct syntax, as described on page 150.
  7. Click on the OK button.
These attributes have now been set as required for this collection, and all collections uploaded to it will automatically be given this attribute. Collections already existing within the collection will not be affected by these modifications.


prev next Up Title Contents Index

Benutzer: Gast • Besitzer: hwsystem • Zuletzt geändert am: