This commit is contained in:
Roberto Cirillo 2019-10-23 10:10:40 +02:00
parent 565312cbb0
commit 108c194bf2
2 changed files with 27 additions and 25 deletions

View File

@ -94,7 +94,6 @@ public class RegistryPublisherImpl implements RegistryPublisher {
log.debug("[VOCREATE] new scope added {}",scope);
ResourceMediator.setScope(resource, scope);
}
// validating the resource
try {
Resources.validate(resource);
@ -103,18 +102,19 @@ public class RegistryPublisherImpl implements RegistryPublisher {
throw new IllegalArgumentException("the resource is not valid ", e.getCause());
}
try{
// checking the current scope: if the operation fails in the current VO it will give an exception, if it fails in another VO no exception will be given
String currentVO = Utils.getCurrentVO(currentScope);
if (currentVO != null){
RegistryStub stub = getRegistryStub();
createResource(resource, currentVO, stub);
vosScopes.remove(currentVO);
//in this case it is a root-vo scope so we need to create the resource only at root-vo level
}else{
RegistryStub stub = getRegistryStub();
createResource(resource, currentVO, stub);
return resource;
if(currentScope != null){
// checking the current scope: if the operation fails in the current VO it will give an exception, if it fails in another VO no exception will be given
String currentVO = Utils.getCurrentVO(currentScope);
if (currentVO != null){
RegistryStub stub = getRegistryStub();
createResource(resource, currentVO, stub);
vosScopes.remove(currentVO);
//in this case it is a root-vo scope so we need to create the resource only at root-vo level
}else{
RegistryStub stub = getRegistryStub();
createResource(resource, currentVO, stub);
return resource;
}
}
// update the resource for each VO
for (String voScope: vosScopes){
@ -231,17 +231,19 @@ public class RegistryPublisherImpl implements RegistryPublisher {
}
HashSet<String> vosScopes = Utils.getInternalVOScopes(resource);
try{
// checking the current scope: if the operation fail in the current VO it will give an exception, if it fails in another VO no exception will be given
String currentVO = Utils.getCurrentVO(currentScope);
if (currentVO != null){
ScopeProvider.instance.set(currentVO);
registryUpdate(resource, 0);
vosScopes.remove(currentVO);
// in this case it is a root-vo scope so we need to update the resource only at root-vo level
}else{
ScopeProvider.instance.set(currentScope);
registryUpdate(resource, 0);
return resource;
if(currentScope != null){
// checking the current scope: if the operation fail in the current VO it will give an exception, if it fails in another VO no exception will be given
String currentVO = Utils.getCurrentVO(currentScope);
if (currentVO != null){
ScopeProvider.instance.set(currentVO);
registryUpdate(resource, 0);
vosScopes.remove(currentVO);
// in this case it is a root-vo scope so we need to update the resource only at root-vo level
}else{
ScopeProvider.instance.set(currentScope);
registryUpdate(resource, 0);
return resource;
}
}
int tries=0;

View File

@ -65,7 +65,7 @@ public class Utils {
ScopeBean scopeBean = new ScopeBean(scope);
if(scopeBean.is(Type.VRE))
vosScopes.add(scopeBean.enclosingScope().toString());
// else if(scopeBean.is(Type.VO))
// if the scope is a root-vo scope, it will be added to the vosScope array
vosScopes.add(scope);
}
return vosScopes;