001: /***************************************************************
002: * This file is part of the [fleXive](R) project.
003: *
004: * Copyright (c) 1999-2008
005: * UCS - unique computing solutions gmbh (http://www.ucs.at)
006: * All rights reserved
007: *
008: * The [fleXive](R) project is free software; you can redistribute
009: * it and/or modify it under the terms of the GNU General Public
010: * License as published by the Free Software Foundation;
011: * either version 2 of the License, or (at your option) any
012: * later version.
013: *
014: * The GNU General Public License can be found at
015: * http://www.gnu.org/copyleft/gpl.html.
016: * A copy is found in the textfile GPL.txt and important notices to the
017: * license from the author are found in LICENSE.txt distributed with
018: * these libraries.
019: *
020: * This library is distributed in the hope that it will be useful,
021: * but WITHOUT ANY WARRANTY; without even the implied warranty of
022: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
023: * GNU General Public License for more details.
024: *
025: * For further information about UCS - unique computing solutions gmbh,
026: * please see the company website: http://www.ucs.at
027: *
028: * For further information about [fleXive](R), please see the
029: * project website: http://www.flexive.org
030: *
031: *
032: * This copyright notice MUST APPEAR in all copies of the file!
033: ***************************************************************/package com.flexive.shared.interfaces;
034:
035: import com.flexive.shared.exceptions.FxApplicationException;
036: import com.flexive.shared.search.ResultLocation;
037: import com.flexive.shared.search.ResultPreferences;
038: import com.flexive.shared.search.ResultViewType;
039:
040: import javax.ejb.Remote;
041:
042: /**
043: * Interface for retrieving and updating the displayed result properties.
044: *
045: * @author Daniel Lichtenberger (daniel.lichtenberger@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)
046: * @version $Rev: 181 $
047: */
048: @Remote
049: public interface ResultPreferencesEngine {
050:
051: /**
052: * Loads the result preferences for the given type for the current user. When no preferences are
053: * defined for the given parameters, the default preferences are returned.
054: *
055: * @param typeId the content type ID, or -1 for the "overall" properties
056: * @param viewType the view type (list, thumbs)
057: * @param location the "location" where the results will be displayed (e.g. the main admin result pages)
058: * @return the result preferences for the given type for the current user.
059: * @throws com.flexive.shared.exceptions.FxApplicationException if the result preferences could not be loaded
060: */
061: ResultPreferences load(long typeId, ResultViewType viewType,
062: ResultLocation location) throws FxApplicationException;
063:
064: /**
065: * Returns true when the user actually stored a configuration for the given parameters. Used to check
066: * if fallbacks were used when loading preferences via {@link #load}.
067: *
068: * @param typeId the content type ID, or -1 for the "overall" properties
069: * @param viewType the view type (list, thumbs)
070: * @param location the "location" where the results will be displayed (e.g. the main admin result pages)
071: * @return true when the user actually stored a configuration for the given parameters
072: * @throws FxApplicationException on errors
073: */
074: boolean isCustomized(long typeId, ResultViewType viewType,
075: ResultLocation location) throws FxApplicationException;
076:
077: /**
078: * Save the given result preferences for the current user.
079: *
080: * @param preferences the preferences to be saved
081: * @param typeId the content type ID
082: * @param viewType the view type (list, thumbs)
083: * @param location the "location" where the results will be displayed
084: * @throws FxApplicationException if the result preferences could not be updated
085: */
086: void save(ResultPreferences preferences, long typeId,
087: ResultViewType viewType, ResultLocation location)
088: throws FxApplicationException;
089:
090: /**
091: * Save the given result preferences as the default settings for the given type, viewtype, and location.
092: * Only the global supervisor can do this.
093: *
094: * @param preferences the preferences to be saved
095: * @param typeId the content type ID
096: * @param viewType the view type (list, thumbs)
097: * @param location the "location" where the results will be displayed
098: * @throws FxApplicationException if the result preferences could not be updated
099: */
100: void saveDefaultPreferences(ResultPreferences preferences,
101: long typeId, ResultViewType viewType,
102: ResultLocation location) throws FxApplicationException;
103:
104: /**
105: * Remove the current user's preferences for the given parameters. If no preferences exist
106: * for the given parameters, no action is performed.
107: *
108: * @param typeId the content type ID, or -1 for the "overall" properties
109: * @param viewType the view type (list, thumbs)
110: * @param location the "location" where the results will be displayed (e.g. the main admin result pages)
111: * @throws FxApplicationException if the user's preferences could not be removed
112: */
113: void remove(long typeId, ResultViewType viewType,
114: ResultLocation location) throws FxApplicationException;
115: }
|