4.1 Sample Design Document

This section contains the design document for a sample UCX component.

4.1.1 Table of Contents

4.1.2 Introduction

This is the design of a Sample component to demonstrate the development of UCX components.

Component Description

This component allows you to get information about the company and employees of the company. Following NSP script illustrates the use of the component

<%
Set Camp = CreateObject(“UCX:COMPANY”)
Response.write Comp.Name

Set Amps = Comp.Employees
Set Emp = Emps.item(5)

’Display the details of 5th employee
Response.write Emp
Response.write Emp.id

’Display all employees
For each Emp in Emps
Response.write Emp.name
Next
%>

Component Methods

text goes here

COMPANY

This is the top-level object. This stores the information about company and allows to access employees of the company.

Constants

The following are the department related constants.

  • ENGG - 1

  • HR - 2

  • ADMIN - 3

Properties

Data Type

Property Name

Attribute

String

Name

Read Only: Name of the company

String

Address

Read Write: Address of the company

EMPLOYEES

Employee

Read Only: Returns the Employees object on success else returns Null. This object is collection of the employees in the company.

EMPLOYEES

Allows to manage and reference Employee objects.

Properties

Data Type

Property Name

Attributes

Long

Count

Read Only: Number of employee in the company

Methods

Method Name

Parameter

Return Value

Item (Variant Index)

This is the Default method for collections.

Index - The specified index of the employee object which is to be retrieved.

EMPLOYEE. Returns the Employee object if the specified employee is in the collection else returns NULL.

HasMoreElements ()

None.

Boolean. Returns TRUE if there are any more elements in the collection else returns FALSE.

Next ()

None.

EMPLOYEE. Returns the next Employee object from the collection else returns NULL.

Reset ()

None.

Void.

NOTE:: HasMoreElements, Next and Reset method are implemented because FOREACHNEXT function internally uses these methods.

EMPLOYEE

Retrieves the specific employee object from the Employees collection.

Properties

Data Type

Property Name

Attributes

String

Name

Read Only: Name of the employee.

This is the Default property

Long

ID

Read Only: Employee Id of employee

Methods

Method Name

Parameter

Return Value

ChangeDepartment ([Integer NewDepartment)

The ID of the new department to which the employee is to be changed.

Returns the previous department of employee.

If no parameter is passed it returns the current department of employee.

Component Design

text goes here

Architecture diagram
Provides the work flow for the sample component
Component Details
  1. Name of the NLM: COMPANY.nlm

  2. This NLM registers following UCX classes:

    • UCX:Company

    • UCX:Employees

    • UCX:Employee

General Information

This section includes any generic information such as error messages related to the component.

Error Messages

Error Code

Description

1

Error in instantiating the Object

2

Index out of range

3

Employee not found

4

Property cannot be set

5

Invalid parameter type

6

Invalid department name