How this works depends a bit on if you're working in a decorator or
you're working directly with Transfer. Within a decorator
You can do:
Query = Transfer.createQuery("from foo where fooID NOT IN (:list)");
Query.setParam("list","1,2,3,4,5");
myData = transfer.listByQuery(Query);
Or you can do:
// Fetch all foo records for Users belonging to Role 5
Query = Transfer.createQuery("from foo where userID NOT IN (select
UserID from user join role where roleID = 5)");
myData = transfer.listByQuery(Query);
Note that this could be shortened to:
// Fetch all foo records for Users belonging to Role 5
myData = transfer.listByQuery(Transfer.createQuery("from foo where
userID NOT IN (select UserID from user join role where roleID = 5)"));
In order to use getByPropertyMap(), you have to at least do:
Transfer.listByProperty(className="foo",propertyMap = {fooID=1});
It's not that much shorter, and adding things like operator support
would make the input parameters that much more verbose, so in essence
you wouldn't save anything!
There's no need to create additional CFCs for any reason here. This
can be used when talking directly to Transfer but it could also be
used from within a decorator... so it covers service layer objects as
well as domain objects (Decorators).
I've always looked at this like getByPropertyMap(struct) is great for
specific, common tasks. For anything more complex than just the basic
functionality it provides, you need to use a query. For the extra
line or two it adds, it also adds all the power of TQL and creating
some sort of intermediate handling for getByPropertyMap() just
doesn't make sense to me. The tools to do the job are already
provided. With all the other more important features that Transfer
needs, I just don't think this is particularly important.
Alternately, if you really crave this sort of syntactic sugar, it
wouldn't be hard to build your own function that takes a struct in
and does the job for you:
props = {
object="foo",
propertyMap= {
{"fooID"=":list",operator="in",mappedValue="1,2,3,4,5"}
}
};
myData = Transfer.listByPropertyMap(argumentCollection=props);
If you compare the two, you'd actually be getting less bang for more
buck by trying to use getByPropertyMap() for more advanced queries.
The code to create the propertyMap would have to be, using the most
concise notation available, really quite verbose...
Laterz,
J
On Nov 10, 2008, at 11:22 AM, Jorge Loyo wrote:
>
> Chris,
>
> Thank you.
>
>> you can do listByQuery( TQL ) and pass in a TQL statement object
>
> I guess I was trying to see if there was a way to have transfer handle
> "all" basic/common query transactions (Like, In, Not In, etc.) without
> having to resort to creating additional code or perhaps additional
> CFCs... specially if it's just a simple data retrieval with no real
> custom code... Am I making sense?
--~--~---------~--~----~------------~-------~--~----~
Before posting questions to the group please read:
http://groups.google.com/group/transfer-dev/web/how-to-ask-support-questions-on-transfer
You received this message because you are subscribed to the Google Groups
"transfer-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/transfer-dev?hl=en
-~----------~----~----~----~------~----~------~--~---