diff --git a/pom.xml b/pom.xml
index fa51599db..b90dd55e0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -18,8 +18,8 @@
dev-44.1.0
- dev-86.1.0
- dev-59.0.0
+ dev-86.3.0
+ dev-60.0.0
diff --git a/src/main/java/sirius/biz/storage/layer2/jdbc/SQLVariant.java b/src/main/java/sirius/biz/storage/layer2/jdbc/SQLVariant.java
index a49026cb0..fb2fb6298 100644
--- a/src/main/java/sirius/biz/storage/layer2/jdbc/SQLVariant.java
+++ b/src/main/java/sirius/biz/storage/layer2/jdbc/SQLVariant.java
@@ -109,7 +109,7 @@ public class SQLVariant extends SQLEntity implements BlobVariant {
@AfterDelete
protected void onDelete() {
- SQLBlob sqlBlob = sourceBlob.fetchValue();
+ SQLBlob sqlBlob = sourceBlob.forceFetchValue();
if (sqlBlob == null) {
return;
}
diff --git a/src/main/java/sirius/biz/storage/layer2/mongo/MongoVariant.java b/src/main/java/sirius/biz/storage/layer2/mongo/MongoVariant.java
index 3c45ef157..6ac8a7c2c 100644
--- a/src/main/java/sirius/biz/storage/layer2/mongo/MongoVariant.java
+++ b/src/main/java/sirius/biz/storage/layer2/mongo/MongoVariant.java
@@ -107,7 +107,7 @@ public class MongoVariant extends MongoEntity implements BlobVariant {
@AfterDelete
protected void onDelete() {
- MongoBlob mongoBlob = blob.fetchValue();
+ MongoBlob mongoBlob = blob.forceFetchValue();
if (mongoBlob == null) {
return;
}
diff --git a/src/main/java/sirius/biz/storage/legacy/VersionManager.java b/src/main/java/sirius/biz/storage/legacy/VersionManager.java
index 0d73d0eb5..0c5abee9e 100644
--- a/src/main/java/sirius/biz/storage/legacy/VersionManager.java
+++ b/src/main/java/sirius/biz/storage/legacy/VersionManager.java
@@ -170,7 +170,7 @@ private void computeVersion(VirtualObject object, String version) {
}
private void performVersionComputation(VirtualObjectVersion objectVersion) {
- VirtualObject object = objectVersion.getVirtualObject().fetchValue();
+ VirtualObject object = objectVersion.getVirtualObject().fetchCachedValue();
try {
Tuple size = Tuple.create(0, 0);
Tuple extendedSize = Tuple.create(0, 0);
diff --git a/src/main/java/sirius/biz/storage/legacy/VirtualObjectVersion.java b/src/main/java/sirius/biz/storage/legacy/VirtualObjectVersion.java
index c81ea0794..67ac6f7a8 100644
--- a/src/main/java/sirius/biz/storage/legacy/VirtualObjectVersion.java
+++ b/src/main/java/sirius/biz/storage/legacy/VirtualObjectVersion.java
@@ -23,6 +23,7 @@
/**
* Represents a resized image version of a {@link VirtualObject}.
+ *
* @deprecated use the new storage APIs
*/
@Deprecated
@@ -100,8 +101,9 @@ protected void removePhysicalFile() {
@AfterDelete
protected void removeVersionFromCaches() {
if (this.getVirtualObject().isFilled()) {
- versionManager.clearCacheForVirtualObject(this.getVirtualObject().fetchValue());
- storage.clearCacheForVirtualObject(this.getVirtualObject().fetchValue());
+ VirtualObject referencedObject = this.getVirtualObject().forceFetchValue();
+ versionManager.clearCacheForVirtualObject(referencedObject);
+ storage.clearCacheForVirtualObject(referencedObject);
}
}
diff --git a/src/main/java/sirius/biz/tenants/SAMLController.java b/src/main/java/sirius/biz/tenants/SAMLController.java
index 0f5f45916..c3f152740 100644
--- a/src/main/java/sirius/biz/tenants/SAMLController.java
+++ b/src/main/java/sirius/biz/tenants/SAMLController.java
@@ -181,7 +181,7 @@ protected List querySAMLTenants() {
private void verifyUser(SAMLResponse response, UserInfo user) {
U account = user.getUserObject(getUserClass());
- T tenant = account.getTenant().fetchValue();
+ T tenant = account.getTenant().forceFetchValue();
if (!checkIssuer(tenant, response)) {
throw Exceptions.createHandled().withSystemErrorMessage("SAML Error: Issuer mismatch!").handle();
diff --git a/src/main/java/sirius/biz/tenants/TenantController.java b/src/main/java/sirius/biz/tenants/TenantController.java
index 3774e3e8b..7bfcba980 100644
--- a/src/main/java/sirius/biz/tenants/TenantController.java
+++ b/src/main/java/sirius/biz/tenants/TenantController.java
@@ -407,7 +407,7 @@ public void selectTenant(final WebContext webContext, String tenantId) {
.causedByUser(account.getUniqueName(), account.getUserAccountData().getLogin().getUsername())
.forUser(account.getUniqueName(), account.getUserAccountData().getLogin().getUsername())
.forTenant(account.getTenant().getIdAsString(),
- account.getTenant().fetchValue().getTenantData().getName())
+ account.getTenant().forceFetchValue().getTenantData().getName())
.log();
webContext.setSessionValue(UserContext.getCurrentScope().getScopeId()
diff --git a/src/main/java/sirius/biz/tenants/TenantUserManager.java b/src/main/java/sirius/biz/tenants/TenantUserManager.java
index 4b8bcb946..9a313a206 100644
--- a/src/main/java/sirius/biz/tenants/TenantUserManager.java
+++ b/src/main/java/sirius/biz/tenants/TenantUserManager.java
@@ -451,9 +451,10 @@ public UserInfo findUserByName(@Nullable WebContext webContext, String user) {
}
U account = optionalAccount.get();
+ T tenant = account.getTenant().forceFetchValue();
userAccountCache.put(account.getUniqueName(), account);
- tenantsCache.put(account.getTenant().fetchValue().getIdAsString(), account.getTenant().fetchValue());
+ tenantsCache.put(tenant.getIdAsString(), tenant);
rolesCache.remove(account.getUniqueName());
configCache.remove(account.getUniqueName());
@@ -525,7 +526,7 @@ private UserInfo verifyIpRange(WebContext webContext, UserInfo info) {
return defaultUser;
}
- T tenant = account.getTenant().fetchValue();
+ T tenant = fetchTenant(account.getTenant().getIdAsString());
if (tenant != null && !tenant.getTenantData().matchesIPRange(webContext)) {
return createUserWithLimitedRoles(info, tenant.getTenantData().getRolesToKeepAsSet());
@@ -569,7 +570,8 @@ protected U fetchAccount(@Nonnull String accountId) {
return null;
}
userAccountCache.put(account.getUniqueName(), account);
- tenantsCache.put(account.getTenant().fetchValue().getIdAsString(), account.getTenant().fetchValue());
+ T tenant = account.getTenant().forceFetchValue();
+ tenantsCache.put(tenant.getIdAsString(), tenant);
rolesCache.remove(account.getUniqueName());
configCache.remove(account.getUniqueName());
@@ -604,7 +606,8 @@ private UserInfo asUserWithRoles(U account, Set roles, @Nullable Supplie
return UserInfo.Builder.createUser(account.getUniqueName())
.withUsername(account.getUserAccountData().getLogin().getUsername())
.withTenantId(String.valueOf(account.getTenant().getId()))
- .withTenantName(account.getTenant().fetchValue().getTenantData().getName())
+ .withTenantName(fetchTenant(account.getTenant().getIdAsString()).getTenantData()
+ .getName())
.withLanguage(computeLanguage(null, account.getUniqueName()))
.withPermissions(roles)
.withSettingsSupplier(user -> getUserSettings(getScopeSettings(), user))
@@ -637,13 +640,12 @@ public UserInfo findUserByCredentials(@Nullable WebContext webContext, String us
}
U account = result.getUserObject(getUserClass());
+ T tenant = fetchTenant(account.getTenant().getIdAsString());
if (account.getUserAccountData().isExternalLoginRequired() && !isWithinInterval(account.getUserAccountData()
.getLogin()
.getLastExternalLogin(),
- account.getTenant()
- .fetchValue()
- .getTenantData()
- .getExternalLoginIntervalDays())) {
+ tenant.getTenantData()
+ .getExternalLoginIntervalDays())) {
completeAuditLogForUser(auditLog.negative("AuditLog.externalLoginRequired"), account);
throw Exceptions.createHandled().withNLSKey("UserAccount.externalLoginMustBePerformed").handle();
}
@@ -672,8 +674,7 @@ public UserInfo findUserByCredentials(@Nullable WebContext webContext, String us
auditLog.negative("AuditLog.loginRejected")
.forUser(account.getUniqueName(), account.getUserAccountData().getLogin().getUsername())
- .forTenant(String.valueOf(account.getTenant().getId()),
- account.getTenant().fetchValue().getTenantData().getName())
+ .forTenant(tenant.getIdAsString(), tenant.getTenantData().getName())
.log();
return null;
@@ -718,7 +719,7 @@ protected void completeAuditLogForUser(AuditLog.AuditLogBuilder builder, U accou
builder.causedByUser(account.getUniqueName(), account.getUserAccountData().getLogin().getUsername())
.forUser(account.getUniqueName(), account.getUserAccountData().getLogin().getUsername())
.forTenant(String.valueOf(account.getTenant().getId()),
- account.getTenant().fetchValue().getTenantData().getName())
+ fetchTenant(account.getTenant().getIdAsString()).getTenantData().getName())
.log();
}
@@ -791,7 +792,7 @@ protected U getUserObject(UserInfo userInfo) {
protected UserSettings getUserSettings(UserSettings scopeSettings, UserInfo userInfo) {
U user = userInfo.getUserObject(getUserClass());
Config userAccountConfig = user.getUserAccountData().getPermissions().getConfig();
- Config tenantConfig = user.getTenant().fetchValue().getTenantData().getConfig();
+ Config tenantConfig = fetchTenant(user.getTenant().getIdAsString()).getTenantData().getConfig();
if (userAccountConfig == null) {
if (tenantConfig == null) {
@@ -852,7 +853,7 @@ protected boolean isUserStillValid(String userId, WebContext webContext) {
}
LoginData loginData = user.getUserAccountData().getLogin();
- TenantData tenantData = user.getTenant().fetchValue().getTenantData();
+ TenantData tenantData = fetchTenant(user.getTenant().getIdAsString()).getTenantData();
if (loginData.isAccountLocked()) {
return false;
@@ -966,7 +967,7 @@ protected Set computeRoles(WebContext webContext, String accountUniqueNa
}
Set roles = computeRoles(user,
- user.getTenant().fetchValue(),
+ fetchTenant(user.getTenant().getIdAsString()),
Strings.areEqual(systemTenant, String.valueOf(user.getTenant().getId())));
rolesCache.put(accountUniqueName, Tuple.create(roles, user.getTenant().getUniqueObjectName()));
@@ -1041,7 +1042,7 @@ protected String computeLanguage(WebContext webContext, String userId) {
return NLS.getDefaultLanguage();
}
return Strings.firstFilled(userAccount.getUserAccountData().getLanguage().getValue(),
- userAccount.getTenant().fetchValue().getTenantData().getLanguage().getValue(),
+ fetchTenant(userAccount.getTenant().getIdAsString()).getTenantData().getLanguage().getValue(),
NLS.getDefaultLanguage());
}
}
diff --git a/src/main/java/sirius/biz/tenants/Tenants.java b/src/main/java/sirius/biz/tenants/Tenants.java
index fa9d33a3f..3b1bf0e8c 100644
--- a/src/main/java/sirius/biz/tenants/Tenants.java
+++ b/src/main/java/sirius/biz/tenants/Tenants.java
@@ -310,10 +310,6 @@ public Optional fetchCachedTenant(BaseEntityRef tenantRef) {
return Optional.empty();
}
- if (tenantRef.isValueLoaded()) {
- return Optional.of(tenantRef.fetchValue());
- }
-
return fetchCachedTenant(String.valueOf(tenantRef.getId()));
}
@@ -401,10 +397,6 @@ public Optional fetchCachedUserAccount(BaseEntityRef userRef) {
return Optional.empty();
}
- if (userRef.isValueLoaded()) {
- return Optional.of(userRef.fetchValue());
- }
-
return fetchCachedUserAccount(userRef.getIdAsString());
}
diff --git a/src/main/java/sirius/biz/tenants/UserAccountData.java b/src/main/java/sirius/biz/tenants/UserAccountData.java
index dc57b3e16..722eba0e0 100644
--- a/src/main/java/sirius/biz/tenants/UserAccountData.java
+++ b/src/main/java/sirius/biz/tenants/UserAccountData.java
@@ -239,7 +239,7 @@ public Optional tryAs(Class adapterType) {
}
protected Tenant> getTenant() {
- return ((UserAccount, ?>) userObject).getTenant().fetchValue();
+ return ((UserAccount, ?>) userObject).getTenant().forceFetchValue();
}
@Override
@@ -369,7 +369,7 @@ public boolean isOwnUser() {
* @return true if this user belongs to the current user's tenant, false otherwise
*/
public boolean isOwnTenant() {
- return Objects.equals(UserContext.getCurrentUser().as(UserAccount.class).getTenant().fetchValue(), getTenant());
+ return Objects.equals(UserContext.getCurrentUser().as(UserAccount.class).getTenant().getIdAsString(), getTenant().getIdAsString());
}
/**
diff --git a/src/main/java/sirius/biz/tenants/UserAccountSearchProvider.java b/src/main/java/sirius/biz/tenants/UserAccountSearchProvider.java
index 66ed78557..1272218f3 100644
--- a/src/main/java/sirius/biz/tenants/UserAccountSearchProvider.java
+++ b/src/main/java/sirius/biz/tenants/UserAccountSearchProvider.java
@@ -87,7 +87,7 @@ public void query(String query, int maxResults, Consumer resul
} else {
openSearchResult.withDescription(userAccount
+ " ("
- + userAccount.getTenant().fetchValue().toString()
+ + userAccount.getTenant().fetchCachedValue().toString()
+ ")")
.withURL("/tenants/select/"
+ userAccount.getTenant().getIdAsString()
@@ -103,9 +103,9 @@ public void query(String query, int maxResults, Consumer resul
+ label="@user.getTenant().fetchCachedValue().toString()"/>
- @user.getTenant().fetchValue().toString()
+ @user.getTenant().fetchCachedValue().toString()
)
diff --git a/src/main/resources/default/templates/biz/tenants/tenant-extended.html.pasta b/src/main/resources/default/templates/biz/tenants/tenant-extended.html.pasta
index bba5ffc14..063be78e1 100644
--- a/src/main/resources/default/templates/biz/tenants/tenant-extended.html.pasta
+++ b/src/main/resources/default/templates/biz/tenants/tenant-extended.html.pasta
@@ -40,7 +40,7 @@
suggestionUri="/tenants/autocomplete">