fixes #360
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-lib@117730 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
f1f016619d
commit
7882d02696
|
@ -15,6 +15,7 @@ import org.gcube.common.resources.gcore.ServiceEndpoint;
|
|||
import org.gcube.common.resources.gcore.ServiceEndpoint.AccessPoint;
|
||||
import org.gcube.common.resources.gcore.ServiceEndpoint.Property;
|
||||
import org.gcube.common.resources.gcore.utils.Group;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
||||
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
||||
import org.gcube.resources.discovery.icclient.ICFactory;
|
||||
|
@ -24,10 +25,11 @@ import org.gcube.resources.discovery.icclient.ICFactory;
|
|||
*/
|
||||
public class AccountingPersistenceConfiguration {
|
||||
|
||||
public final String SERVICE_ENDPOINT_CATEGORY = "Accounting";
|
||||
public final String SERVICE_ENDPOINT_NAME = "Persistence";
|
||||
|
||||
protected static final String PERSISTENCE_CLASS_NAME = "persistenceClassName";
|
||||
protected static final String TARGET_SCOPE = "targetScope";
|
||||
|
||||
protected final String SERVICE_ENDPOINT_CATEGORY = "Accounting";
|
||||
protected final String SERVICE_ENDPOINT_NAME = "Persistence";
|
||||
|
||||
protected URI uri;
|
||||
protected String username;
|
||||
|
@ -121,6 +123,12 @@ public class AccountingPersistenceConfiguration {
|
|||
|
||||
DiscoveryClient<ServiceEndpoint> client = ICFactory.clientFor(ServiceEndpoint.class);
|
||||
List<ServiceEndpoint> serviceEndpoints = client.submit(query);
|
||||
if(serviceEndpoints.size()>1){
|
||||
query.addCondition(String.format("$resource/Profile/AccessPoint/Properties/Property/Name/text() eq '%s'", TARGET_SCOPE));
|
||||
query.addCondition(String.format("$resource/Profile/AccessPoint/Properties/Property/Value/text() eq '%s'", ScopeProvider.instance.get()));
|
||||
serviceEndpoints = client.submit(query);
|
||||
}
|
||||
|
||||
return serviceEndpoints.get(0);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue