001 /** 002 * Copyright (c) 2000-present Liferay, Inc. All rights reserved. 003 * 004 * This library is free software; you can redistribute it and/or modify it under 005 * the terms of the GNU Lesser General Public License as published by the Free 006 * Software Foundation; either version 2.1 of the License, or (at your option) 007 * any later version. 008 * 009 * This library is distributed in the hope that it will be useful, but WITHOUT 010 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 011 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 012 * details. 013 */ 014 015 package com.liferay.portlet.ratings.transformer; 016 017 import com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery; 018 import com.liferay.portal.kernel.exception.PortalException; 019 import com.liferay.portlet.ratings.RatingsType; 020 import com.liferay.portlet.ratings.model.RatingsEntry; 021 022 /** 023 * Provides an interface defining the transformations to be applied to the 024 * ratings data when the ratings type used by an entity is changed to use a 025 * different ratings type. 026 * 027 * <p> 028 * Implementations must be registered in the OSGI Registry. The portal invokes 029 * the highest ranking OSGI component implementing this interface when the 030 * ratings type of an entity is changed. 031 * </p> 032 * 033 * @author Roberto D??az 034 * @author Sergio Gonz??lez 035 */ 036 public interface RatingsDataTransformer { 037 038 /** 039 * Defines the transformations to be applied on a ratings entry when the 040 * ratings type is changed from the previous ratings type to the new ratings 041 * type. 042 * 043 * <p> 044 * This method returns an {@link ActionableDynamicQuery.PerformActionMethod} 045 * for operating on a {@link RatingsEntry} entity to transform its values 046 * based on when the ratings type is changed. 047 * </p> 048 * 049 * @param fromRatingsType the previous ratings type 050 * @param toRatingsType the final ratings type 051 * @return an {@link ActionableDynamicQuery.PerformActionMethod} with the 052 * actions to be applied to the ratings entry when the ratings type 053 * changes. 054 */ 055 public ActionableDynamicQuery.PerformActionMethod<RatingsEntry> 056 transformRatingsData( 057 final RatingsType fromRatingsType, 058 final RatingsType toRatingsType) 059 throws PortalException; 060 061 }