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.Address;
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 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            @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 address to the database. Also notifies the appropriate model listeners.
079            *
080            * @param address the address
081            * @return the address that was added
082            */
083            @Indexable(type = IndexableType.REINDEX)
084            public Address addAddress(Address address);
085    
086            public Address addAddress(long userId, java.lang.String className,
087                    long classPK, java.lang.String street1, java.lang.String street2,
088                    java.lang.String street3, java.lang.String city, java.lang.String zip,
089                    long regionId, long countryId, long typeId, boolean mailing,
090                    boolean primary, ServiceContext serviceContext)
091                    throws PortalException;
092    
093            /**
094            * Creates a new address with the primary key. Does not add the address to the database.
095            *
096            * @param addressId the primary key for the new address
097            * @return the new address
098            */
099            public Address createAddress(long addressId);
100    
101            /**
102            * Deletes the address from the database. Also notifies the appropriate model listeners.
103            *
104            * @param address the address
105            * @return the address that was removed
106            */
107            @Indexable(type = IndexableType.DELETE)
108            @SystemEvent(action = SystemEventConstants.ACTION_SKIP, type = SystemEventConstants.TYPE_DELETE)
109            public Address deleteAddress(Address address);
110    
111            /**
112            * Deletes the address with the primary key from the database. Also notifies the appropriate model listeners.
113            *
114            * @param addressId the primary key of the address
115            * @return the address that was removed
116            * @throws PortalException if a address with the primary key could not be found
117            */
118            @Indexable(type = IndexableType.DELETE)
119            public Address deleteAddress(long addressId) throws PortalException;
120    
121            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
122            public Address fetchAddress(long addressId);
123    
124            /**
125            * Returns the address with the matching UUID and company.
126            *
127            * @param uuid the address's UUID
128            * @param companyId the primary key of the company
129            * @return the matching address, or <code>null</code> if a matching address could not be found
130            */
131            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
132            public Address fetchAddressByUuidAndCompanyId(java.lang.String uuid,
133                    long companyId);
134    
135            /**
136            * Returns the address with the primary key.
137            *
138            * @param addressId the primary key of the address
139            * @return the address
140            * @throws PortalException if a address with the primary key could not be found
141            */
142            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
143            public Address getAddress(long addressId) throws PortalException;
144    
145            /**
146            * Returns the address with the matching UUID and company.
147            *
148            * @param uuid the address's UUID
149            * @param companyId the primary key of the company
150            * @return the matching address
151            * @throws PortalException if a matching address could not be found
152            */
153            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
154            public Address getAddressByUuidAndCompanyId(java.lang.String uuid,
155                    long companyId) throws PortalException;
156    
157            /**
158            * Updates the address in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
159            *
160            * @param address the address
161            * @return the address that was updated
162            */
163            @Indexable(type = IndexableType.REINDEX)
164            public Address updateAddress(Address address);
165    
166            public Address updateAddress(long addressId, java.lang.String street1,
167                    java.lang.String street2, java.lang.String street3,
168                    java.lang.String city, java.lang.String zip, long regionId,
169                    long countryId, long typeId, boolean mailing, boolean primary)
170                    throws PortalException;
171    
172            /**
173            * @throws PortalException
174            */
175            @Override
176            public PersistedModel deletePersistedModel(PersistedModel persistedModel)
177                    throws PortalException;
178    
179            @Override
180            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
181            public PersistedModel getPersistedModel(Serializable primaryKeyObj)
182                    throws PortalException;
183    
184            /**
185            * Returns the number of addresses.
186            *
187            * @return the number of addresses
188            */
189            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
190            public int getAddressesCount();
191    
192            /**
193            * Returns the OSGi service identifier.
194            *
195            * @return the OSGi service identifier
196            */
197            public java.lang.String getOSGiServiceIdentifier();
198    
199            /**
200            * Performs a dynamic query on the database and returns the matching rows.
201            *
202            * @param dynamicQuery the dynamic query
203            * @return the matching rows
204            */
205            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery);
206    
207            /**
208            * Performs a dynamic query on the database and returns a range of the matching rows.
209            *
210            * <p>
211            * 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.
212            * </p>
213            *
214            * @param dynamicQuery the dynamic query
215            * @param start the lower bound of the range of model instances
216            * @param end the upper bound of the range of model instances (not inclusive)
217            * @return the range of matching rows
218            */
219            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
220                    int end);
221    
222            /**
223            * Performs a dynamic query on the database and returns an ordered range of the matching rows.
224            *
225            * <p>
226            * 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.
227            * </p>
228            *
229            * @param dynamicQuery the dynamic query
230            * @param start the lower bound of the range of model instances
231            * @param end the upper bound of the range of model instances (not inclusive)
232            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
233            * @return the ordered range of matching rows
234            */
235            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
236                    int end, OrderByComparator<T> orderByComparator);
237    
238            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
239            public List<Address> getAddresses();
240    
241            /**
242            * Returns a range of all the addresses.
243            *
244            * <p>
245            * 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.
246            * </p>
247            *
248            * @param start the lower bound of the range of addresses
249            * @param end the upper bound of the range of addresses (not inclusive)
250            * @return the range of addresses
251            */
252            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
253            public List<Address> getAddresses(int start, int end);
254    
255            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
256            public List<Address> getAddresses(long companyId,
257                    java.lang.String className, long classPK);
258    
259            /**
260            * Returns the number of rows matching the dynamic query.
261            *
262            * @param dynamicQuery the dynamic query
263            * @return the number of rows matching the dynamic query
264            */
265            public long dynamicQueryCount(DynamicQuery dynamicQuery);
266    
267            /**
268            * Returns the number of rows matching the dynamic query.
269            *
270            * @param dynamicQuery the dynamic query
271            * @param projection the projection to apply to the query
272            * @return the number of rows matching the dynamic query
273            */
274            public long dynamicQueryCount(DynamicQuery dynamicQuery,
275                    Projection projection);
276    
277            public void deleteAddresses(long companyId, java.lang.String className,
278                    long classPK);
279    }