Previous Topic

Next Topic

Book Contents

Book Index

Metadata and Annotations

Metadata is used in order for the application to be able to obtain information for the set of Properties/Operations of particular FI. Annotations are used for defining Functional Items Metadata.

Metadata

Metadata is used in order for the application to be able to obtain information for the set of Properties/Operations of particular FI. Also the type of each property and the types of arguments for the operation and the result. Functional Items may use different metadata types. To obtain specific information about the metadata of Item/Property/Operation the following commands may be executed. They invoke different methods (e.g. getItemMetadata). For more information check the metadata package.

fim>$info 1

Information for Functional Item

-----------------------------------------------------------------------------------------------------------------------

UID                  

         demo:fim:BinarySwitch:1

Name                          BS Room 1

Version                       2.0.0

Tags                          lamp

Interfaces                    com.prosyst.mbs.demo.fim.BinarySwitch

Properties

    state                     Switched On

Operations                    turnOff

                              toggle

                              turnOn

fim>$info 1 state
Property                      state
Value                         Switched On
classes                       com.prosyst.mbs.demo.fim.BinarySwitch$State
consts                        {name: OFF, value: Switched Off}
                              {name: ON, value: Switched On}
description                   Switch state.
getter                        getState
isEventable                   true
name                          state

fim>$info 1 turnOn
Operation                     turnOn
description                   Turns on the binary switch.
name                          turnOn
parameters                    N/A
return                        N/A

Different Types of Metadata

The following properties are required for defining all Functional Items:

Key

Description

name

Name of the Functional Item (e.g. Alarm).

description

User-friendly description of the FI function.

type

The type of FI Metadata that will be used (e.g. Numeric, Enum, Bean, etc.).

classes

The Metadata Classes.

Types of Metadata:

Annotations

The FIM annotations (com.prosyst.mbs.services.fim.annotations) are used for defining Functional Items Metadata. They can be used in java interfaces, their constants and methods or in class (beans) methods.

The table below displays the possible use of annotations. "@" means "annotated".

Annotation

Item annotated interface

Interface constant

Method/Method return

Method parameter

Class

Item

Yes

No

No

No

No

Name

Yes

No

No

No

No

Description

Yes

Yes if @Property

Yes if FI @Operation return or Bean field @Getter

Yes if @Operation

No

Version

Yes

No

No

No

Yes

Attribute(s)

Yes

Yes if @Property

Yes if @Operation

No

No

Property

No

Yes

No

No

No

Operation

No

No

Yes in FI Interface

No

No

OperationEvent (since 2.3.0)

No

Yes (since 2.3.2000)

Yes in FI Interface

No

No

OperationEventProperty (since 2.3.0)

No

Yes

No

No

No

Getter

No

No

Yes in FI Interface or Bean

No

No

Setter

No

No

Yes in FI Interface

No

No

Ignore

Yes

No

Yes in FI Interface or Bean

No

No

Regex (since 2.3.0)

No

Yes If @Property

Yes if FI @Operation return or Bean field @Getter

Yes if @Operation

No

Numeric

No

Yes if @Property

Yes if FI @Operation return or Bean field @Getter

Yes if @Operation

No

Enum (deprecated since 2.3.0, automatically detected for java enums)

No

Yes if @Property

Yes if FI @Operation return or Bean field @Getter

Yes if @Operation

No

Constructor

No

No

No

No

Yes, for one of the constructors

Status (deprecated since 2.3.0)

No

No

Yes if FI @Operation or property setter

No

No

Tooling

Add this maven dependency:

<dependency>

    <groupId>com.prosyst.mbs.fim</groupId>

    <artifactId>com.prosyst.mbs.fim.validator</artifactId>

    <version>2.3.0</version>

    <scope>compile</scope>

</dependency>

It will validate your annotations. For more information refer to FIM Annotations Validator.

Functional Item Interface Guidelines

Item Interface

Property Constant

Operation Method

Bean