renamed StepExecutionRequest to PerformStepRequest

This commit is contained in:
Francesco Mangiacrapa 2024-04-15 12:27:52 +02:00
parent 40fb99d477
commit e8346fa8e3
5 changed files with 16 additions and 16 deletions

View File

@ -13,7 +13,7 @@ import lombok.NoArgsConstructor;
@Data @Data
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class StepExecutionRequest { public class PerformStepRequest {
private String stepID; private String stepID;
@XmlAttribute(required = false) @XmlAttribute(required = false)

View File

@ -13,7 +13,7 @@ import org.gcube.application.geoportal.common.model.rest.CreateRelationshipReque
import org.gcube.application.geoportal.common.model.rest.DeleteRelationshipRequest; import org.gcube.application.geoportal.common.model.rest.DeleteRelationshipRequest;
import org.gcube.application.geoportal.common.model.rest.QueryRequest; import org.gcube.application.geoportal.common.model.rest.QueryRequest;
import org.gcube.application.geoportal.common.model.rest.RegisterFileSetRequest; import org.gcube.application.geoportal.common.model.rest.RegisterFileSetRequest;
import org.gcube.application.geoportal.common.model.rest.StepExecutionRequest; import org.gcube.application.geoportal.common.model.rest.PerformStepRequest;
public interface Projects<P extends Project> { public interface Projects<P extends Project> {
@ -39,7 +39,7 @@ public interface Projects<P extends Project> {
public String queryForJSON(QueryRequest request)throws RemoteException; public String queryForJSON(QueryRequest request)throws RemoteException;
//Execution //Execution
public P performStep(String id, StepExecutionRequest request) throws RemoteException; public P performStep(String id, PerformStepRequest request) throws RemoteException;
//FileSets //FileSets
public P registerFileSet(String id, RegisterFileSetRequest req) throws RemoteException, InvalidRequestException; public P registerFileSet(String id, RegisterFileSetRequest req) throws RemoteException, InvalidRequestException;

View File

@ -34,7 +34,7 @@ import org.gcube.application.geoportal.common.model.document.lifecycle.Lifecycle
import org.gcube.application.geoportal.common.model.rest.ConfigurationException; import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import org.gcube.application.geoportal.common.model.rest.QueryRequest; import org.gcube.application.geoportal.common.model.rest.QueryRequest;
import org.gcube.application.geoportal.common.model.rest.RegisterFileSetRequest; import org.gcube.application.geoportal.common.model.rest.RegisterFileSetRequest;
import org.gcube.application.geoportal.common.model.rest.StepExecutionRequest; import org.gcube.application.geoportal.common.model.rest.PerformStepRequest;
import org.gcube.application.geoportal.common.rest.InterfaceConstants; import org.gcube.application.geoportal.common.rest.InterfaceConstants;
import org.gcube.application.geoportal.service.engine.mongo.ProfiledMongoManager; import org.gcube.application.geoportal.service.engine.mongo.ProfiledMongoManager;
import org.gcube.application.geoportal.service.engine.providers.ConfigurationCache; import org.gcube.application.geoportal.service.engine.providers.ConfigurationCache;
@ -312,20 +312,20 @@ public class ProfiledDocuments {
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("/" + InterfaceConstants.Methods.STEP + "/{" + InterfaceConstants.Parameters.PROJECT_ID + "}") @Path("/" + InterfaceConstants.Methods.STEP + "/{" + InterfaceConstants.Parameters.PROJECT_ID + "}")
public Project performStep(@PathParam(InterfaceConstants.Parameters.PROJECT_ID) String id, public Project performStep(@PathParam(InterfaceConstants.Parameters.PROJECT_ID) String id,
StepExecutionRequest request) { PerformStepRequest performStepRequest) {
Project theProject = new GuardedMethod<Project>() { Project theProject = new GuardedMethod<Project>() {
@Override @Override
protected Project run() throws Exception, WebApplicationException { protected Project run() throws Exception, WebApplicationException {
log.info("Executing step {} on Project ({},ID,{}) with options {}", request.getStepID(), log.info("Executing step {} on Project ({},ID,{}) with options {}", performStepRequest.getStepID(),
manager.getUseCaseDescriptor().getId(), id, request.getOptions()); manager.getUseCaseDescriptor().getId(), id, performStepRequest.getOptions());
return manager.performStep(id, request.getStepID(), request.getOptions()); return manager.performStep(id, performStepRequest.getStepID(), performStepRequest.getOptions());
} }
}.execute().getResult(); }.execute().getResult();
log.info("Starting event..."); log.info("Starting event...");
if(log.isInfoEnabled()) { if(log.isInfoEnabled()) {
List<Field> allFields = Arrays.asList(StepExecutionRequest.class.getDeclaredFields()); List<Field> allFields = Arrays.asList(PerformStepRequest.class.getDeclaredFields());
String fieldsName = allFields.stream().map(e -> e.getName()).collect(Collectors.joining(",")); String fieldsName = allFields.stream().map(e -> e.getName()).collect(Collectors.joining(","));
log.info("Fields name: "+fieldsName); log.info("Fields name: "+fieldsName);
} }
@ -339,7 +339,7 @@ public class ProfiledDocuments {
item.setUserCaller(user.getUser()); item.setUserCaller(user.getUser());
item.setContext(user.getContext()); item.setContext(user.getContext());
item.setEvent(event); item.setEvent(event);
item.setOptionalMessage(request.getMessage()); item.setOptionalMessage(performStepRequest.getMessage());
item.setUseCaseDescriptor(manager.getUseCaseDescriptor()); item.setUseCaseDescriptor(manager.getUseCaseDescriptor());
item.setProject(theProject); item.setProject(theProject);
log.info("By notifying event ({}, ID {})", event, item.getProjectId()); log.info("By notifying event ({}, ID {})", event, item.getProjectId());

View File

@ -21,7 +21,7 @@ import org.gcube.application.geoportal.common.model.document.access.Access;
import org.gcube.application.geoportal.common.model.document.lifecycle.LifecycleInformation; import org.gcube.application.geoportal.common.model.document.lifecycle.LifecycleInformation;
import org.gcube.application.geoportal.common.model.rest.QueryRequest; import org.gcube.application.geoportal.common.model.rest.QueryRequest;
import org.gcube.application.geoportal.common.model.rest.RegisterFileSetRequest; import org.gcube.application.geoportal.common.model.rest.RegisterFileSetRequest;
import org.gcube.application.geoportal.common.model.rest.StepExecutionRequest; import org.gcube.application.geoportal.common.model.rest.PerformStepRequest;
import org.gcube.application.geoportal.common.rest.InterfaceConstants; import org.gcube.application.geoportal.common.rest.InterfaceConstants;
import org.gcube.application.geoportal.common.utils.FileSets; import org.gcube.application.geoportal.common.utils.FileSets;
import org.gcube.application.geoportal.common.utils.StorageUtils; import org.gcube.application.geoportal.common.utils.StorageUtils;
@ -180,7 +180,7 @@ public abstract class AbstractProfiledDocumentsTests extends BasicServiceTestUni
} }
protected Project step(String id, StepExecutionRequest request) throws Exception { protected Project step(String id, PerformStepRequest request) throws Exception {
Project toReturn= check(baseTarget(). Project toReturn= check(baseTarget().
path(InterfaceConstants.Methods.STEP).path(id).request(MediaType.APPLICATION_JSON). path(InterfaceConstants.Methods.STEP).path(id).request(MediaType.APPLICATION_JSON).
post(Entity.entity(Serialization.write(request), post(Entity.entity(Serialization.write(request),

View File

@ -9,7 +9,7 @@ import org.gcube.application.geoportal.common.model.document.access.Access;
import org.gcube.application.geoportal.common.model.document.identification.SpatialReference; import org.gcube.application.geoportal.common.model.document.identification.SpatialReference;
import org.gcube.application.geoportal.common.model.document.lifecycle.LifecycleInformation; import org.gcube.application.geoportal.common.model.document.lifecycle.LifecycleInformation;
import org.gcube.application.geoportal.common.model.rest.RegisterFileSetRequest; import org.gcube.application.geoportal.common.model.rest.RegisterFileSetRequest;
import org.gcube.application.geoportal.common.model.rest.StepExecutionRequest; import org.gcube.application.geoportal.common.model.rest.PerformStepRequest;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.Field; import org.gcube.application.geoportal.common.model.useCaseDescriptor.Field;
import org.gcube.application.geoportal.common.utils.StorageUtils; import org.gcube.application.geoportal.common.utils.StorageUtils;
import org.gcube.application.geoportal.common.utils.tests.GCubeTest; import org.gcube.application.geoportal.common.utils.tests.GCubeTest;
@ -69,7 +69,7 @@ public class ProfiledConcessioniTests extends AbstractProfiledDocumentsTests{
System.out.println("Registered posizionamento, result is "+ Serialization.write(doc)); System.out.println("Registered posizionamento, result is "+ Serialization.write(doc));
// invoke step SUBMIT-FOR-REVIEW // invoke step SUBMIT-FOR-REVIEW
StepExecutionRequest submitReq=new StepExecutionRequest(); PerformStepRequest submitReq=new PerformStepRequest();
submitReq.setStepID("SUBMIT-FOR-REVIEW"); submitReq.setStepID("SUBMIT-FOR-REVIEW");
// doc=step(doc.getId(),submitReq); // doc=step(doc.getId(),submitReq);
doc=step(doc.getId(),submitReq); doc=step(doc.getId(),submitReq);
@ -79,7 +79,7 @@ public class ProfiledConcessioniTests extends AbstractProfiledDocumentsTests{
// invoke step Publish // invoke step Publish
StepExecutionRequest approveDraftReq=new StepExecutionRequest(); PerformStepRequest approveDraftReq=new PerformStepRequest();
approveDraftReq.setStepID("APPROVE-SUBMITTED"); approveDraftReq.setStepID("APPROVE-SUBMITTED");
doc=step(doc.getId(),approveDraftReq); doc=step(doc.getId(),approveDraftReq);
System.out.println(doc); System.out.println(doc);
@ -137,7 +137,7 @@ public class ProfiledConcessioniTests extends AbstractProfiledDocumentsTests{
assertEquals(doc2.getRelationships().get(0).getTargetUCD(),doc1.getProfileID()); assertEquals(doc2.getRelationships().get(0).getTargetUCD(),doc1.getProfileID());
assertEquals(doc2.getRelationships().get(0).getRelationshipName(),reverse); assertEquals(doc2.getRelationships().get(0).getRelationshipName(),reverse);
StepExecutionRequest stepReq = new StepExecutionRequest(); PerformStepRequest stepReq = new PerformStepRequest();
stepReq.setStepID("SUBMIT-FOR-REVIEW"); stepReq.setStepID("SUBMIT-FOR-REVIEW");
step(doc1.getId(),stepReq); step(doc1.getId(),stepReq);