01: package org.manentia.kasai;
02:
03: import java.sql.ResultSet;
04: import java.sql.SQLException;
05: import java.util.ArrayList;
06: import java.util.Collection;
07:
08: /**
09: *
10: * @author fpena
11: *
12: */
13: public class AuthObject {
14:
15: private String id;
16:
17: private Collection objectsUsersRoles;
18:
19: private Collection objectsGroupsRoles;
20:
21: /** Creates a new instance of Object */
22: public AuthObject() {
23: objectsUsersRoles = new ArrayList();
24: objectsGroupsRoles = new ArrayList();
25: }
26:
27: public AuthObject(ResultSet rs) throws SQLException {
28: id = rs.getString("id");
29: }
30:
31: public String getId() {
32: return this .id;
33: }
34:
35: public void setId(String id) {
36: this .id = id;
37: }
38:
39: public Collection getObjectsUsersRoles() {
40: return objectsUsersRoles;
41: }
42:
43: public void setObjectsUsersRoles(Collection objectUserRole) {
44: this .objectsUsersRoles = objectUserRole;
45: }
46:
47: public void addObjectUserRole(ObjectUserRole objectUserRole) {
48: if (objectUserRole != null) {
49: if (!objectsUsersRoles.contains(objectUserRole)) {
50: this .objectsUsersRoles.add(objectUserRole);
51: }
52: }
53: }
54:
55: public void removeObjectUserRole(ObjectUserRole objectUserRole) {
56: if (objectUserRole != null) {
57: this .objectsUsersRoles.remove(objectUserRole);
58: }
59: }
60:
61: public Collection getObjectsGroupsRoles() {
62: return objectsGroupsRoles;
63: }
64:
65: public void setObjectsGroupsRoles(Collection objectGroupRole) {
66: this .objectsGroupsRoles = objectGroupRole;
67: }
68:
69: public void addObjectGroupRole(ObjectGroupRole objectGroupRole) {
70: if (objectGroupRole != null) {
71: if (!objectsGroupsRoles.contains(objectGroupRole)) {
72: this .objectsGroupsRoles.add(objectGroupRole);
73: }
74: }
75: }
76:
77: public void removeObjectGroupRole(ObjectGroupRole objectGroupRole) {
78: if (objectGroupRole != null) {
79: this .objectsGroupsRoles.remove(objectGroupRole);
80: }
81: }
82:
83: public boolean equals(java.lang.Object obj) {
84: boolean result = false;
85:
86: try {
87: if (obj instanceof AuthObject) {
88: if (((AuthObject) obj).getId().equals(this .id)) {
89: result = true;
90: }
91: }
92: } catch (Exception e) {
93: result = false;
94: }
95: return result;
96: }
97: }
|