mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-09 19:13:18 +00:00
Using dependency injection to get a instance of ConfigurationService
This commit is contained in:

committed by
Pascal-Nicolas Becker

parent
60f245854d
commit
dc45980a5b
@@ -24,6 +24,7 @@ import org.dspace.services.ConfigurationService;
|
|||||||
import org.dspace.services.factory.DSpaceServicesFactory;
|
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encapsulate access to the news texts.
|
* Encapsulate access to the news texts.
|
||||||
@@ -36,12 +37,14 @@ public class NewsServiceImpl implements NewsService
|
|||||||
|
|
||||||
private List<String> acceptableFilenames;
|
private List<String> acceptableFilenames;
|
||||||
|
|
||||||
|
@Autowired(required = true)
|
||||||
|
private ConfigurationService configurationService;
|
||||||
|
|
||||||
public void setAcceptableFilenames(List<String> acceptableFilenames) {
|
public void setAcceptableFilenames(List<String> acceptableFilenames) {
|
||||||
this.acceptableFilenames = addLocalesToAcceptableFilenames(acceptableFilenames);
|
this.acceptableFilenames = addLocalesToAcceptableFilenames(acceptableFilenames);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List<String> addLocalesToAcceptableFilenames(List<String> acceptableFilenames){
|
protected List<String> addLocalesToAcceptableFilenames(List<String> acceptableFilenames){
|
||||||
ConfigurationService configurationService = DSpaceServicesFactory.getInstance().getConfigurationService();
|
|
||||||
String [] locales = configurationService.getArrayProperty("webui.supported.locales");
|
String [] locales = configurationService.getArrayProperty("webui.supported.locales");
|
||||||
List<String> newAcceptableFilenames = new ArrayList<>();
|
List<String> newAcceptableFilenames = new ArrayList<>();
|
||||||
newAcceptableFilenames.addAll(acceptableFilenames);
|
newAcceptableFilenames.addAll(acceptableFilenames);
|
||||||
|
Reference in New Issue
Block a user