* Builds a criteria object based upon an User object
*/
public static Criteria buildCriteria(User user)
{
Hashtable permData = (Hashtable) user.getPermStorage().clone();
Criteria criteria = new Criteria();
if ( !((BaseObject)user).isNew() )
{
criteria.add(USER_ID, ((BaseObject)user).getPrimaryKey());
}
for (int i=1; i<TurbineUserPeer.columnNames.length; i++ )
{
if ( permData.containsKey(TurbineUserPeer.columnNames[i]) )
{
criteria.add( TurbineUserPeer.criteriaKeys[i],
permData.remove(TurbineUserPeer.columnNames[i]) );
}
}
criteria.add( TurbineUserPeer.OBJECT_DATA, permData );
return criteria;
}