001/*
002 * The contents of this file are subject to the terms of the Common Development and
003 * Distribution License (the License). You may not use this file except in compliance with the
004 * License.
005 *
006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
007 * specific language governing permission and limitations under the License.
008 *
009 * When distributing Covered Software, include this CDDL Header Notice in each file and include
010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
011 * Header, with the fields enclosed by brackets [] replaced by your own identifying
012 * information: "Portions Copyright [year] [name of copyright owner]".
013 *
014 * Copyright 2010 Sun Microsystems, Inc.
015 * Portions Copyright 2015 ForgeRock AS.
016 */
017
018package org.opends.guitools.controlpanel.event;
019
020import java.util.Collections;
021import java.util.HashSet;
022import java.util.Set;
023
024import org.opends.server.types.ObjectClass;
025
026/**
027 * This is the event sent to notify the changes made in the superiors of a given
028 * object class.  It is used mainly by the
029 * {@link
030 * org.opends.guitools.controlpanel.components.SuperiorObjectClassesEditor}
031 * class.  It is linked to the {@link SuperiorObjectClassesChangedListener}
032 * interface.
033 *
034 */
035public class SuperiorObjectClassesChangedEvent
036{
037  private Object source;
038  private Set<ObjectClass> newObjectClasses = new HashSet<>();
039
040  /**
041   * Constructor of the event.
042   * @param source the source of the event.
043   * @param newObjectClasses the set of new superior object classes.
044   */
045  public SuperiorObjectClassesChangedEvent(Object source,
046      Set<ObjectClass> newObjectClasses)
047  {
048    this.source = source;
049    this.newObjectClasses.addAll(newObjectClasses);
050  }
051
052  /**
053   * Returns the source of the object.
054   * @return the source of the object.
055   */
056  public Object getSource()
057  {
058    return source;
059  }
060
061  /**
062   * Returns the new superior object classes.
063   * @return the new superior object classes.
064   */
065  public Set<ObjectClass> getNewObjectClasses()
066  {
067    return Collections.unmodifiableSet(newObjectClasses);
068  }
069}