Hi all. My colleague Leonard and I have been experimenting with
porting Helm to the Turbine Peer system. As of yet, I have not found
a clear way to distinguish whether static factory methods for
instantiating business objects corresponding to existing database
entries should live in subclasses of BasePeer or subclasses of
BaseObject. Here's an example that gets a User for a specific Domain
by login name. Both classes mentioned are BaseObject subclasses. The
getFirstBO() method just grabs the first BaseObject implementation
from the Vector returned by doSelect(Criteria), or throws a
DoesNotExist exception if there is no first element:
/**
* Returns the user for a specified domain and login name.
*/
public static User getInstanceByLoginName(Domain domain, String name)
throws DoesNotExist, Exception
{
Criteria c = new Criteria()
.add(UserPeer.LOGIN_NAME, name);
checkThisAndHostDomain(c, domain);
return (User)PeerTool.getFirstBO(UserPeer.doSelect(c),
"User with login name of " + name,
domain);
}
I'd like to hear thoughts on this from anyone else using the Peer system.
--
Daniel Rall <[EMAIL PROTECTED]>
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]