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 org.slf4j.Logger; 019import org.xml.sax.ContentHandler; 020import org.xml.sax.SAXException; 021 022import org.ametys.plugins.repository.AmetysObject; 023import org.ametys.web.frontoffice.search.requesttime.SearchComponentArguments; 024 025/** 026 * An object returned by {@link Returnable#getSaxer} to SAX hits (results) 027 */ 028public interface ReturnableSaxer 029{ 030 /** 031 * Returns <code>true</code> if this saxer is able to SAX the given search hit 032 * @param hit The search hit 033 * @param logger A logger 034 * @param args The other arguments 035 * @return <code>true</code> if this saxer is able to SAX the given search hit 036 */ 037 boolean canSax(AmetysObject hit, Logger logger, SearchComponentArguments args); 038 039 /** 040 * SAX the given search hit 041 * @param contentHandler The content handler 042 * @param hit The search hit 043 * @param logger A logger 044 * @param args The other arguments 045 * @throws SAXException if a SAX error occured 046 */ 047 void sax(ContentHandler contentHandler, AmetysObject hit, Logger logger, SearchComponentArguments args) throws SAXException; 048}