1 /** 2 * Copyright 2005-2014 The Kuali Foundation 3 * 4 * Licensed under the Educational Community License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.opensource.org/licenses/ecl2.php 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package org.kuali.rice.kew.useroptions; 17 18 import java.util.Collection; 19 import java.util.List; 20 import java.util.Map; 21 22 /** 23 * Sits on top of the UserOptionsTable and manages certain aspects of action list refresh behaviors. 24 * This service could probably be broken up and it's dao put somewhere else and injected in the appropriate places. 25 * 26 * @author Kuali Rice Team (rice.collab@kuali.org) 27 */ 28 public interface UserOptionsService { 29 30 /** 31 * Finds {@link UserOptions} for the given workflow id. 32 * @param principalId the workflow id to search by 33 * @return a collection of {@link UserOptions} or an empty collection if no results were found. 34 */ 35 Collection<UserOptions> findByWorkflowUser(String principalId); 36 37 /** 38 * Finds a collection of {@link UserOptions} for the given principal id and search string. 39 * @param principalId the workflow id. 40 * @param likeString the option id search string. 41 * @return A {@link List} of {@link UserOptions} or an empty collection if no results are found. 42 */ 43 List<UserOptions> findByUserQualified(String principalId, String likeString); 44 45 /** 46 * Persists the given {@link UserOptions} to the datasource. 47 * @param userOptions the {@link UserOptions} to persist to the datasource 48 */ 49 void save(UserOptions userOptions); 50 51 /** 52 * This overridden method saves an option for each optionsMap entry, all for the given principalId. 53 * @param principalId the unique identifier 54 * @param optionsMap a {@link Map} of user options keyed with option ids 55 */ 56 void save(String principalId, Map<String, String> optionsMap); 57 58 /** 59 * Combines the given parameters into an {@link UserOptions} and persists the object to the datasource. 60 * @param principalId the principal id to persist to the datasource 61 * @param optionId the option id to persist to the datasource 62 * @param optionValue the option value to persist to the datasource 63 */ 64 void save(String principalId, String optionId, String optionValue); 65 66 /** 67 * Removes the given {@link UserOptions} from the underlining datasource. 68 * @param userOptions the {@link UserOptions} to delete 69 */ 70 void deleteUserOptions(UserOptions userOptions); 71 72 /** 73 * Find a {@link UserOptions} for the given option id and principal id. 74 * @param optionId the option id to search by. 75 * @param principalId the workflow id to search by 76 * @return a {@link UserOptions} or null if no results are found. 77 */ 78 UserOptions findByOptionId(String optionId, String principalId); 79 80 /** 81 * Finds a {@link List} of {@link UserOptions} for the given email setting. 82 * @param emailSetting the option value to search by. 83 * @return a {@link List} of {@link UserOptions} or an empty collection if no results are found. 84 */ 85 List<UserOptions> retrieveEmailPreferenceUserOptions(String emailSetting); 86 }