com.liferay.oauth2.provider.service.base.OAuth2AuthorizationLocalServiceBaseImpl Maven / Gradle / Ivy
Show all versions of com.liferay.oauth2.provider.service
/**
* SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
*/
package com.liferay.oauth2.provider.service.base;
import com.liferay.oauth2.provider.model.OAuth2Authorization;
import com.liferay.oauth2.provider.service.OAuth2AuthorizationLocalService;
import com.liferay.oauth2.provider.service.OAuth2AuthorizationLocalServiceUtil;
import com.liferay.oauth2.provider.service.persistence.OAuth2AuthorizationFinder;
import com.liferay.oauth2.provider.service.persistence.OAuth2AuthorizationPersistence;
import com.liferay.oauth2.provider.service.persistence.OAuth2ScopeGrantPersistence;
import com.liferay.petra.sql.dsl.query.DSLQuery;
import com.liferay.portal.aop.AopService;
import com.liferay.portal.kernel.dao.db.DB;
import com.liferay.portal.kernel.dao.db.DBManagerUtil;
import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
import com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery;
import com.liferay.portal.kernel.dao.orm.DefaultActionableDynamicQuery;
import com.liferay.portal.kernel.dao.orm.DynamicQuery;
import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil;
import com.liferay.portal.kernel.dao.orm.IndexableActionableDynamicQuery;
import com.liferay.portal.kernel.dao.orm.Projection;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.model.PersistedModel;
import com.liferay.portal.kernel.module.framework.service.IdentifiableOSGiService;
import com.liferay.portal.kernel.search.Indexable;
import com.liferay.portal.kernel.search.IndexableType;
import com.liferay.portal.kernel.service.BaseLocalServiceImpl;
import com.liferay.portal.kernel.service.PersistedModelLocalService;
import com.liferay.portal.kernel.service.persistence.BasePersistence;
import com.liferay.portal.kernel.transaction.Transactional;
import com.liferay.portal.kernel.util.OrderByComparator;
import com.liferay.portal.kernel.util.PortalUtil;
import java.io.Serializable;
import java.util.List;
import javax.sql.DataSource;
import org.osgi.service.component.annotations.Deactivate;
import org.osgi.service.component.annotations.Reference;
/**
* Provides the base implementation for the o auth2 authorization local service.
*
*
* This implementation exists only as a container for the default service methods generated by ServiceBuilder. All custom service methods should be put in {@link com.liferay.oauth2.provider.service.impl.OAuth2AuthorizationLocalServiceImpl}.
*
*
* @author Brian Wing Shun Chan
* @see com.liferay.oauth2.provider.service.impl.OAuth2AuthorizationLocalServiceImpl
* @generated
*/
public abstract class OAuth2AuthorizationLocalServiceBaseImpl
extends BaseLocalServiceImpl
implements AopService, IdentifiableOSGiService,
OAuth2AuthorizationLocalService {
/*
* NOTE FOR DEVELOPERS:
*
* Never modify or reference this class directly. Use OAuth2AuthorizationLocalService
via injection or a org.osgi.util.tracker.ServiceTracker
or use OAuth2AuthorizationLocalServiceUtil
.
*/
/**
* Adds the o auth2 authorization to the database. Also notifies the appropriate model listeners.
*
*
* Important: Inspect OAuth2AuthorizationLocalServiceImpl for overloaded versions of the method. If provided, use these entry points to the API, as the implementation logic may require the additional parameters defined there.
*
*
* @param oAuth2Authorization the o auth2 authorization
* @return the o auth2 authorization that was added
*/
@Indexable(type = IndexableType.REINDEX)
@Override
public OAuth2Authorization addOAuth2Authorization(
OAuth2Authorization oAuth2Authorization) {
oAuth2Authorization.setNew(true);
return oAuth2AuthorizationPersistence.update(oAuth2Authorization);
}
/**
* Creates a new o auth2 authorization with the primary key. Does not add the o auth2 authorization to the database.
*
* @param oAuth2AuthorizationId the primary key for the new o auth2 authorization
* @return the new o auth2 authorization
*/
@Override
@Transactional(enabled = false)
public OAuth2Authorization createOAuth2Authorization(
long oAuth2AuthorizationId) {
return oAuth2AuthorizationPersistence.create(oAuth2AuthorizationId);
}
/**
* Deletes the o auth2 authorization with the primary key from the database. Also notifies the appropriate model listeners.
*
*
* Important: Inspect OAuth2AuthorizationLocalServiceImpl for overloaded versions of the method. If provided, use these entry points to the API, as the implementation logic may require the additional parameters defined there.
*
*
* @param oAuth2AuthorizationId the primary key of the o auth2 authorization
* @return the o auth2 authorization that was removed
* @throws PortalException if a o auth2 authorization with the primary key could not be found
*/
@Indexable(type = IndexableType.DELETE)
@Override
public OAuth2Authorization deleteOAuth2Authorization(
long oAuth2AuthorizationId)
throws PortalException {
return oAuth2AuthorizationPersistence.remove(oAuth2AuthorizationId);
}
/**
* Deletes the o auth2 authorization from the database. Also notifies the appropriate model listeners.
*
*
* Important: Inspect OAuth2AuthorizationLocalServiceImpl for overloaded versions of the method. If provided, use these entry points to the API, as the implementation logic may require the additional parameters defined there.
*
*
* @param oAuth2Authorization the o auth2 authorization
* @return the o auth2 authorization that was removed
*/
@Indexable(type = IndexableType.DELETE)
@Override
public OAuth2Authorization deleteOAuth2Authorization(
OAuth2Authorization oAuth2Authorization) {
return oAuth2AuthorizationPersistence.remove(oAuth2Authorization);
}
@Override
public T dslQuery(DSLQuery dslQuery) {
return oAuth2AuthorizationPersistence.dslQuery(dslQuery);
}
@Override
public int dslQueryCount(DSLQuery dslQuery) {
Long count = dslQuery(dslQuery);
return count.intValue();
}
@Override
public DynamicQuery dynamicQuery() {
Class> clazz = getClass();
return DynamicQueryFactoryUtil.forClass(
OAuth2Authorization.class, clazz.getClassLoader());
}
/**
* Performs a dynamic query on the database and returns the matching rows.
*
* @param dynamicQuery the dynamic query
* @return the matching rows
*/
@Override
public List dynamicQuery(DynamicQuery dynamicQuery) {
return oAuth2AuthorizationPersistence.findWithDynamicQuery(
dynamicQuery);
}
/**
* Performs a dynamic query on the database and returns a range of the matching rows.
*
*
* Useful when paginating results. Returns a maximum of end - start
instances. start
and end
are not primary keys, they are indexes in the result set. Thus, 0
refers to the first result in the set. Setting both start
and end
to com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS
will return the full result set. If orderByComparator
is specified, then the query will include the given ORDER BY logic. If orderByComparator
is absent, then the query will include the default ORDER BY logic from com.liferay.oauth2.provider.model.impl.OAuth2AuthorizationModelImpl
.
*
*
* @param dynamicQuery the dynamic query
* @param start the lower bound of the range of model instances
* @param end the upper bound of the range of model instances (not inclusive)
* @return the range of matching rows
*/
@Override
public List dynamicQuery(
DynamicQuery dynamicQuery, int start, int end) {
return oAuth2AuthorizationPersistence.findWithDynamicQuery(
dynamicQuery, start, end);
}
/**
* Performs a dynamic query on the database and returns an ordered range of the matching rows.
*
*
* Useful when paginating results. Returns a maximum of end - start
instances. start
and end
are not primary keys, they are indexes in the result set. Thus, 0
refers to the first result in the set. Setting both start
and end
to com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS
will return the full result set. If orderByComparator
is specified, then the query will include the given ORDER BY logic. If orderByComparator
is absent, then the query will include the default ORDER BY logic from com.liferay.oauth2.provider.model.impl.OAuth2AuthorizationModelImpl
.
*
*
* @param dynamicQuery the dynamic query
* @param start the lower bound of the range of model instances
* @param end the upper bound of the range of model instances (not inclusive)
* @param orderByComparator the comparator to order the results by (optionally null
)
* @return the ordered range of matching rows
*/
@Override
public List dynamicQuery(
DynamicQuery dynamicQuery, int start, int end,
OrderByComparator orderByComparator) {
return oAuth2AuthorizationPersistence.findWithDynamicQuery(
dynamicQuery, start, end, orderByComparator);
}
/**
* Returns the number of rows matching the dynamic query.
*
* @param dynamicQuery the dynamic query
* @return the number of rows matching the dynamic query
*/
@Override
public long dynamicQueryCount(DynamicQuery dynamicQuery) {
return oAuth2AuthorizationPersistence.countWithDynamicQuery(
dynamicQuery);
}
/**
* Returns the number of rows matching the dynamic query.
*
* @param dynamicQuery the dynamic query
* @param projection the projection to apply to the query
* @return the number of rows matching the dynamic query
*/
@Override
public long dynamicQueryCount(
DynamicQuery dynamicQuery, Projection projection) {
return oAuth2AuthorizationPersistence.countWithDynamicQuery(
dynamicQuery, projection);
}
@Override
public OAuth2Authorization fetchOAuth2Authorization(
long oAuth2AuthorizationId) {
return oAuth2AuthorizationPersistence.fetchByPrimaryKey(
oAuth2AuthorizationId);
}
/**
* Returns the o auth2 authorization with the primary key.
*
* @param oAuth2AuthorizationId the primary key of the o auth2 authorization
* @return the o auth2 authorization
* @throws PortalException if a o auth2 authorization with the primary key could not be found
*/
@Override
public OAuth2Authorization getOAuth2Authorization(
long oAuth2AuthorizationId)
throws PortalException {
return oAuth2AuthorizationPersistence.findByPrimaryKey(
oAuth2AuthorizationId);
}
@Override
public ActionableDynamicQuery getActionableDynamicQuery() {
ActionableDynamicQuery actionableDynamicQuery =
new DefaultActionableDynamicQuery();
actionableDynamicQuery.setBaseLocalService(
oAuth2AuthorizationLocalService);
actionableDynamicQuery.setClassLoader(getClassLoader());
actionableDynamicQuery.setModelClass(OAuth2Authorization.class);
actionableDynamicQuery.setPrimaryKeyPropertyName(
"oAuth2AuthorizationId");
return actionableDynamicQuery;
}
@Override
public IndexableActionableDynamicQuery
getIndexableActionableDynamicQuery() {
IndexableActionableDynamicQuery indexableActionableDynamicQuery =
new IndexableActionableDynamicQuery();
indexableActionableDynamicQuery.setBaseLocalService(
oAuth2AuthorizationLocalService);
indexableActionableDynamicQuery.setClassLoader(getClassLoader());
indexableActionableDynamicQuery.setModelClass(
OAuth2Authorization.class);
indexableActionableDynamicQuery.setPrimaryKeyPropertyName(
"oAuth2AuthorizationId");
return indexableActionableDynamicQuery;
}
protected void initActionableDynamicQuery(
ActionableDynamicQuery actionableDynamicQuery) {
actionableDynamicQuery.setBaseLocalService(
oAuth2AuthorizationLocalService);
actionableDynamicQuery.setClassLoader(getClassLoader());
actionableDynamicQuery.setModelClass(OAuth2Authorization.class);
actionableDynamicQuery.setPrimaryKeyPropertyName(
"oAuth2AuthorizationId");
}
/**
* @throws PortalException
*/
@Override
public PersistedModel createPersistedModel(Serializable primaryKeyObj)
throws PortalException {
return oAuth2AuthorizationPersistence.create(
((Long)primaryKeyObj).longValue());
}
/**
* @throws PortalException
*/
@Override
public PersistedModel deletePersistedModel(PersistedModel persistedModel)
throws PortalException {
if (_log.isWarnEnabled()) {
_log.warn(
"Implement OAuth2AuthorizationLocalServiceImpl#deleteOAuth2Authorization(OAuth2Authorization) to avoid orphaned data");
}
return oAuth2AuthorizationLocalService.deleteOAuth2Authorization(
(OAuth2Authorization)persistedModel);
}
@Override
public BasePersistence getBasePersistence() {
return oAuth2AuthorizationPersistence;
}
/**
* @throws PortalException
*/
@Override
public PersistedModel getPersistedModel(Serializable primaryKeyObj)
throws PortalException {
return oAuth2AuthorizationPersistence.findByPrimaryKey(primaryKeyObj);
}
/**
* Returns a range of all the o auth2 authorizations.
*
*
* Useful when paginating results. Returns a maximum of end - start
instances. start
and end
are not primary keys, they are indexes in the result set. Thus, 0
refers to the first result in the set. Setting both start
and end
to com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS
will return the full result set. If orderByComparator
is specified, then the query will include the given ORDER BY logic. If orderByComparator
is absent, then the query will include the default ORDER BY logic from com.liferay.oauth2.provider.model.impl.OAuth2AuthorizationModelImpl
.
*
*
* @param start the lower bound of the range of o auth2 authorizations
* @param end the upper bound of the range of o auth2 authorizations (not inclusive)
* @return the range of o auth2 authorizations
*/
@Override
public List getOAuth2Authorizations(
int start, int end) {
return oAuth2AuthorizationPersistence.findAll(start, end);
}
/**
* Returns the number of o auth2 authorizations.
*
* @return the number of o auth2 authorizations
*/
@Override
public int getOAuth2AuthorizationsCount() {
return oAuth2AuthorizationPersistence.countAll();
}
/**
* Updates the o auth2 authorization in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
*
*
* Important: Inspect OAuth2AuthorizationLocalServiceImpl for overloaded versions of the method. If provided, use these entry points to the API, as the implementation logic may require the additional parameters defined there.
*
*
* @param oAuth2Authorization the o auth2 authorization
* @return the o auth2 authorization that was updated
*/
@Indexable(type = IndexableType.REINDEX)
@Override
public OAuth2Authorization updateOAuth2Authorization(
OAuth2Authorization oAuth2Authorization) {
return oAuth2AuthorizationPersistence.update(oAuth2Authorization);
}
/**
*/
@Override
public boolean addOAuth2ScopeGrantOAuth2Authorization(
long oAuth2ScopeGrantId, long oAuth2AuthorizationId) {
return oAuth2ScopeGrantPersistence.addOAuth2Authorization(
oAuth2ScopeGrantId, oAuth2AuthorizationId);
}
/**
*/
@Override
public boolean addOAuth2ScopeGrantOAuth2Authorization(
long oAuth2ScopeGrantId, OAuth2Authorization oAuth2Authorization) {
return oAuth2ScopeGrantPersistence.addOAuth2Authorization(
oAuth2ScopeGrantId, oAuth2Authorization);
}
/**
*/
@Override
public boolean addOAuth2ScopeGrantOAuth2Authorizations(
long oAuth2ScopeGrantId, long[] oAuth2AuthorizationIds) {
return oAuth2ScopeGrantPersistence.addOAuth2Authorizations(
oAuth2ScopeGrantId, oAuth2AuthorizationIds);
}
/**
*/
@Override
public boolean addOAuth2ScopeGrantOAuth2Authorizations(
long oAuth2ScopeGrantId,
List oAuth2Authorizations) {
return oAuth2ScopeGrantPersistence.addOAuth2Authorizations(
oAuth2ScopeGrantId, oAuth2Authorizations);
}
/**
*/
@Override
public void clearOAuth2ScopeGrantOAuth2Authorizations(
long oAuth2ScopeGrantId) {
oAuth2ScopeGrantPersistence.clearOAuth2Authorizations(
oAuth2ScopeGrantId);
}
/**
*/
@Override
public void deleteOAuth2ScopeGrantOAuth2Authorization(
long oAuth2ScopeGrantId, long oAuth2AuthorizationId) {
oAuth2ScopeGrantPersistence.removeOAuth2Authorization(
oAuth2ScopeGrantId, oAuth2AuthorizationId);
}
/**
*/
@Override
public void deleteOAuth2ScopeGrantOAuth2Authorization(
long oAuth2ScopeGrantId, OAuth2Authorization oAuth2Authorization) {
oAuth2ScopeGrantPersistence.removeOAuth2Authorization(
oAuth2ScopeGrantId, oAuth2Authorization);
}
/**
*/
@Override
public void deleteOAuth2ScopeGrantOAuth2Authorizations(
long oAuth2ScopeGrantId, long[] oAuth2AuthorizationIds) {
oAuth2ScopeGrantPersistence.removeOAuth2Authorizations(
oAuth2ScopeGrantId, oAuth2AuthorizationIds);
}
/**
*/
@Override
public void deleteOAuth2ScopeGrantOAuth2Authorizations(
long oAuth2ScopeGrantId,
List oAuth2Authorizations) {
oAuth2ScopeGrantPersistence.removeOAuth2Authorizations(
oAuth2ScopeGrantId, oAuth2Authorizations);
}
/**
* Returns the oAuth2ScopeGrantIds of the o auth2 scope grants associated with the o auth2 authorization.
*
* @param oAuth2AuthorizationId the oAuth2AuthorizationId of the o auth2 authorization
* @return long[] the oAuth2ScopeGrantIds of o auth2 scope grants associated with the o auth2 authorization
*/
@Override
public long[] getOAuth2ScopeGrantPrimaryKeys(long oAuth2AuthorizationId) {
return oAuth2AuthorizationPersistence.getOAuth2ScopeGrantPrimaryKeys(
oAuth2AuthorizationId);
}
/**
*/
@Override
public List getOAuth2ScopeGrantOAuth2Authorizations(
long oAuth2ScopeGrantId) {
return oAuth2AuthorizationPersistence.
getOAuth2ScopeGrantOAuth2Authorizations(oAuth2ScopeGrantId);
}
/**
*/
@Override
public List getOAuth2ScopeGrantOAuth2Authorizations(
long oAuth2ScopeGrantId, int start, int end) {
return oAuth2AuthorizationPersistence.
getOAuth2ScopeGrantOAuth2Authorizations(
oAuth2ScopeGrantId, start, end);
}
/**
*/
@Override
public List getOAuth2ScopeGrantOAuth2Authorizations(
long oAuth2ScopeGrantId, int start, int end,
OrderByComparator orderByComparator) {
return oAuth2AuthorizationPersistence.
getOAuth2ScopeGrantOAuth2Authorizations(
oAuth2ScopeGrantId, start, end, orderByComparator);
}
/**
*/
@Override
public int getOAuth2ScopeGrantOAuth2AuthorizationsCount(
long oAuth2ScopeGrantId) {
return oAuth2ScopeGrantPersistence.getOAuth2AuthorizationsSize(
oAuth2ScopeGrantId);
}
/**
*/
@Override
public boolean hasOAuth2ScopeGrantOAuth2Authorization(
long oAuth2ScopeGrantId, long oAuth2AuthorizationId) {
return oAuth2ScopeGrantPersistence.containsOAuth2Authorization(
oAuth2ScopeGrantId, oAuth2AuthorizationId);
}
/**
*/
@Override
public boolean hasOAuth2ScopeGrantOAuth2Authorizations(
long oAuth2ScopeGrantId) {
return oAuth2ScopeGrantPersistence.containsOAuth2Authorizations(
oAuth2ScopeGrantId);
}
/**
*/
@Override
public void setOAuth2ScopeGrantOAuth2Authorizations(
long oAuth2ScopeGrantId, long[] oAuth2AuthorizationIds) {
oAuth2ScopeGrantPersistence.setOAuth2Authorizations(
oAuth2ScopeGrantId, oAuth2AuthorizationIds);
}
@Deactivate
protected void deactivate() {
OAuth2AuthorizationLocalServiceUtil.setService(null);
}
@Override
public Class>[] getAopInterfaces() {
return new Class>[] {
OAuth2AuthorizationLocalService.class,
IdentifiableOSGiService.class, PersistedModelLocalService.class
};
}
@Override
public void setAopProxy(Object aopProxy) {
oAuth2AuthorizationLocalService =
(OAuth2AuthorizationLocalService)aopProxy;
OAuth2AuthorizationLocalServiceUtil.setService(
oAuth2AuthorizationLocalService);
}
/**
* Returns the OSGi service identifier.
*
* @return the OSGi service identifier
*/
@Override
public String getOSGiServiceIdentifier() {
return OAuth2AuthorizationLocalService.class.getName();
}
protected Class> getModelClass() {
return OAuth2Authorization.class;
}
protected String getModelClassName() {
return OAuth2Authorization.class.getName();
}
/**
* Performs a SQL query.
*
* @param sql the sql query
*/
protected void runSQL(String sql) {
try {
DataSource dataSource =
oAuth2AuthorizationPersistence.getDataSource();
DB db = DBManagerUtil.getDB();
sql = db.buildSQL(sql);
sql = PortalUtil.transformSQL(sql);
SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(
dataSource, sql);
sqlUpdate.update();
}
catch (Exception exception) {
throw new SystemException(exception);
}
}
protected OAuth2AuthorizationLocalService oAuth2AuthorizationLocalService;
@Reference
protected OAuth2AuthorizationPersistence oAuth2AuthorizationPersistence;
@Reference
protected OAuth2AuthorizationFinder oAuth2AuthorizationFinder;
@Reference
protected com.liferay.counter.kernel.service.CounterLocalService
counterLocalService;
@Reference
protected OAuth2ScopeGrantPersistence oAuth2ScopeGrantPersistence;
private static final Log _log = LogFactoryUtil.getLog(
OAuth2AuthorizationLocalServiceBaseImpl.class);
}