mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 18:14:26 +00:00
[DS-1814] remove deprecated ConfigurationManager in favour of ConfigurationService
This commit is contained in:
@@ -7,6 +7,15 @@
|
||||
*/
|
||||
package org.dspace.content;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
@@ -18,7 +27,14 @@ import org.dspace.authorize.service.AuthorizeService;
|
||||
import org.dspace.authorize.service.ResourcePolicyService;
|
||||
import org.dspace.content.authority.Choices;
|
||||
import org.dspace.content.dao.ItemDAO;
|
||||
import org.dspace.content.service.*;
|
||||
import org.dspace.content.service.BitstreamFormatService;
|
||||
import org.dspace.content.service.BitstreamService;
|
||||
import org.dspace.content.service.BundleService;
|
||||
import org.dspace.content.service.CollectionService;
|
||||
import org.dspace.content.service.CommunityService;
|
||||
import org.dspace.content.service.InstallItemService;
|
||||
import org.dspace.content.service.ItemService;
|
||||
import org.dspace.content.service.MetadataSchemaService;
|
||||
import org.dspace.core.Constants;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.LogManager;
|
||||
@@ -29,15 +45,10 @@ import org.dspace.harvest.HarvestedItem;
|
||||
import org.dspace.harvest.service.HarvestedItemService;
|
||||
import org.dspace.identifier.IdentifierException;
|
||||
import org.dspace.identifier.service.IdentifierService;
|
||||
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||
import org.dspace.services.ConfigurationService;
|
||||
import org.dspace.versioning.service.VersioningService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.sql.SQLException;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Service implementation for the Item object.
|
||||
* This class is responsible for all business logic calls for the Item object and is autowired by spring.
|
||||
@@ -79,6 +90,8 @@ public class ItemServiceImpl extends DSpaceObjectServiceImpl<Item> implements It
|
||||
protected VersioningService versioningService;
|
||||
@Autowired(required=true)
|
||||
protected HarvestedItemService harvestedItemService;
|
||||
@Autowired(required=true)
|
||||
protected ConfigurationService configurationService;
|
||||
|
||||
protected ItemServiceImpl()
|
||||
{
|
||||
@@ -896,7 +909,7 @@ public class ItemServiceImpl extends DSpaceObjectServiceImpl<Item> implements It
|
||||
if (context.getCurrentUser() != null
|
||||
&& context.getCurrentUser().equals(item.getSubmitter()))
|
||||
{
|
||||
return DSpaceServicesFactory.getInstance().getConfigurationService().getPropertyAsType(
|
||||
return configurationService.getPropertyAsType(
|
||||
"versioning.submitterCanCreateNewVersion", false);
|
||||
}
|
||||
|
||||
|
@@ -13,7 +13,6 @@ import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.dspace.app.webui.util.VersionUtil;
|
||||
@@ -21,7 +20,6 @@ import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.content.factory.ContentServiceFactory;
|
||||
import org.dspace.content.service.ItemService;
|
||||
import org.dspace.core.ConfigurationManager;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.handle.factory.HandleServiceFactory;
|
||||
import org.dspace.handle.service.HandleService;
|
||||
@@ -32,6 +30,7 @@ import org.dspace.identifier.service.DOIService;
|
||||
import org.dspace.identifier.service.IdentifierService;
|
||||
import org.dspace.plugin.ItemHomeProcessor;
|
||||
import org.dspace.plugin.PluginException;
|
||||
import org.dspace.services.ConfigurationService;
|
||||
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||
import org.dspace.versioning.Version;
|
||||
import org.dspace.versioning.VersionHistory;
|
||||
@@ -50,6 +49,7 @@ public class VersioningItemHome implements ItemHomeProcessor {
|
||||
private VersionHistoryService versionHistoryService;
|
||||
private VersioningService versioningService;
|
||||
private ItemService itemService;
|
||||
private ConfigurationService configurationService;
|
||||
|
||||
public VersioningItemHome() {
|
||||
doiService = IdentifierServiceFactory.getInstance().getDOIService();
|
||||
@@ -58,6 +58,7 @@ public class VersioningItemHome implements ItemHomeProcessor {
|
||||
itemService = ContentServiceFactory.getInstance().getItemService();
|
||||
versioningService = VersionServiceFactory.getInstance().getVersionService();
|
||||
versionHistoryService = VersionServiceFactory.getInstance().getVersionHistoryService();
|
||||
configurationService = DSpaceServicesFactory.getInstance().getConfigurationService();
|
||||
}
|
||||
|
||||
|
||||
@@ -65,11 +66,9 @@ public class VersioningItemHome implements ItemHomeProcessor {
|
||||
public void process(Context context, HttpServletRequest request,
|
||||
HttpServletResponse response, Item item) throws PluginException,
|
||||
AuthorizeException {
|
||||
boolean versioningEnabled = ConfigurationManager.getBooleanProperty(
|
||||
"versioning", "enabled");
|
||||
boolean submitterCanCreateNewVersion = DSpaceServicesFactory
|
||||
.getInstance()
|
||||
.getConfigurationService()
|
||||
boolean versioningEnabled = configurationService
|
||||
.getPropertyAsType("versioning.enabled", false);
|
||||
boolean submitterCanCreateNewVersion = configurationService
|
||||
.getPropertyAsType("versioning.submitterCanCreateNewVersion", false);
|
||||
boolean newVersionAvailable = false;
|
||||
boolean showVersionWorkflowAvailable = false;
|
||||
@@ -154,7 +153,7 @@ public class VersioningItemHome implements ItemHomeProcessor {
|
||||
}
|
||||
|
||||
// do we prefer to use handle or DOIs?
|
||||
if ("doi".equalsIgnoreCase(ConfigurationManager.getProperty("webui.preferred.identifier")))
|
||||
if ("doi".equalsIgnoreCase(configurationService.getProperty("webui.preferred.identifier")))
|
||||
{
|
||||
if (latestVersionDOI != null)
|
||||
{
|
||||
|
Reference in New Issue
Block a user