Skip to content

Commit

Permalink
The ProvenanceService wasn't initialized in the BundleAccessControl
Browse files Browse the repository at this point in the history
  • Loading branch information
milanmajchrak committed Dec 16, 2024
1 parent 46ab18c commit 5f63dcd
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
import org.dspace.content.service.ItemService;
import org.dspace.core.Constants;
import org.dspace.core.Context;
import org.dspace.core.ProvenanceServiceImpl;
import org.dspace.core.ProvenanceService;
import org.dspace.discovery.DiscoverQuery;
import org.dspace.discovery.SearchService;
import org.dspace.discovery.SearchServiceException;
Expand All @@ -70,7 +70,6 @@
import org.dspace.services.factory.DSpaceServicesFactory;
import org.dspace.submit.model.AccessConditionOption;
import org.dspace.utils.DSpace;
import org.springframework.beans.factory.annotation.Autowired;

/**
* Implementation of {@link DSpaceRunnable} to perform a bulk access control via json file.
Expand Down Expand Up @@ -114,8 +113,7 @@ public class BulkAccessControl extends DSpaceRunnable<BulkAccessControlScriptCon

protected String eperson = null;

@Autowired
protected ProvenanceServiceImpl provenanceService;
protected ProvenanceService provenanceService = ContentServiceFactory.getInstance().getProvenanceService();

@Override
@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.dspace.content.service.RelationshipTypeService;
import org.dspace.content.service.SiteService;
import org.dspace.content.service.WorkspaceItemService;
import org.dspace.core.ProvenanceService;
import org.dspace.eperson.service.SubscribeService;
import org.dspace.handle.service.HandleClarinService;
import org.dspace.services.factory.DSpaceServicesFactory;
Expand Down Expand Up @@ -77,6 +78,7 @@ public abstract class ContentServiceFactory {
public abstract SiteService getSiteService();

public abstract SubscribeService getSubscribeService();

public abstract PreviewContentService getPreviewContentService();

/**
Expand Down Expand Up @@ -123,6 +125,13 @@ public abstract class ContentServiceFactory {
*/
public abstract HandleClarinService getHandleClarinService();

/**
* Return the implementation of the ProvenanceService interface
*
* @return the ProvenanceService
*/
public abstract ProvenanceService getProvenanceService();

public InProgressSubmissionService getInProgressSubmissionService(InProgressSubmission inProgressSubmission) {
if (inProgressSubmission instanceof WorkspaceItem) {
return getWorkspaceItemService();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.dspace.content.service.RelationshipTypeService;
import org.dspace.content.service.SiteService;
import org.dspace.content.service.WorkspaceItemService;
import org.dspace.core.ProvenanceService;
import org.dspace.eperson.service.SubscribeService;
import org.dspace.handle.service.HandleClarinService;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -93,6 +94,9 @@ public class ContentServiceFactoryImpl extends ContentServiceFactory {
@Autowired(required = true)
private HandleClarinService handleClarinService;

@Autowired(required = true)
private ProvenanceService provenanceService;

@Override
public List<DSpaceObjectService<? extends DSpaceObject>> getDSpaceObjectServices() {
return dSpaceObjectServices;
Expand Down Expand Up @@ -173,6 +177,11 @@ public PreviewContentService getPreviewContentService() {
return previewContentService;
}

@Override
public ProvenanceService getProvenanceService() {
return provenanceService;
}

@Override
public RelationshipTypeService getRelationshipTypeService() {
return relationshipTypeService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import org.dspace.content.service.clarin.ClarinLicenseService;
import org.dspace.core.Constants;
import org.dspace.core.Context;
import org.dspace.core.ProvenanceServiceImpl;
import org.dspace.core.ProvenanceService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -100,7 +100,7 @@ public class ItemAddBundleController {
ClarinLicenseResourceMappingService clarinLicenseResourceMappingService;

@Autowired
ProvenanceServiceImpl provenanceService;
ProvenanceService provenanceService;

/**
* Method to add a Bundle to an Item with the given UUID in the URL. This will create a Bundle with the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import org.dspace.content.service.ItemService;
import org.dspace.core.Constants;
import org.dspace.core.Context;
import org.dspace.core.ProvenanceServiceImpl;
import org.dspace.core.ProvenanceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.rest.webmvc.ResourceNotFoundException;
import org.springframework.security.access.prepost.PostAuthorize;
Expand Down Expand Up @@ -67,7 +67,7 @@ public class ItemOwningCollectionUpdateRestController {
Utils utils;

@Autowired
ProvenanceServiceImpl provenanceService;
ProvenanceService provenanceService;

/**
* This method will update the owning collection of the item that correspond to the provided item uuid, effectively
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import org.dspace.content.service.CollectionService;
import org.dspace.content.service.ItemService;
import org.dspace.core.Context;
import org.dspace.core.ProvenanceServiceImpl;
import org.dspace.core.ProvenanceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.PathVariable;
Expand Down Expand Up @@ -59,7 +59,7 @@ public class MappedCollectionRestController {
Utils utils;

@Autowired
ProvenanceServiceImpl provenanceService;
ProvenanceService provenanceService;

/**
* This method will add an Item to a Collection. The Collection object is encapsulated in the request due to the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import org.dspace.content.service.ItemService;
import org.dspace.core.Constants;
import org.dspace.core.Context;
import org.dspace.core.ProvenanceServiceImpl;
import org.dspace.core.ProvenanceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
Expand Down Expand Up @@ -71,7 +71,7 @@ public class BundleRestRepository extends DSpaceObjectRestRepository<Bundle, Bun
private BitstreamFormatService bitstreamFormatService;

@Autowired
private ProvenanceServiceImpl provenanceService;
private ProvenanceService provenanceService;

public BundleRestRepository(BundleService dsoService) {
super(dsoService);
Expand Down

0 comments on commit 5f63dcd

Please sign in to comment.