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.portal.kernel.service; 016 017 import aQute.bnd.annotation.ProviderType; 018 019 import com.liferay.exportimport.kernel.lar.PortletDataContext; 020 021 import com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery; 022 import com.liferay.portal.kernel.dao.orm.DynamicQuery; 023 import com.liferay.portal.kernel.dao.orm.ExportActionableDynamicQuery; 024 import com.liferay.portal.kernel.dao.orm.IndexableActionableDynamicQuery; 025 import com.liferay.portal.kernel.dao.orm.Projection; 026 import com.liferay.portal.kernel.exception.PortalException; 027 import com.liferay.portal.kernel.exception.SystemException; 028 import com.liferay.portal.kernel.model.EmailAddress; 029 import com.liferay.portal.kernel.model.PersistedModel; 030 import com.liferay.portal.kernel.model.SystemEventConstants; 031 import com.liferay.portal.kernel.search.Indexable; 032 import com.liferay.portal.kernel.search.IndexableType; 033 import com.liferay.portal.kernel.systemevent.SystemEvent; 034 import com.liferay.portal.kernel.transaction.Isolation; 035 import com.liferay.portal.kernel.transaction.Propagation; 036 import com.liferay.portal.kernel.transaction.Transactional; 037 import com.liferay.portal.kernel.util.OrderByComparator; 038 039 import java.io.Serializable; 040 041 import java.util.List; 042 043 /** 044 * Provides the local service interface for EmailAddress. Methods of this 045 * service will not have security checks based on the propagated JAAS 046 * credentials because this service can only be accessed from within the same 047 * VM. 048 * 049 * @author Brian Wing Shun Chan 050 * @see EmailAddressLocalServiceUtil 051 * @see com.liferay.portal.service.base.EmailAddressLocalServiceBaseImpl 052 * @see com.liferay.portal.service.impl.EmailAddressLocalServiceImpl 053 * @generated 054 */ 055 @ProviderType 056 @Transactional(isolation = Isolation.PORTAL, rollbackFor = { 057 PortalException.class, SystemException.class}) 058 public interface EmailAddressLocalService extends BaseLocalService, 059 PersistedModelLocalService { 060 /* 061 * NOTE FOR DEVELOPERS: 062 * 063 * Never modify or reference this interface directly. Always use {@link EmailAddressLocalServiceUtil} to access the email address local service. Add custom service methods to {@link com.liferay.portal.service.impl.EmailAddressLocalServiceImpl} and rerun ServiceBuilder to automatically copy the method declarations to this interface. 064 */ 065 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 066 public ActionableDynamicQuery getActionableDynamicQuery(); 067 068 public DynamicQuery dynamicQuery(); 069 070 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 071 public ExportActionableDynamicQuery getExportActionableDynamicQuery( 072 PortletDataContext portletDataContext); 073 074 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 075 public IndexableActionableDynamicQuery getIndexableActionableDynamicQuery(); 076 077 /** 078 * Adds the email address to the database. Also notifies the appropriate model listeners. 079 * 080 * @param emailAddress the email address 081 * @return the email address that was added 082 */ 083 @Indexable(type = IndexableType.REINDEX) 084 public EmailAddress addEmailAddress(EmailAddress emailAddress); 085 086 public EmailAddress addEmailAddress(long userId, 087 java.lang.String className, long classPK, java.lang.String address, 088 long typeId, boolean primary, ServiceContext serviceContext) 089 throws PortalException; 090 091 /** 092 * Creates a new email address with the primary key. Does not add the email address to the database. 093 * 094 * @param emailAddressId the primary key for the new email address 095 * @return the new email address 096 */ 097 public EmailAddress createEmailAddress(long emailAddressId); 098 099 /** 100 * Deletes the email address from the database. Also notifies the appropriate model listeners. 101 * 102 * @param emailAddress the email address 103 * @return the email address that was removed 104 */ 105 @Indexable(type = IndexableType.DELETE) 106 @SystemEvent(action = SystemEventConstants.ACTION_SKIP, type = SystemEventConstants.TYPE_DELETE) 107 public EmailAddress deleteEmailAddress(EmailAddress emailAddress); 108 109 /** 110 * Deletes the email address with the primary key from the database. Also notifies the appropriate model listeners. 111 * 112 * @param emailAddressId the primary key of the email address 113 * @return the email address that was removed 114 * @throws PortalException if a email address with the primary key could not be found 115 */ 116 @Indexable(type = IndexableType.DELETE) 117 public EmailAddress deleteEmailAddress(long emailAddressId) 118 throws PortalException; 119 120 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 121 public EmailAddress fetchEmailAddress(long emailAddressId); 122 123 /** 124 * Returns the email address with the matching UUID and company. 125 * 126 * @param uuid the email address's UUID 127 * @param companyId the primary key of the company 128 * @return the matching email address, or <code>null</code> if a matching email address could not be found 129 */ 130 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 131 public EmailAddress fetchEmailAddressByUuidAndCompanyId( 132 java.lang.String uuid, long companyId); 133 134 /** 135 * Returns the email address with the primary key. 136 * 137 * @param emailAddressId the primary key of the email address 138 * @return the email address 139 * @throws PortalException if a email address with the primary key could not be found 140 */ 141 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 142 public EmailAddress getEmailAddress(long emailAddressId) 143 throws PortalException; 144 145 /** 146 * Returns the email address with the matching UUID and company. 147 * 148 * @param uuid the email address's UUID 149 * @param companyId the primary key of the company 150 * @return the matching email address 151 * @throws PortalException if a matching email address could not be found 152 */ 153 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 154 public EmailAddress getEmailAddressByUuidAndCompanyId( 155 java.lang.String uuid, long companyId) throws PortalException; 156 157 /** 158 * Updates the email address in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 159 * 160 * @param emailAddress the email address 161 * @return the email address that was updated 162 */ 163 @Indexable(type = IndexableType.REINDEX) 164 public EmailAddress updateEmailAddress(EmailAddress emailAddress); 165 166 public EmailAddress updateEmailAddress(long emailAddressId, 167 java.lang.String address, long typeId, boolean primary) 168 throws PortalException; 169 170 /** 171 * @throws PortalException 172 */ 173 @Override 174 public PersistedModel deletePersistedModel(PersistedModel persistedModel) 175 throws PortalException; 176 177 @Override 178 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 179 public PersistedModel getPersistedModel(Serializable primaryKeyObj) 180 throws PortalException; 181 182 /** 183 * Returns the number of email addresses. 184 * 185 * @return the number of email addresses 186 */ 187 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 188 public int getEmailAddressesCount(); 189 190 /** 191 * Returns the OSGi service identifier. 192 * 193 * @return the OSGi service identifier 194 */ 195 public java.lang.String getOSGiServiceIdentifier(); 196 197 /** 198 * Performs a dynamic query on the database and returns the matching rows. 199 * 200 * @param dynamicQuery the dynamic query 201 * @return the matching rows 202 */ 203 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery); 204 205 /** 206 * Performs a dynamic query on the database and returns a range of the matching rows. 207 * 208 * <p> 209 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.EmailAddressModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. 210 * </p> 211 * 212 * @param dynamicQuery the dynamic query 213 * @param start the lower bound of the range of model instances 214 * @param end the upper bound of the range of model instances (not inclusive) 215 * @return the range of matching rows 216 */ 217 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start, 218 int end); 219 220 /** 221 * Performs a dynamic query on the database and returns an ordered range of the matching rows. 222 * 223 * <p> 224 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.EmailAddressModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. 225 * </p> 226 * 227 * @param dynamicQuery the dynamic query 228 * @param start the lower bound of the range of model instances 229 * @param end the upper bound of the range of model instances (not inclusive) 230 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) 231 * @return the ordered range of matching rows 232 */ 233 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start, 234 int end, OrderByComparator<T> orderByComparator); 235 236 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 237 public List<EmailAddress> getEmailAddresses(); 238 239 /** 240 * Returns a range of all the email addresses. 241 * 242 * <p> 243 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.EmailAddressModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. 244 * </p> 245 * 246 * @param start the lower bound of the range of email addresses 247 * @param end the upper bound of the range of email addresses (not inclusive) 248 * @return the range of email addresses 249 */ 250 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 251 public List<EmailAddress> getEmailAddresses(int start, int end); 252 253 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 254 public List<EmailAddress> getEmailAddresses(long companyId, 255 java.lang.String className, long classPK); 256 257 /** 258 * Returns the number of rows matching the dynamic query. 259 * 260 * @param dynamicQuery the dynamic query 261 * @return the number of rows matching the dynamic query 262 */ 263 public long dynamicQueryCount(DynamicQuery dynamicQuery); 264 265 /** 266 * Returns the number of rows matching the dynamic query. 267 * 268 * @param dynamicQuery the dynamic query 269 * @param projection the projection to apply to the query 270 * @return the number of rows matching the dynamic query 271 */ 272 public long dynamicQueryCount(DynamicQuery dynamicQuery, 273 Projection projection); 274 275 public void deleteEmailAddresses(long companyId, 276 java.lang.String className, long classPK); 277 }