001/* 002 * Copyright 2016 Anyware Services 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.ametys.core.group.directory; 017 018import org.ametys.core.group.InvalidModificationException; 019import org.ametys.core.group.ModifiableGroup; 020 021/** 022 * Abstraction for a modifiable directory of group. 023 */ 024public interface ModifiableGroupDirectory extends GroupDirectory 025{ 026 @Override 027 public ModifiableGroup getGroup(String groupID); 028 029 /** 030 * Add a new group of users. 031 * @param name The name of the user group to create. Cannot be null; 032 * @return The user group created 033 * @throws InvalidModificationException if the group id exists yet or 034 * if at least one of the parameter is invalid. 035 */ 036 public ModifiableGroup add(String name) throws InvalidModificationException; 037 038 /** 039 * Modify an existing group of users. 040 * @param userGroup Informations about the new group. Cannot be null: 041 * @throws InvalidModificationException if the group id does not exist yet 042 */ 043 public void update(ModifiableGroup userGroup) throws InvalidModificationException; 044 045 /** 046 * Remove a group of users. 047 * @param groupID The id of the group. Cannot be null; 048 * @throws InvalidModificationException if the group id does not exist. 049 */ 050 public void remove(String groupID) throws InvalidModificationException; 051}