/**
* =============================================================================
*
* ORCID (R) Open Source
* http://orcid.org
*
* Copyright (c) 2012-2014 ORCID, Inc.
* Licensed under an MIT-Style License (MIT)
* http://orcid.org/open-source-license
*
* This copyright and license information (including a link to the full license)
* shall be included in its entirety in all copies or substantial portion of
* the software.
*
* =============================================================================
*/
package org.orcid.persistence.dao.impl;
import javax.persistence.Query;
import org.orcid.persistence.dao.ClientScopeDao;
import org.orcid.persistence.jpa.entities.ClientScopeEntity;
import org.orcid.persistence.jpa.entities.keys.ClientScopePk;
import org.springframework.transaction.annotation.Transactional;
public class ClientScopeDaoImpl extends GenericDaoImpl<ClientScopeEntity, ClientScopePk> implements ClientScopeDao {
public ClientScopeDaoImpl() {
super(ClientScopeEntity.class);
}
/**
* Removes a client secret key
*
* @param clientId
* @param clientSecret
* @return true if a entity is removed
* */
@Override
@Transactional
public boolean deleteScope(String clientId, String scopeType) {
Query deleteQuery = entityManager.createNativeQuery("delete from client_scope where client_details_id=:clientId and scope_type=:scopeType");
deleteQuery.setParameter("clientId", clientId);
deleteQuery.setParameter("scopeType", scopeType);
return deleteQuery.executeUpdate() > 0;
}
}