31 lines
883 B
Java
31 lines
883 B
Java
package org.gcube.informationsystem.publisher.scope;
|
|
|
|
import java.util.List;
|
|
|
|
import org.gcube.common.resources.gcore.Resource;
|
|
|
|
public class DefaultScopeValidator implements Validator{
|
|
|
|
@Override
|
|
public void validate(Resource resource) {
|
|
if (resource.scopes().isEmpty())
|
|
throw new IllegalArgumentException("scopes in the resource are empty");
|
|
}
|
|
|
|
|
|
@Override
|
|
public void checkScopeCompatibility(Resource resource,
|
|
List<String> scopesList) {
|
|
// for(String scope: scopesList){
|
|
// ScopeGroup<String> scopes=resource.scopes();
|
|
// for(Iterator<String> it=scopes.iterator(); it.hasNext();){
|
|
// String scopeItem=it.next();
|
|
// if((!scopeItem.contains(scope)) && (!scope.contains(scopeItem)))
|
|
// throw new IllegalStateException("The scope "+scope+" is not compatible with scope: "+scopeItem+" that is present in the resource"+ resource.id());
|
|
// }
|
|
// }
|
|
}
|
|
|
|
|
|
}
|