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