Add method to calculate extended version of stakeholders if something goes wrong.

This commit is contained in:
Konstantinos Triantafyllou 2024-11-15 15:32:46 +02:00
parent 009ab187b3
commit c753d2f45a
3 changed files with 13 additions and 0 deletions

View File

@ -16,6 +16,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication(scanBasePackages = {"eu.dnetlib.irishmonitorservice"})
@PropertySources({
@PropertySource("classpath:admintoolslibrary.properties"),
@PropertySource("classpath:authorization.properties"),
@PropertySource("classpath:authentication.properties"),
@PropertySource("classpath:monitorservice.properties"),
@PropertySource("classpath:irishmonitorservice.properties"),

View File

@ -5,6 +5,7 @@ import eu.dnetlib.irishmonitorservice.entities.StakeholderExtended;
import eu.dnetlib.irishmonitorservice.services.StakeholderExtendedService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.io.UnsupportedEncodingException;
@ -29,4 +30,11 @@ public class StakeholderExtendedController {
public ResponseEntity<StakeholderExtended> getStakeholder(@PathVariable String stakeholderId) throws UnsupportedEncodingException {
return ResponseEntity.ok(this.service.getStakeholderExtended(stakeholderId));
}
@RequestMapping(value = "/calculate", method = RequestMethod.GET)
@PreAuthorize("hasAuthority(@AuthorizationService.PORTAL_ADMIN)")
public ResponseEntity<Void> calculate() {
this.service.calculate();
return ResponseEntity.noContent().build();
}
}

View File

@ -67,4 +67,8 @@ public class StakeholderExtendedService {
}
return stakeholders;
}
public void calculate() {
this.cacheService.clearCache();
}
}