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

32 lines
996 B
Java
Raw Normal View History

2023-10-18 17:05:39 +02:00
package eu.eudat.logic.services;
import eu.eudat.commons.scope.user.UserScope;
import eu.eudat.service.externalfetcher.criteria.ExternalReferenceCriteria;
2024-01-03 17:22:24 +01:00
import gr.cite.tools.exception.MyNotFoundException;
2023-10-18 17:05:39 +02:00
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
2023-10-20 16:44:41 +02:00
public class ExternalValidationService {
2023-10-18 17:05:39 +02:00
2024-02-08 17:12:47 +01:00
// private RemoteFetcherService remoteFetcherService;
private final UserScope userScope;
2023-10-18 17:05:39 +02:00
@Autowired
2024-02-08 17:12:47 +01:00
public ExternalValidationService(UserScope userScope) {
2023-10-18 17:05:39 +02:00
super();
2024-02-08 17:12:47 +01:00
// this.remoteFetcherService = remoteFetcherService;
this.userScope = userScope;
2023-10-18 17:05:39 +02:00
}
2024-02-19 17:10:34 +01:00
public Boolean validateIdentifier(String identifier, String type) throws MyNotFoundException {
2024-02-20 09:11:49 +01:00
ExternalReferenceCriteria externalReferenceCriteria = new ExternalReferenceCriteria(identifier, null);
2024-02-08 17:12:47 +01:00
// Integer count = this.remoteFetcherService.countEntries(externalReferenceCriteria, type);
Integer count = 1;
return userScope.isSet() && count > 0;
2023-10-18 17:05:39 +02:00
}
}