public Long getRecordIdFromObject(final UUID objectId, final ObjectType objectType, final TenantContext context) { try { if (objectBelongsToTheRightTenant(objectId, objectType, context)) { return nonEntityDao.retrieveRecordIdFromObject(objectId, objectType, recordIdCacheController); } else { return null; } } catch (final ObjectDoesNotExist e) { return null; } }
private Long getAccountRecordIdSafe(final UUID objectId, final ObjectType objectType, final Long tenantRecordId) throws ObjectDoesNotExist { if (objectBelongsToTheRightTenant(objectId, objectType, tenantRecordId)) { return getAccountRecordIdUnsafe(objectId, objectType); } else { throw new IllegalStateException(String.format("Object id=%s type=%s doesn't belong to tenant recordId=%s", objectId, objectType, tenantRecordId)); } }
private Long getAccountRecordIdSafe(final UUID objectId, final ObjectType objectType, final TenantContext context) { if (objectBelongsToTheRightTenant(objectId, objectType, context)) { return getAccountRecordIdUnsafe(objectId, objectType); } else { throw new IllegalStateException(String.format("Object id=%s type=%s doesn't belong to tenant id=%s", objectId, objectType, context.getTenantId())); } }
private boolean objectBelongsToTheRightTenant(final UUID objectId, final ObjectType objectType, final TenantContext context) throws ObjectDoesNotExist { final Long realTenantRecordId = getTenantRecordIdSafe(context); if (realTenantRecordId == null) { throw new ObjectDoesNotExist(String.format("Tenant id=%s doesn't exist!", context.getTenantId())); } return objectBelongsToTheRightTenant(objectId, objectType, realTenantRecordId); }
public Long getRecordIdFromObject(final UUID objectId, final ObjectType objectType, final TenantContext context) { try { if (objectBelongsToTheRightTenant(objectId, objectType, context)) { return nonEntityDao.retrieveRecordIdFromObject(objectId, objectType, recordIdCacheController); } else { return null; } } catch (final ObjectDoesNotExist e) { return null; } }
private Long getAccountRecordIdSafe(final UUID objectId, final ObjectType objectType, final Long tenantRecordId) throws ObjectDoesNotExist { if (objectBelongsToTheRightTenant(objectId, objectType, tenantRecordId)) { return getAccountRecordIdUnsafe(objectId, objectType); } else { throw new IllegalStateException(String.format("Object id=%s type=%s doesn't belong to tenant recordId=%s", objectId, objectType, tenantRecordId)); } }
private Long getAccountRecordIdSafe(final UUID objectId, final ObjectType objectType, final TenantContext context) { if (objectBelongsToTheRightTenant(objectId, objectType, context)) { return getAccountRecordIdUnsafe(objectId, objectType); } else { throw new IllegalStateException(String.format("Object id=%s type=%s doesn't belong to tenant id=%s", objectId, objectType, context.getTenantId())); } }
private boolean objectBelongsToTheRightTenant(final UUID objectId, final ObjectType objectType, final TenantContext context) throws ObjectDoesNotExist { final Long realTenantRecordId = getTenantRecordIdSafe(context); if (realTenantRecordId == null) { throw new ObjectDoesNotExist(String.format("Tenant id=%s doesn't exist!", context.getTenantId())); } return objectBelongsToTheRightTenant(objectId, objectType, realTenantRecordId); }