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