001/*
002 *  Copyright 2015 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.cms.search.model;
017
018import org.ametys.cms.data.ametysobject.ModelAwareDataAwareAmetysObject;
019import org.ametys.cms.model.properties.Property;
020
021/**
022 * Represents a universal property of a supported {@link ModelAwareDataAwareAmetysObject}
023 * Ex: content types, language or current workflow steps are some system properties supporting contents
024 * @param <T> type of the property values
025 * @param <X> type of ametys object supported by this property
026 */
027public interface SystemProperty<T, X extends ModelAwareDataAwareAmetysObject> extends Property<T, X>
028{
029    /**
030     * Get if the property can be displayed (i.e. used in a ResultField).
031     * @return <code>true</code> if the property can be displayed, <code>false</code> otherwise.
032     */
033    public default boolean isDisplayable()
034    {
035        // Default to true: override when the property is not displayable.
036        return true;
037    }
038    
039    /**
040     * Get the renderer.
041     * @return The column renderer.
042     */
043    public default String getRenderer()
044    {
045        return null;
046    }
047    
048    /**
049     * Get the property column converter.
050     * @return The property column converter.
051     */
052    public default String getConverter()
053    {
054        return null;
055    }
056    
057    /**
058     * Get the column width.
059     * @return the default column width, can be null.
060     */
061    public default Integer getColumnWidth()
062    {
063        return null;
064    }
065}