Added method `performStep`

This commit is contained in:
Francesco Mangiacrapa 2022-09-13 16:17:50 +02:00
parent 637028d9c8
commit 1b11e3fba2
2 changed files with 36 additions and 14 deletions

View File

@ -18,8 +18,8 @@ import org.gcube.application.geoportalcommon.config.CSVReader;
import org.gcube.application.geoportalcommon.config.CSVRow;
import org.gcube.application.geoportalcommon.config.FileUtil;
import org.gcube.application.geoportalcommon.shared.GNADataEntryConfigProfile;
import org.gcube.application.geoportalcommon.shared.config.OPERATION_ON_ITEM;
import org.gcube.application.geoportalcommon.shared.config.GcubeUserRole;
import org.gcube.application.geoportalcommon.shared.config.OPERATION_ON_ITEM;
import org.gcube.application.geoportalcommon.shared.config.RoleRights;
import org.gcube.application.geoportalcommon.shared.config.RoleRights.OPERATION_TYPE;
import org.gcube.application.geoportalcommon.shared.exception.ApplicationProfileNotFoundException;

View File

@ -23,6 +23,7 @@ import org.gcube.application.geoportal.common.model.rest.QueryRequest.OrderedReq
import org.gcube.application.geoportal.common.model.rest.QueryRequest.OrderedRequest.Direction;
import org.gcube.application.geoportal.common.model.rest.QueryRequest.PagedRequest;
import org.gcube.application.geoportal.common.model.rest.RegisterFileSetRequest;
import org.gcube.application.geoportal.common.model.rest.StepExecutionRequest;
import org.gcube.application.geoportal.common.rest.Projects;
import org.gcube.application.geoportal.common.utils.FileSets;
import org.gcube.application.geoportal.common.utils.StorageUtils;
@ -234,13 +235,13 @@ public class ProjectsCaller {
}
/**
* Gets the phases.
* Gets the phases into document store collection.
*
* @param profileID the profile ID
* @return the phases
* @return the phases into document store collection
* @throws Exception the exception
*/
public PhaseDV[] getPhases(String profileID) throws Exception {
public PhaseDV[] getPhasesIntoDocumentStoreCollection(String profileID) throws Exception {
LOG.info("getPhases called for profileID: {}", profileID);
Projects<Project> client = (Projects<Project>) getClient(profileID);
Configuration config = client.getConfiguration();
@ -267,9 +268,30 @@ public class ProjectsCaller {
return null;
}
/**
* Perform step.
*
* @param profileID the profile ID
* @param projectID the project ID
* @param stepID the step ID
* @param options the options
* @return the project
* @throws Exception the exception
*/
public Project performStep(String profileID, String projectID, String stepID, Document options) throws Exception {
LOG.info("performStep called for profileID: {}, projectID: {}", profileID, projectID);
Projects<Project> client = (Projects<Project>) getClient(profileID);
StepExecutionRequest request = new StepExecutionRequest(projectID, options);
Project project = client.performStep(projectID, request);
LOG.info("performStep returning project ID: " + project.getId());
return project;
}
/**
* Delete project.
*
* @param profileID the profile ID
* @param projectID the project ID
* @param force the force
* @throws RemoteException the remote exception
@ -361,7 +383,8 @@ public class ProjectsCaller {
for (ItemFieldDV itemField : orderByFields) {
if (itemField.getJsonFields() != null) {
for (String jsonFieldPath : itemField.getJsonFields()) {
//String fieldFullPath = String.format("%s.%s", itemField.getProjection(), field);
// String fieldFullPath = String.format("%s.%s", itemField.getProjection(),
// field);
orderingFields.add(jsonFieldPath);
}
}
@ -443,16 +466,15 @@ public class ProjectsCaller {
}
//REMOVING DIRTY DOCUMENTS
// REMOVING DIRTY DOCUMENTS
/*
BasicDBObject bsValid_Document = new BasicDBObject();
bsValid_Document.append("$exists", true);
bsValid_Document.append("$ne", null);
query.append("_theDocument", bsValid_Document);
BasicDBObject bsValidLfc = new BasicDBObject();
bsValidLfc.append("$ne", null);
query.append("_lifecycleInformation._phase", bsValidLfc);*/
* BasicDBObject bsValid_Document = new BasicDBObject();
* bsValid_Document.append("$exists", true); bsValid_Document.append("$ne",
* null); query.append("_theDocument", bsValid_Document);
*
* BasicDBObject bsValidLfc = new BasicDBObject(); bsValidLfc.append("$ne",
* null); query.append("_lifecycleInformation._phase", bsValidLfc);
*/
// BasicDBObject bsDocumentExists = new BasicDBObject();
// bsDocumentExists.append("$exists", false);