ERD2WDisplayRelationshipFlag Class Reference

Inherits com::webobjects::directtoweb::D2WDisplayBoolean.

Collaboration diagram for ERD2WDisplayRelationshipFlag:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 ERD2WDisplayRelationshipFlag (WOContext context)
Object objectPropertyValue ()


Detailed Description

Allows for a flag if an object has a given related object. Given a "User" with a "groups" relationship to a "Group" entity, you can have a list page for your users and tabular display if a user is in a group or not. You need some rules like:
 100 : (task = 'list') and (entity.name = "User") => displayPropertyKeys = (name, "groups.@Admin", "groups.@Accounting")
 100 : (task = 'list') and (entity.name = "User") and (propertyKey like 'groups.*') => componentName = "ERD2WDisplayRelationshipFlag"
 100 : (entity.name = 'Group') => keyWhenRelationship = "name"
 100 : (propertyKey = 'groups.') => displayNameForProperty = "Admin"
 100 : (propertyKey = 'groups.') => displayNameForProperty = "Accounting"
 
However, this might be too much work, as you need to change the rules anytime you add or remove from the Group entity. To automatically display possible values from the Group entity, use the ERDDelayedRelationshipFlagAssignment:
 100 : (task = 'list') and (entity.name = "User") => displayPropertyKeys = (name, "@groups") [er.directtoweb.ERDDelayedRelationshipFlagAssignment]
 100 : (task = 'list') and (entity.name = "User") and (propertyKey like 'groups.*') => componentName = "ERD2WDisplayRelationshipFlag"
 100 : (entity.name = 'Group') => keyWhenRelationship = "name"
 100 : (propertyKey like 'groups.@*') => displayNameForProperty = '<computed>' [er.directtoweb.ERDDelayedRelationshipFlagAssignment]
 100 : (propertyKey like 'groups.@*') => restrictedChoiceKey = "session.possibleGroups"
 
The "@" in the displayPropertyKeys rule is the flag that tells the assignment which relationship to expand. Together with a method that returns the candidates for the Group entity in the Session class, you now have an automatic display of boolean flags:
 Name   |  Admin   | Accounting | Marketing
 ------------------------------------------
 Fred   |   [x]    |    [ ]     |   [ ]    
 Carl   |   [ ]    |    [x]     |   [x]    
 Suzi   |   [x]    |    [ ]     |   [ ]    
 
Note that the ERDDelayedRelationshipFlagAssignment gets called up pretty often, so you might need to make your candidate method in the session cache the keys.

Author:
ak keyWhenRelationship

Constructor & Destructor Documentation

ERD2WDisplayRelationshipFlag ( WOContext  context  ) 


Member Function Documentation

Object objectPropertyValue (  ) 


The documentation for this class was generated from the following file:

Generated on Sat May 26 06:42:52 2012 for Project Wonder by  doxygen 1.5.8