1 package de.webman.acl; 2 3 import com.teamkonzept.lib.TKException; 4 import com.teamkonzept.lib.TKVector; 5 import de.webman.acl.db.*; 6 import com.teamkonzept.webman.mainint.WebmanExceptionHandler; 7 8 15 public class ProfileFactory 16 implements ObjectFactory 17 { 18 19 21 23 26 private static ProfileFactory SINGLETON = null; 27 28 29 31 34 private LoginFactory factory = null; 35 36 37 39 44 private ProfileFactory (LoginFactory factory) 45 throws TKException 46 { 47 this.factory = factory; 48 } 49 50 51 53 59 public static synchronized final ProfileFactory getInstance () 60 throws TKException 61 { 62 if (SINGLETON == null) 63 { 64 SINGLETON = new ProfileFactory(LoginFactory.getInstance()); 65 } 66 67 return SINGLETON; 68 } 69 70 71 73 78 public final void configurationChanged () 79 throws TKException 80 { 81 this.factory.configurationChanged(); 82 } 83 84 91 public final WMObject getObject (Integer id) 92 throws TKException 93 { 94 return this.factory.getObject(id); 95 } 96 97 103 public final TKVector getObjects () 104 throws TKException 105 { 106 return this.factory.getObjects(getObjectIDs()); 107 } 108 109 116 public TKVector getObjects (TKVector ids) 117 throws TKException 118 { 119 return this.factory.getObjects(ids); 120 } 121 122 128 public TKVector getObjectIDs () 129 throws TKException 130 { 131 TKVector proxies = null; 132 133 try 134 { 135 LoginDBData data = new LoginDBData(null, null, null, LoginDBInterface.TYPE_PROFILE); 137 data.setQuery(LoginDBInterface.WM_USER_SELECT_BY_TYPE); 138 data.setPrototype(new ObjectCollectionDBData(null, 139 null, 140 LoginDBInterface.PRIMARY_KEY_NAME, 141 null)); 142 143 proxies = getObjectIDs(data); 145 } 146 catch (Exception x) 147 { 148 throw WebmanExceptionHandler.getException(x); 149 } 150 151 return proxies; 152 } 153 154 161 public final TKVector getObjectIDs (ObjectDBData data) 162 throws TKException 163 { 164 return this.factory.getObjectIDs(data); 165 } 166 167 174 public final TKVector getObjectAssociations (WMObject object) 175 throws TKException 176 { 177 return this.factory.getObjectAssociations(object); 178 } 179 180 187 public final WMObject createObject (ObjectDBData data) 188 throws TKException 189 { 190 return this.factory.createObject(data); 191 } 192 193 199 public final void modifyObject (WMObject object) 200 throws TKException 201 { 202 this.factory.modifyObject(object); 203 } 204 205 211 public final void deleteObject (WMObject object) 212 throws TKException 213 { 214 this.factory.deleteObject(object); 215 } 216 217 218 220 227 public final Profile getProfile (Integer id) 228 throws TKException 229 { 230 return (Profile) getObject(id); 231 } 232 233 239 public final TKVector getProfiles () 240 throws TKException 241 { 242 return getObjects(); 243 } 244 245 253 public final Profile createProfile (String login, 254 String name) 255 throws TKException 256 { 257 this.factory.checkLogin(login); 259 260 return (Profile) createObject(new LoginDBData(null, 262 login, 263 name, 264 LoginDBInterface.TYPE_PROFILE)); 265 } 266 267 273 public final void modifyProfile (Profile profile) 274 throws TKException 275 { 276 modifyObject(profile); 277 } 278 279 285 public final void deleteProfile (Profile profile) 286 throws TKException 287 { 288 deleteObject(profile); 289 } 290 291 } 292 | Popular Tags |