Refs #10188: Add a way to esplicitly set the scope in accounting-analytics
Task-Url: https://support.d4science.org/issues/10188 git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-analytics@161934 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
0dd016b6fa
commit
34f3c095fa
|
@ -28,7 +28,7 @@ public interface AccountingPersistenceBackendQuery {
|
|||
public static final int KEY_VALUES_LIMIT = 25;
|
||||
|
||||
public static String getScopeToQuery() {
|
||||
String scope = AccountingPersistenceQueryFactory.getForcedScope().get();
|
||||
String scope = AccountingPersistenceQueryFactory.getForcedQueryScope().get();
|
||||
if(scope == null) {
|
||||
scope = BasicUsageRecord.getContextFromToken();
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ package org.gcube.accounting.analytics.persistence;
|
|||
*/
|
||||
public class AccountingPersistenceQueryFactory {
|
||||
|
||||
private static final InheritableThreadLocal<String> forcedScope = new InheritableThreadLocal<String>() {
|
||||
private static final InheritableThreadLocal<String> forcedQueryScope = new InheritableThreadLocal<String>() {
|
||||
|
||||
@Override
|
||||
protected String initialValue() {
|
||||
|
@ -21,10 +21,11 @@ public class AccountingPersistenceQueryFactory {
|
|||
/**
|
||||
* Used to force the query in a certain scope without changing the current effective scope.
|
||||
* Please note that is responsibility of the AccountingPersistenceBackendQuery implementation
|
||||
* use the scope to query. The facility method getScopeToQuery() has been also created
|
||||
* use the scope to query.
|
||||
* The facility method AccountingPersistenceBackendQuery.getScopeToQuery() has been also created
|
||||
*/
|
||||
public static InheritableThreadLocal<String> getForcedScope() {
|
||||
return forcedScope;
|
||||
public static InheritableThreadLocal<String> getForcedQueryScope() {
|
||||
return forcedQueryScope;
|
||||
}
|
||||
|
||||
public static AccountingPersistenceQuery getInstance() {
|
||||
|
|
Loading…
Reference in New Issue