コード例 #1
0
  /** {@inheritDoc} */
  public Identity findIdentity(final String providerId, final String remoteId)
      throws IdentityStorageException {

    //
    IdentityCompositeKey key = new IdentityCompositeKey(providerId, remoteId);

    //
    IdentityKey k =
        identityIndexCache.get(
            new ServiceContext<IdentityKey>() {

              public IdentityKey execute() {
                Identity i = storage.findIdentity(providerId, remoteId);
                if (i == null) return null;
                IdentityKey key = new IdentityKey(i);
                exoIdentityCache.put(key, new IdentityData(i));
                return key;
              }
            },
            key);

    //
    if (k != null) {
      return findIdentityById(k.getId());
    } else {
      return null;
    }
  }
コード例 #2
0
  /**
   * Build the identity list from the caches Ids.
   *
   * @param data ids
   * @return identities
   */
  private List<Identity> buildIdentities(ListIdentitiesData data) {

    List<Identity> identities = new ArrayList<Identity>();
    for (IdentityKey k : data.getIds()) {
      Identity gotIdentity = findIdentityById(k.getId());
      gotIdentity.setProfile(loadProfile(gotIdentity.getProfile()));
      identities.add(gotIdentity);
    }
    return identities;
  }