001/**
002 * Copyright 2005-2016 The Kuali Foundation
003 *
004 * Licensed under the Educational Community 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.opensource.org/licenses/ecl2.php
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.kuali.rice.kew.impl.document.search;
017
018import org.kuali.rice.kew.api.document.search.DocumentSearchCriteria;
019
020import java.util.Map;
021
022/**
023 * Handles translating between parameters submitted to the document search and {@link org.kuali.rice.kew.api.document.search.DocumentSearchCriteria}.
024 *
025 * @author Kuali Rice Team (rice.collab@kuali.org)
026 */
027public interface DocumentSearchCriteriaTranslator {
028
029    /**
030     * Translates the given map of fields values into a {@link org.kuali.rice.kew.api.document.search.DocumentSearchCriteria}.  The given map of
031     * field values is keyed based on the name of the field being submitted and the value represents that field value,
032     * which may contain wildcards and other logical operators supported by the KNS lookup framework.
033     *
034     * @param fieldValues the map of field names and values from which to populate the criteria
035     * @return populated document search criteria which contains the various criteria components populated based on the
036     * interpretation of the given field values
037     */
038    DocumentSearchCriteria translateFieldsToCriteria(Map<String, String> fieldValues);
039
040    /**
041     * Translates the given {@link org.kuali.rice.kew.api.document.search.DocumentSearchCriteria} into a map of fields values.  Reverse of
042     * {@link #translateFieldsToCriteria(java.util.Map)}
043     *
044     * @param criteria document search criteria
045     * @return Map populated with the various criteria components
046     */
047    Map<String, String[]> translateCriteriaToFields(DocumentSearchCriteria criteria);
048}