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-2016 ForgeRock AS. 016 */ 017package org.opends.guitools.controlpanel.event; 018 019import java.util.Collections; 020import java.util.HashSet; 021import java.util.Set; 022 023import org.forgerock.opendj.ldap.schema.ObjectClass; 024 025/** 026 * This is the event sent to notify the changes made in the superiors of a given object class. It is 027 * used mainly by the 028 * {@link org.opends.guitools.controlpanel.ui.components.SuperiorObjectClassesEditor} class. It is 029 * linked to the {@link SuperiorObjectClassesChangedListener} interface. 030 */ 031public class SuperiorObjectClassesChangedEvent 032{ 033 private Object source; 034 private Set<ObjectClass> newObjectClasses = new HashSet<>(); 035 036 /** 037 * Constructor of the event. 038 * @param source the source of the event. 039 * @param newObjectClasses the set of new superior object classes. 040 */ 041 public SuperiorObjectClassesChangedEvent(Object source, Set<ObjectClass> newObjectClasses) 042 { 043 this.source = source; 044 this.newObjectClasses.addAll(newObjectClasses); 045 } 046 047 /** 048 * Returns the source of the object. 049 * @return the source of the object. 050 */ 051 public Object getSource() 052 { 053 return source; 054 } 055 056 /** 057 * Returns the new superior object classes. 058 * @return the new superior object classes. 059 */ 060 public Set<ObjectClass> getNewObjectClasses() 061 { 062 return Collections.unmodifiableSet(newObjectClasses); 063 } 064}