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.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 */ 050 public static com.liferay.portlet.shopping.model.ShoppingCart addShoppingCart( 051 com.liferay.portlet.shopping.model.ShoppingCart shoppingCart) { 052 return getService().addShoppingCart(shoppingCart); 053 } 054 055 /** 056 * Creates a new shopping cart with the primary key. Does not add the shopping cart to the database. 057 * 058 * @param cartId the primary key for the new shopping cart 059 * @return the new shopping cart 060 */ 061 public static com.liferay.portlet.shopping.model.ShoppingCart createShoppingCart( 062 long cartId) { 063 return getService().createShoppingCart(cartId); 064 } 065 066 public static void deleteGroupCarts(long groupId) { 067 getService().deleteGroupCarts(groupId); 068 } 069 070 /** 071 * @throws PortalException 072 */ 073 public static com.liferay.portal.model.PersistedModel deletePersistedModel( 074 com.liferay.portal.model.PersistedModel persistedModel) 075 throws com.liferay.portal.kernel.exception.PortalException { 076 return getService().deletePersistedModel(persistedModel); 077 } 078 079 /** 080 * Deletes the shopping cart with the primary key from the database. Also notifies the appropriate model listeners. 081 * 082 * @param cartId the primary key of the shopping cart 083 * @return the shopping cart that was removed 084 * @throws PortalException if a shopping cart with the primary key could not be found 085 */ 086 public static com.liferay.portlet.shopping.model.ShoppingCart deleteShoppingCart( 087 long cartId) throws com.liferay.portal.kernel.exception.PortalException { 088 return getService().deleteShoppingCart(cartId); 089 } 090 091 /** 092 * Deletes the shopping cart from the database. Also notifies the appropriate model listeners. 093 * 094 * @param shoppingCart the shopping cart 095 * @return the shopping cart that was removed 096 */ 097 public static com.liferay.portlet.shopping.model.ShoppingCart deleteShoppingCart( 098 com.liferay.portlet.shopping.model.ShoppingCart shoppingCart) { 099 return getService().deleteShoppingCart(shoppingCart); 100 } 101 102 public static void deleteUserCarts(long userId) { 103 getService().deleteUserCarts(userId); 104 } 105 106 public static com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery() { 107 return getService().dynamicQuery(); 108 } 109 110 /** 111 * Performs a dynamic query on the database and returns the matching rows. 112 * 113 * @param dynamicQuery the dynamic query 114 * @return the matching rows 115 */ 116 public static <T> java.util.List<T> dynamicQuery( 117 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery) { 118 return getService().dynamicQuery(dynamicQuery); 119 } 120 121 /** 122 * Performs a dynamic query on the database and returns a range of the matching rows. 123 * 124 * <p> 125 * 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. 126 * </p> 127 * 128 * @param dynamicQuery the dynamic query 129 * @param start the lower bound of the range of model instances 130 * @param end the upper bound of the range of model instances (not inclusive) 131 * @return the range of matching rows 132 */ 133 public static <T> java.util.List<T> dynamicQuery( 134 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, 135 int end) { 136 return getService().dynamicQuery(dynamicQuery, start, end); 137 } 138 139 /** 140 * Performs a dynamic query on the database and returns an ordered range of the matching rows. 141 * 142 * <p> 143 * 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. 144 * </p> 145 * 146 * @param dynamicQuery the dynamic query 147 * @param start the lower bound of the range of model instances 148 * @param end the upper bound of the range of model instances (not inclusive) 149 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) 150 * @return the ordered range of matching rows 151 */ 152 public static <T> java.util.List<T> dynamicQuery( 153 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, 154 int end, 155 com.liferay.portal.kernel.util.OrderByComparator<T> orderByComparator) { 156 return getService() 157 .dynamicQuery(dynamicQuery, start, end, orderByComparator); 158 } 159 160 /** 161 * Returns the number of rows matching the dynamic query. 162 * 163 * @param dynamicQuery the dynamic query 164 * @return the number of rows matching the dynamic query 165 */ 166 public static long dynamicQueryCount( 167 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery) { 168 return getService().dynamicQueryCount(dynamicQuery); 169 } 170 171 /** 172 * Returns the number of rows matching 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 matching the dynamic query 177 */ 178 public static long dynamicQueryCount( 179 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, 180 com.liferay.portal.kernel.dao.orm.Projection projection) { 181 return getService().dynamicQueryCount(dynamicQuery, projection); 182 } 183 184 public static com.liferay.portlet.shopping.model.ShoppingCart fetchShoppingCart( 185 long cartId) { 186 return getService().fetchShoppingCart(cartId); 187 } 188 189 public static com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery getActionableDynamicQuery() { 190 return getService().getActionableDynamicQuery(); 191 } 192 193 /** 194 * Returns the Spring bean ID for this bean. 195 * 196 * @return the Spring bean ID for this bean 197 */ 198 public static java.lang.String getBeanIdentifier() { 199 return getService().getBeanIdentifier(); 200 } 201 202 public static com.liferay.portlet.shopping.model.ShoppingCart getCart( 203 long userId, long groupId) 204 throws com.liferay.portal.kernel.exception.PortalException { 205 return getService().getCart(userId, groupId); 206 } 207 208 public static java.util.Map<com.liferay.portlet.shopping.model.ShoppingCartItem, java.lang.Integer> getItems( 209 long groupId, java.lang.String itemIds) { 210 return getService().getItems(groupId, itemIds); 211 } 212 213 public static com.liferay.portal.model.PersistedModel getPersistedModel( 214 java.io.Serializable primaryKeyObj) 215 throws com.liferay.portal.kernel.exception.PortalException { 216 return getService().getPersistedModel(primaryKeyObj); 217 } 218 219 /** 220 * Returns the shopping cart with the primary key. 221 * 222 * @param cartId the primary key of the shopping cart 223 * @return the shopping cart 224 * @throws PortalException if a shopping cart with the primary key could not be found 225 */ 226 public static com.liferay.portlet.shopping.model.ShoppingCart getShoppingCart( 227 long cartId) throws com.liferay.portal.kernel.exception.PortalException { 228 return getService().getShoppingCart(cartId); 229 } 230 231 /** 232 * Returns a range of all the shopping carts. 233 * 234 * <p> 235 * 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. 236 * </p> 237 * 238 * @param start the lower bound of the range of shopping carts 239 * @param end the upper bound of the range of shopping carts (not inclusive) 240 * @return the range of shopping carts 241 */ 242 public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCart> getShoppingCarts( 243 int start, int end) { 244 return getService().getShoppingCarts(start, end); 245 } 246 247 /** 248 * Returns the number of shopping carts. 249 * 250 * @return the number of shopping carts 251 */ 252 public static int getShoppingCartsCount() { 253 return getService().getShoppingCartsCount(); 254 } 255 256 /** 257 * Sets the Spring bean ID for this bean. 258 * 259 * @param beanIdentifier the Spring bean ID for this bean 260 */ 261 public static void setBeanIdentifier(java.lang.String beanIdentifier) { 262 getService().setBeanIdentifier(beanIdentifier); 263 } 264 265 public static com.liferay.portlet.shopping.model.ShoppingCart updateCart( 266 long userId, long groupId, java.lang.String itemIds, 267 java.lang.String couponCodes, int altShipping, boolean insure) 268 throws com.liferay.portal.kernel.exception.PortalException { 269 return getService() 270 .updateCart(userId, groupId, itemIds, couponCodes, 271 altShipping, insure); 272 } 273 274 /** 275 * Updates the shopping cart in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 276 * 277 * @param shoppingCart the shopping cart 278 * @return the shopping cart that was updated 279 */ 280 public static com.liferay.portlet.shopping.model.ShoppingCart updateShoppingCart( 281 com.liferay.portlet.shopping.model.ShoppingCart shoppingCart) { 282 return getService().updateShoppingCart(shoppingCart); 283 } 284 285 public static ShoppingCartLocalService getService() { 286 if (_service == null) { 287 _service = (ShoppingCartLocalService)PortalBeanLocatorUtil.locate(ShoppingCartLocalService.class.getName()); 288 289 ReferenceRegistry.registerReference(ShoppingCartLocalServiceUtil.class, 290 "_service"); 291 } 292 293 return _service; 294 } 295 296 /** 297 * @deprecated As of 6.2.0 298 */ 299 @Deprecated 300 public void setService(ShoppingCartLocalService service) { 301 } 302 303 private static ShoppingCartLocalService _service; 304 }