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.kernel.service; 016 017 import aQute.bnd.annotation.ProviderType; 018 019 import com.liferay.counter.kernel.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.model.PersistedModel; 026 import com.liferay.portal.kernel.search.Indexable; 027 import com.liferay.portal.kernel.search.IndexableType; 028 import com.liferay.portal.kernel.service.BaseLocalService; 029 import com.liferay.portal.kernel.service.PersistedModelLocalService; 030 import com.liferay.portal.kernel.transaction.Isolation; 031 import com.liferay.portal.kernel.transaction.Propagation; 032 import com.liferay.portal.kernel.transaction.Transactional; 033 import com.liferay.portal.kernel.util.OrderByComparator; 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 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 100 public Counter fetchCounter(java.lang.String name); 101 102 /** 103 * Returns the counter with the primary key. 104 * 105 * @param name the primary key of the counter 106 * @return the counter 107 * @throws PortalException if a counter with the primary key could not be found 108 */ 109 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 110 public Counter getCounter(java.lang.String name) throws PortalException; 111 112 /** 113 * Updates the counter in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 114 * 115 * @param counter the counter 116 * @return the counter that was updated 117 */ 118 @Indexable(type = IndexableType.REINDEX) 119 public Counter updateCounter(Counter counter); 120 121 public DynamicQuery dynamicQuery(); 122 123 /** 124 * @throws PortalException 125 */ 126 @Override 127 public PersistedModel deletePersistedModel(PersistedModel persistedModel) 128 throws PortalException; 129 130 @Override 131 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 132 public PersistedModel getPersistedModel(Serializable primaryKeyObj) 133 throws PortalException; 134 135 /** 136 * Returns the number of counters. 137 * 138 * @return the number of counters 139 */ 140 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 141 public int getCountersCount(); 142 143 /** 144 * Returns the OSGi service identifier. 145 * 146 * @return the OSGi service identifier 147 */ 148 public java.lang.String getOSGiServiceIdentifier(); 149 150 /** 151 * Performs a dynamic query on the database and returns the matching rows. 152 * 153 * @param dynamicQuery the dynamic query 154 * @return the matching rows 155 */ 156 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery); 157 158 /** 159 * Performs a dynamic query on the database and returns a range of the matching rows. 160 * 161 * <p> 162 * 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. 163 * </p> 164 * 165 * @param dynamicQuery the dynamic query 166 * @param start the lower bound of the range of model instances 167 * @param end the upper bound of the range of model instances (not inclusive) 168 * @return the range of matching rows 169 */ 170 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start, 171 int end); 172 173 /** 174 * Performs a dynamic query on the database and returns an ordered range of the matching rows. 175 * 176 * <p> 177 * 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. 178 * </p> 179 * 180 * @param dynamicQuery the dynamic query 181 * @param start the lower bound of the range of model instances 182 * @param end the upper bound of the range of model instances (not inclusive) 183 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) 184 * @return the ordered range of matching rows 185 */ 186 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start, 187 int end, OrderByComparator<T> orderByComparator); 188 189 /** 190 * Returns a range of all the counters. 191 * 192 * <p> 193 * 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. 194 * </p> 195 * 196 * @param start the lower bound of the range of counters 197 * @param end the upper bound of the range of counters (not inclusive) 198 * @return the range of counters 199 */ 200 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 201 public List<Counter> getCounters(int start, int end); 202 203 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 204 public List<java.lang.String> getNames(); 205 206 /** 207 * Returns the number of rows matching the dynamic query. 208 * 209 * @param dynamicQuery the dynamic query 210 * @return the number of rows matching the dynamic query 211 */ 212 public long dynamicQueryCount(DynamicQuery dynamicQuery); 213 214 /** 215 * Returns the number of rows matching the dynamic query. 216 * 217 * @param dynamicQuery the dynamic query 218 * @param projection the projection to apply to the query 219 * @return the number of rows matching the dynamic query 220 */ 221 public long dynamicQueryCount(DynamicQuery dynamicQuery, 222 Projection projection); 223 224 @Transactional(isolation = Isolation.COUNTER, propagation = Propagation.REQUIRES_NEW) 225 public long increment(); 226 227 @Transactional(isolation = Isolation.COUNTER, propagation = Propagation.REQUIRES_NEW) 228 public long increment(java.lang.String name); 229 230 @Transactional(isolation = Isolation.COUNTER, propagation = Propagation.REQUIRES_NEW) 231 public long increment(java.lang.String name, int size); 232 233 @Transactional(isolation = Isolation.COUNTER, propagation = Propagation.REQUIRES_NEW) 234 public void rename(java.lang.String oldName, java.lang.String newName); 235 236 @Transactional(isolation = Isolation.COUNTER, propagation = Propagation.REQUIRES_NEW) 237 public void reset(java.lang.String name); 238 239 @Transactional(isolation = Isolation.COUNTER, propagation = Propagation.REQUIRES_NEW) 240 public void reset(java.lang.String name, long size); 241 }