SSDM - Sibilo Software Development Model

(by Google)

Developer's Corner - User Defined Attributes
  1. Introduction
    1. Overview (N-tier Architecture)
  2. Requirements Capture
    1. Natural Language Text to UML
  3. UML Static Data Model
    1. Object / Class
    2. Relationships
    3. Data Type / Enumeration
    4. Supported Data Types
  4. Application Design
    1. Database (UML-DB Mapping)
    2. Business Objects (UML-Class Mapping)
    3. User Interface (UML-User Control Mapping)
  5. Sibilo Software Development Environment (Sibilo.SDE)
    1. Sibilo.SDE User Guide
  6. Sibilo.DBL Programming
    1. Introduction
      1. Background Information
      2. The Clist Class
    2. Core Objects
      1. Common Constructors
      2. Common Destructors
      3. Common Properties
      4. Common Methods
        • Add
        • Update
        • Remove
        • GetDetails
        • Load
        • Equals
      5. Shared Methods
        • GetAll
        • Remove
        • RemoveAll
        • Exists
        • Search
        • ObjectCount
        • CreateInstance
      6. User Defined Attributes
        • AddAttribute
        • RemoveAttribute
        • GetAttributeList
        • GetClassList
        • GetAttribute
        • SetAttribute
    3. Relationships
      1. Overview
      2. One-to-One Relationships
      3. One-to-Many and Many-to-Many Relationships
        • Add
        • Remove
        • RemoveAll
        • Exists
      4. Default Object of a Relationship
        • SetDefault
        • GetDefault

6.2.6 User Defined Attributes

There is also support for "User-defined attributes" in SSDM. One can say that he wants to keep, say the hair colour of a person. This property must first be introduced to the model by means of the following method in the CApp:

Function AddAttribute(ByVal ClassName As String, _
                      ByVal AttributeName As String, _
                      ByVal AttributeType As String) As Boolean

The ClassName should be the name of the class (i.e. CUser, CEmail, etc.); the AttributeName is the name of the attribute that is initiated; and the AttributeType is the type of the attribute.

The AttributeType should include the assembly name (i.e. System.String). Currently it is not supported to have a SSDM class as an attribute. So AttributeType should typically be System.String, System.Int16, System.Int32, System.Int64, System.Byte, System.Double, System.Boolean, etc.


oSite.AddAttribute("CUser", "HairColour", "System.Int16")

Function RemoveAttribute(ByVal ClassName As String, _
                         ByVal AttributeName As String, _
                         Optional ByVal DeleteRecords As Boolean = False) As Boolean

The ClassName should be the name of the class (i.e. CUser, CEmail, etc.); and the AttributeName is the name of the attribute that is to be removed; DeleteRecords parameter is for deleting the records in the database that correspond to the information of the attribute that is being removed. So for example "HairColour" attribute may not be necessary for the moment, but one may not want to delete the information already in the database. So if that is the case, DeleteRecords should be passed as False.


' Delete the records corresponding to HairColour as well
oSite.RemoveAttribute("CUser", "HairColour", True)

Public Function GetAttributeList(ByVal ClassName As String) AsISList

The ClassName should be the name of the class (i.e. CUser, CEmail, etc.); Returns a ISList of names (as String) of the attributes already defined using AddAttribute method. This enables one to list all the attributes for a class for administration purposes. In order to loop all the classes see GetClassList method


For Each oAttributeInfo As SibiloDBL.CAttributeInfo in App.GetAttributeList("CUser")
    Response.write(oAttributeInfo.Name & " - " & oAtttibuteInfo.Type & "<br> ")

Public Function GetClassList() As ISList

Returns an ISList of class names stored as String;


Dim sClassName As String
For Each sClassName in App.GetClassList
    Response.Write("<b>" & sClassName & "</b><br>")
    For Each oAttributeInfo As SibiloDBL.CAttributeInfo in ucSite.oSite.GetAttributeList("CUser")
        Response.write(oAttributeInfo.Name & " - " & oAtttibuteInfo.Type & "<br>")

After defining the attributes, they can be accessed using GetAttribute and SetAttribute methods from the Objects.

Public Function GetAttribute(ByVal AttrName As String) As Object

The AtrrName should be the name of the attribute, of which the value we want to get (i.e. "HairColour");


Response.Write(CType(oUser.GetAttribute("HairColour"), String))

Public Function SetAttribute(ByVal AttrName As String, ByVal ValueAs Object) As Boolean

The AtrrName should be the name of the attribute we want to set (i.e. "HairColour"); The Value should be the same type as it is defined using AddAttribute function of CSite (i.e. System.String). The return will be True if the value is successfully set. The Update function must be called to save the changes to the database.


Response.Write(oUser.SetAttribute("HairColour"), "Blond"))