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 java.util.Locale; 019 020import org.ametys.cms.repository.Content; 021import org.ametys.cms.search.SearchField; 022import org.ametys.runtime.model.ViewItem; 023 024/** 025 * Represents a Field to be returned by a search. 026 * @deprecated Use {@link ViewItem} instead 027 */ 028@Deprecated 029public interface ResultField extends Field 030{ 031 032 /** 033 * Get the result field ID. 034 * @return the result field ID. 035 */ 036 String getId(); 037 038 /** 039 * Get the value represented by this field in the given result content. 040 * @param content the result content. 041 * @param defaultLocale the default locale for localized value if the content's language is null 042 * @return the content field value (cast to the appropriate object). 043 */ 044 Object getValue(Content content, Locale defaultLocale); 045 046 /** 047 * Get the value represented by this field in the given result content. 048 * @param content the result content. 049 * @param defaultLocale the default locale for localized value if the content's language is null 050 * @return the content field value (cast to the appropriate object). 051 */ 052 default Object getFullValue(Content content, Locale defaultLocale) 053 { 054 // Defaults to the same value. 055 return getValue(content, defaultLocale); 056 } 057 058 /** 059 * Get the {@link SearchField} representing this result field. 060 * @return The {@link SearchField} representing this result field. 061 */ 062 SearchField getSearchField(); 063}