01: package org.osbl.authorization.gui;
02:
03: import org.osbl.client.wings.form.*;
04: import org.osbl.persistence.*;
05: import org.osbl.ServiceProvider;
06: import org.osbl.authorization.model.Profile;
07: import org.conform.hibernate.HibernateEnvironment;
08:
09: public class ProfileEditor extends GenericObjectEditor {
10: Persistence persistence = (Persistence) ServiceProvider
11: .getInstance().getService("AuthorizationPersistence");
12:
13: protected ObjectForm initializeForm() {
14: return new ProfileForm();
15: }
16:
17: protected ObjectList initializeList() {
18: return new ProfileList();
19: }
20:
21: public Class getType() {
22: return Profile.class;
23: }
24:
25: public void saveObject(Object object) {
26: SaveOrUpdateCommand command = (SaveOrUpdateCommand) persistence
27: .createCommand("save");
28: command.setObject(object);
29: try {
30: HibernateEnvironment.getInstance().beginTransaction();
31: command.execute();
32: } finally {
33: HibernateEnvironment.getInstance().endTransaction();
34: }
35: }
36:
37: public void deleteObject(Object object) {
38: DeleteCommand command = (DeleteCommand) persistence
39: .createCommand("delete");
40: command.setObject(object);
41: try {
42: HibernateEnvironment.getInstance().beginTransaction();
43: command.execute();
44: } finally {
45: HibernateEnvironment.getInstance().endTransaction();
46: }
47: }
48:
49: public void revertObject(Object object) {
50: RevertCommand command = (RevertCommand) persistence
51: .createCommand("revert");
52: command.setObject(object);
53: try {
54: HibernateEnvironment.getInstance().beginTransaction();
55: command.execute();
56: } finally {
57: HibernateEnvironment.getInstance().endTransaction();
58: }
59: }
60: }
|