mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-16 06:23:10 +00:00
[CST-5755] Added changes
This commit is contained in:

committed by
corrado lombardi

parent
c09a8d097d
commit
be353c5301
@@ -77,7 +77,7 @@ public class ProcessServiceImpl implements ProcessService {
|
||||
@Override
|
||||
public Process create(Context context, EPerson ePerson, String scriptName,
|
||||
List<DSpaceCommandLineParameter> parameters,
|
||||
final List<Group> specialGroups) throws SQLException {
|
||||
final Set<Group> specialGroups) throws SQLException {
|
||||
|
||||
Process process = new Process();
|
||||
process.setEPerson(ePerson);
|
||||
|
@@ -11,6 +11,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.Bitstream;
|
||||
@@ -40,7 +41,7 @@ public interface ProcessService {
|
||||
*/
|
||||
public Process create(Context context, EPerson ePerson, String scriptName,
|
||||
List<DSpaceCommandLineParameter> parameters,
|
||||
final List<Group> specialGroups) throws SQLException;
|
||||
final Set<Group> specialGroups) throws SQLException;
|
||||
|
||||
/**
|
||||
* This method will retrieve a Process object from the Database with the given ID
|
||||
|
@@ -12,6 +12,7 @@ import java.sql.SQLException;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.ProcessStatus;
|
||||
@@ -39,14 +40,14 @@ public class ProcessBuilder extends AbstractBuilder<Process, ProcessService> {
|
||||
|
||||
public static ProcessBuilder createProcess(Context context, EPerson ePerson, String scriptName,
|
||||
List<DSpaceCommandLineParameter> parameters,
|
||||
List<Group> specialGroups)
|
||||
Set<Group> specialGroups)
|
||||
throws SQLException {
|
||||
ProcessBuilder processBuilder = new ProcessBuilder(context);
|
||||
return processBuilder.create(context, ePerson, scriptName, parameters, specialGroups);
|
||||
}
|
||||
|
||||
private ProcessBuilder create(Context context, EPerson ePerson, String scriptName,
|
||||
List<DSpaceCommandLineParameter> parameters, final List<Group> specialGroups)
|
||||
List<DSpaceCommandLineParameter> parameters, final Set<Group> specialGroups)
|
||||
throws SQLException {
|
||||
this.context = context;
|
||||
this.process = processService.create(context, ePerson, scriptName, parameters, specialGroups);
|
||||
|
@@ -10,9 +10,10 @@ package org.dspace.process;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.dspace.AbstractIntegrationTestWithDatabase;
|
||||
@@ -27,7 +28,7 @@ import org.dspace.scripts.service.ProcessService;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* This class will aim to test Proccess related use cases
|
||||
* This class will aim to test Process related use cases
|
||||
*
|
||||
* @author Mykhaylo Boychuk (mykhaylo.boychuk at 4science.it)
|
||||
*/
|
||||
@@ -44,9 +45,12 @@ public class ProcessIT extends AbstractIntegrationTestWithDatabase {
|
||||
.addMember(admin)
|
||||
.build();
|
||||
|
||||
Set<Group> groupSet = new HashSet<>();
|
||||
groupSet.add(groupA);
|
||||
|
||||
Process processA = ProcessBuilder.createProcess(context, admin, "mock-script",
|
||||
new LinkedList<>(),
|
||||
Collections.singletonList(groupA)).build();
|
||||
groupSet).build();
|
||||
|
||||
context.restoreAuthSystemState();
|
||||
Process process = processService.find(context, processA.getID());
|
||||
@@ -63,9 +67,12 @@ public class ProcessIT extends AbstractIntegrationTestWithDatabase {
|
||||
.withName("Group A")
|
||||
.addMember(admin).build();
|
||||
|
||||
Set<Group> groupSet = new HashSet<>();
|
||||
groupSet.add(groupA);
|
||||
|
||||
UUID groupUuid = groupA.getID();
|
||||
Process processA = ProcessBuilder.createProcess(context, admin, "mock-script", new LinkedList<>(),
|
||||
Collections.singletonList(groupA)).build();
|
||||
groupSet).build();
|
||||
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
|
@@ -11,6 +11,7 @@ import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -110,7 +111,7 @@ public class ScriptRestRepository extends DSpaceRestRepository<ScriptRest, Strin
|
||||
}
|
||||
RestDSpaceRunnableHandler restDSpaceRunnableHandler = new RestDSpaceRunnableHandler(
|
||||
context.getCurrentUser(), scriptToExecute.getName(), dSpaceCommandLineParameters,
|
||||
context.getSpecialGroups());
|
||||
new HashSet<>(context.getSpecialGroups()));
|
||||
List<String> args = constructArgs(dSpaceCommandLineParameters);
|
||||
runDSpaceScript(files, context, scriptToExecute, restDSpaceRunnableHandler, args);
|
||||
return converter.toRest(restDSpaceRunnableHandler.getProcess(context), utils.obtainProjection());
|
||||
|
@@ -15,6 +15,7 @@ import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.apache.commons.cli.HelpFormatter;
|
||||
@@ -65,7 +66,7 @@ public class RestDSpaceRunnableHandler implements DSpaceRunnableHandler {
|
||||
* creating process at process creation time
|
||||
*/
|
||||
public RestDSpaceRunnableHandler(EPerson ePerson, String scriptName, List<DSpaceCommandLineParameter> parameters,
|
||||
final List<Group> specialGroups) {
|
||||
final Set<Group> specialGroups) {
|
||||
Context context = new Context();
|
||||
try {
|
||||
ePersonId = ePerson.getID();
|
||||
|
Reference in New Issue
Block a user