er.directtoweb
Class ERDDelayedExtraQualifierAssignment
java.lang.Object
com.webobjects.directtoweb.Assignment
er.directtoweb.ERDDelayedAssignment
er.directtoweb.ERDDelayedExtraQualifierAssignment
- All Implemented Interfaces:
- EOKeyValueArchiving, Serializable
- public class ERDDelayedExtraQualifierAssignment
- extends ERDDelayedAssignment
Very useful when you want to restrict the things a user can see during searches or in list pages.
set it up via a rule like:
entity.name = "Movie" and session.user.role <> "admin"
=>
extraRestrictingQualifier = {
"studio" = "session.user.studios";
} [er.directtoweb.ERDDelayedExtraQualifierAssignment]
then in your query page use sth like:
public EODataSource queryDataSource() {
EODataSource ds = super.queryDataSource();
if (ds != null && (ds instanceof EODatabaseDataSource)) {
EOFetchSpecification fs = ((EODatabaseDataSource)ds).fetchSpecification();
EOQualifier q = fs.qualifier();
EOQualifier extraQualifier = (EOQualifier)d2wContext().valueForKey("extraRestrictingQualifier");
if(q != null && extraQualifier != null) {
q = new EOAndQualifier(new NSArray(new Object[] {q, extraQualifier}));
} else if(extraQualifier != null) {
q = extraQualifier;
}
fs.setQualifier(q);
}
return ds;
}
This should guarantee that the user can only see the Movies that
are made by studios contained in his studio relationship.
- See Also:
- Serialized Form
log
public static final ERXLogger log
- logging support
ERDDelayedExtraQualifierAssignment
public ERDDelayedExtraQualifierAssignment(EOKeyValueUnarchiver u)
- Public constructor
- Parameters:
u
- key-value unarchiver used when unarchiving
from rule files.
ERDDelayedExtraQualifierAssignment
public ERDDelayedExtraQualifierAssignment(String key,
Object value)
- Public constructor
- Parameters:
key
- context keyvalue
- of the assignment
decodeWithKeyValueUnarchiver
public static Object decodeWithKeyValueUnarchiver(EOKeyValueUnarchiver eokeyvalueunarchiver)
- Static constructor required by the EOKeyValueUnarchiver
interface. If this isn't implemented then the default
behavior is to construct the first super class that does
implement this method. Very lame.
- Parameters:
eokeyvalueunarchiver
- to be unarchived
- Returns:
- decoded assignment of this class
qualifierForArray
protected EOQualifier qualifierForArray(String key,
NSArray objects)
qualifierForObject
protected EOQualifier qualifierForObject(String key,
Object object)
extraQualifier
protected EOQualifier extraQualifier(D2WContext c,
NSDictionary dict)
fireNow
public Object fireNow(D2WContext c)
- Description copied from class:
ERDDelayedAssignment
- Implemented by subclasses.
- Specified by:
fireNow
in class ERDDelayedAssignment
Copyright © 2002 – 2004 Project Wonder.