01: /* JFox, the OpenSource J2EE Application Server
02: *
03: * Copyright (C) 2002 huihoo.org
04: * Distributable under GNU LGPL license
05: * See the GNU Lesser General Public License for more details.
06: */
07:
08: package javax.management.relation;
09:
10: import java.util.Iterator;
11: import java.io.Serializable;
12:
13: /**
14: *
15: * @author <a href="mailto:young_yy@hotmail.org">Young Yang</a>
16: */
17:
18: /**
19: * Represents the result of a multiple access to several roles of a relation
20: * (either for reading or writing).
21: */
22: public class RoleResult implements Serializable {
23:
24: // List of roles successfully accessed
25: private RoleList roleList = new RoleList();
26:
27: // List of roles unsuccessfully accessed
28: private RoleUnresolvedList roleUnresList = new RoleUnresolvedList();
29:
30: /**
31: * Constructor
32: *
33: * @param theRoleList list of roles succesfully accessed
34: * @param theRoleUnresList list of roles not accessed (with problem
35: * descriptions)
36: */
37: public RoleResult(RoleList theRoleList,
38: RoleUnresolvedList theRoleUnresList) {
39: setRoles(theRoleList);
40: setRolesUnresolved(theRoleUnresList);
41: }
42:
43: /**
44: * Retrieves list of roles successfully accessed
45: *
46: * @return a RoleList
47: */
48: public RoleList getRoles() {
49: return roleList;
50: }
51:
52: /**
53: * Retrieves list of roles unsuccessfully accessed
54: *
55: * @return a RoleUnresolvedList
56: */
57: public RoleUnresolvedList getRolesUnresolved() {
58: return roleUnresList;
59: }
60:
61: /**
62: * Sets list of roles successfully accessed
63: *
64: * @param _roleList list of roles successfully accessed
65: */
66: public void setRoles(RoleList _roleList) {
67: if (_roleList == null)
68: return;
69:
70: for (Iterator it = _roleList.iterator(); it.hasNext();) {
71: Role currRole = (Role) (it.next());
72: roleList.add((Role) (currRole.clone()));
73: }
74: }
75:
76: /**
77: * Sets list of roles unsuccessfully accessed
78: *
79: * @param _roleUnresList list of roles unsuccessfully accessed
80: */
81: public void setRolesUnresolved(RoleUnresolvedList _roleUnresList) {
82: if (_roleUnresList == null)
83: return;
84:
85: for (Iterator it = _roleUnresList.iterator(); it.hasNext();) {
86: RoleUnresolved roleUnres = (RoleUnresolved) (it.next());
87: roleUnresList.add((RoleUnresolved) (roleUnres.clone()));
88: }
89: }
90: }
|