Start work for support BlackBox Project
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/statistical-algorithms-importer@149326 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
f8aaa60efb
commit
658dcd6d7f
|
@ -1,11 +1,10 @@
|
|||
package org.gcube.portlets.user.statisticalalgorithmsimporter.client;
|
||||
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.maindata.MainDataPanel;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.maindata.WorkAreaPanel;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.resource.StatAlgoImporterResources;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.ribbon.StatAlgoImporterRibbon;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.rpc.StatAlgoImporterService;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.rpc.StatAlgoImporterServiceAsync;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.tools.ToolsPanel;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.core.client.EntryPoint;
|
||||
|
@ -37,7 +36,7 @@ public class StatAlgoImporter implements EntryPoint {
|
|||
.create(StatAlgoImporterService.class);
|
||||
|
||||
// Main Panel
|
||||
private static BorderLayoutContainer mainPanelLayout;
|
||||
private static BorderLayoutContainer workAreaPanelLayout;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
|
@ -61,29 +60,6 @@ public class StatAlgoImporter implements EntryPoint {
|
|||
|
||||
}
|
||||
|
||||
/*private void loadScope() {
|
||||
ClientScopeHelper.getService().setScope(Location.getHref(),
|
||||
new AsyncCallback<Boolean>() {
|
||||
@Override
|
||||
public void onSuccess(Boolean result) {
|
||||
if (result) {
|
||||
loadMainPanel();
|
||||
} else {
|
||||
UtilsGXT3
|
||||
.info("Attention",
|
||||
"ClientScopeHelper has returned a false value!");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
UtilsGXT3.alert("Error", "Error setting scope: "
|
||||
+ caught.getLocalizedMessage());
|
||||
caught.printStackTrace();
|
||||
}
|
||||
});
|
||||
|
||||
}*/
|
||||
|
||||
private void loadMainPanel() {
|
||||
StatAlgoImporterResources.INSTANCE.saiStyles().ensureInjected();
|
||||
|
@ -93,17 +69,17 @@ public class StatAlgoImporter implements EntryPoint {
|
|||
EventBus eventBus = controller.getEventBus();
|
||||
|
||||
// Layout
|
||||
mainPanelLayout = new BorderLayoutContainer();
|
||||
mainPanelLayout.setId("mainPanelLayout");
|
||||
mainPanelLayout.setBorders(false);
|
||||
mainPanelLayout.setResize(true);
|
||||
workAreaPanelLayout = new BorderLayoutContainer();
|
||||
//workAreaPanelLayout.setId("workAreaPanelLayout");
|
||||
workAreaPanelLayout.setBorders(false);
|
||||
workAreaPanelLayout.setResize(true);
|
||||
|
||||
// mainPanelLayout.getElement().getStyle().setBackgroundColor("rgb(3, 126, 207)");
|
||||
|
||||
// Main
|
||||
final MainDataPanel mainDataPanel = new MainDataPanel(eventBus);
|
||||
MarginData mainData = new MarginData(new Margins(2));
|
||||
mainPanelLayout.setCenterWidget(mainDataPanel, mainData);
|
||||
final WorkAreaPanel workAreaPanel = new WorkAreaPanel(eventBus);
|
||||
MarginData workAreaData = new MarginData(new Margins(2));
|
||||
workAreaPanelLayout.setCenterWidget(workAreaPanel, workAreaData);
|
||||
|
||||
// Menu
|
||||
StatAlgoImporterRibbon accountingManagerMenu = new StatAlgoImporterRibbon(
|
||||
|
@ -114,32 +90,17 @@ public class StatAlgoImporter implements EntryPoint {
|
|||
ribbonData.setCollapsible(false);
|
||||
ribbonData.setSplit(false);
|
||||
|
||||
mainPanelLayout.setNorthWidget(accountingManagerMenu.getContainer(),
|
||||
workAreaPanelLayout.setNorthWidget(accountingManagerMenu.getContainer(),
|
||||
ribbonData);
|
||||
|
||||
// Right
|
||||
ToolsPanel toolsPanel = new ToolsPanel(eventBus);
|
||||
BorderLayoutData eastData = new BorderLayoutData(500);
|
||||
eastData.setCollapsible(true);
|
||||
eastData.setSplit(false);
|
||||
eastData.setFloatable(false);
|
||||
eastData.setCollapseMini(true);
|
||||
eastData.setMargins(new Margins(0, 5, 0, 5));
|
||||
eastData.setCollapseHidden(false);
|
||||
|
||||
// estData.setMaxSize(510);
|
||||
// estData.setMinSize(310);
|
||||
mainPanelLayout.setEastWidget(toolsPanel, eastData);
|
||||
toolsPanel.enable();
|
||||
toolsPanel.collapse();
|
||||
|
||||
bind(mainPanelLayout);
|
||||
controller.setMainPanelLayout(mainPanelLayout);
|
||||
|
||||
//
|
||||
bind(workAreaPanelLayout);
|
||||
controller.setMainPanelLayout(workAreaPanelLayout);
|
||||
controller.restoreUISession();
|
||||
|
||||
}
|
||||
|
||||
protected void bind(BorderLayoutContainer mainWidget) {
|
||||
private void bind(BorderLayoutContainer mainWidget) {
|
||||
try {
|
||||
RootPanel root = RootPanel.get(JSP_TAG_ID);
|
||||
Log.info("Root Panel: " + root);
|
||||
|
|
|
@ -48,6 +48,7 @@ public class StatAlgoImporterController {
|
|||
|
||||
private SimpleEventBus eventBus;
|
||||
private UserInfo userInfo;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private BorderLayoutContainer mainPanel;
|
||||
private ProjectManager pm;
|
||||
|
@ -61,16 +62,17 @@ public class StatAlgoImporterController {
|
|||
|
||||
public StatAlgoImporterController() {
|
||||
eventBus = new SimpleEventBus();
|
||||
pm = new ProjectManager(eventBus);
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
callHello();
|
||||
checkSession();
|
||||
pm = new ProjectManager(eventBus);
|
||||
bindToEvents();
|
||||
}
|
||||
|
||||
|
||||
private void checkSession() {
|
||||
// if you do not need to something when the session expire
|
||||
//CheckSession.getInstance().startPolling();
|
||||
|
@ -176,6 +178,9 @@ public class StatAlgoImporterController {
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Bind Controller to events on bus
|
||||
private void bindToEvents() {
|
||||
eventBus.addHandler(SessionExpiredEvent.TYPE,
|
||||
|
@ -250,6 +255,10 @@ public class StatAlgoImporterController {
|
|||
pm.startProjectManager();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private void doMenuCommand(StatAlgoImporterRibbonEvent event) {
|
||||
StatAlgoImporterRibbonType eventType = event.getStatRunnerRibbonType();
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.create;
|
||||
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.ProjectCreateSession;
|
||||
import org.gcube.portlets.widgets.githubconnector.client.wizard.WizardWindow;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ProjectCreateWizard extends WizardWindow {
|
||||
|
||||
private ProjectCreateSession projectCreateSession;
|
||||
|
||||
public ProjectCreateWizard() {
|
||||
super("Project Create");
|
||||
GWT.log("ProjectCreateWizard");
|
||||
|
||||
projectCreateSession = new ProjectCreateSession();
|
||||
create();
|
||||
}
|
||||
|
||||
private void create() {
|
||||
ProjectSetupSelectionCard CredentialCard = new ProjectSetupSelectionCard();
|
||||
addCard(CredentialCard);
|
||||
CredentialCard.setup();
|
||||
|
||||
}
|
||||
|
||||
public ProjectCreateSession getProjectCreateSession() {
|
||||
return projectCreateSession;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,138 @@
|
|||
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.create;
|
||||
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.workspace.ItemDescription;
|
||||
import org.gcube.portlets.widgets.githubconnector.client.util.GWTMessages;
|
||||
import org.gcube.portlets.widgets.githubconnector.client.wizard.WizardCard;
|
||||
import org.gcube.portlets.widgets.githubconnector.client.wizard.event.WizardEvent;
|
||||
import org.gcube.portlets.widgets.githubconnector.client.wizard.event.WizardEventType;
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.notification.WorkspaceExplorerSelectNotification.WorskpaceExplorerSelectNotificationListener;
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.select.WorkspaceExplorerSelectPanel;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemType;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.core.shared.GWT;
|
||||
import com.google.gwt.user.client.Command;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ProjectFolderSelectionCard extends WizardCard {
|
||||
|
||||
// private DecoratorPanel decPanel;
|
||||
|
||||
private ItemDescription newProjectFolder;
|
||||
|
||||
public ProjectFolderSelectionCard() {
|
||||
super("Project Setup", "Select the project folder");
|
||||
try {
|
||||
WorkspaceExplorerSelectPanel wselectPanel = new WorkspaceExplorerSelectPanel("Select Project Folder", true);
|
||||
|
||||
WorskpaceExplorerSelectNotificationListener handler = new WorskpaceExplorerSelectNotificationListener() {
|
||||
|
||||
@Override
|
||||
public void onSelectedItem(Item item) {
|
||||
|
||||
if (item.getType() == ItemType.FOLDER) {
|
||||
createNewProjectFolder(item);
|
||||
|
||||
} else {
|
||||
newProjectFolder=null;
|
||||
GWTMessages.alert("Attention", "Select a valid project folder!", getZIndex());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(Throwable throwable) {
|
||||
Log.error("Error in create project: " + throwable.getLocalizedMessage(), throwable);
|
||||
showErrorAndHide("Error", throwable.getLocalizedMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAborted() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNotValidSelection() {
|
||||
newProjectFolder=null;
|
||||
GWTMessages.alert("Attention", "Select a valid project folder!", getZIndex());
|
||||
}
|
||||
};
|
||||
|
||||
wselectPanel.addWorkspaceExplorerSelectNotificationListener(handler);
|
||||
setContent(wselectPanel);
|
||||
} catch (Exception e) {
|
||||
GWT.log("Error: " + e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void createNewProjectFolder(Item item) {
|
||||
Log.debug("Create Project Item selected: " + item);
|
||||
newProjectFolder = new ItemDescription(item.getId(), item.getName(), item.getOwner(),
|
||||
item.getPath(), item.getType().name());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
Command sayNextCard = new Command() {
|
||||
|
||||
public void execute() {
|
||||
checkData();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Command sayPreviousCard = new Command() {
|
||||
public void execute() {
|
||||
try {
|
||||
GWT.log("PreviousCard");
|
||||
getWizardWindow().setNextButtonToDefault();
|
||||
getWizardWindow().previousCard();
|
||||
} catch (Exception e) {
|
||||
GWT.log("sayPreviousCard :" + e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
|
||||
getWizardWindow().setNextButtonCommand(sayNextCard);
|
||||
|
||||
getWizardWindow().setNextButtonToFinish();
|
||||
setEnableBackButton(true);
|
||||
setBackButtonVisible(true);
|
||||
setEnableNextButton(true);
|
||||
setNextButtonVisible(true);
|
||||
|
||||
}
|
||||
|
||||
private void checkData() {
|
||||
if(newProjectFolder!=null){
|
||||
ProjectCreateWizard wiz = (ProjectCreateWizard) getWizardWindow();
|
||||
wiz.getProjectCreateSession().setNewProjectFolder(newProjectFolder);
|
||||
goNext();
|
||||
|
||||
} else {
|
||||
GWTMessages.alert("Attention", "Select a valid project folder!", getZIndex());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void goNext() {
|
||||
try {
|
||||
GWT.log("NextCard");
|
||||
WizardEvent event = new WizardEvent(WizardEventType.Completed);
|
||||
getWizardWindow().fireEvent(event);
|
||||
getWizardWindow().close(false);
|
||||
} catch (Exception e) {
|
||||
GWT.log("sayNextCard :" + e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,177 @@
|
|||
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.create;
|
||||
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.rpc.StatAlgoImporterServiceAsync;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.descriptor.ProjectSetup;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.descriptor.SAIDescriptor;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.exception.StatAlgoImporterSessionExpiredException;
|
||||
import org.gcube.portlets.widgets.githubconnector.client.resource.GCResources;
|
||||
import org.gcube.portlets.widgets.githubconnector.client.util.GWTMessages;
|
||||
import org.gcube.portlets.widgets.githubconnector.client.util.WaitDialog;
|
||||
import org.gcube.portlets.widgets.githubconnector.client.wizard.WizardCard;
|
||||
|
||||
import com.google.gwt.core.shared.GWT;
|
||||
import com.google.gwt.user.client.Command;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.FlexTable;
|
||||
import com.google.gwt.user.client.ui.ListBox;
|
||||
import com.google.gwt.user.client.ui.SimplePanel;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ProjectSetupSelectionCard extends WizardCard {
|
||||
|
||||
private SAIDescriptor saiDescription;
|
||||
private ListBox projectSetupListBox;
|
||||
|
||||
// private DecoratorPanel decPanel;
|
||||
|
||||
public ProjectSetupSelectionCard() {
|
||||
super("Project Setup", "Configure the project");
|
||||
retrieveSaiDescriptor();
|
||||
}
|
||||
|
||||
|
||||
private void init(){
|
||||
try {
|
||||
SimplePanel projectSetupSelectionPanel = new SimplePanel();
|
||||
|
||||
projectSetupListBox = new ListBox();
|
||||
projectSetupListBox.setWidth("176px");
|
||||
projectSetupListBox.ensureDebugId("projectSetupListBox");
|
||||
|
||||
for (ProjectSetup projectSetup : saiDescription.getAvailableProjectConfigurations()) {
|
||||
projectSetupListBox.addItem(projectSetup.getLanguage());
|
||||
}
|
||||
|
||||
|
||||
// Form
|
||||
FlexTable layout = new FlexTable();
|
||||
layout.setCellSpacing(10);
|
||||
|
||||
FlexTable loginFlexTable = new FlexTable();
|
||||
loginFlexTable.setStyleName(GCResources.INSTANCE.wizardCSS().getCardPanelContent());
|
||||
loginFlexTable.setCellSpacing(16);
|
||||
|
||||
loginFlexTable.setHTML(1, 0, "Type:");
|
||||
loginFlexTable.setWidget(1, 1, projectSetupListBox);
|
||||
|
||||
projectSetupSelectionPanel.add(loginFlexTable);
|
||||
setContent(projectSetupSelectionPanel);
|
||||
} catch (Exception e) {
|
||||
GWT.log("Error: " + e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void retrieveSaiDescriptor() {
|
||||
final WaitDialog waitDialog = new WaitDialog(getZIndex());
|
||||
waitDialog.show();
|
||||
|
||||
StatAlgoImporterServiceAsync.INSTANCE.getSAIDescripor(new AsyncCallback<SAIDescriptor>() {
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
waitDialog.hide();
|
||||
GWT.log("Error retrieving repositories: " + caught.getMessage());
|
||||
if (caught instanceof StatAlgoImporterSessionExpiredException) {
|
||||
showErrorAndHide("Error", "Expired Session");
|
||||
|
||||
} else {
|
||||
showErrorAndHide("Error", "Retrieving repositories: " + caught.getLocalizedMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(SAIDescriptor saiDesc) {
|
||||
waitDialog.hide();
|
||||
saiDescription=saiDesc;
|
||||
init();
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
Command sayNextCard = new Command() {
|
||||
|
||||
public void execute() {
|
||||
checkData();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Command sayPreviousCard = new Command() {
|
||||
public void execute() {
|
||||
try {
|
||||
GWT.log("PreviousCard");
|
||||
getWizardWindow().setNextButtonToDefault();
|
||||
getWizardWindow().previousCard();
|
||||
} catch (Exception e) {
|
||||
GWT.log("sayPreviousCard :" + e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
|
||||
getWizardWindow().setNextButtonCommand(sayNextCard);
|
||||
|
||||
setEnableBackButton(false);
|
||||
setBackButtonVisible(false);
|
||||
setEnableNextButton(true);
|
||||
setNextButtonVisible(true);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void checkData() {
|
||||
int selected = projectSetupListBox.getSelectedIndex();
|
||||
if (selected >= 0) {
|
||||
String language = projectSetupListBox.getValue(selected);
|
||||
if (language == null || language.isEmpty()) {
|
||||
GWTMessages.alert("Attention", "Select a type!", getZIndex());
|
||||
} else {
|
||||
ProjectSetup selectedSetup=null;
|
||||
ProjectCreateWizard wiz = (ProjectCreateWizard) getWizardWindow();
|
||||
for(ProjectSetup pSetup:saiDescription.getAvailableProjectConfigurations()){
|
||||
if(pSetup.getLanguage().compareTo(language)==0){
|
||||
selectedSetup=pSetup;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(selectedSetup!=null){
|
||||
wiz.getProjectCreateSession().setProjectSetup(selectedSetup);
|
||||
goNext();
|
||||
} else {
|
||||
GWTMessages.alert("Attention", "Select a type!", getZIndex());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
GWTMessages.alert("Attention", "Select a type!", getZIndex());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void goNext() {
|
||||
try {
|
||||
GWT.log("NextCard: ProjectFolderSelectionCard");
|
||||
ProjectFolderSelectionCard card = new ProjectFolderSelectionCard();
|
||||
getWizardWindow().addCard(card);
|
||||
getWizardWindow().nextCard();
|
||||
} catch (Throwable e) {
|
||||
GWT.log("sayNextCard :" + e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,144 @@
|
|||
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.maindata;
|
||||
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.ProjectStatusEvent;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.tools.ToolsPanel;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.type.ProjectStatusEventType;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.event.shared.EventBus;
|
||||
import com.sencha.gxt.core.client.util.Margins;
|
||||
import com.sencha.gxt.widget.core.client.container.BorderLayoutContainer;
|
||||
import com.sencha.gxt.widget.core.client.container.BorderLayoutContainer.BorderLayoutData;
|
||||
import com.sencha.gxt.widget.core.client.container.MarginData;
|
||||
import com.sencha.gxt.widget.core.client.container.SimpleContainer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class WorkAreaPanel extends SimpleContainer {
|
||||
|
||||
private EventBus eventBus;
|
||||
|
||||
public WorkAreaPanel(EventBus eventBus) {
|
||||
super();
|
||||
this.eventBus = eventBus;
|
||||
init();
|
||||
create();
|
||||
bindToEvents();
|
||||
}
|
||||
|
||||
protected void init() {
|
||||
forceLayoutOnResize = true;
|
||||
setBorders(false);
|
||||
}
|
||||
|
||||
protected void create() {
|
||||
|
||||
}
|
||||
|
||||
private void bindToEvents() {
|
||||
eventBus.addHandler(ProjectStatusEvent.TYPE, new ProjectStatusEvent.ProjectStatusEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onProjectStatus(ProjectStatusEvent event) {
|
||||
Log.debug("Catch ProjectStatusEvent");
|
||||
doProjectStatusCommand(event);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void doProjectStatusCommand(ProjectStatusEvent event) {
|
||||
if (event.getProjectStatusEventType() == null) {
|
||||
return;
|
||||
}
|
||||
switch (event.getProjectStatusEventType()) {
|
||||
case WORK_AREA_SETUP:
|
||||
setupWorkAreaPanel(event.getProject());
|
||||
break;
|
||||
case DELETE_MAIN_CODE:
|
||||
case MAIN_CODE_SET:
|
||||
case OPEN:
|
||||
case WORK_AREA_READY:
|
||||
case SAVE:
|
||||
case START:
|
||||
case UPDATE:
|
||||
case SOFTWARE_CREATED:
|
||||
case SOFTWARE_PUBLISH:
|
||||
case SOFTWARE_REPACKAGE:
|
||||
case ADD_RESOURCE:
|
||||
case DELETE_RESOURCE:
|
||||
case EXPLORER_REFRESH:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void setupWorkAreaPanel(Project project) {
|
||||
if (project != null) {
|
||||
if (project.getProjectConfig() == null || project.getProjectConfig().getLanguage() == "R") {
|
||||
createRArea(project);
|
||||
} else {
|
||||
createBlackBoxArea(project);
|
||||
}
|
||||
forceLayout();
|
||||
fireWorkAreaReady(project);
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void createBlackBoxArea(Project project) {
|
||||
ToolsPanel toolsPanel = new ToolsPanel(eventBus);
|
||||
clear();
|
||||
add(toolsPanel);
|
||||
}
|
||||
|
||||
private void createRArea(Project project) {
|
||||
// Main Panel
|
||||
BorderLayoutContainer mainPanelLayout = new BorderLayoutContainer();
|
||||
// mainPanelLayout.setId("mainPanelLayout");
|
||||
mainPanelLayout.setBorders(false);
|
||||
mainPanelLayout.setResize(true);
|
||||
|
||||
// Main
|
||||
final MainDataPanel mainDataPanel = new MainDataPanel(eventBus);
|
||||
MarginData mainData = new MarginData(new Margins(2));
|
||||
mainPanelLayout.setCenterWidget(mainDataPanel, mainData);
|
||||
|
||||
// Right
|
||||
ToolsPanel toolsPanel = new ToolsPanel(eventBus);
|
||||
BorderLayoutData eastData = new BorderLayoutData(500);
|
||||
eastData.setCollapsible(true);
|
||||
eastData.setSplit(false);
|
||||
eastData.setFloatable(false);
|
||||
eastData.setCollapseMini(true);
|
||||
eastData.setMargins(new Margins(0, 5, 0, 5));
|
||||
eastData.setCollapseHidden(false);
|
||||
|
||||
mainPanelLayout.setEastWidget(toolsPanel, eastData);
|
||||
toolsPanel.enable();
|
||||
toolsPanel.collapse();
|
||||
|
||||
clear();
|
||||
add(mainPanelLayout);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void fireWorkAreaReady(Project project) {
|
||||
ProjectStatusEvent event = new ProjectStatusEvent(ProjectStatusEventType.WORK_AREA_READY, project);
|
||||
eventBus.fireEvent(event);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -12,6 +12,7 @@ import org.gcube.portlets.user.statisticalalgorithmsimporter.client.rpc.StatAlgo
|
|||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.type.ProjectStatusEventType;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.type.SessionExpiredType;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.utils.UtilsGXT3;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.descriptor.SAIDescriptor;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.exception.StatAlgoImporterSessionExpiredException;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.InputData;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
||||
|
@ -42,15 +43,51 @@ import com.sencha.gxt.widget.core.client.event.DialogHideEvent.DialogHideHandler
|
|||
public class ProjectManager {
|
||||
private EventBus eventBus;
|
||||
private Project project;
|
||||
private SAIDescriptor saiDescriptor;
|
||||
|
||||
public ProjectManager(EventBus eventBus) {
|
||||
this.eventBus = eventBus;
|
||||
|
||||
}
|
||||
|
||||
public void bind(){
|
||||
eventBus.addHandler(ProjectStatusEvent.TYPE,
|
||||
new ProjectStatusEvent.ProjectStatusEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onProjectStatus(ProjectStatusEvent event) {
|
||||
Log.debug("Catch ProjectStatusEvent");
|
||||
doProjectStatusManage(event);
|
||||
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void doProjectStatusManage(ProjectStatusEvent event) {
|
||||
if(event==null|| event.getProjectStatusEventType()==null){
|
||||
return;
|
||||
}
|
||||
switch(event.getProjectStatusEventType()){
|
||||
case WORK_AREA_READY:
|
||||
fireProjectStatusOpenEvent();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void createProject() {
|
||||
|
||||
WorkspaceExplorerSelectDialog wselectDialog = new WorkspaceExplorerSelectDialog(
|
||||
"Select Project Folder", true);
|
||||
|
||||
}
|
||||
|
||||
private void selectProjectFolder(){
|
||||
|
||||
|
||||
WorkspaceExplorerSelectDialog wselectDialog = new WorkspaceExplorerSelectDialog("Select Project Folder", true);
|
||||
|
||||
WorskpaceExplorerSelectNotificationListener handler = new WorskpaceExplorerSelectNotificationListener() {
|
||||
|
||||
|
@ -61,16 +98,14 @@ public class ProjectManager {
|
|||
createProjectOnServer(item);
|
||||
|
||||
} else {
|
||||
UtilsGXT3.info("Attention",
|
||||
"Select a valid project folder!");
|
||||
UtilsGXT3.info("Attention", "Select a valid project folder!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(Throwable throwable) {
|
||||
Log.error("Error in create project: "
|
||||
+ throwable.getLocalizedMessage());
|
||||
Log.error("Error in create project: " + throwable.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error", throwable.getLocalizedMessage());
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
|
@ -92,8 +127,7 @@ public class ProjectManager {
|
|||
}
|
||||
|
||||
public void openProject() {
|
||||
WorkspaceExplorerSelectDialog wselectDialog = new WorkspaceExplorerSelectDialog(
|
||||
"Select Project Folder", true);
|
||||
WorkspaceExplorerSelectDialog wselectDialog = new WorkspaceExplorerSelectDialog("Select Project Folder", true);
|
||||
|
||||
WorskpaceExplorerSelectNotificationListener handler = new WorskpaceExplorerSelectNotificationListener() {
|
||||
|
||||
|
@ -104,16 +138,14 @@ public class ProjectManager {
|
|||
openProjectOnServer(item);
|
||||
|
||||
} else {
|
||||
UtilsGXT3.info("Attention",
|
||||
"Select a valid project folder!");
|
||||
UtilsGXT3.info("Attention", "Select a valid project folder!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(Throwable throwable) {
|
||||
Log.error("Error in create project: "
|
||||
+ throwable.getLocalizedMessage());
|
||||
Log.error("Error in create project: " + throwable.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error", throwable.getLocalizedMessage());
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
|
@ -137,14 +169,12 @@ public class ProjectManager {
|
|||
|
||||
public void addGitHubProject() {
|
||||
if (project != null) {
|
||||
if (project.getProjectFolder() != null
|
||||
&& project.getProjectFolder().getFolder() != null) {
|
||||
if (project.getProjectFolder() != null && project.getProjectFolder().getFolder() != null) {
|
||||
WizardEvent.WizardEventHandler handler = new WizardEvent.WizardEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onResponse(WizardEvent event) {
|
||||
GWT.log("Wizard Response: "
|
||||
+ event.getWizardEventType());
|
||||
GWT.log("Wizard Response: " + event.getWizardEventType());
|
||||
if (event.getWizardEventType() == null) {
|
||||
fireProjectStatusAddResourceEvent();
|
||||
return;
|
||||
|
@ -170,8 +200,7 @@ public class ProjectManager {
|
|||
wizard.setZIndex(XDOM.getTopZIndex());
|
||||
wizard.show();
|
||||
} else {
|
||||
Log.error("Invalid ProjectFolder: "
|
||||
+ project.getProjectFolder());
|
||||
Log.error("Invalid ProjectFolder: " + project.getProjectFolder());
|
||||
UtilsGXT3.alert("Error", "Error retrieving project folder!");
|
||||
}
|
||||
|
||||
|
@ -193,17 +222,15 @@ public class ProjectManager {
|
|||
List<ItemType> showableTypes = new ArrayList<ItemType>();
|
||||
showableTypes.addAll(Arrays.asList(ItemType.values()));
|
||||
|
||||
WorkspaceExplorerSelectDialog wselectDialog = new WorkspaceExplorerSelectDialog(
|
||||
"Select a Resource", selectableTypes, showableTypes);
|
||||
WorkspaceExplorerSelectDialog wselectDialog = new WorkspaceExplorerSelectDialog("Select a Resource",
|
||||
selectableTypes, showableTypes);
|
||||
|
||||
WorskpaceExplorerSelectNotificationListener handler = new WorskpaceExplorerSelectNotificationListener() {
|
||||
|
||||
@Override
|
||||
public void onSelectedItem(Item item) {
|
||||
if (item.getType() == ItemType.EXTERNAL_FILE
|
||||
|| item.getType() == ItemType.EXTERNAL_IMAGE
|
||||
|| item.getType() == ItemType.IMAGE_DOCUMENT
|
||||
|| item.getType() == ItemType.DOCUMENT
|
||||
if (item.getType() == ItemType.EXTERNAL_FILE || item.getType() == ItemType.EXTERNAL_IMAGE
|
||||
|| item.getType() == ItemType.IMAGE_DOCUMENT || item.getType() == ItemType.DOCUMENT
|
||||
|| item.getType() == ItemType.PDF_DOCUMENT) {
|
||||
String filename = item.getName();
|
||||
if (filename != null && !filename.isEmpty()) {
|
||||
|
@ -220,8 +247,7 @@ public class ProjectManager {
|
|||
|
||||
@Override
|
||||
public void onFailed(Throwable throwable) {
|
||||
Log.error("Error in add resource: "
|
||||
+ throwable.getLocalizedMessage());
|
||||
Log.error("Error in add resource: " + throwable.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error", throwable.getLocalizedMessage());
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
|
@ -245,180 +271,153 @@ public class ProjectManager {
|
|||
private void addResourceToProject(Item item) {
|
||||
final StatAlgoImporterMonitor monitor = new StatAlgoImporterMonitor();
|
||||
Log.debug("Add Resource To Project Item selected: " + item);
|
||||
ItemDescription itemDescription = new ItemDescription(item.getId(),
|
||||
item.getName(), item.getOwner(), item.getPath(), item.getType()
|
||||
.name());
|
||||
StatAlgoImporterServiceAsync.INSTANCE.addResourceToProject(
|
||||
itemDescription, new AsyncCallback<Void>() {
|
||||
ItemDescription itemDescription = new ItemDescription(item.getId(), item.getName(), item.getOwner(),
|
||||
item.getPath(), item.getType().name());
|
||||
StatAlgoImporterServiceAsync.INSTANCE.addResourceToProject(itemDescription, new AsyncCallback<Void>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
monitor.hide();
|
||||
fireProjectStatusAddResourceEvent();
|
||||
}
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
monitor.hide();
|
||||
fireProjectStatusAddResourceEvent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
monitor.hide();
|
||||
if (caught instanceof StatAlgoImporterSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
Log.error("Error in add resource to project: "
|
||||
+ caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error",
|
||||
caught.getLocalizedMessage());
|
||||
}
|
||||
caught.printStackTrace();
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
monitor.hide();
|
||||
if (caught instanceof StatAlgoImporterSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
Log.error("Error in add resource to project: " + caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error", caught.getLocalizedMessage());
|
||||
}
|
||||
caught.printStackTrace();
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void createProjectOnServer(Item item) {
|
||||
final StatAlgoImporterMonitor monitor = new StatAlgoImporterMonitor();
|
||||
Log.debug("Create Project Item selected: " + item);
|
||||
final ItemDescription newProjectFolder = new ItemDescription(
|
||||
item.getId(), item.getName(), item.getOwner(), item.getPath(),
|
||||
item.getType().name());
|
||||
StatAlgoImporterServiceAsync.INSTANCE.createProjectOnWorkspace(
|
||||
newProjectFolder, new AsyncCallback<Void>() {
|
||||
final ItemDescription newProjectFolder = new ItemDescription(item.getId(), item.getName(), item.getOwner(),
|
||||
item.getPath(), item.getType().name());
|
||||
StatAlgoImporterServiceAsync.INSTANCE.createProjectOnWorkspace(newProjectFolder, new AsyncCallback<Void>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
monitor.hide();
|
||||
project = new Project(new ProjectFolder(
|
||||
newProjectFolder));
|
||||
fireProjectStatusOpenEvent();
|
||||
}
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
monitor.hide();
|
||||
project = new Project(new ProjectFolder(newProjectFolder));
|
||||
fireProjectStatusWorkAreaSetupEvent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
monitor.hide();
|
||||
if (caught instanceof StatAlgoImporterSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
Log.error("Error in create project: "
|
||||
+ caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error",
|
||||
caught.getLocalizedMessage());
|
||||
}
|
||||
caught.printStackTrace();
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
monitor.hide();
|
||||
if (caught instanceof StatAlgoImporterSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
Log.error("Error in create project: " + caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error", caught.getLocalizedMessage());
|
||||
}
|
||||
caught.printStackTrace();
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void openProjectOnServer(Item item) {
|
||||
final StatAlgoImporterMonitor monitor = new StatAlgoImporterMonitor();
|
||||
|
||||
Log.debug("Open Project Item selected: " + item);
|
||||
final ItemDescription newProjectFolder = new ItemDescription(
|
||||
item.getId(), item.getName(), item.getOwner(), item.getPath(),
|
||||
item.getType().name());
|
||||
StatAlgoImporterServiceAsync.INSTANCE.openProjectOnWorkspace(
|
||||
newProjectFolder, new AsyncCallback<Project>() {
|
||||
final ItemDescription newProjectFolder = new ItemDescription(item.getId(), item.getName(), item.getOwner(),
|
||||
item.getPath(), item.getType().name());
|
||||
StatAlgoImporterServiceAsync.INSTANCE.openProjectOnWorkspace(newProjectFolder, new AsyncCallback<Project>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(Project projectOpened) {
|
||||
Log.debug("Open: " + projectOpened);
|
||||
monitor.hide();
|
||||
project = projectOpened;
|
||||
fireProjectStatusOpenEvent();
|
||||
@Override
|
||||
public void onSuccess(Project projectOpened) {
|
||||
Log.debug("Open: " + projectOpened);
|
||||
monitor.hide();
|
||||
project = projectOpened;
|
||||
fireProjectStatusWorkAreaSetupEvent();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
monitor.hide();
|
||||
if (caught instanceof StatAlgoImporterSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
Log.error("Error in open project: "
|
||||
+ caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error",
|
||||
caught.getLocalizedMessage());
|
||||
}
|
||||
caught.printStackTrace();
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
monitor.hide();
|
||||
if (caught instanceof StatAlgoImporterSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
Log.error("Error in open project: " + caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error", caught.getLocalizedMessage());
|
||||
}
|
||||
caught.printStackTrace();
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void saveProject(InputData inputData,
|
||||
final StatAlgoImporterMonitor monitor) {
|
||||
public void saveProject(InputData inputData, final StatAlgoImporterMonitor monitor) {
|
||||
Log.debug("Save Project: " + inputData);
|
||||
|
||||
StatAlgoImporterServiceAsync.INSTANCE.saveProject(inputData,
|
||||
new AsyncCallback<Void>() {
|
||||
StatAlgoImporterServiceAsync.INSTANCE.saveProject(inputData, new AsyncCallback<Void>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
monitor.hide();
|
||||
UtilsGXT3.info("Save", "Project saved!");
|
||||
fireProjectStatusExplorerRefreshEvent();
|
||||
}
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
monitor.hide();
|
||||
UtilsGXT3.info("Save", "Project saved!");
|
||||
fireProjectStatusExplorerRefreshEvent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
monitor.hide();
|
||||
if (caught instanceof StatAlgoImporterSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
Log.error("Error on save project: "
|
||||
+ caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error",
|
||||
caught.getLocalizedMessage());
|
||||
}
|
||||
caught.printStackTrace();
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
monitor.hide();
|
||||
if (caught instanceof StatAlgoImporterSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
Log.error("Error on save project: " + caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error", caught.getLocalizedMessage());
|
||||
}
|
||||
caught.printStackTrace();
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void softwareCreate(final InputData inputData,
|
||||
final StatAlgoImporterMonitor monitor) {
|
||||
public void softwareCreate(final InputData inputData, final StatAlgoImporterMonitor monitor) {
|
||||
|
||||
StatAlgoImporterServiceAsync.INSTANCE.createSoftware(inputData,
|
||||
new AsyncCallback<Void>() {
|
||||
StatAlgoImporterServiceAsync.INSTANCE.createSoftware(inputData, new AsyncCallback<Void>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
monitor.hide();
|
||||
fireProjectStatusSoftwareCreatedEvent();
|
||||
UtilsGXT3.info("Create Software", "Software Created!");
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
monitor.hide();
|
||||
fireProjectStatusSoftwareCreatedEvent();
|
||||
UtilsGXT3.info("Create Software", "Software Created!");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
monitor.hide();
|
||||
if (caught instanceof StatAlgoImporterSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
Log.error("Error in create software: "
|
||||
+ caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error",
|
||||
caught.getLocalizedMessage());
|
||||
fireProjectStatusExplorerRefreshEvent();
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
monitor.hide();
|
||||
if (caught instanceof StatAlgoImporterSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
Log.error("Error in create software: " + caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error", caught.getLocalizedMessage());
|
||||
fireProjectStatusExplorerRefreshEvent();
|
||||
|
||||
}
|
||||
caught.printStackTrace();
|
||||
}
|
||||
caught.printStackTrace();
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void setMainCode(final ItemDescription itemDescription) {
|
||||
if (project != null) {
|
||||
if (project.getMainCode() != null
|
||||
&& project.getMainCode().getItemDescription() != null) {
|
||||
if (project.getMainCode() != null && project.getMainCode().getItemDescription() != null) {
|
||||
final ConfirmMessageBox mb = new ConfirmMessageBox("Attention",
|
||||
"All previous configurations will be lost. Would you like to change main code?");
|
||||
mb.addDialogHideHandler(new DialogHideHandler() {
|
||||
|
@ -452,50 +451,41 @@ public class ProjectManager {
|
|||
private void setMainCodeOnServer(final ItemDescription itemDescription) {
|
||||
|
||||
Log.debug("Set Main Code: " + itemDescription);
|
||||
StatAlgoImporterServiceAsync.INSTANCE.setMainCode(itemDescription,
|
||||
new AsyncCallback<Project>() {
|
||||
StatAlgoImporterServiceAsync.INSTANCE.setMainCode(itemDescription, new AsyncCallback<Project>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof StatAlgoImporterSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
Log.error("Error setting main code: "
|
||||
+ caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error",
|
||||
caught.getLocalizedMessage());
|
||||
}
|
||||
caught.printStackTrace();
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof StatAlgoImporterSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
Log.error("Error setting main code: " + caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error", caught.getLocalizedMessage());
|
||||
}
|
||||
caught.printStackTrace();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Project result) {
|
||||
project = result;
|
||||
fireProjectStatusMainCodeSetEvent();
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onSuccess(Project result) {
|
||||
project = result;
|
||||
fireProjectStatusMainCodeSetEvent();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void setNewMainCode(NewMainCodeEvent newMainCodeEvent,
|
||||
final StatAlgoImporterMonitor monitor) {
|
||||
StatAlgoImporterServiceAsync.INSTANCE.setNewMainCode(
|
||||
newMainCodeEvent.getFile(), newMainCodeEvent.getCode(),
|
||||
public void setNewMainCode(NewMainCodeEvent newMainCodeEvent, final StatAlgoImporterMonitor monitor) {
|
||||
StatAlgoImporterServiceAsync.INSTANCE.setNewMainCode(newMainCodeEvent.getFile(), newMainCodeEvent.getCode(),
|
||||
new AsyncCallback<Project>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
monitor.hide();
|
||||
if (caught instanceof StatAlgoImporterSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
eventBus.fireEvent(new SessionExpiredEvent(SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
Log.error("Error on save new main code: "
|
||||
+ caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error",
|
||||
caught.getLocalizedMessage());
|
||||
Log.error("Error on save new main code: " + caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error", caught.getLocalizedMessage());
|
||||
}
|
||||
caught.printStackTrace();
|
||||
|
||||
|
@ -512,11 +502,8 @@ public class ProjectManager {
|
|||
}
|
||||
|
||||
public void deleteItem(final ItemDescription itemDescription) {
|
||||
if (project != null
|
||||
&& project.getMainCode() != null
|
||||
&& project.getMainCode().getItemDescription() != null
|
||||
&& itemDescription.getId().compareTo(
|
||||
project.getMainCode().getItemDescription().getId()) == 0) {
|
||||
if (project != null && project.getMainCode() != null && project.getMainCode().getItemDescription() != null
|
||||
&& itemDescription.getId().compareTo(project.getMainCode().getItemDescription().getId()) == 0) {
|
||||
final ConfirmMessageBox mb = new ConfirmMessageBox("Delete",
|
||||
"All previous configurations will be lost. Would you like to delete main code?");
|
||||
mb.addDialogHideHandler(new DialogHideHandler() {
|
||||
|
@ -539,8 +526,7 @@ public class ProjectManager {
|
|||
mb.show();
|
||||
|
||||
} else {
|
||||
final ConfirmMessageBox mb = new ConfirmMessageBox("Delete",
|
||||
"Would you like to delete this resource?");
|
||||
final ConfirmMessageBox mb = new ConfirmMessageBox("Delete", "Would you like to delete this resource?");
|
||||
mb.addDialogHideHandler(new DialogHideHandler() {
|
||||
|
||||
@Override
|
||||
|
@ -564,73 +550,40 @@ public class ProjectManager {
|
|||
|
||||
}
|
||||
|
||||
private void deleteItemOnServer(ItemDescription itemDescription,
|
||||
final boolean mainCode) {
|
||||
private void deleteItemOnServer(ItemDescription itemDescription, final boolean mainCode) {
|
||||
final StatAlgoImporterMonitor monitor = new StatAlgoImporterMonitor();
|
||||
|
||||
StatAlgoImporterServiceAsync.INSTANCE.deleteResourceOnProject(
|
||||
itemDescription, new AsyncCallback<Project>() {
|
||||
StatAlgoImporterServiceAsync.INSTANCE.deleteResourceOnProject(itemDescription, new AsyncCallback<Project>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
monitor.hide();
|
||||
if (caught instanceof StatAlgoImporterSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
Log.error("Error deleting resourse: "
|
||||
+ caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error",
|
||||
caught.getLocalizedMessage());
|
||||
}
|
||||
caught.printStackTrace();
|
||||
}
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
monitor.hide();
|
||||
if (caught instanceof StatAlgoImporterSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
Log.error("Error deleting resourse: " + caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error", caught.getLocalizedMessage());
|
||||
}
|
||||
caught.printStackTrace();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Project result) {
|
||||
monitor.hide();
|
||||
project = result;
|
||||
if (mainCode) {
|
||||
fireProjectStatusDeleteMainCodeEvent();
|
||||
} else {
|
||||
fireProjectStatusDeleteEvent();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void startProjectManager(String value) {
|
||||
|
||||
StatAlgoImporterServiceAsync.INSTANCE.restoreUISession(value,
|
||||
new AsyncCallback<Project>() {
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof StatAlgoImporterSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
UtilsGXT3.alert("Error",
|
||||
caught.getLocalizedMessage());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void onSuccess(Project p) {
|
||||
if (p != null) {
|
||||
project = p;
|
||||
fireProjectStatusOpenEvent();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
@Override
|
||||
public void onSuccess(Project result) {
|
||||
monitor.hide();
|
||||
project = result;
|
||||
if (mainCode) {
|
||||
fireProjectStatusDeleteMainCodeEvent();
|
||||
} else {
|
||||
fireProjectStatusDeleteEvent();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void softwareRepackage() {
|
||||
if (project != null) {
|
||||
final ConfirmMessageBox mb = new ConfirmMessageBox(
|
||||
"Attention",
|
||||
final ConfirmMessageBox mb = new ConfirmMessageBox("Attention",
|
||||
"This operation repackages the script only without recreating the Java software. The already deployed Java software will use the new script package. Do you want to proceed?");
|
||||
mb.addDialogHideHandler(new DialogHideHandler() {
|
||||
|
||||
|
@ -660,35 +613,30 @@ public class ProjectManager {
|
|||
|
||||
private void softwareRepackageOnServer() {
|
||||
final StatAlgoImporterMonitor monitor = new StatAlgoImporterMonitor();
|
||||
StatAlgoImporterServiceAsync.INSTANCE
|
||||
.repackageSoftware(new AsyncCallback<Void>() {
|
||||
StatAlgoImporterServiceAsync.INSTANCE.repackageSoftware(new AsyncCallback<Void>() {
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
monitor.hide();
|
||||
if (caught instanceof StatAlgoImporterSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
UtilsGXT3.alert("Error",
|
||||
caught.getLocalizedMessage());
|
||||
fireProjectStatusExplorerRefreshEvent();
|
||||
}
|
||||
}
|
||||
public void onFailure(Throwable caught) {
|
||||
monitor.hide();
|
||||
if (caught instanceof StatAlgoImporterSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
UtilsGXT3.alert("Error", caught.getLocalizedMessage());
|
||||
fireProjectStatusExplorerRefreshEvent();
|
||||
}
|
||||
}
|
||||
|
||||
public void onSuccess(Void result) {
|
||||
monitor.hide();
|
||||
UtilsGXT3.info("Repackage",
|
||||
"The script has been repackaged!");
|
||||
fireProjectStatusSoftwareRepackageEvent();
|
||||
}
|
||||
public void onSuccess(Void result) {
|
||||
monitor.hide();
|
||||
UtilsGXT3.info("Repackage", "The script has been repackaged!");
|
||||
fireProjectStatusSoftwareRepackageEvent();
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public void softwarePublish() {
|
||||
if (project != null) {
|
||||
final ConfirmMessageBox mb = new ConfirmMessageBox(
|
||||
"Attention",
|
||||
final ConfirmMessageBox mb = new ConfirmMessageBox("Attention",
|
||||
"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() {
|
||||
|
||||
|
@ -718,39 +666,101 @@ public class ProjectManager {
|
|||
|
||||
private void softwarePublishOnServer() {
|
||||
final StatAlgoImporterMonitor monitor = new StatAlgoImporterMonitor();
|
||||
StatAlgoImporterServiceAsync.INSTANCE
|
||||
.publishSoftware(new AsyncCallback<Void>() {
|
||||
StatAlgoImporterServiceAsync.INSTANCE.publishSoftware(new AsyncCallback<Void>() {
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
monitor.hide();
|
||||
if (caught instanceof StatAlgoImporterSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
UtilsGXT3.alert("Error",
|
||||
caught.getLocalizedMessage());
|
||||
fireProjectStatusExplorerRefreshEvent();
|
||||
public void onFailure(Throwable caught) {
|
||||
monitor.hide();
|
||||
if (caught instanceof StatAlgoImporterSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
UtilsGXT3.alert("Error", caught.getLocalizedMessage());
|
||||
fireProjectStatusExplorerRefreshEvent();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onSuccess(Void result) {
|
||||
monitor.hide();
|
||||
UtilsGXT3.info("Publish",
|
||||
"The software has been published!");
|
||||
fireProjectStatusSoftwarePublishEvent();
|
||||
}
|
||||
public void onSuccess(Void result) {
|
||||
monitor.hide();
|
||||
UtilsGXT3.info("Publish", "The software has been published!");
|
||||
fireProjectStatusSoftwarePublishEvent();
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public void startProjectManager() {
|
||||
fireProjectStatusStartEvent();
|
||||
retrieveSAIDescriptor(null);
|
||||
}
|
||||
|
||||
public void startProjectManager(String restoreValue) {
|
||||
retrieveSAIDescriptor(restoreValue);
|
||||
|
||||
}
|
||||
|
||||
private void retrieveSAIDescriptor(final String restoreValue) {
|
||||
StatAlgoImporterServiceAsync.INSTANCE.getSAIDescripor(new AsyncCallback<SAIDescriptor>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
Log.info("Error retrieving SAI descriptor: " + caught.getMessage(), caught);
|
||||
if (caught instanceof StatAlgoImporterSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
UtilsGXT3.alert("Error", "Error retrieving SAI descriptor: " + caught.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(SAIDescriptor saiDesc) {
|
||||
saiDescriptor = saiDesc;
|
||||
Log.info("SAIDescriptor: " + saiDescriptor);
|
||||
if (restoreValue == null || restoreValue.isEmpty()) {
|
||||
fireProjectStatusStartEvent();
|
||||
} else {
|
||||
restoreProject(restoreValue);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void restoreProject(String restoreValue) {
|
||||
Log.info("Restore Project");
|
||||
StatAlgoImporterServiceAsync.INSTANCE.restoreUISession(restoreValue, new AsyncCallback<Project>() {
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof StatAlgoImporterSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
UtilsGXT3.alert("Error", caught.getLocalizedMessage());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void onSuccess(Project p) {
|
||||
if (p != null) {
|
||||
project = p;
|
||||
fireProjectStatusWorkAreaSetupEvent();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void fireProjectStatusWorkAreaSetupEvent() {
|
||||
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(ProjectStatusEventType.WORK_AREA_SETUP, project);
|
||||
eventBus.fireEvent(projectStatusEvent);
|
||||
Log.debug("ProjectStatusEvent fired! " + projectStatusEvent);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void fireProjectStatusOpenEvent() {
|
||||
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(
|
||||
ProjectStatusEventType.OPEN, project);
|
||||
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(ProjectStatusEventType.OPEN, project);
|
||||
eventBus.fireEvent(projectStatusEvent);
|
||||
Log.debug("ProjectStatusEvent fired! " + projectStatusEvent);
|
||||
|
||||
|
@ -758,79 +768,73 @@ public class ProjectManager {
|
|||
|
||||
@SuppressWarnings("unused")
|
||||
private void fireProjectStatusSaveProjectEvent() {
|
||||
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(
|
||||
ProjectStatusEventType.SAVE, project);
|
||||
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(ProjectStatusEventType.SAVE, project);
|
||||
eventBus.fireEvent(projectStatusEvent);
|
||||
Log.debug("ProjectStatusEvent fired! " + projectStatusEvent);
|
||||
}
|
||||
|
||||
private void fireProjectStatusAddResourceEvent() {
|
||||
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(
|
||||
ProjectStatusEventType.ADD_RESOURCE, project);
|
||||
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(ProjectStatusEventType.ADD_RESOURCE, project);
|
||||
eventBus.fireEvent(projectStatusEvent);
|
||||
Log.debug("ProjectStatusEvent fired! " + projectStatusEvent);
|
||||
}
|
||||
|
||||
private void fireProjectStatusDeleteEvent() {
|
||||
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(
|
||||
ProjectStatusEventType.DELETE_RESOURCE, project);
|
||||
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(ProjectStatusEventType.DELETE_RESOURCE, project);
|
||||
eventBus.fireEvent(projectStatusEvent);
|
||||
Log.debug("ProjectStatusEvent fired! " + projectStatusEvent);
|
||||
}
|
||||
|
||||
private void fireProjectStatusDeleteMainCodeEvent() {
|
||||
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(
|
||||
ProjectStatusEventType.DELETE_MAIN_CODE, project);
|
||||
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(ProjectStatusEventType.DELETE_MAIN_CODE,
|
||||
project);
|
||||
eventBus.fireEvent(projectStatusEvent);
|
||||
Log.debug("ProjectStatusEvent fired! " + projectStatusEvent);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private void fireProjectStatusUpdateEvent() {
|
||||
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(
|
||||
ProjectStatusEventType.UPDATE, project);
|
||||
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(ProjectStatusEventType.UPDATE, project);
|
||||
eventBus.fireEvent(projectStatusEvent);
|
||||
Log.debug("ProjectStatusEvent fired! " + projectStatusEvent);
|
||||
}
|
||||
|
||||
private void fireProjectStatusExplorerRefreshEvent() {
|
||||
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(
|
||||
ProjectStatusEventType.EXPLORER_REFRESH, project);
|
||||
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(ProjectStatusEventType.EXPLORER_REFRESH,
|
||||
project);
|
||||
eventBus.fireEvent(projectStatusEvent);
|
||||
Log.debug("ProjectStatusEvent fired! " + projectStatusEvent);
|
||||
}
|
||||
|
||||
private void fireProjectStatusMainCodeSetEvent() {
|
||||
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(
|
||||
ProjectStatusEventType.MAIN_CODE_SET, project);
|
||||
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(ProjectStatusEventType.MAIN_CODE_SET, project);
|
||||
eventBus.fireEvent(projectStatusEvent);
|
||||
Log.debug("ProjectStatusEvent fired! " + projectStatusEvent);
|
||||
}
|
||||
|
||||
private void fireProjectStatusSoftwareCreatedEvent() {
|
||||
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(
|
||||
ProjectStatusEventType.SOFTWARE_CREATED, project);
|
||||
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(ProjectStatusEventType.SOFTWARE_CREATED,
|
||||
project);
|
||||
eventBus.fireEvent(projectStatusEvent);
|
||||
Log.debug("ProjectStatusEvent fired! " + projectStatusEvent);
|
||||
}
|
||||
|
||||
private void fireProjectStatusSoftwarePublishEvent() {
|
||||
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(
|
||||
ProjectStatusEventType.SOFTWARE_PUBLISH, project);
|
||||
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(ProjectStatusEventType.SOFTWARE_PUBLISH,
|
||||
project);
|
||||
eventBus.fireEvent(projectStatusEvent);
|
||||
Log.debug("ProjectStatusEvent fired! " + projectStatusEvent);
|
||||
}
|
||||
|
||||
private void fireProjectStatusSoftwareRepackageEvent() {
|
||||
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(
|
||||
ProjectStatusEventType.SOFTWARE_REPACKAGE, project);
|
||||
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(ProjectStatusEventType.SOFTWARE_REPACKAGE,
|
||||
project);
|
||||
eventBus.fireEvent(projectStatusEvent);
|
||||
Log.debug("ProjectStatusEvent fired! " + projectStatusEvent);
|
||||
}
|
||||
|
||||
private void fireProjectStatusStartEvent() {
|
||||
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(
|
||||
ProjectStatusEventType.START, project);
|
||||
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(ProjectStatusEventType.START, project);
|
||||
eventBus.fireEvent(projectStatusEvent);
|
||||
Log.debug("ProjectStatusEvent fired! " + projectStatusEvent);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.gcube.portlets.user.statisticalalgorithmsimporter.client.rpc;
|
|||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.code.CodeData;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.descriptor.SAIDescriptor;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.exception.StatAlgoImporterServiceException;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.file.FileUploadMonitor;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.InputData;
|
||||
|
@ -30,6 +31,14 @@ public interface StatAlgoImporterService extends RemoteService {
|
|||
*/
|
||||
public UserInfo hello() throws StatAlgoImporterServiceException;
|
||||
|
||||
/**
|
||||
* Retrieve SAI descriptort
|
||||
*
|
||||
* @return SAI descriptort
|
||||
* @throws StatAlgoImporterServiceException Exception
|
||||
*/
|
||||
public SAIDescriptor getSAIDescripor() throws StatAlgoImporterServiceException;
|
||||
|
||||
// File Upload Monitor
|
||||
/**
|
||||
* Get File Upload Monitor during the file upload operation in Import CSV
|
||||
|
|
|
@ -6,6 +6,7 @@ package org.gcube.portlets.user.statisticalalgorithmsimporter.client.rpc;
|
|||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.code.CodeData;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.descriptor.SAIDescriptor;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.file.FileUploadMonitor;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.InputData;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
||||
|
@ -28,6 +29,8 @@ public interface StatAlgoImporterServiceAsync {
|
|||
|
||||
void hello(AsyncCallback<UserInfo> callback);
|
||||
|
||||
void getSAIDescripor(AsyncCallback<SAIDescriptor> callback);
|
||||
|
||||
void getFileUploadMonitor(AsyncCallback<FileUploadMonitor> callback);
|
||||
|
||||
void getCode(AsyncCallback<ArrayList<CodeData>> callback);
|
||||
|
@ -58,4 +61,6 @@ public interface StatAlgoImporterServiceAsync {
|
|||
|
||||
void repackageSoftware(AsyncCallback<Void> asyncCallback);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -8,6 +8,8 @@ package org.gcube.portlets.user.statisticalalgorithmsimporter.client.type;
|
|||
*/
|
||||
public enum ProjectStatusEventType {
|
||||
START,
|
||||
WORK_AREA_SETUP,
|
||||
WORK_AREA_READY,
|
||||
OPEN,
|
||||
MAIN_CODE_SET,
|
||||
UPDATE,
|
||||
|
@ -19,6 +21,4 @@ public enum ProjectStatusEventType {
|
|||
SOFTWARE_REPACKAGE,
|
||||
EXPLORER_REFRESH,
|
||||
SAVE;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import org.gcube.portlets.user.statisticalalgorithmsimporter.client.rpc.StatAlgo
|
|||
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.annotation.WPS4RParser;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.file.CodeReader;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.generator.ProjectBuilder;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.is.BuildSAIDescriptor;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.social.AlgorithmNotification;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.social.Recipient;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.storage.FilesStorage;
|
||||
|
@ -20,6 +21,7 @@ import org.gcube.portlets.user.statisticalalgorithmsimporter.server.storage.Main
|
|||
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.storage.ProjectArchiver;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.util.ServiceCredentials;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.code.CodeData;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.descriptor.SAIDescriptor;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.exception.StatAlgoImporterServiceException;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.exception.StatAlgoImporterSessionExpiredException;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.file.FileUploadMonitor;
|
||||
|
@ -120,6 +122,29 @@ public class StatAlgoImporterServiceImpl extends RemoteServiceServlet implements
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public SAIDescriptor getSAIDescripor() throws StatAlgoImporterServiceException {
|
||||
HttpServletRequest httpRequest = null;
|
||||
try {
|
||||
httpRequest = this.getThreadLocalRequest();
|
||||
ServiceCredentials serviceCredentials = SessionUtil
|
||||
.getServiceCredentials(httpRequest);
|
||||
logger.debug("getSAIDescriptor()");
|
||||
SAIDescriptor saiDescriptor=BuildSAIDescriptor.build(serviceCredentials.getScope());
|
||||
return saiDescriptor;
|
||||
|
||||
} catch (StatAlgoImporterServiceException e) {
|
||||
logger.error("Error retrieving SAI descriptor: "+e.getLocalizedMessage(),e);
|
||||
throw e;
|
||||
} catch (Throwable e) {
|
||||
logger.error("Error retrieving SAI descriptor: "+e.getLocalizedMessage(),e);
|
||||
throw new StatAlgoImporterServiceException(e.getLocalizedMessage(),e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Project restoreUISession(String value)
|
||||
throws StatAlgoImporterServiceException {
|
||||
|
@ -142,6 +167,7 @@ public class StatAlgoImporterServiceImpl extends RemoteServiceServlet implements
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -705,4 +731,6 @@ public class StatAlgoImporterServiceImpl extends RemoteServiceServlet implements
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
package org.gcube.portlets.user.statisticalalgorithmsimporter.server.is;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
@XmlRootElement(name = "availableprojectconfig")
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class AvailableProjectConfigJAXB {
|
||||
@XmlElement
|
||||
private String language;
|
||||
|
||||
@XmlElement
|
||||
private String support;
|
||||
|
||||
public String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
public void setLanguage(String language) {
|
||||
this.language = language;
|
||||
}
|
||||
|
||||
public String getSupport() {
|
||||
return support;
|
||||
}
|
||||
|
||||
public void setSupport(String support) {
|
||||
this.support = support;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ProjectConfigJAXB [language=" + language + ", support=" + support + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,105 @@
|
|||
package org.gcube.portlets.user.statisticalalgorithmsimporter.server.is;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.Constants;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.descriptor.ProjectSetup;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.descriptor.ProjectSupportType;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.descriptor.SAIDescriptor;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.exception.StatAlgoImporterServiceException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class BuildSAIDescriptor {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(BuildSAIDescriptor.class);
|
||||
|
||||
public static SAIDescriptor build(String scope) throws StatAlgoImporterServiceException {
|
||||
SAIDescriptor saiDescriptor = null;
|
||||
|
||||
if (Constants.DEBUG_MODE) {
|
||||
ArrayList<ProjectSetup> availableProjectConfigurations = new ArrayList<>();
|
||||
ProjectSetup r = new ProjectSetup("R", ProjectSupportType.REdit);
|
||||
availableProjectConfigurations.add(r);
|
||||
ProjectSetup rBlackBox = new ProjectSetup("R-black box", ProjectSupportType.BlackBox);
|
||||
availableProjectConfigurations.add(rBlackBox);
|
||||
ProjectSetup java = new ProjectSetup("Java", ProjectSupportType.BlackBox);
|
||||
availableProjectConfigurations.add(java);
|
||||
ProjectSetup knimeWorkflow = new ProjectSetup("Knime Workflow",
|
||||
ProjectSupportType.BlackBox);
|
||||
availableProjectConfigurations.add(knimeWorkflow);
|
||||
ProjectSetup linuxCompiled = new ProjectSetup("Linux-compiled",
|
||||
ProjectSupportType.BlackBox);
|
||||
availableProjectConfigurations.add(linuxCompiled);
|
||||
ProjectSetup octave = new ProjectSetup("Octave", ProjectSupportType.BlackBox);
|
||||
availableProjectConfigurations.add(octave);
|
||||
ProjectSetup python = new ProjectSetup("Python", ProjectSupportType.BlackBox);
|
||||
availableProjectConfigurations.add(python);
|
||||
ProjectSetup windowsCompiled = new ProjectSetup("Windows-compiled",
|
||||
ProjectSupportType.BlackBox);
|
||||
availableProjectConfigurations.add(windowsCompiled);
|
||||
ProjectSetup preInstalled = new ProjectSetup("Pre-Installed",
|
||||
ProjectSupportType.BlackBox);
|
||||
availableProjectConfigurations.add(preInstalled);
|
||||
saiDescriptor = new SAIDescriptor(availableProjectConfigurations);
|
||||
} else {
|
||||
SAIDescriptorJAXB saiDescriptorJAXB = null;
|
||||
try {
|
||||
saiDescriptorJAXB = InformationSystemUtils.retrieveSAIDescriptor(scope);
|
||||
} catch (StatAlgoImporterServiceException e) {
|
||||
logger.info(e.getLocalizedMessage());
|
||||
}
|
||||
ArrayList<ProjectSetup> availableProjectConfigurations = new ArrayList<>();
|
||||
|
||||
logger.debug("SAIDescriptorJAXB: " + saiDescriptorJAXB);
|
||||
if (saiDescriptorJAXB != null && saiDescriptorJAXB.getAvailableprojectconfigurations() != null
|
||||
&& !saiDescriptorJAXB.getAvailableprojectconfigurations().isEmpty()) {
|
||||
|
||||
ProjectSupportType type;
|
||||
|
||||
for (AvailableProjectConfigJAXB availableProjectConfigJAXB : saiDescriptorJAXB
|
||||
.getAvailableprojectconfigurations()) {
|
||||
type = ProjectSupportType.valueOf(availableProjectConfigJAXB.getSupport());
|
||||
if (type != null) {
|
||||
availableProjectConfigurations
|
||||
.add(new ProjectSetup(availableProjectConfigJAXB.getLanguage(), type));
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logger.info("SAIDescriptorJAXB use default configuration for scope: " + scope);
|
||||
ProjectSetup r = new ProjectSetup("R", ProjectSupportType.REdit);
|
||||
availableProjectConfigurations.add(r);
|
||||
ProjectSetup rBlackBox = new ProjectSetup("R-black box", ProjectSupportType.BlackBox);
|
||||
availableProjectConfigurations.add(rBlackBox);
|
||||
ProjectSetup java = new ProjectSetup("Java", ProjectSupportType.BlackBox);
|
||||
availableProjectConfigurations.add(java);
|
||||
ProjectSetup knimeWorkflow = new ProjectSetup("Knime Workflow",
|
||||
ProjectSupportType.BlackBox);
|
||||
availableProjectConfigurations.add(knimeWorkflow);
|
||||
ProjectSetup linuxCompiled = new ProjectSetup("Linux-compiled",
|
||||
ProjectSupportType.BlackBox);
|
||||
availableProjectConfigurations.add(linuxCompiled);
|
||||
ProjectSetup octave = new ProjectSetup("Octave", ProjectSupportType.BlackBox);
|
||||
availableProjectConfigurations.add(octave);
|
||||
ProjectSetup python = new ProjectSetup("Python", ProjectSupportType.BlackBox);
|
||||
availableProjectConfigurations.add(python);
|
||||
ProjectSetup windowsCompiled = new ProjectSetup("Windows-compiled",
|
||||
ProjectSupportType.BlackBox);
|
||||
availableProjectConfigurations.add(windowsCompiled);
|
||||
|
||||
}
|
||||
saiDescriptor = new SAIDescriptor(availableProjectConfigurations);
|
||||
}
|
||||
|
||||
logger.debug("SAIDescriptor: " + saiDescriptor);
|
||||
return saiDescriptor;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
package org.gcube.portlets.user.statisticalalgorithmsimporter.server.is;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.common.resources.gcore.GenericResource;
|
||||
import org.gcube.common.resources.gcore.ScopeGroup;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.Constants;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.exception.StatAlgoImporterServiceException;
|
||||
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
||||
import org.gcube.resources.discovery.client.impl.JAXBParser;
|
||||
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
||||
import org.gcube.resources.discovery.icclient.ICFactory;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class InformationSystemUtils {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(InformationSystemUtils.class);
|
||||
|
||||
public static SAIDescriptorJAXB retrieveSAIDescriptor(String scope) throws StatAlgoImporterServiceException {
|
||||
try {
|
||||
|
||||
if (scope == null || scope.length() == 0)
|
||||
return null;
|
||||
|
||||
ScopeProvider.instance.set(scope);
|
||||
logger.debug("Retrieve SAI descriptor in scope: " + scope);
|
||||
|
||||
SimpleQuery query = ICFactory.queryFor(GenericResource.class);
|
||||
query.addCondition("$resource/Profile/SecondaryType/text() eq '" + Constants.SAI_CATEGORY + "'")
|
||||
.addCondition("$resource/Profile/Name/text() eq '" + Constants.SAI_NAME + "'")
|
||||
.setResult("$resource");
|
||||
|
||||
DiscoveryClient<GenericResource> client = ICFactory.clientFor(GenericResource.class);
|
||||
List<GenericResource> accountingResources = client.submit(query);
|
||||
logger.debug("Resources: " + accountingResources);
|
||||
|
||||
SAIDescriptorJAXB enableTabs = null;
|
||||
|
||||
for (GenericResource genericResource : accountingResources) {
|
||||
if (genericResource.scopes() != null) {
|
||||
ScopeGroup<String> scopes = genericResource.scopes();
|
||||
Iterator<String> iterator = scopes.iterator();
|
||||
String scopeFound = null;
|
||||
boolean found = false;
|
||||
while (iterator.hasNext() && !found) {
|
||||
scopeFound = iterator.next();
|
||||
if (scopeFound.compareTo(scope) == 0) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
if (found) {
|
||||
try {
|
||||
JAXBParser<SAIDescriptorJAXB> parser = new JAXBParser<SAIDescriptorJAXB>(
|
||||
SAIDescriptorJAXB.class);
|
||||
logger.debug("Body: " + genericResource.profile().bodyAsString());
|
||||
enableTabs = (SAIDescriptorJAXB) parser.parse(genericResource.profile().bodyAsString());
|
||||
logger.debug("Enable: " + enableTabs);
|
||||
} catch (Throwable e) {
|
||||
String error = "Error in discovery SAI profile generic resource on IS in scope " + scope + ". "
|
||||
+ "Resource parsing failed!";
|
||||
logger.error(error);
|
||||
logger.error(
|
||||
"Error {resource=" + genericResource + ", error=" + e.getLocalizedMessage() + "}");
|
||||
e.printStackTrace();
|
||||
throw new StatAlgoImporterServiceException(error, e);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return enableTabs;
|
||||
|
||||
} catch (StatAlgoImporterServiceException e) {
|
||||
throw e;
|
||||
} catch (Throwable e) {
|
||||
String error = "Error in discovery SAI profile generic resource on IS in scope : " + scope;
|
||||
logger.error(error);
|
||||
logger.error("Error: " + e.getLocalizedMessage(),e);
|
||||
throw new StatAlgoImporterServiceException(error, e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package org.gcube.portlets.user.statisticalalgorithmsimporter.server.is;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
@XmlRootElement(name = "saidescriptor")
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class SAIDescriptorJAXB {
|
||||
|
||||
@XmlElement(name = "availableprojectconfigurations")
|
||||
private List<AvailableProjectConfigJAXB> availableprojectconfigurations = null;
|
||||
|
||||
public List<AvailableProjectConfigJAXB> getAvailableprojectconfigurations() {
|
||||
return availableprojectconfigurations;
|
||||
}
|
||||
|
||||
public void setAvailableprojectconfigurations(List<AvailableProjectConfigJAXB> availableprojectconfigurations) {
|
||||
this.availableprojectconfigurations = availableprojectconfigurations;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SAIDescriptorJAXB [availableprojectconfigurations=" + availableprojectconfigurations + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -30,5 +30,11 @@ public class Constants {
|
|||
public static final String CURR_USER_ID = "CURR_USER_ID";
|
||||
|
||||
public static final String LOCAL_UPLOAD_SERVLET = "LocalUploadServlet";
|
||||
|
||||
// IS Resource
|
||||
public static final String SAI_NAME = "SAIProfile";
|
||||
public static final String SAI_CATEGORY = "SAI";
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
package org.gcube.portlets.user.statisticalalgorithmsimporter.shared.descriptor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ProjectSetup implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -7559226273036843188L;
|
||||
private String language;
|
||||
private ProjectSupportType projectSupportType;
|
||||
|
||||
public ProjectSetup() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ProjectSetup(String language, ProjectSupportType projectSupportType) {
|
||||
super();
|
||||
this.language = language;
|
||||
this.projectSupportType = projectSupportType;
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
public void setLanguage(String language) {
|
||||
this.language = language;
|
||||
}
|
||||
|
||||
public ProjectSupportType getProjectSupportType() {
|
||||
return projectSupportType;
|
||||
}
|
||||
|
||||
public void setProjectSupportType(ProjectSupportType projectSupportType) {
|
||||
this.projectSupportType = projectSupportType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ProjectSetup [language=" + language + ", projectSupportType=" + projectSupportType + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package org.gcube.portlets.user.statisticalalgorithmsimporter.shared.descriptor;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public enum ProjectSupportType {
|
||||
|
||||
REdit("REdit"), BlackBox("BlackBox");
|
||||
|
||||
private String id;
|
||||
|
||||
private ProjectSupportType(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public static ProjectSupportType valueFromLabel(String label) {
|
||||
for(ProjectSupportType type: values()){
|
||||
if(type.getId().compareTo(label)==0){
|
||||
return type;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static List<ProjectSupportType> asList() {
|
||||
List<ProjectSupportType> list = Arrays.asList(values());
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package org.gcube.portlets.user.statisticalalgorithmsimporter.shared.descriptor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SAIDescriptor implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 8083363401840308985L;
|
||||
private ArrayList<ProjectSetup> availableProjectConfigurations;
|
||||
|
||||
public SAIDescriptor() {
|
||||
super();
|
||||
}
|
||||
|
||||
public SAIDescriptor(ArrayList<ProjectSetup> availableProjectConfigurations) {
|
||||
super();
|
||||
this.availableProjectConfigurations = availableProjectConfigurations;
|
||||
}
|
||||
|
||||
public ArrayList<ProjectSetup> getAvailableProjectConfigurations() {
|
||||
return availableProjectConfigurations;
|
||||
}
|
||||
|
||||
public void setAvailableProjectConfigurations(ArrayList<ProjectSetup> availableProjectConfigurations) {
|
||||
this.availableProjectConfigurations = availableProjectConfigurations;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SAIDescriptor [availableProjectConfigurations=" + availableProjectConfigurations + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -10,20 +10,10 @@ import java.util.List;
|
|||
*
|
||||
*/
|
||||
public enum DataType {
|
||||
STRING("String"), INTEGER("Integer"), DOUBLE("Double"), ENUMERATED(
|
||||
"Enumerated"), FILE("File"), BOOLEAN("Boolean");
|
||||
STRING("String"), INTEGER("Integer"), DOUBLE("Double"), ENUMERATED("Enumerated"), FILE("File"), BOOLEAN("Boolean");
|
||||
|
||||
// private static InputTypeMessages
|
||||
// msgs=GWT.create(InputTypeMessages.class);
|
||||
private String id;
|
||||
|
||||
// private static List<String> inputTypeI18NList;
|
||||
|
||||
/*
|
||||
* static { inputTypeI18NList = new ArrayList<String>(); for (InputType
|
||||
* itype : values()) { inputTypeI18NList.add(msgs.inputType(itype)); } }
|
||||
*/
|
||||
|
||||
private DataType(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
@ -37,7 +27,6 @@ public enum DataType {
|
|||
}
|
||||
|
||||
public String getLabel() {
|
||||
// return msgs.inputType(this);
|
||||
return id;
|
||||
}
|
||||
|
||||
|
@ -47,15 +36,9 @@ public enum DataType {
|
|||
}
|
||||
|
||||
public static List<DataType> asListForGlobalVariables() {
|
||||
List<DataType> list = Arrays.asList(DataType.STRING, DataType.INTEGER,
|
||||
DataType.DOUBLE, DataType.FILE, DataType.BOOLEAN);
|
||||
List<DataType> list = Arrays.asList(DataType.STRING, DataType.INTEGER, DataType.DOUBLE, DataType.FILE,
|
||||
DataType.BOOLEAN);
|
||||
return list;
|
||||
}
|
||||
|
||||
/*
|
||||
* public static List<String> asI18NList() { return inputTypeI18NList;
|
||||
*
|
||||
* }
|
||||
*/
|
||||
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ public class Project implements Serializable {
|
|||
private static final long serialVersionUID = -7906477664944910362L;
|
||||
|
||||
private ProjectFolder projectFolder;
|
||||
private ProjectConfig projectConfig;
|
||||
private MainCode mainCode;
|
||||
private InputData inputData;
|
||||
private ProjectTarget projectTarget;
|
||||
|
@ -27,6 +28,14 @@ public class Project implements Serializable {
|
|||
|
||||
}
|
||||
|
||||
public ProjectConfig getProjectConfig() {
|
||||
return projectConfig;
|
||||
}
|
||||
|
||||
public void setProjectConfig(ProjectConfig projectConfig) {
|
||||
this.projectConfig = projectConfig;
|
||||
}
|
||||
|
||||
public MainCode getMainCode() {
|
||||
return mainCode;
|
||||
}
|
||||
|
@ -61,9 +70,8 @@ public class Project implements Serializable {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Project [projectFolder=" + projectFolder + ", mainCode="
|
||||
+ mainCode + ", inputData=" + inputData + ", projectTarget="
|
||||
+ projectTarget + "]";
|
||||
return "Project [projectFolder=" + projectFolder + ", projectConfig=" + projectConfig + ", mainCode=" + mainCode
|
||||
+ ", inputData=" + inputData + ", projectTarget=" + projectTarget + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
package org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ProjectConfig implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 8006265995411482998L;
|
||||
private String language;
|
||||
private ProjectSupport projectSupport;
|
||||
|
||||
public ProjectConfig() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ProjectConfig(String language, ProjectSupport projectSupport) {
|
||||
super();
|
||||
this.language = language;
|
||||
this.projectSupport = projectSupport;
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
public void setLanguage(String language) {
|
||||
this.language = language;
|
||||
}
|
||||
|
||||
public ProjectSupport getProjectSupport() {
|
||||
return projectSupport;
|
||||
}
|
||||
|
||||
public void setProjectSupport(ProjectSupport projectSupport) {
|
||||
this.projectSupport = projectSupport;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ProjectConfig [language=" + language + ", projectSupport=" + projectSupport + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.descriptor.ProjectSetup;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.workspace.ItemDescription;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ProjectCreateSession implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -6892840268452906937L;
|
||||
|
||||
private ItemDescription newProjectFolder;
|
||||
private ProjectSetup projectSetup;
|
||||
|
||||
public ProjectCreateSession() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ProjectCreateSession(ItemDescription newProjectFolder, ProjectSetup projectSetup) {
|
||||
super();
|
||||
this.newProjectFolder = newProjectFolder;
|
||||
this.projectSetup = projectSetup;
|
||||
}
|
||||
|
||||
public ItemDescription getNewProjectFolder() {
|
||||
return newProjectFolder;
|
||||
}
|
||||
|
||||
public void setNewProjectFolder(ItemDescription newProjectFolder) {
|
||||
this.newProjectFolder = newProjectFolder;
|
||||
}
|
||||
|
||||
public ProjectSetup getProjectSetup() {
|
||||
return projectSetup;
|
||||
}
|
||||
|
||||
public void setProjectSetup(ProjectSetup projectSetup) {
|
||||
this.projectSetup = projectSetup;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ProjectCreateSession [newProjectFolder=" + newProjectFolder + ", projectSetup=" + projectSetup + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
interface ProjectSupport extends Serializable {
|
||||
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project;
|
||||
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.workspace.ItemDescription;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ProjectSupportBlackBox implements ProjectSupport {
|
||||
|
||||
private static final long serialVersionUID = -5337735100116549017L;
|
||||
|
||||
private ItemDescription binaryItem;
|
||||
|
||||
public ProjectSupportBlackBox() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param binaryItem
|
||||
* Binary Item
|
||||
*/
|
||||
public ProjectSupportBlackBox(ItemDescription binaryItem) {
|
||||
super();
|
||||
this.binaryItem = binaryItem;
|
||||
|
||||
}
|
||||
|
||||
public ItemDescription getBinaryItem() {
|
||||
return binaryItem;
|
||||
}
|
||||
|
||||
public void setBinaryItem(ItemDescription binaryItem) {
|
||||
this.binaryItem = binaryItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ProjectSupportBlackBox [binaryItem=" + binaryItem + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ProjectSupportREdit implements ProjectSupport {
|
||||
|
||||
private static final long serialVersionUID = -5337735100116549017L;
|
||||
|
||||
public ProjectSupportREdit() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ProjectSupportREdit []";
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue