Codota Logo
TenantAware.getCurrentTenant
Code IndexAdd Codota to your IDE (free)

How to use
getCurrentTenant
method
in
org.eclipse.hawkbit.tenancy.TenantAware

Best Java code snippets using org.eclipse.hawkbit.tenancy.TenantAware.getCurrentTenant (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Dictionary d =
  • Codota Iconnew Hashtable()
  • Codota IconBundle bundle;bundle.getHeaders()
  • Codota Iconnew Properties()
  • Smart code suggestions by Codota
}
origin: org.eclipse.hawkbit/hawkbit-repository-jpa

@Override
public TenantMetaData getTenantMetadata() {
  if (tenantAware.getCurrentTenant() == null) {
    throw new IllegalStateException("Tenant not set");
  }
  return getTenantMetadata(tenantAware.getCurrentTenant());
}
origin: eclipse/hawkbit

@Override
public TenantMetaData getTenantMetadata() {
  if (tenantAware.getCurrentTenant() == null) {
    throw new IllegalStateException("Tenant not set");
  }
  return getTenantMetadata(tenantAware.getCurrentTenant());
}
origin: org.eclipse.hawkbit/hawkbit-autoconfigure

  @Override
  protected Collection<String> getCacheNames(final CacheOperationInvocationContext<?> context) {
    return super.getCacheNames(context).stream()
        .map(cacheName -> tenantAware.getCurrentTenant() + "." + cacheName).collect(Collectors.toList());
  }
}
origin: org.eclipse.hawkbit/hawkbit-autoconfigure

/**
 * @return
 * @see org.springframework.cache.Cache#getName()
 */
@Override
public String getName() {
  return tenantAware.getCurrentTenant() + "." + delegate.getName();
}
origin: org.eclipse.hawkbit/hawkbit-repository-jpa

@Override
public Optional<AbstractDbArtifact> loadArtifactBinary(final String sha1Hash) {
  return Optional.ofNullable(artifactRepository.getArtifactBySha1(tenantAware.getCurrentTenant(), sha1Hash));
}
origin: eclipse/hawkbit

@Override
public Collection<String> getCacheNames() {
  String currentTenant = tenantAware.getCurrentTenant();
  if (isTenantInvalid(currentTenant)) {
    return Collections.emptyList();
  }
  currentTenant = currentTenant.toUpperCase();
  return getCacheNames(currentTenant);
}
origin: org.eclipse.hawkbit/hawkbit-core

@Override
public Collection<String> getCacheNames() {
  String currentTenant = tenantAware.getCurrentTenant();
  if (isTenantInvalid(currentTenant)) {
    return Collections.emptyList();
  }
  currentTenant = currentTenant.toUpperCase();
  return getCacheNames(currentTenant);
}
origin: eclipse/hawkbit

private void sendRolloutGroupDeletedEvents(final JpaRollout rollout) {
  final List<Long> groupIds = rollout.getRolloutGroups().stream().map(RolloutGroup::getId)
      .collect(Collectors.toList());
  afterCommit.afterCommit(() -> groupIds.forEach(rolloutGroupId -> eventPublisher
      .publishEvent(new RolloutGroupDeletedEvent(tenantAware.getCurrentTenant(), rolloutGroupId,
          JpaRolloutGroup.class.getName(), bus.getId()))));
}
origin: org.eclipse.hawkbit/hawkbit-repository-jpa

private void sendRolloutGroupDeletedEvents(final JpaRollout rollout) {
  final List<Long> groupIds = rollout.getRolloutGroups().stream().map(RolloutGroup::getId)
      .collect(Collectors.toList());
  afterCommit.afterCommit(() -> groupIds.forEach(rolloutGroupId -> eventPublisher
      .publishEvent(new RolloutGroupDeletedEvent(tenantAware.getCurrentTenant(), rolloutGroupId,
          JpaRolloutGroup.class.getName(), applicationContext.getId()))));
}
origin: org.eclipse.hawkbit/hawkbit-repository-jpa

@Override
@Cacheable(value = "currentTenant", keyGenerator = "currentTenantKeyGenerator", cacheManager = "directCacheManager", unless = "#result == null")
public String currentTenant() {
  final String initialTenantCreation = currentTenantCacheKeyGenerator.getCreateInitialTenant().get();
  if (initialTenantCreation == null) {
    final TenantMetaData findByTenant = tenantMetaDataRepository
        .findByTenantIgnoreCase(tenantAware.getCurrentTenant());
    return findByTenant != null ? findByTenant.getTenant() : null;
  }
  return initialTenantCreation;
}
origin: eclipse/hawkbit

@Override
@Cacheable(value = "currentTenant", keyGenerator = "currentTenantKeyGenerator", cacheManager = "directCacheManager", unless = "#result == null")
public String currentTenant() {
  final String initialTenantCreation = currentTenantCacheKeyGenerator.getCreateInitialTenant().get();
  if (initialTenantCreation == null) {
    final TenantMetaData findByTenant = tenantMetaDataRepository
        .findByTenantIgnoreCase(tenantAware.getCurrentTenant());
    return findByTenant != null ? findByTenant.getTenant() : null;
  }
  return initialTenantCreation;
}
origin: eclipse/hawkbit

@Override
public Cache getCache(final String name) {
  String currentTenant = tenantAware.getCurrentTenant();
  if (isTenantInvalid(currentTenant)) {
    return null;
  }
  currentTenant = currentTenant.toUpperCase();
  return delegate.getCache(buildKey(currentTenant, name));
}
origin: org.eclipse.hawkbit/hawkbit-core

@Override
public Cache getCache(final String name) {
  String currentTenant = tenantAware.getCurrentTenant();
  if (isTenantInvalid(currentTenant)) {
    return null;
  }
  currentTenant = currentTenant.toUpperCase();
  return delegate.getCache(buildKey(currentTenant, name));
}
origin: eclipse/hawkbit

@Override
public void requestControllerAttributes(final String controllerId) {
  final JpaTarget target = getByControllerIdAndThrowIfNotFound(controllerId);
  target.setRequestControllerAttributes(true);
  eventPublisher.publishEvent(new TargetAttributesRequestedEvent(tenantAware.getCurrentTenant(), target.getId(),
      target.getControllerId(), target.getAddress() != null ? target.getAddress().toString() : null,
      JpaTarget.class.getName(), bus.getId()));
}
origin: eclipse/hawkbit

  @Override
  protected void doBegin(final Object transaction, final TransactionDefinition definition) {
    super.doBegin(transaction, definition);

    final String currentTenant = tenantAware.getCurrentTenant();
    if (currentTenant != null) {
      final EntityManagerHolder emHolder = (EntityManagerHolder) TransactionSynchronizationManager
          .getResource(getEntityManagerFactory());
      final EntityManager em = emHolder.getEntityManager();
      em.setProperty(PersistenceUnitProperties.MULTITENANT_PROPERTY_DEFAULT, currentTenant.toUpperCase());
    }
  }
}
origin: eclipse/hawkbit

private void requestControllerAttributes(final String controllerId) {
  final JpaTarget target = (JpaTarget) getByControllerId(controllerId)
      .orElseThrow(() -> new EntityNotFoundException(Target.class, controllerId));
  target.setRequestControllerAttributes(true);
  eventPublisher.publishEvent(new TargetAttributesRequestedEvent(tenantAware.getCurrentTenant(), target.getId(),
      target.getControllerId(), target.getAddress() != null ? target.getAddress().toString() : null,
      JpaTarget.class.getName(), bus.getId()));
}
origin: org.eclipse.hawkbit/hawkbit-repository-jpa

@Override
public void requestControllerAttributes(final String controllerId) {
  final JpaTarget target = getByControllerIdAndThrowIfNotFound(controllerId);
  target.setRequestControllerAttributes(true);
  eventPublisher.publishEvent(new TargetAttributesRequestedEvent(tenantAware.getCurrentTenant(), target.getId(),
      target.getControllerId(), target.getAddress() != null ? target.getAddress().toString() : null,
      JpaTarget.class.getName(), applicationContext.getId()));
}
origin: org.eclipse.hawkbit/hawkbit-repository-jpa

  @Override
  protected void doBegin(final Object transaction, final TransactionDefinition definition) {
    super.doBegin(transaction, definition);

    final String currentTenant = tenantAware.getCurrentTenant();
    if (currentTenant != null) {
      final EntityManagerHolder emHolder = (EntityManagerHolder) TransactionSynchronizationManager
          .getResource(getEntityManagerFactory());
      final EntityManager em = emHolder.getEntityManager();
      em.setProperty(PersistenceUnitProperties.MULTITENANT_PROPERTY_DEFAULT, currentTenant.toUpperCase());
    }
  }
}
origin: org.eclipse.hawkbit/hawkbit-repository-jpa

@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public TenantUsage getStatsOfTenant() {
  final String tenant = tenantAware.getCurrentTenant();
  final TenantUsage result = new TenantUsage(tenant);
  result.setTargets(targetRepository.count());
  result.setArtifacts(artifactRepository.countBySoftwareModuleDeleted(false));
  artifactRepository.getSumOfUndeletedArtifactSize().ifPresent(result::setOverallArtifactVolumeInBytes);
  result.setActions(actionRepository.count());
  return result;
}
origin: eclipse/hawkbit

@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public TenantUsage getStatsOfTenant() {
  final String tenant = tenantAware.getCurrentTenant();
  final TenantUsage result = new TenantUsage(tenant);
  result.setTargets(targetRepository.count());
  result.setArtifacts(artifactRepository.countBySoftwareModuleDeleted(false));
  artifactRepository.getSumOfUndeletedArtifactSize().ifPresent(result::setOverallArtifactVolumeInBytes);
  result.setActions(actionRepository.count());
  return result;
}
org.eclipse.hawkbit.tenancyTenantAwaregetCurrentTenant

Javadoc

Implementation might retrieve the current tenant from a session or thread-local.

Popular methods of TenantAware

  • runAsTenant
    Gives the possibility to run a certain code under a specific given tenant. Only the given TenantRunn

Popular in Java

  • Start an intent from android
  • setContentView (Activity)
  • notifyDataSetChanged (ArrayAdapter)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • Point (java.awt)
    A point representing a location in (x, y) coordinate space, specified in integer precision.
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • Reference (javax.naming)
  • Join (org.hibernate.mapping)
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now