001 /** 002 * Copyright (c) 2000-2013 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.shopping.service; 016 017 import aQute.bnd.annotation.ProviderType; 018 019 import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil; 020 import com.liferay.portal.kernel.util.ReferenceRegistry; 021 022 /** 023 * Provides the local service utility for ShoppingCart. This utility wraps 024 * {@link com.liferay.portlet.shopping.service.impl.ShoppingCartLocalServiceImpl} and is the 025 * primary access point for service operations in application layer code running 026 * on the local server. Methods of this service will not have security checks 027 * based on the propagated JAAS credentials because this service can only be 028 * accessed from within the same VM. 029 * 030 * @author Brian Wing Shun Chan 031 * @see ShoppingCartLocalService 032 * @see com.liferay.portlet.shopping.service.base.ShoppingCartLocalServiceBaseImpl 033 * @see com.liferay.portlet.shopping.service.impl.ShoppingCartLocalServiceImpl 034 * @generated 035 */ 036 @ProviderType 037 public class ShoppingCartLocalServiceUtil { 038 /* 039 * NOTE FOR DEVELOPERS: 040 * 041 * Never modify this class directly. Add custom service methods to {@link com.liferay.portlet.shopping.service.impl.ShoppingCartLocalServiceImpl} and rerun ServiceBuilder to regenerate this class. 042 */ 043 044 /** 045 * Adds the shopping cart to the database. Also notifies the appropriate model listeners. 046 * 047 * @param shoppingCart the shopping cart 048 * @return the shopping cart that was added 049 * @throws SystemException if a system exception occurred 050 */ 051 public static com.liferay.portlet.shopping.model.ShoppingCart addShoppingCart( 052 com.liferay.portlet.shopping.model.ShoppingCart shoppingCart) 053 throws com.liferay.portal.kernel.exception.SystemException { 054 return getService().addShoppingCart(shoppingCart); 055 } 056 057 /** 058 * Creates a new shopping cart with the primary key. Does not add the shopping cart to the database. 059 * 060 * @param cartId the primary key for the new shopping cart 061 * @return the new shopping cart 062 */ 063 public static com.liferay.portlet.shopping.model.ShoppingCart createShoppingCart( 064 long cartId) { 065 return getService().createShoppingCart(cartId); 066 } 067 068 /** 069 * Deletes the shopping cart with the primary key from the database. Also notifies the appropriate model listeners. 070 * 071 * @param cartId the primary key of the shopping cart 072 * @return the shopping cart that was removed 073 * @throws PortalException if a shopping cart with the primary key could not be found 074 * @throws SystemException if a system exception occurred 075 */ 076 public static com.liferay.portlet.shopping.model.ShoppingCart deleteShoppingCart( 077 long cartId) 078 throws com.liferay.portal.kernel.exception.PortalException, 079 com.liferay.portal.kernel.exception.SystemException { 080 return getService().deleteShoppingCart(cartId); 081 } 082 083 /** 084 * Deletes the shopping cart from the database. Also notifies the appropriate model listeners. 085 * 086 * @param shoppingCart the shopping cart 087 * @return the shopping cart that was removed 088 * @throws SystemException if a system exception occurred 089 */ 090 public static com.liferay.portlet.shopping.model.ShoppingCart deleteShoppingCart( 091 com.liferay.portlet.shopping.model.ShoppingCart shoppingCart) 092 throws com.liferay.portal.kernel.exception.SystemException { 093 return getService().deleteShoppingCart(shoppingCart); 094 } 095 096 public static com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery() { 097 return getService().dynamicQuery(); 098 } 099 100 /** 101 * Performs a dynamic query on the database and returns the matching rows. 102 * 103 * @param dynamicQuery the dynamic query 104 * @return the matching rows 105 * @throws SystemException if a system exception occurred 106 */ 107 @SuppressWarnings("rawtypes") 108 public static java.util.List dynamicQuery( 109 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery) 110 throws com.liferay.portal.kernel.exception.SystemException { 111 return getService().dynamicQuery(dynamicQuery); 112 } 113 114 /** 115 * Performs a dynamic query on the database and returns a range of the matching rows. 116 * 117 * <p> 118 * 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.portlet.shopping.model.impl.ShoppingCartModelImpl}. 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. 119 * </p> 120 * 121 * @param dynamicQuery the dynamic query 122 * @param start the lower bound of the range of model instances 123 * @param end the upper bound of the range of model instances (not inclusive) 124 * @return the range of matching rows 125 * @throws SystemException if a system exception occurred 126 */ 127 @SuppressWarnings("rawtypes") 128 public static java.util.List dynamicQuery( 129 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, 130 int end) throws com.liferay.portal.kernel.exception.SystemException { 131 return getService().dynamicQuery(dynamicQuery, start, end); 132 } 133 134 /** 135 * Performs a dynamic query on the database and returns an ordered range of the matching rows. 136 * 137 * <p> 138 * 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.portlet.shopping.model.impl.ShoppingCartModelImpl}. 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. 139 * </p> 140 * 141 * @param dynamicQuery the dynamic query 142 * @param start the lower bound of the range of model instances 143 * @param end the upper bound of the range of model instances (not inclusive) 144 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) 145 * @return the ordered range of matching rows 146 * @throws SystemException if a system exception occurred 147 */ 148 @SuppressWarnings("rawtypes") 149 public static java.util.List dynamicQuery( 150 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, 151 int end, 152 com.liferay.portal.kernel.util.OrderByComparator orderByComparator) 153 throws com.liferay.portal.kernel.exception.SystemException { 154 return getService() 155 .dynamicQuery(dynamicQuery, start, end, orderByComparator); 156 } 157 158 /** 159 * Returns the number of rows that match the dynamic query. 160 * 161 * @param dynamicQuery the dynamic query 162 * @return the number of rows that match the dynamic query 163 * @throws SystemException if a system exception occurred 164 */ 165 public static long dynamicQueryCount( 166 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery) 167 throws com.liferay.portal.kernel.exception.SystemException { 168 return getService().dynamicQueryCount(dynamicQuery); 169 } 170 171 /** 172 * Returns the number of rows that match the dynamic query. 173 * 174 * @param dynamicQuery the dynamic query 175 * @param projection the projection to apply to the query 176 * @return the number of rows that match the dynamic query 177 * @throws SystemException if a system exception occurred 178 */ 179 public static long dynamicQueryCount( 180 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, 181 com.liferay.portal.kernel.dao.orm.Projection projection) 182 throws com.liferay.portal.kernel.exception.SystemException { 183 return getService().dynamicQueryCount(dynamicQuery, projection); 184 } 185 186 public static com.liferay.portlet.shopping.model.ShoppingCart fetchShoppingCart( 187 long cartId) throws com.liferay.portal.kernel.exception.SystemException { 188 return getService().fetchShoppingCart(cartId); 189 } 190 191 /** 192 * Returns the shopping cart with the primary key. 193 * 194 * @param cartId the primary key of the shopping cart 195 * @return the shopping cart 196 * @throws PortalException if a shopping cart with the primary key could not be found 197 * @throws SystemException if a system exception occurred 198 */ 199 public static com.liferay.portlet.shopping.model.ShoppingCart getShoppingCart( 200 long cartId) 201 throws com.liferay.portal.kernel.exception.PortalException, 202 com.liferay.portal.kernel.exception.SystemException { 203 return getService().getShoppingCart(cartId); 204 } 205 206 public static com.liferay.portal.model.PersistedModel getPersistedModel( 207 java.io.Serializable primaryKeyObj) 208 throws com.liferay.portal.kernel.exception.PortalException, 209 com.liferay.portal.kernel.exception.SystemException { 210 return getService().getPersistedModel(primaryKeyObj); 211 } 212 213 /** 214 * Returns a range of all the shopping carts. 215 * 216 * <p> 217 * 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.portlet.shopping.model.impl.ShoppingCartModelImpl}. 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. 218 * </p> 219 * 220 * @param start the lower bound of the range of shopping carts 221 * @param end the upper bound of the range of shopping carts (not inclusive) 222 * @return the range of shopping carts 223 * @throws SystemException if a system exception occurred 224 */ 225 public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCart> getShoppingCarts( 226 int start, int end) 227 throws com.liferay.portal.kernel.exception.SystemException { 228 return getService().getShoppingCarts(start, end); 229 } 230 231 /** 232 * Returns the number of shopping carts. 233 * 234 * @return the number of shopping carts 235 * @throws SystemException if a system exception occurred 236 */ 237 public static int getShoppingCartsCount() 238 throws com.liferay.portal.kernel.exception.SystemException { 239 return getService().getShoppingCartsCount(); 240 } 241 242 /** 243 * Updates the shopping cart in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 244 * 245 * @param shoppingCart the shopping cart 246 * @return the shopping cart that was updated 247 * @throws SystemException if a system exception occurred 248 */ 249 public static com.liferay.portlet.shopping.model.ShoppingCart updateShoppingCart( 250 com.liferay.portlet.shopping.model.ShoppingCart shoppingCart) 251 throws com.liferay.portal.kernel.exception.SystemException { 252 return getService().updateShoppingCart(shoppingCart); 253 } 254 255 /** 256 * Returns the Spring bean ID for this bean. 257 * 258 * @return the Spring bean ID for this bean 259 */ 260 public static java.lang.String getBeanIdentifier() { 261 return getService().getBeanIdentifier(); 262 } 263 264 /** 265 * Sets the Spring bean ID for this bean. 266 * 267 * @param beanIdentifier the Spring bean ID for this bean 268 */ 269 public static void setBeanIdentifier(java.lang.String beanIdentifier) { 270 getService().setBeanIdentifier(beanIdentifier); 271 } 272 273 public static void deleteGroupCarts(long groupId) 274 throws com.liferay.portal.kernel.exception.SystemException { 275 getService().deleteGroupCarts(groupId); 276 } 277 278 public static void deleteUserCarts(long userId) 279 throws com.liferay.portal.kernel.exception.SystemException { 280 getService().deleteUserCarts(userId); 281 } 282 283 public static com.liferay.portlet.shopping.model.ShoppingCart getCart( 284 long userId, long groupId) 285 throws com.liferay.portal.kernel.exception.PortalException, 286 com.liferay.portal.kernel.exception.SystemException { 287 return getService().getCart(userId, groupId); 288 } 289 290 public static java.util.Map<com.liferay.portlet.shopping.model.ShoppingCartItem, java.lang.Integer> getItems( 291 long groupId, java.lang.String itemIds) 292 throws com.liferay.portal.kernel.exception.SystemException { 293 return getService().getItems(groupId, itemIds); 294 } 295 296 public static com.liferay.portlet.shopping.model.ShoppingCart updateCart( 297 long userId, long groupId, java.lang.String itemIds, 298 java.lang.String couponCodes, int altShipping, boolean insure) 299 throws com.liferay.portal.kernel.exception.PortalException, 300 com.liferay.portal.kernel.exception.SystemException { 301 return getService() 302 .updateCart(userId, groupId, itemIds, couponCodes, 303 altShipping, insure); 304 } 305 306 public static ShoppingCartLocalService getService() { 307 if (_service == null) { 308 _service = (ShoppingCartLocalService)PortalBeanLocatorUtil.locate(ShoppingCartLocalService.class.getName()); 309 310 ReferenceRegistry.registerReference(ShoppingCartLocalServiceUtil.class, 311 "_service"); 312 } 313 314 return _service; 315 } 316 317 /** 318 * @deprecated As of 6.2.0 319 */ 320 public void setService(ShoppingCartLocalService service) { 321 } 322 323 private static ShoppingCartLocalService _service; 324 }