skip to main content
Programmers documentation > Business objects and data sources > The business model > Business class manager API
 
Business class manager API
Once business object classes are created, it is important to make them available to the whole application and allow them to be used by all the components. This is the role of the class manager defined by the interface IlpClassManager. This interface provides methods to:
*Retrieve an IlpClass from an identifier
*Verify whether a given class is part of the business model
*Retrieve the root classes in the model
For example, the following function writes the entire content of a class manager. It iterates over all the classes stored in a class manager and then over their attributes, displaying the class they belong to along with their default value, if any.
How to write the content of a class manager
 
public void displayModel(IlpClassManager classManager) {
    for (Iterator i = classManager.getClasses().iterator();
         i.hasNext();) {
      IlpClass ilpClass = (IlpClass)i.next();
      System.out.println(ilpClass.getName());
      if (ilpClass.getSuperClass() != null) {
        System.out.println("\t"+ilpClass.getSuperClass().getName());
      }
      for (Iterator j = ilpClass.getAttributes().iterator();
           j.hasNext();) {
        IlpAttribute attr = (IlpAttribute)j.next();
        System.out.println("\t" +attr.getName() +": "
                           +attr.getValueClass().toString());
        if (attr.getDefaultValue() !=
            IlpAttributeValueHolder.VALUE_NOT_SET) {
          System.out.print("\t\tdefault: " +attr.getDefaultValue());
          if (attr.getDefaultValue() != null) {
            System.out.print(" " +attr.getDefaultValue().getClass());
          }
          System.out.println();
        }
      }
    }
  }
JViews TGO provides a default implementation of the class manager, which is defined by the class IlpDefaultClassManager. This implementation has the following additional functionality:
*Creates dynamic classes from an XML file. Classes and attributes can be defined by the application using XML and can be loaded in the class manager at runtime.
*Retrieves a dynamic class from a Java™ class. If the IlpClass defining the Java class is not yet present in the class manager, an IlpBeansClass is created and the attribute group is automatically built through introspection in the Java class.
NOTE You can deactivate this behavior or provide a specific IlpClass implementation for your Java classes as described in Defining the business model with dynamic classes.
JViews TGO also provides a class manager implementation to automatically handle the predefined business classes. This implementation is defined by class IltDefaultClassManager.
For easier access to the business classes information in your application, the class manager has been defined as one of the application context services. For information on how to customize the class manager information through the application context and the deployment descriptor, refer to Class manager.

Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.