public InternalTenantContext createInternalTenantContext(final UUID objectId, final ObjectType objectType, final TenantContext context) {
        // The callcontext may come from a user API - for security, check we're not doing cross-tenants operations
        //final Long tenantRecordIdFromObject = retrieveTenantRecordIdFromObject(objectId, objectType);
        //final Long tenantRecordIdFromContext = getTenantRecordIdSafe(callcontext);
        //Preconditions.checkState(tenantRecordIdFromContext.equals(tenantRecordIdFromObject),
        //                         "tenant of the pointed object (%s) and the callcontext (%s) don't match!", tenantRecordIdFromObject, tenantRecordIdFromContext);
        final Long tenantRecordId = getTenantRecordIdSafe(context);
        final Long accountRecordId = getAccountRecordIdSafe(objectId, objectType, context);
        return createInternalTenantContext(tenantRecordId, accountRecordId);
    }
public InternalTenantContext createInternalTenantContext ( final UUID objectId , final ObjectType objectType , final TenantContext context ) { final Long tenantRecordId = getTenantRecordIdSafe ( context ) ; final Long accountRecordId = getAccountRecordIdSafe ( objectId , objectType , context ) ; return createInternalTenantContext ( tenantRecordId , accountRecordId ) ; }
Crate an internal tenant callcontext from a tenant callcontext, and retrieving the account_record_id from another table

@param objectId   the id of the row in the table pointed by object type where to look for account_record_id
@param objectType the object type pointed by this objectId
@param context    original tenant callcontext
@return internal tenant callcontext from callcontext, with a non null account_record_id (if found)