1 package org.campware.cream.modules.screens; 2 3 42 43 import org.apache.torque.util.Criteria; 44 45 import org.apache.velocity.context.Context; 46 47 import org.campware.cream.om.TurbineUser; 48 import org.campware.cream.om.TurbineUserPeer; 49 import org.campware.cream.om.TurbineRolePeer; 50 import org.campware.cream.om.CreamUser; 51 import org.campware.cream.om.CreamUserPeer; 52 53 57 public class UserForm extends CreamForm 58 { 59 protected void initScreen() 60 { 61 setModuleType(LOOKUP); 62 setModuleName("TURBINE_USER"); 63 setIdName(TurbineUserPeer.USER_ID); 64 setFormIdName("userid"); 65 } 66 67 protected boolean getEntry(Criteria criteria, Context context) 68 { 69 try 70 { 71 TurbineUser entry = (TurbineUser) TurbineUserPeer.doSelect(criteria).get(0); 72 73 Criteria prefcrit= new Criteria(); 74 prefcrit.add(CreamUserPeer.LOGIN_NAME, entry.getUserName()); 75 CreamUser prefs = (CreamUser) CreamUserPeer.doSelect(prefcrit).get(0); 76 77 context.put("entry", entry); 78 context.put("entryitems", entry.getTurbineUserGroupRoles()); 79 context.put("prefs", prefs); 80 return true; 81 } 82 catch (Exception e) 83 { 84 return false; 85 } 86 } 87 88 protected boolean getNew(Context context) 89 { 90 try 91 { 92 TurbineUser entry = new TurbineUser(); 93 CreamUser prefs = new CreamUser(); 94 context.put("entry", entry); 95 context.put("prefs", prefs); 96 97 return true; 98 } 99 catch (Exception e) 100 { 101 return false; 102 } 103 } 104 105 protected boolean getLookups(Context context) 106 { 107 try 108 { 109 Criteria rolecrit = new Criteria(); 110 rolecrit.add(TurbineRolePeer.ROLE_ID, 999, Criteria.GREATER_THAN); 111 rolecrit.addAscendingOrderByColumn(TurbineRolePeer.ROLE_NAME); 112 context.put("roles", TurbineRolePeer.doSelect(rolecrit)); 113 114 return true; 115 } 116 catch (Exception e) 117 { 118 return false; 119 } 120 } 121 122 123 } 124 | Popular Tags |