argos/dmp-backend/web/src/main/java/eu/eudat/logic/services/ExternalValidationService.java

32 lines
996 B
Java

package eu.eudat.logic.services;
import eu.eudat.commons.scope.user.UserScope;
import eu.eudat.service.externalfetcher.criteria.ExternalReferenceCriteria;
import gr.cite.tools.exception.MyNotFoundException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class ExternalValidationService {
// private RemoteFetcherService remoteFetcherService;
private final UserScope userScope;
@Autowired
public ExternalValidationService(UserScope userScope) {
super();
// this.remoteFetcherService = remoteFetcherService;
this.userScope = userScope;
}
public Boolean validateIdentifier(String identifier, String type) throws MyNotFoundException {
ExternalReferenceCriteria externalReferenceCriteria = new ExternalReferenceCriteria(identifier, null);
// Integer count = this.remoteFetcherService.countEntries(externalReferenceCriteria, type);
Integer count = 1;
return userScope.isSet() && count > 0;
}
}