01: /**
02: * Copyright (C) The MX4J Contributors.
03: * All rights reserved.
04: *
05: * This software is distributed under the terms of the MX4J License version 1.0.
06: * See the terms of the MX4J License in the documentation provided with this software.
07: */package javax.management.relation;
08:
09: import java.io.Serializable;
10: import java.util.Iterator;
11:
12: /**
13: * @version $Revision: 1.6 $
14: */
15: public class RoleResult implements Serializable {
16: private static final long serialVersionUID = -6304063118040985512L;
17:
18: private RoleList roleList;
19: private RoleUnresolvedList unresolvedRoleList;
20:
21: public RoleResult(RoleList roleList,
22: RoleUnresolvedList unresolvedList) {
23: setRoles(roleList);
24: setRolesUnresolved(unresolvedList);
25: }
26:
27: public RoleList getRoles() {
28: return roleList == null ? null : (RoleList) roleList.clone();
29: }
30:
31: public RoleUnresolvedList getRolesUnresolved() {
32: return unresolvedRoleList == null ? null
33: : (RoleUnresolvedList) unresolvedRoleList.clone();
34: }
35:
36: public void setRoles(RoleList list) {
37: if (list != null) {
38: if (roleList == null) {
39: roleList = new RoleList();
40: }
41: for (Iterator i = list.iterator(); i.hasNext();) {
42: Role currentRole = (Role) i.next();
43: roleList.add(currentRole.clone());
44: }
45: } else {
46: roleList = null;
47: }
48: }
49:
50: public void setRolesUnresolved(RoleUnresolvedList list) {
51: if (list != null) {
52: if (unresolvedRoleList == null) {
53: unresolvedRoleList = new RoleUnresolvedList();
54: }
55: for (Iterator i = list.iterator(); i.hasNext();) {
56: RoleUnresolved currentUnresolvedRole = (RoleUnresolved) i
57: .next();
58: unresolvedRoleList.add(currentUnresolvedRole.clone());
59: }
60: } else {
61: unresolvedRoleList = null;
62: }
63: }
64: }
|