public class ERDDelayedExtraQualifierAssignment extends ERDDelayedAssignment
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. If the value is null, then this
qualifier will not be added. To search for NULL, return
NSKeyValueCoding.NullValue.{ "id" = { "ne" = "object.id"; }; "startDateTime" = { "lt" = "object.startDateTime"; }; }
com.webobjects.eocontrol.EOKeyValueArchiving._NullValueSupport, com.webobjects.eocontrol.EOKeyValueArchiving._NumberSupport, com.webobjects.eocontrol.EOKeyValueArchiving._TimestampSupport, com.webobjects.eocontrol.EOKeyValueArchiving.Awaking, com.webobjects.eocontrol.EOKeyValueArchiving.FinishInitialization, com.webobjects.eocontrol.EOKeyValueArchiving.Support
Constructor and Description |
---|
ERDDelayedExtraQualifierAssignment(com.webobjects.eocontrol.EOKeyValueUnarchiver u)
Public constructor
|
ERDDelayedExtraQualifierAssignment(String key,
Object value)
Public constructor
|
Modifier and Type | Method and Description |
---|---|
static Object |
decodeWithKeyValueUnarchiver(com.webobjects.eocontrol.EOKeyValueUnarchiver eokeyvalueunarchiver)
Static constructor required by the EOKeyValueUnarchiver
interface.
|
protected com.webobjects.eocontrol.EOQualifier |
extraQualifier(com.webobjects.directtoweb.D2WContext c,
NSDictionary<String,Object> dict) |
Object |
fireNow(com.webobjects.directtoweb.D2WContext c)
Implemented by subclasses.
|
protected com.webobjects.eocontrol.EOQualifier |
qualifierForArray(String key,
NSArray objects) |
protected com.webobjects.eocontrol.EOQualifier |
qualifierForObject(String key,
NSDictionary object) |
protected com.webobjects.eocontrol.EOQualifier |
qualifierForObject(String key,
Object object) |
protected com.webobjects.eocontrol.EOQualifier |
qualifierForOperatorAndObject(String key,
String operatorKey,
Object value) |
fire
public static final Logger log
public ERDDelayedExtraQualifierAssignment(com.webobjects.eocontrol.EOKeyValueUnarchiver u)
u
- key-value unarchiver used when unarchiving
from rule files.public static Object decodeWithKeyValueUnarchiver(com.webobjects.eocontrol.EOKeyValueUnarchiver eokeyvalueunarchiver)
eokeyvalueunarchiver
- to be unarchivedprotected com.webobjects.eocontrol.EOQualifier qualifierForArray(String key, NSArray objects)
protected com.webobjects.eocontrol.EOQualifier qualifierForObject(String key, Object object)
protected com.webobjects.eocontrol.EOQualifier qualifierForObject(String key, NSDictionary object)
protected com.webobjects.eocontrol.EOQualifier qualifierForOperatorAndObject(String key, String operatorKey, Object value)
protected com.webobjects.eocontrol.EOQualifier extraQualifier(com.webobjects.directtoweb.D2WContext c, NSDictionary<String,Object> dict)
public Object fireNow(com.webobjects.directtoweb.D2WContext c)
ERDDelayedAssignment
fireNow
in class ERDDelayedAssignment
Copyright © 2002 – 2020 Project Wonder.