* into the database.
*/
public void doUpdate(RunData data, Context context)
throws Exception
{
TurbineRole entry = new TurbineRole();
data.getParameters().setProperties(entry);
ParameterParser pp= data.getParameters();
Enumeration paramKeys= pp.keys();
while(paramKeys.hasMoreElements()) {
String paramName = paramKeys.nextElement().toString();
if(paramName.startsWith("permissionid")) {
String suffix=paramName.substring(12, paramName.length());
TurbineRolePermission entryItem= new TurbineRolePermission();
entryItem.setPermissionId(pp.getInt("permissionid" + suffix));
entry.addTurbineRolePermission(entryItem);
}
}
entry.setModified(true);
entry.setNew(false);
Criteria crit = new Criteria();
crit.add(TurbineRolePermissionPeer.ROLE_ID, entry.getRoleId());
Connection conn = Transaction.begin(TurbineRolePeer.DATABASE_NAME);
boolean success = false;
try {
TurbineRolePermissionPeer.doDelete(crit, conn);
entry.save(conn);
Transaction.commit(conn);
success = true;
} finally {
if (!success) Transaction.safeRollback(conn);