Automatically setting the scope
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-lib@117353 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
f0b9f1cd4b
commit
7283ad5e24
|
@ -29,6 +29,7 @@ import org.gcube.accounting.datamodel.validations.annotations.ValidInteger;
|
|||
import org.gcube.accounting.datamodel.validations.annotations.ValidLong;
|
||||
import org.gcube.accounting.datamodel.validations.annotations.ValidOperationResult;
|
||||
import org.gcube.accounting.exception.InvalidValueException;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -193,6 +194,11 @@ public abstract class BasicUsageRecord implements UsageRecord, Serializable {
|
|||
this.aggregatedFields = new HashSet<String>();
|
||||
this.computedFields = new HashSet<String>();
|
||||
initializeValidation();
|
||||
try {
|
||||
this.setScope(ScopeProvider.instance.get().toString());
|
||||
} catch (InvalidValueException e) {
|
||||
logger.warn("Unable to automaticcally set the scope using scope provider. The record will not be valid if the scope will not be explicitly set.");
|
||||
}
|
||||
}
|
||||
|
||||
public BasicUsageRecord(){
|
||||
|
|
Loading…
Reference in New Issue