View Javadoc
1   /*
2    * Copyright (C) 2015 eXo Platform SAS.
3    *
4    * This is free software; you can redistribute it and/or modify it
5    * under the terms of the GNU Lesser General Public License as
6    * published by the Free Software Foundation; either version 2.1 of
7    * the License, or (at your option) any later version.
8    *
9    * This software is distributed in the hope that it will be useful,
10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12   * Lesser General Public License for more details.
13   *
14   * You should have received a copy of the GNU Lesser General Public
15   * License along with this software; if not, write to the Free
16   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
17   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
18   */
19  
20  package org.exoplatform.social.core.jpa.storage.dao;
21  
22  import org.exoplatform.commons.api.persistence.GenericDAO;
23  import org.exoplatform.commons.utils.ListAccess;
24  import org.exoplatform.social.core.jpa.search.ExtendProfileFilter;
25  import org.exoplatform.social.core.jpa.storage.entity.ConnectionEntity;
26  import org.exoplatform.social.core.jpa.storage.entity.IdentityEntity;
27  
28  import java.util.List;
29  import java.util.Map;
30  
31  /**
32   * @author <a href="mailto:tuyennt@exoplatform.com">Tuyen Nguyen The</a>.
33   */
34  public interface IdentityDAO extends GenericDAO<IdentityEntity, Long> {
35    IdentityEntity findByProviderAndRemoteId(String providerId, String remoteId);
36    long countIdentityByProvider(String providerId);
37  
38    ListAccess<IdentityEntity> findIdentities(ExtendProfileFilter filter);
39  
40    List<Long> getAllIds(int offset, int limit);  
41  
42    List<Long> getAllIdsByProvider(String providerId, int offset, int limit);
43    ListAccess<Map.Entry<IdentityEntity, ConnectionEntity>> findAllIdentitiesWithConnections(long identityId, String sortField, char firstChar);
44  
45    /**
46     * set the DELETED flag to true
47     * @param identityId the identity Id
48     */
49    void setAsDeleted(long identityId);
50  
51    /**
52     * delete definitely an identity
53     * @param identityId the identity Id
54     */
55    void hardDeleteIdentity(long identityId);
56  
57    /**
58     * Get all identities by providerId sorted by sortField
59     * 
60     * @param providerId
61     * @param sortField
62     * @param firstChar
63     * @param offset
64     * @param limit
65     * @return
66     */
67    List<String> getAllIdsByProviderSorted(String providerId, String sortField, char firstChar, long offset, long limit);
68  }