Fixed R code add

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/statistical-algorithms-importer@160640 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2017-12-18 12:01:19 +00:00
parent 3b6ade4f1c
commit 170cf1eb2a
6 changed files with 37 additions and 26 deletions

View File

@ -56,12 +56,15 @@ public class StatAlgoImporterController {
private StatAlgoImporterMonitor monitor;
private enum InputRequestType {
Save, MainCodeSet, BinaryCodeSet, SoftwareCreate;
Save, NewMainCodeSet, MainCodeSet, BinaryCodeSet, SoftwareCreate;
}
private InputRequestType inputRequestType;
private NewCodeEvent newCodeEvent;
private ItemDescription mainCodeItemDescription;
private ItemDescription binaryCodeItemDescription;
public StatAlgoImporterController() {
eventBus = new SimpleEventBus();
@ -321,10 +324,10 @@ public class StatAlgoImporterController {
UtilsGXT3.alert("Attention", event.getError());
return;
} else {
if(inputRequestType==null){
if (inputRequestType == null) {
return;
}
switch (inputRequestType) {
case Save:
pm.saveProject(event.getInputData(), monitor);
@ -332,6 +335,9 @@ public class StatAlgoImporterController {
case SoftwareCreate:
pm.softwareCreate(event.getInputData(), monitor);
break;
case NewMainCodeSet:
pm.setNewCode(event.getInputData(),newCodeEvent, monitor);
break;
case MainCodeSet:
pm.setMainCode(event.getInputData(), mainCodeItemDescription);
break;
@ -359,9 +365,9 @@ public class StatAlgoImporterController {
final ConfirmMessageBox mb = new ConfirmMessageBox("Attention",
"The creation of new software will overwrite the possible previous version, moreover"
+ " the compiled software will be notified to the Infrastructure Administrators"
+ " and will be published in the suggested VREs. The source code will not be shared."
+ " Do you confirm the submission?");
+ " the compiled software will be notified to the Infrastructure Administrators"
+ " and will be published in the suggested VREs. The source code will not be shared."
+ " Do you confirm the submission?");
mb.addDialogHideHandler(new DialogHideHandler() {
@Override
@ -386,8 +392,6 @@ public class StatAlgoImporterController {
mb.show();
}
private void softwareRepackage() {
pm.softwareRepackage();
@ -438,10 +442,16 @@ public class StatAlgoImporterController {
private void doSetNewMainCodeEvent(NewCodeEvent event) {
monitor = new StatAlgoImporterMonitor();
pm.setNewCode(event, monitor);
newCodeEvent = event;
inputRequestType = InputRequestType.NewMainCodeSet;
InputRequestEvent inputRequestEvent = new InputRequestEvent();
eventBus.fireEvent(inputRequestEvent);
Log.debug("ProjectNewMainCodeSetRequest: " + inputRequestEvent);
}
private void doDeleteItemCommand(DeleteItemEvent event) {
ItemDescription itemDescription = event.getItemDescription();
if (itemDescription != null && itemDescription.getId() != null) {

View File

@ -55,7 +55,7 @@ public class NewCodeEvent extends GwtEvent<NewCodeEvent.NewCodeEventHandler> {
source.fireEvent(saveNewMainCodeEvent);
}
public CodeContentType getCodeType() {
public CodeContentType getCodeContentType() {
return codeContentType;
}
@ -72,6 +72,4 @@ public class NewCodeEvent extends GwtEvent<NewCodeEvent.NewCodeEventHandler> {
return "NewCodeEvent [codeContentType=" + codeContentType + ", file=" + file + ", code=" + code + "]";
}
}

View File

@ -529,8 +529,8 @@ public class ProjectManager {
}
public void setNewCode(NewCodeEvent newCodeEvent, final StatAlgoImporterMonitor monitor) {
StatAlgoImporterServiceAsync.INSTANCE.setNewCode(newCodeEvent.getFile(), newCodeEvent.getCode(),
public void setNewCode(InputData inputData, NewCodeEvent newCodeEvent, final StatAlgoImporterMonitor monitor) {
StatAlgoImporterServiceAsync.INSTANCE.setNewCode(inputData, newCodeEvent.getFile(), newCodeEvent.getCode(),
new AsyncCallback<Project>() {
@Override

View File

@ -36,7 +36,8 @@ public interface StatAlgoImporterService extends RemoteService {
* Retrieve SAI descriptort
*
* @return SAI descriptort
* @throws StatAlgoImporterServiceException Exception
* @throws StatAlgoImporterServiceException
* Exception
*/
public SAIDescriptor getSAIDescripor() throws StatAlgoImporterServiceException;
@ -53,13 +54,14 @@ public interface StatAlgoImporterService extends RemoteService {
// Code
public ArrayList<CodeData> getCode() throws StatAlgoImporterServiceException;
public Project createProjectOnWorkspace(ProjectCreateSession projectCreateSession) throws StatAlgoImporterServiceException;
public Project createProjectOnWorkspace(ProjectCreateSession projectCreateSession)
throws StatAlgoImporterServiceException;
//
public Project setMainCode(ItemDescription itemDescription) throws StatAlgoImporterServiceException;
public Project setBinaryCode(ItemDescription itemDescription) throws StatAlgoImporterServiceException;
public void addResourceToProject(ItemDescription itemDescription) throws StatAlgoImporterServiceException;
public Project deleteResourceOnProject(ItemDescription itemDescription) throws StatAlgoImporterServiceException;
@ -76,15 +78,15 @@ public interface StatAlgoImporterService extends RemoteService {
public Project restoreUISession(String value) throws StatAlgoImporterServiceException;
public Project setNewCode(ItemDescription itemDescription, String code) throws StatAlgoImporterServiceException;
public Project setNewCode(InputData inputData, ItemDescription itemDescription, String code)
throws StatAlgoImporterServiceException;
public String publishSoftware() throws StatAlgoImporterServiceException;
public String getDeployOperationStatus(String operationId) throws StatAlgoImporterServiceException;
public String getDeployOperationLogs(String operationId) throws StatAlgoImporterServiceException;
public void repackageSoftware() throws StatAlgoImporterServiceException;
}

View File

@ -52,7 +52,7 @@ public interface StatAlgoImporterServiceAsync {
void saveCode(String code, AsyncCallback<Void> asyncCallback);
void setNewCode(ItemDescription itemDescription, String code, AsyncCallback<Project> asyncCallback);
void setNewCode(InputData inputData, ItemDescription itemDescription, String code, AsyncCallback<Project> asyncCallback);
void createSoftware(InputData inputData, AsyncCallback<Project> callback);

View File

@ -593,11 +593,11 @@ public class StatAlgoImporterServiceImpl extends RemoteServiceServlet implements
}
@Override
public Project setNewCode(ItemDescription fileDescription, String code) throws StatAlgoImporterServiceException {
public Project setNewCode(InputData inputData,ItemDescription fileDescription, String code) throws StatAlgoImporterServiceException {
try {
HttpServletRequest httpRequest = this.getThreadLocalRequest();
ServiceCredentials serviceCredentials = SessionUtil.getServiceCredentials(httpRequest);
logger.debug("saveNewCode(): itemDescription" + fileDescription + ", code:" + code);
logger.debug("setNewCode(): "+inputData+", " + fileDescription + ", " + code);
Project project = SessionUtil.getProjectSession(httpRequest, serviceCredentials);
if (project != null && project.getProjectFolder() != null
&& project.getProjectFolder().getFolder() != null) {
@ -609,9 +609,9 @@ public class StatAlgoImporterServiceImpl extends RemoteServiceServlet implements
code, project.getProjectFolder().getFolder().getId());
MainCode mainCode = new MainCode(mainCodeItemDescription);
project.setMainCode(mainCode);
InputData inputData=project.getInputData();
if(inputData!=null){
inputData.setListInputOutputVariables(null);
project.setInputData(inputData);
}
project.setProjectTarget(null);
WPS4RParser wps4Parser = new WPS4RParser(project, serviceCredentials);
@ -625,6 +625,7 @@ public class StatAlgoImporterServiceImpl extends RemoteServiceServlet implements
ItemDescription binaryCodeItemDescription = codeSave.saveNew(serviceCredentials,
fileDescription, code, project.getProjectFolder().getFolder().getId());
projectSupportBashEdit.setBinaryItem(binaryCodeItemDescription);
project.setInputData(inputData);
project.setProjectTarget(null);
} else {
throw new StatAlgoImporterServiceException("Error in project support!");