All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.phasetwo.service.model.OrganizationProvider Maven / Gradle / Ivy

There is a newer version: 0.79
Show newest version
package io.phasetwo.service.model;

import com.google.common.base.Strings;
import com.google.common.collect.Maps;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Stream;
import org.keycloak.models.RealmModel;
import org.keycloak.models.UserModel;
import org.keycloak.provider.Provider;

public interface OrganizationProvider extends Provider {

  OrganizationModel createOrganization(
      RealmModel realm, String name, UserModel createdBy, boolean admin);

  OrganizationModel getOrganizationById(RealmModel realm, String id);

  Stream getOrganizationsStreamForDomain(
      RealmModel realm, String domain, boolean verified);

  Stream getUserOrganizationsStream(RealmModel realm, UserModel user);

  Stream searchForOrganizationStream(
      RealmModel realm,
      Map attributes,
      Integer firstResult,
      Integer maxResults,
      Optional member);

  Long getOrganizationsCount(RealmModel realm, String search);

  boolean removeOrganization(RealmModel realm, String id);

  void removeOrganizations(RealmModel realm);

  Stream getUserInvitationsStream(RealmModel realm, UserModel user);

  // deprecated methods

  /**
   * @deprecated use {@link #searchForOrganizationStream searchForOrganizationStream} method instead
   */
  @Deprecated(forRemoval = true)
  default Stream searchForOrganizationByNameStream(
      RealmModel realm, String search, Integer firstResult, Integer maxResults) {
    Map attributes = Maps.newHashMap();
    if (!Strings.isNullOrEmpty(search)) {
      attributes.put("name", search);
    }
    return searchForOrganizationStream(
        realm, attributes, firstResult, maxResults, Optional.empty());
  }

  /**
   * @deprecated use {@link #searchForOrganizationStream searchForOrganizationStream} method instead
   */
  @Deprecated(forRemoval = true)
  default Stream searchForOrganizationByAttributesStream(
      RealmModel realm, Map attributes, Integer firstResult, Integer maxResults) {
    return searchForOrganizationStream(
        realm, attributes, firstResult, maxResults, Optional.empty());
  }

  /**
   * @deprecated use {@link #searchForOrganizationStream searchForOrganizationStream} method instead
   */
  @Deprecated(forRemoval = true)
  default Stream getOrganizationsStream(
      RealmModel realm, Integer firstResult, Integer maxResults) {
    return searchForOrganizationStream(realm, null, firstResult, maxResults, Optional.empty());
  }

  /**
   * @deprecated use {@link #searchForOrganizationStream searchForOrganizationStream} method instead
   */
  @Deprecated(forRemoval = true)
  default Stream getOrganizationsStream(
      RealmModel realm, Map attributes, Integer firstResult, Integer maxResults) {
    return searchForOrganizationStream(
        realm, attributes, firstResult, maxResults, Optional.empty());
  }

  /**
   * @deprecated use {@link #searchForOrganizationStream searchForOrganizationStream} method instead
   */
  @Deprecated(forRemoval = true)
  default Stream getOrganizationsStream(RealmModel realm) {
    return searchForOrganizationStream(realm, null, null, null, Optional.empty());
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy