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.right;
017
018import java.util.List;
019import java.util.Map;
020import java.util.Set;
021
022import org.ametys.core.ui.ClientSideElement;
023
024/**
025 * This interface represents a context of right assignment
026 */
027public interface RightAssignmentContext extends ClientSideElement
028{
029    /**
030     * Determines if this rights assignment context is a private context
031     * @return true if is private 
032     */
033    public boolean isPrivate();
034    
035    /**
036     * From a JavaScript context object, converts it into a Java object
037     * @param jsContext the JS context object
038     * @return the Java object
039     */
040    public Object convertJSContext(Object jsContext);
041    
042    /**
043     * Gets the identifier of the object context
044     * @param context The object context
045     * @return the identifier of the object context
046     */
047    public String getContextIdentifier(Object context);
048    
049    /**
050     * Get the parent contexts of the object context
051     * @param context The object context
052     * @return The parents if exist or <code>null</code> otherwise
053     */
054    public Set<Object> getParentContexts(Object context);
055    
056    /**
057     * Get the list of root contexts if the current workspace matches the allowed workspace
058     * @param contextParameters The contextual parameters
059     * @return The root context object in a list
060     */
061    public List<Object> getRootContexts(Map<String, Object> contextParameters);
062}