001/* 002 * Copyright 2018 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.web.frontoffice.search.metamodel; 017 018import java.util.Optional; 019 020import org.ametys.cms.search.SearchField; 021import org.ametys.runtime.i18n.I18nizableText; 022 023/** 024 * A potential facet proposed to the creator of an instance of search service. 025 */ 026public interface FacetDefinition 027{ 028 /** 029 * Gets the id of the facet. It must be unique across all facet definitions 030 * @return the unique id of the facet 031 */ 032 String getId(); 033 034 /** 035 * Gets the label of the facet. 036 * @return the label of the facet. 037 */ 038 I18nizableText getLabel(); 039 040 /** 041 * Gets the search field of this facet 042 * @return the search field of this facet 043 */ 044 SearchField getSearchField(); 045 046 /** 047 * Gets the label of a facet value 048 * @param value the facet value 049 * @param currentLang the current lang 050 * @return the label of a facet value 051 */ 052 I18nizableText getFacetLabel(String value, String currentLang); 053 054 /** 055 * Gets the ({@link Returnable}) the facet belongs to. 056 * @return the ({@link Returnable}) the facet belongs to. 057 */ 058 Optional<Returnable> getReturnable(); 059}