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.counter.service; 016 017 import aQute.bnd.annotation.ProviderType; 018 019 import com.liferay.counter.model.Counter; 020 021 import com.liferay.portal.kernel.dao.orm.DynamicQuery; 022 import com.liferay.portal.kernel.dao.orm.Projection; 023 import com.liferay.portal.kernel.exception.PortalException; 024 import com.liferay.portal.kernel.exception.SystemException; 025 import com.liferay.portal.kernel.search.Indexable; 026 import com.liferay.portal.kernel.search.IndexableType; 027 import com.liferay.portal.kernel.transaction.Isolation; 028 import com.liferay.portal.kernel.transaction.Propagation; 029 import com.liferay.portal.kernel.transaction.Transactional; 030 import com.liferay.portal.kernel.util.OrderByComparator; 031 import com.liferay.portal.model.PersistedModel; 032 import com.liferay.portal.service.BaseLocalService; 033 import com.liferay.portal.service.PersistedModelLocalService; 034 035 import java.io.Serializable; 036 037 import java.util.List; 038 039 /** 040 * Provides the local service interface for Counter. Methods of this 041 * service will not have security checks based on the propagated JAAS 042 * credentials because this service can only be accessed from within the same 043 * VM. 044 * 045 * @author Brian Wing Shun Chan 046 * @see CounterLocalServiceUtil 047 * @see com.liferay.counter.service.base.CounterLocalServiceBaseImpl 048 * @see com.liferay.counter.service.impl.CounterLocalServiceImpl 049 * @generated 050 */ 051 @ProviderType 052 @Transactional(isolation = Isolation.PORTAL, rollbackFor = { 053 PortalException.class, SystemException.class}) 054 public interface CounterLocalService extends BaseLocalService, 055 PersistedModelLocalService { 056 /* 057 * NOTE FOR DEVELOPERS: 058 * 059 * Never modify or reference this interface directly. Always use {@link CounterLocalServiceUtil} to access the counter local service. Add custom service methods to {@link com.liferay.counter.service.impl.CounterLocalServiceImpl} and rerun ServiceBuilder to automatically copy the method declarations to this interface. 060 */ 061 062 /** 063 * Adds the counter to the database. Also notifies the appropriate model listeners. 064 * 065 * @param counter the counter 066 * @return the counter that was added 067 */ 068 @Indexable(type = IndexableType.REINDEX) 069 public Counter addCounter(Counter counter); 070 071 /** 072 * Creates a new counter with the primary key. Does not add the counter to the database. 073 * 074 * @param name the primary key for the new counter 075 * @return the new counter 076 */ 077 public Counter createCounter(java.lang.String name); 078 079 /** 080 * Deletes the counter from the database. Also notifies the appropriate model listeners. 081 * 082 * @param counter the counter 083 * @return the counter that was removed 084 */ 085 @Indexable(type = IndexableType.DELETE) 086 public Counter deleteCounter(Counter counter); 087 088 /** 089 * Deletes the counter with the primary key from the database. Also notifies the appropriate model listeners. 090 * 091 * @param name the primary key of the counter 092 * @return the counter that was removed 093 * @throws PortalException if a counter with the primary key could not be found 094 */ 095 @Indexable(type = IndexableType.DELETE) 096 public Counter deleteCounter(java.lang.String name) 097 throws PortalException; 098 099 /** 100 * @throws PortalException 101 */ 102 @Override 103 public PersistedModel deletePersistedModel(PersistedModel persistedModel) 104 throws PortalException; 105 106 public DynamicQuery dynamicQuery(); 107 108 /** 109 * Performs a dynamic query on the database and returns the matching rows. 110 * 111 * @param dynamicQuery the dynamic query 112 * @return the matching rows 113 */ 114 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery); 115 116 /** 117 * Performs a dynamic query on the database and returns a range of the matching rows. 118 * 119 * <p> 120 * 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.counter.model.impl.CounterModelImpl}. 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. 121 * </p> 122 * 123 * @param dynamicQuery the dynamic query 124 * @param start the lower bound of the range of model instances 125 * @param end the upper bound of the range of model instances (not inclusive) 126 * @return the range of matching rows 127 */ 128 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start, 129 int end); 130 131 /** 132 * Performs a dynamic query on the database and returns an ordered 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.counter.model.impl.CounterModelImpl}. 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 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) 142 * @return the ordered range of matching rows 143 */ 144 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start, 145 int end, OrderByComparator<T> orderByComparator); 146 147 /** 148 * Returns the number of rows matching the dynamic query. 149 * 150 * @param dynamicQuery the dynamic query 151 * @return the number of rows matching the dynamic query 152 */ 153 public long dynamicQueryCount(DynamicQuery dynamicQuery); 154 155 /** 156 * Returns the number of rows matching the dynamic query. 157 * 158 * @param dynamicQuery the dynamic query 159 * @param projection the projection to apply to the query 160 * @return the number of rows matching the dynamic query 161 */ 162 public long dynamicQueryCount(DynamicQuery dynamicQuery, 163 Projection projection); 164 165 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 166 public Counter fetchCounter(java.lang.String name); 167 168 /** 169 * Returns the counter with the primary key. 170 * 171 * @param name the primary key of the counter 172 * @return the counter 173 * @throws PortalException if a counter with the primary key could not be found 174 */ 175 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 176 public Counter getCounter(java.lang.String name) throws PortalException; 177 178 /** 179 * Returns a range of all the counters. 180 * 181 * <p> 182 * 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.counter.model.impl.CounterModelImpl}. 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. 183 * </p> 184 * 185 * @param start the lower bound of the range of counters 186 * @param end the upper bound of the range of counters (not inclusive) 187 * @return the range of counters 188 */ 189 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 190 public List<Counter> getCounters(int start, int end); 191 192 /** 193 * Returns the number of counters. 194 * 195 * @return the number of counters 196 */ 197 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 198 public int getCountersCount(); 199 200 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 201 public List<java.lang.String> getNames(); 202 203 /** 204 * Returns the OSGi service identifier. 205 * 206 * @return the OSGi service identifier 207 */ 208 public java.lang.String getOSGiServiceIdentifier(); 209 210 @Override 211 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 212 public PersistedModel getPersistedModel(Serializable primaryKeyObj) 213 throws PortalException; 214 215 @Transactional(isolation = Isolation.COUNTER, propagation = Propagation.REQUIRES_NEW) 216 public long increment(); 217 218 @Transactional(isolation = Isolation.COUNTER, propagation = Propagation.REQUIRES_NEW) 219 public long increment(java.lang.String name); 220 221 @Transactional(isolation = Isolation.COUNTER, propagation = Propagation.REQUIRES_NEW) 222 public long increment(java.lang.String name, int size); 223 224 @Transactional(isolation = Isolation.COUNTER, propagation = Propagation.REQUIRES_NEW) 225 public void rename(java.lang.String oldName, java.lang.String newName); 226 227 @Transactional(isolation = Isolation.COUNTER, propagation = Propagation.REQUIRES_NEW) 228 public void reset(java.lang.String name); 229 230 @Transactional(isolation = Isolation.COUNTER, propagation = Propagation.REQUIRES_NEW) 231 public void reset(java.lang.String name, long size); 232 233 /** 234 * Updates the counter in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 235 * 236 * @param counter the counter 237 * @return the counter that was updated 238 */ 239 @Indexable(type = IndexableType.REINDEX) 240 public Counter updateCounter(Counter counter); 241 }