001/*
002 *  Licensed to the Apache Software Foundation (ASF) under one
003 *  or more contributor license agreements.  See the NOTICE file
004 *  distributed with this work for additional information
005 *  regarding copyright ownership.  The ASF licenses this file
006 *  to you under the Apache License, Version 2.0 (the
007 *  "License"); you may not use this file except in compliance
008 *  with the License.  You may obtain a copy of the License at
009 *
010 *        http://www.apache.org/licenses/LICENSE-2.0
011 *
012 *  Unless required by applicable law or agreed to in writing,
013 *  software distributed under the License is distributed on an
014 *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 *  KIND, either express or implied.  See the License for the
016 *  specific language governing permissions and limitations
017 *  under the License.
018 */
019package org.apache.isis.viewer.restfulobjects.rendering;
020
021import java.util.List;
022
023import org.apache.isis.applib.annotation.Render;
024import org.apache.isis.applib.annotation.Where;
025import org.apache.isis.applib.profiles.Localization;
026import org.apache.isis.core.commons.authentication.AuthenticationSession;
027import org.apache.isis.core.commons.config.IsisConfiguration;
028import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
029import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
030import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
031import org.apache.isis.viewer.restfulobjects.rendering.domainobjects.DomainObjectReprRenderer;
032
033public interface RendererContext {
034
035    public String urlFor(final String url);
036
037    public AuthenticationSession getAuthenticationSession();
038    
039    public IsisConfiguration getConfiguration();
040    
041    public AdapterManager getAdapterManager();
042
043    public PersistenceSession getPersistenceSession();
044    
045    public List<List<String>> getFollowLinks();
046    
047    public Where getWhere();
048    
049    public Localization getLocalization();
050    
051    /**
052     * To avoid infinite loops when {@link Render.Type#EAGERLY eagerly} rendering graphs
053     * of objects as {@link DomainObjectReprRenderer#asEventSerialization() events}.
054     * 
055     * <p>
056     * @param objectAdapter - the object proposed to be rendered eagerly 
057     * @return whether this adapter has already been rendered (implying the caller should not render the value).
058     */
059    public boolean canEagerlyRender(ObjectAdapter objectAdapter);
060
061}