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"; }; }
EOKeyValueArchiving._NullValueSupport, EOKeyValueArchiving._NumberSupport, EOKeyValueArchiving._TimestampSupport, EOKeyValueArchiving.Awaking, EOKeyValueArchiving.FinishInitialization, EOKeyValueArchiving.Support
Modifier and Type | Field and Description |
---|---|
static org.apache.log4j.Logger |
log
logging support
|
_CLASS
Constructor and Description |
---|
ERDDelayedExtraQualifierAssignment(EOKeyValueUnarchiver u)
Public constructor
|
ERDDelayedExtraQualifierAssignment(String key,
Object value)
Public constructor
|
Modifier and Type | Method and Description |
---|---|
static Object |
decodeWithKeyValueUnarchiver(EOKeyValueUnarchiver eokeyvalueunarchiver)
Static constructor required by the EOKeyValueUnarchiver
interface.
|
protected EOQualifier |
extraQualifier(com.webobjects.directtoweb.D2WContext c,
NSDictionary<String,Object> dict) |
Object |
fireNow(com.webobjects.directtoweb.D2WContext c)
Implemented by subclasses.
|
protected EOQualifier |
qualifierForArray(String key,
NSArray objects) |
protected EOQualifier |
qualifierForObject(String key,
NSDictionary object) |
protected EOQualifier |
qualifierForObject(String key,
Object object) |
protected EOQualifier |
qualifierForOperatorAndObject(String key,
String operatorKey,
Object value) |
fire
public ERDDelayedExtraQualifierAssignment(EOKeyValueUnarchiver u)
u
- key-value unarchiver used when unarchiving
from rule files.public static Object decodeWithKeyValueUnarchiver(EOKeyValueUnarchiver eokeyvalueunarchiver)
eokeyvalueunarchiver
- to be unarchivedprotected EOQualifier qualifierForArray(String key, NSArray objects)
protected EOQualifier qualifierForObject(String key, Object object)
protected EOQualifier qualifierForObject(String key, NSDictionary object)
protected EOQualifier qualifierForOperatorAndObject(String key, String operatorKey, Object value)
protected 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 – 2024 Project Wonder.