Previous Topic: Use Case Example: Formatting a Date AttributeNext Topic: Run Time Activities


Design Time Activities
Problem

Display an account expiration date in a user-friendly format based on separate month, day, and year fields. However, the date is stored in the database as a single physical attribute value in the format mm.dd.yyyy.

Solution

Create a logical attribute that associates the physical date attribute with three logical attributes that are displayed on the screen in separate Month, Day, and Year fields.

Note: Although the date in this use case is an expiration date, the custom logical attribute handler is a general date handler that can process any type of date.

To create a logical attribute for handling expiration dates and other dates

  1. Register the new logical attribute handler in the Management Console:
  2. Create the logical attribute handler DateFormatAdapter by extending the class LogicalAttributeAdapter. The custom handler should implement the following methods:

    To obtain the names of the logical and physical attributes, you pass the values of the attribute Name field as defined in the Management Console to the getLogicalAttributeName() or getPhysicalAttributeName() method. These methods are in the LogicalAttributeContext object, which is passed into every call to DateFormatAdapter.

    In this example, the attribute names you pass in are Month, Day, Year, and Date, as follows:

    
    private final String LOGICAL_ATTRIBUTE_MONTH = "Month";
    private final String LOGICAL_ATTRIBUTE_DAY = "Day";
    private final String LOGICAL_ATTRIBUTE_YEAR = "Year";
    private final String PHYSICAL_ATTRIBUTE_DATE = "Date";
    . . .
    public void initialize(LogicalAttributeContext attrContext)
                                              throws Exception {
        String _month = attrContext.getLogicalAttributeName(
                           LOGICAL_ATTRIBUTE_MONTH);
        String _day = attrContext.getLogicalAttributeName( 
                           LOGICAL_ATTRIBUTE_DAY);
        String _year = attrContext.getLogicalAttributeName( 
                           LOGICAL_ATTRIBUTE_YEAR);
        String _date = attrContext.getPhysicalAttributeName( 
                           PHYSICAL_ATTRIBUTE_DATE);
    . . .
    }
    

    The handler uses the returned logical and physical attribute names when setting and retrieving attribute values.

  3. Deploy the compiled logical attribute handler DateFormatAdapter.
  4. Restart the CA IdentityMinder environment.
  5. When creating the associated task screen in the User Console, assign the three logical attribute names to the Month, Day, and Year fields you add to the screen.

    It is not necessary to assign the corresponding physical attribute to a field on the task screen.