RoleResult.java :  » JMX » jfoxmx » javax » management » relation » Java Open Source

Java Open Source » JMX » jfoxmx 
jfoxmx » javax » management » relation » RoleResult.java
/* JFox, the OpenSource J2EE Application Server
 *
 * Copyright (C) 2002 huihoo.org
 * Distributable under GNU LGPL license
 * See the GNU Lesser General Public License for more details.
 */

package javax.management.relation;

import java.util.Iterator;
import java.io.Serializable;

/**
 * 
 * @author <a href="mailto:young_yy@hotmail.org">Young Yang</a>
 */

/**
 * Represents the result of a multiple access to several roles of a relation
 * (either for reading or writing).
 */
public class RoleResult implements Serializable {

  // List of roles successfully accessed
  private RoleList roleList = new RoleList();

  // List of roles unsuccessfully accessed
  private RoleUnresolvedList roleUnresList = new RoleUnresolvedList();

  /**
   * Constructor
   *
   * @param theRoleList  list of roles succesfully accessed
   * @param theRoleUnresList  list of roles not accessed (with problem
   * descriptions)
   */
  public RoleResult(RoleList theRoleList,RoleUnresolvedList theRoleUnresList) {
    setRoles(theRoleList);
    setRolesUnresolved(theRoleUnresList);
  }

  /**
   * Retrieves list of roles successfully accessed
   *
   * @return a RoleList
   */
  public RoleList getRoles() {
    return roleList;
  }

  /**
   * Retrieves list of roles unsuccessfully accessed
   *
   * @return a RoleUnresolvedList
   */
  public RoleUnresolvedList getRolesUnresolved() {
    return roleUnresList;
  }

  /**
   * Sets list of roles successfully accessed
   *
   * @param _roleList  list of roles successfully accessed
   */
  public void setRoles(RoleList _roleList) {
    if (_roleList == null) return;

    for (Iterator it = _roleList.iterator(); it.hasNext();) {
      Role currRole = (Role)(it.next());
      roleList.add((Role)(currRole.clone()));
    }
  }

  /**
   * Sets list of roles unsuccessfully accessed
   *
   * @param _roleUnresList  list of roles unsuccessfully accessed
   */
  public void setRolesUnresolved(RoleUnresolvedList _roleUnresList) {
    if(_roleUnresList == null) return;

    for (Iterator it = _roleUnresList.iterator(); it.hasNext();) {
      RoleUnresolved roleUnres = (RoleUnresolved)(it.next());
      roleUnresList.add((RoleUnresolved)(roleUnres.clone()));
    }
  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.