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