2015-12-04 18:45:47 +01:00
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.project ;
2017-06-07 19:46:05 +02:00
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.create.ProjectCreateWizard ;
2017-06-30 18:51:18 +02:00
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.NewCodeEvent ;
2016-01-22 16:08:06 +01:00
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.ProjectStatusEvent ;
2015-12-09 18:15:10 +01:00
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.SessionExpiredEvent ;
2017-06-07 19:46:05 +02:00
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.WorkAreaEvent ;
2017-07-17 18:39:42 +02:00
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.monitor.MonitorDeployOperation ;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.monitor.MonitorDeployOperationEvent ;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.monitor.MonitorDeployOperationEvent.MonitorDeployOperationEventHandler ;
2016-01-14 12:31:23 +01:00
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.monitor.StatAlgoImporterMonitor ;
2015-12-09 18:15:10 +01:00
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.rpc.StatAlgoImporterServiceAsync ;
2015-12-04 18:45:47 +01:00
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.type.ProjectStatusEventType ;
2015-12-09 18:15:10 +01:00
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.type.SessionExpiredType ;
2017-06-07 19:46:05 +02:00
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.type.WorkAreaEventType ;
2015-12-04 18:45:47 +01:00
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.utils.UtilsGXT3 ;
2018-10-30 20:20:11 +01:00
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.Constants ;
2017-06-06 20:15:22 +02:00
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.descriptor.SAIDescriptor ;
2015-12-09 18:15:10 +01:00
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.exception.StatAlgoImporterSessionExpiredException ;
2015-12-14 18:44:54 +01:00
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.InputData ;
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project ;
2017-06-07 19:46:05 +02:00
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.ProjectCreateSession ;
2017-06-30 18:51:18 +02:00
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.ProjectSupportBashEdit ;
2017-06-09 18:35:45 +02:00
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.ProjectSupportBlackBox ;
2015-12-11 18:02:03 +01:00
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.workspace.ItemDescription ;
2016-06-30 18:06:23 +02:00
import org.gcube.portlets.widgets.githubconnector.client.GitHubConnectorWizard ;
import org.gcube.portlets.widgets.githubconnector.client.wizard.event.WizardEvent ;
2015-12-04 18:45:47 +01:00
import org.gcube.portlets.widgets.wsexplorer.client.notification.WorkspaceExplorerSelectNotification.WorskpaceExplorerSelectNotificationListener ;
import org.gcube.portlets.widgets.wsexplorer.client.select.WorkspaceExplorerSelectDialog ;
import org.gcube.portlets.widgets.wsexplorer.shared.Item ;
import org.gcube.portlets.widgets.wsexplorer.shared.ItemType ;
import com.allen_sauer.gwt.log.client.Log ;
2016-06-30 18:06:23 +02:00
import com.google.gwt.core.shared.GWT ;
2015-12-04 18:45:47 +01:00
import com.google.gwt.event.shared.EventBus ;
2015-12-09 18:15:10 +01:00
import com.google.gwt.user.client.rpc.AsyncCallback ;
2015-12-04 18:45:47 +01:00
import com.sencha.gxt.core.client.dom.XDOM ;
2015-12-22 17:55:55 +01:00
import com.sencha.gxt.widget.core.client.box.ConfirmMessageBox ;
import com.sencha.gxt.widget.core.client.event.DialogHideEvent ;
import com.sencha.gxt.widget.core.client.event.DialogHideEvent.DialogHideHandler ;
2015-12-04 18:45:47 +01:00
/ * *
*
2017-05-12 18:26:05 +02:00
* @author Giancarlo Panichi
*
2015-12-04 18:45:47 +01:00
*
* /
public class ProjectManager {
private EventBus eventBus ;
2015-12-14 18:44:54 +01:00
private Project project ;
2017-06-06 20:15:22 +02:00
private SAIDescriptor saiDescriptor ;
2015-12-22 12:04:49 +01:00
2015-12-09 18:15:10 +01:00
public ProjectManager ( EventBus eventBus ) {
this . eventBus = eventBus ;
2017-06-07 19:46:05 +02:00
// bind();
2015-12-04 18:45:47 +01:00
}
2015-12-09 18:15:10 +01:00
2017-06-07 19:46:05 +02:00
public void bind ( ) {
eventBus . addHandler ( ProjectStatusEvent . TYPE , new ProjectStatusEvent . ProjectStatusEventHandler ( ) {
@Override
public void onProjectStatus ( ProjectStatusEvent event ) {
Log . debug ( " Project Manager catch ProjectStatusEvent: " + event ) ;
// doProjectStatusManage(event);
}
} ) ;
2017-06-06 20:15:22 +02:00
}
2015-12-09 18:15:10 +01:00
2017-06-06 20:15:22 +02:00
public void createProject ( ) {
2015-12-04 18:45:47 +01:00
2017-06-07 19:46:05 +02:00
// Example
WizardEvent . WizardEventHandler handler = new WizardEvent . WizardEventHandler ( ) {
2015-12-04 18:45:47 +01:00
@Override
2017-06-07 19:46:05 +02:00
public void onResponse ( WizardEvent event ) {
if ( event = = null | | event . getWizardEventType ( ) = = null ) {
GWT . log ( " ProjectCreateWizard Response: null " ) ;
return ;
2015-12-14 18:44:54 +01:00
} else {
2017-06-07 19:46:05 +02:00
GWT . log ( " ProjectCreateWizard Response: " + event . getWizardEventType ( ) ) ;
switch ( event . getWizardEventType ( ) ) {
2015-12-14 18:44:54 +01:00
2017-06-07 19:46:05 +02:00
case Completed :
2015-12-14 18:44:54 +01:00
2017-06-07 19:46:05 +02:00
ProjectCreateWizard wizard = ( ProjectCreateWizard ) event . getSource ( ) ;
ProjectCreateSession projectCreateSession = wizard . getProjectCreateSession ( ) ;
createProjectOnServer ( projectCreateSession ) ;
2015-12-14 18:44:54 +01:00
2017-06-07 19:46:05 +02:00
break ;
case Background :
case Aborted :
case Failed :
break ;
default :
break ;
2015-12-14 18:44:54 +01:00
2017-06-07 19:46:05 +02:00
}
}
2015-12-14 18:44:54 +01:00
}
2017-06-07 19:46:05 +02:00
2015-12-14 18:44:54 +01:00
} ;
2018-10-30 20:20:11 +01:00
if ( Constants . DEBUG_MODE ) {
project = Constants . TEST_PROJECT ;
fireWorkAreaSetupEvent ( ) ;
} else {
final ProjectCreateWizard wizard = new ProjectCreateWizard ( ) ;
wizard . addWizardEventHandler ( handler ) ;
wizard . setZIndex ( XDOM . getTopZIndex ( ) ) ;
wizard . show ( ) ;
}
2017-06-07 19:46:05 +02:00
}
2015-12-14 18:44:54 +01:00
public void openProject ( ) {
2017-06-06 20:15:22 +02:00
WorkspaceExplorerSelectDialog wselectDialog = new WorkspaceExplorerSelectDialog ( " Select Project Folder " , true ) ;
2015-12-14 18:44:54 +01:00
WorskpaceExplorerSelectNotificationListener handler = new WorskpaceExplorerSelectNotificationListener ( ) {
@Override
public void onSelectedItem ( Item item ) {
2018-10-30 20:20:11 +01:00
if ( item . getType ( ) = = ItemType . FOLDER | | item . getType ( ) = = ItemType . PRIVATE_FOLDER
| | item . getType ( ) = = ItemType . SHARED_FOLDER | | item . getType ( ) = = ItemType . VRE_FOLDER ) {
2015-12-14 18:44:54 +01:00
openProjectOnServer ( item ) ;
2015-12-04 18:45:47 +01:00
} else {
2017-06-06 20:15:22 +02:00
UtilsGXT3 . info ( " Attention " , " Select a valid project folder! " ) ;
2015-12-04 18:45:47 +01:00
}
}
@Override
public void onFailed ( Throwable throwable ) {
2017-06-06 20:15:22 +02:00
Log . error ( " Error in create project: " + throwable . getLocalizedMessage ( ) ) ;
2015-12-11 18:02:03 +01:00
UtilsGXT3 . alert ( " Error " , throwable . getLocalizedMessage ( ) ) ;
2015-12-04 18:45:47 +01:00
throwable . printStackTrace ( ) ;
}
@Override
public void onAborted ( ) {
}
@Override
public void onNotValidSelection ( ) {
UtilsGXT3 . info ( " Attention " , " Select a valid project folder! " ) ;
}
} ;
wselectDialog . addWorkspaceExplorerSelectNotificationListener ( handler ) ;
2015-12-09 18:15:10 +01:00
wselectDialog . setZIndex ( XDOM . getTopZIndex ( ) ) ;
2015-12-04 18:45:47 +01:00
wselectDialog . show ( ) ;
2015-12-22 12:04:49 +01:00
2015-12-04 18:45:47 +01:00
}
2015-12-09 18:15:10 +01:00
2016-06-30 18:06:23 +02:00
public void addGitHubProject ( ) {
if ( project ! = null ) {
2017-06-06 20:15:22 +02:00
if ( project . getProjectFolder ( ) ! = null & & project . getProjectFolder ( ) . getFolder ( ) ! = null ) {
2016-06-30 18:06:23 +02:00
WizardEvent . WizardEventHandler handler = new WizardEvent . WizardEventHandler ( ) {
@Override
public void onResponse ( WizardEvent event ) {
2017-06-06 20:15:22 +02:00
GWT . log ( " Wizard Response: " + event . getWizardEventType ( ) ) ;
2016-06-30 18:06:23 +02:00
if ( event . getWizardEventType ( ) = = null ) {
fireProjectStatusAddResourceEvent ( ) ;
return ;
}
switch ( event . getWizardEventType ( ) ) {
case Aborted :
case Background :
case Completed :
case Failed :
default :
fireProjectStatusAddResourceEvent ( ) ;
}
}
} ;
GitHubConnectorWizard wizard = new GitHubConnectorWizard (
project . getProjectFolder ( ) . getFolder ( ) . getId ( ) ) ;
wizard . addWizardEventHandler ( handler ) ;
wizard . setZIndex ( XDOM . getTopZIndex ( ) ) ;
wizard . show ( ) ;
} else {
2017-06-06 20:15:22 +02:00
Log . error ( " Invalid ProjectFolder: " + project . getProjectFolder ( ) ) ;
2016-06-30 18:06:23 +02:00
UtilsGXT3 . alert ( " Error " , " Error retrieving project folder! " ) ;
}
} else {
Log . error ( " Invalid Project: " + project ) ;
UtilsGXT3 . alert ( " Error " , " Error retrieving project: " + project ) ;
}
}
2015-12-11 18:02:03 +01:00
public void addResource ( ) {
2019-02-26 17:07:56 +01:00
/ *
* List < ItemType > selectableTypes = new ArrayList < ItemType > ( ) ;
* selectableTypes . add ( ItemType . EXTERNAL_FILE ) ;
*
* List < ItemType > showableTypes = new ArrayList < ItemType > ( ) ;
* showableTypes . addAll ( Arrays . asList ( ItemType . values ( ) ) ) ;
* /
2018-10-30 20:20:11 +01:00
2019-02-26 17:07:56 +01:00
WorkspaceExplorerSelectDialog wselectDialog = new WorkspaceExplorerSelectDialog ( " Select a file resource " , false ) ;
2015-12-11 18:02:03 +01:00
WorskpaceExplorerSelectNotificationListener handler = new WorskpaceExplorerSelectNotificationListener ( ) {
@Override
public void onSelectedItem ( Item item ) {
2019-02-26 17:07:56 +01:00
if ( item = = null | | item . getType ( ) = = ItemType . FOLDER | | item . getType ( ) = = ItemType . PRIVATE_FOLDER
| | item . getType ( ) = = ItemType . SHARED_FOLDER | | item . getType ( ) = = ItemType . VRE_FOLDER ) {
UtilsGXT3 . info ( " Attention " , " Select a valid file resource! " ) ;
} else {
2015-12-11 18:02:03 +01:00
String filename = item . getName ( ) ;
if ( filename ! = null & & ! filename . isEmpty ( ) ) {
addResourceToProject ( item ) ;
} else {
2019-02-26 17:07:56 +01:00
UtilsGXT3 . info ( " Attention " , " Select a valid file resource! " ) ;
2015-12-11 18:02:03 +01:00
}
}
}
@Override
public void onFailed ( Throwable throwable ) {
2017-06-06 20:15:22 +02:00
Log . error ( " Error in add resource: " + throwable . getLocalizedMessage ( ) ) ;
2015-12-11 18:02:03 +01:00
UtilsGXT3 . alert ( " Error " , throwable . getLocalizedMessage ( ) ) ;
throwable . printStackTrace ( ) ;
}
@Override
public void onAborted ( ) {
}
@Override
public void onNotValidSelection ( ) {
UtilsGXT3 . info ( " Attention " , " Select a valid resource! " ) ;
}
} ;
wselectDialog . addWorkspaceExplorerSelectNotificationListener ( handler ) ;
wselectDialog . setZIndex ( XDOM . getTopZIndex ( ) ) ;
wselectDialog . show ( ) ;
}
2016-01-25 17:21:48 +01:00
private void addResourceToProject ( Item item ) {
2016-02-01 16:08:07 +01:00
final StatAlgoImporterMonitor monitor = new StatAlgoImporterMonitor ( ) ;
2015-12-11 18:02:03 +01:00
Log . debug ( " Add Resource To Project Item selected: " + item ) ;
2017-06-06 20:15:22 +02:00
ItemDescription itemDescription = new ItemDescription ( item . getId ( ) , item . getName ( ) , item . getOwner ( ) ,
item . getPath ( ) , item . getType ( ) . name ( ) ) ;
StatAlgoImporterServiceAsync . INSTANCE . addResourceToProject ( itemDescription , new AsyncCallback < Void > ( ) {
2015-12-11 18:02:03 +01:00
2017-06-06 20:15:22 +02:00
@Override
public void onSuccess ( Void result ) {
monitor . hide ( ) ;
fireProjectStatusAddResourceEvent ( ) ;
}
2015-12-11 18:02:03 +01:00
2017-06-06 20:15:22 +02:00
@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 ( ) ;
2015-12-11 18:02:03 +01:00
2017-06-06 20:15:22 +02:00
}
} ) ;
2015-12-11 18:02:03 +01:00
}
2017-06-07 19:46:05 +02:00
private void createProjectOnServer ( final ProjectCreateSession projectCreateSession ) {
2016-02-01 16:08:07 +01:00
final StatAlgoImporterMonitor monitor = new StatAlgoImporterMonitor ( ) ;
2017-06-07 19:46:05 +02:00
Log . debug ( " Create Project: " + projectCreateSession ) ;
StatAlgoImporterServiceAsync . INSTANCE . createProjectOnWorkspace ( projectCreateSession ,
new AsyncCallback < Project > ( ) {
2015-12-09 18:15:10 +01:00
2017-06-07 19:46:05 +02:00
@Override
public void onSuccess ( Project p ) {
monitor . hide ( ) ;
project = p ;
fireWorkAreaSetupEvent ( ) ;
2015-12-09 18:15:10 +01:00
2017-06-07 19:46:05 +02:00
}
2015-12-11 18:02:03 +01:00
2017-06-07 19:46:05 +02:00
@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 ( ) ;
}
} ) ;
2015-12-11 18:02:03 +01:00
}
2015-12-22 12:04:49 +01:00
2017-06-07 19:46:05 +02:00
private void openProjectOnServer ( Item item ) {
2016-02-01 16:08:07 +01:00
final StatAlgoImporterMonitor monitor = new StatAlgoImporterMonitor ( ) ;
2015-12-14 18:44:54 +01:00
Log . debug ( " Open Project Item selected: " + item ) ;
2017-06-06 20:15:22 +02:00
final ItemDescription newProjectFolder = new ItemDescription ( item . getId ( ) , item . getName ( ) , item . getOwner ( ) ,
item . getPath ( ) , item . getType ( ) . name ( ) ) ;
StatAlgoImporterServiceAsync . INSTANCE . openProjectOnWorkspace ( newProjectFolder , new AsyncCallback < Project > ( ) {
2015-12-11 18:02:03 +01:00
2017-06-06 20:15:22 +02:00
@Override
public void onSuccess ( Project projectOpened ) {
Log . debug ( " Open: " + projectOpened ) ;
monitor . hide ( ) ;
project = projectOpened ;
2017-06-07 19:46:05 +02:00
fireWorkAreaSetupEvent ( ) ;
2015-12-11 18:02:03 +01:00
2017-06-06 20:15:22 +02:00
}
2015-12-14 18:44:54 +01:00
2017-06-06 20:15:22 +02:00
@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 ( ) ;
2015-12-14 18:44:54 +01:00
2017-06-06 20:15:22 +02:00
}
} ) ;
2015-12-14 18:44:54 +01:00
}
2017-06-06 20:15:22 +02:00
public void saveProject ( InputData inputData , final StatAlgoImporterMonitor monitor ) {
2015-12-14 18:44:54 +01:00
Log . debug ( " Save Project: " + inputData ) ;
2017-06-06 20:15:22 +02:00
StatAlgoImporterServiceAsync . INSTANCE . saveProject ( inputData , new AsyncCallback < Void > ( ) {
2015-12-11 18:02:03 +01:00
2017-06-06 20:15:22 +02:00
@Override
public void onSuccess ( Void result ) {
monitor . hide ( ) ;
UtilsGXT3 . info ( " Save " , " Project saved! " ) ;
fireProjectStatusExplorerRefreshEvent ( ) ;
}
2015-12-11 18:02:03 +01:00
2017-06-06 20:15:22 +02:00
@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 ( ) ;
2016-01-18 12:59:57 +01:00
2017-06-06 20:15:22 +02:00
}
} ) ;
2015-12-09 18:15:10 +01:00
}
2017-06-06 20:15:22 +02:00
public void softwareCreate ( final InputData inputData , final StatAlgoImporterMonitor monitor ) {
2019-01-17 15:15:09 +01:00
Log . debug ( " SoftwareCreate On Server " ) ;
2017-06-12 18:21:54 +02:00
StatAlgoImporterServiceAsync . INSTANCE . createSoftware ( inputData , new AsyncCallback < Project > ( ) {
2016-01-12 17:21:22 +01:00
2017-06-06 20:15:22 +02:00
@Override
2017-06-12 18:21:54 +02:00
public void onSuccess ( Project p ) {
2017-12-11 19:24:42 +01:00
Log . info ( " Software Created! " ) ;
2017-06-30 18:51:18 +02:00
project = p ;
2017-12-11 19:24:42 +01:00
softwarePublish ( monitor ) ;
2018-10-30 20:20:11 +01:00
2017-06-06 20:15:22 +02:00
}
2016-01-12 17:21:22 +01:00
2017-06-06 20:15:22 +02:00
@Override
public void onFailure ( Throwable caught ) {
monitor . hide ( ) ;
if ( caught instanceof StatAlgoImporterSessionExpiredException ) {
2019-01-17 15:15:09 +01:00
Log . error ( " Session Expired " ) ;
2017-06-06 20:15:22 +02:00
eventBus . fireEvent ( new SessionExpiredEvent ( SessionExpiredType . EXPIREDONSERVER ) ) ;
} else {
2019-02-26 17:07:56 +01:00
Log . error ( " Error in create software: " + caught . getLocalizedMessage ( ) , caught ) ;
2017-06-06 20:15:22 +02:00
UtilsGXT3 . alert ( " Error " , caught . getLocalizedMessage ( ) ) ;
fireProjectStatusExplorerRefreshEvent ( ) ;
}
2016-01-12 17:21:22 +01:00
2017-06-06 20:15:22 +02:00
}
} ) ;
2016-01-12 17:21:22 +01:00
}
2017-06-19 19:18:14 +02:00
public void setMainCode ( final InputData inputData , final ItemDescription itemDescription ) {
2016-01-12 17:21:22 +01:00
if ( project ! = null ) {
2017-06-06 20:15:22 +02:00
if ( project . getMainCode ( ) ! = null & & project . getMainCode ( ) . getItemDescription ( ) ! = null ) {
2016-01-12 17:21:22 +01:00
final ConfirmMessageBox mb = new ConfirmMessageBox ( " Attention " ,
" All previous configurations will be lost. Would you like to change main code? " ) ;
mb . addDialogHideHandler ( new DialogHideHandler ( ) {
@Override
public void onDialogHide ( DialogHideEvent event ) {
switch ( event . getHideButton ( ) ) {
case NO :
2017-06-19 19:18:14 +02:00
mb . hide ( ) ;
2016-01-12 17:21:22 +01:00
break ;
case YES :
2017-06-19 19:18:14 +02:00
mb . hide ( ) ;
2017-06-30 18:51:18 +02:00
saveInputDataForMainSet ( inputData , itemDescription ) ;
2016-01-12 17:21:22 +01:00
break ;
default :
2017-06-30 18:51:18 +02:00
2016-01-12 17:21:22 +01:00
break ;
}
2015-12-22 17:55:55 +01:00
}
2016-01-12 17:21:22 +01:00
} ) ;
mb . setWidth ( 300 ) ;
mb . show ( ) ;
} else {
2017-06-19 19:18:14 +02:00
saveInputDataForMainSet ( inputData , itemDescription ) ;
2016-01-12 17:21:22 +01:00
}
} else {
2017-06-30 18:51:18 +02:00
2015-12-22 17:55:55 +01:00
}
2016-01-12 17:21:22 +01:00
}
2017-06-30 18:51:18 +02:00
private void saveInputDataForMainSet ( final InputData inputData , final ItemDescription itemDescription ) {
2018-10-30 20:20:11 +01:00
final StatAlgoImporterMonitor monitor = new StatAlgoImporterMonitor ( ) ;
2017-06-19 19:18:14 +02:00
StatAlgoImporterServiceAsync . INSTANCE . saveProject ( inputData , new AsyncCallback < Void > ( ) {
@Override
public void onSuccess ( Void result ) {
2017-07-19 20:40:18 +02:00
setMainCodeOnServer ( itemDescription , monitor ) ;
2017-06-19 19:18:14 +02:00
/ *
2017-06-30 18:51:18 +02:00
* UtilsGXT3 . info ( " Save " , " Project saved! " ) ;
* fireProjectStatusExplorerRefreshEvent ( ) ;
* /
2017-06-19 19:18:14 +02:00
}
@Override
public void onFailure ( Throwable caught ) {
2017-07-19 20:40:18 +02:00
monitor . hide ( ) ;
2017-06-19 19:18:14 +02:00
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 ( ) ;
}
} ) ;
}
2016-01-12 17:21:22 +01:00
2018-10-30 20:20:11 +01:00
private void setMainCodeOnServer ( final ItemDescription itemDescription , final StatAlgoImporterMonitor monitor ) {
2016-01-12 17:21:22 +01:00
2015-12-11 18:02:03 +01:00
Log . debug ( " Set Main Code: " + itemDescription ) ;
2017-06-06 20:15:22 +02:00
StatAlgoImporterServiceAsync . INSTANCE . setMainCode ( itemDescription , new AsyncCallback < Project > ( ) {
2015-12-09 18:15:10 +01:00
2017-06-06 20:15:22 +02:00
@Override
public void onFailure ( Throwable caught ) {
2017-07-19 20:40:18 +02:00
monitor . hide ( ) ;
2017-06-06 20:15:22 +02:00
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 ( ) ;
2015-12-09 18:15:10 +01:00
2017-06-06 20:15:22 +02:00
}
2015-12-09 18:15:10 +01:00
2017-06-06 20:15:22 +02:00
@Override
public void onSuccess ( Project result ) {
2017-07-19 20:40:18 +02:00
monitor . hide ( ) ;
2017-06-06 20:15:22 +02:00
project = result ;
fireProjectStatusMainCodeSetEvent ( ) ;
}
} ) ;
2015-12-09 18:15:10 +01:00
}
2016-01-18 17:28:55 +01:00
2017-12-18 13:01:19 +01:00
public void setNewCode ( InputData inputData , NewCodeEvent newCodeEvent , final StatAlgoImporterMonitor monitor ) {
StatAlgoImporterServiceAsync . INSTANCE . setNewCode ( inputData , newCodeEvent . getFile ( ) , newCodeEvent . getCode ( ) ,
2016-02-01 19:07:11 +01:00
new AsyncCallback < Project > ( ) {
2016-01-18 12:59:57 +01:00
@Override
public void onFailure ( Throwable caught ) {
monitor . hide ( ) ;
if ( caught instanceof StatAlgoImporterSessionExpiredException ) {
2017-06-06 20:15:22 +02:00
eventBus . fireEvent ( new SessionExpiredEvent ( SessionExpiredType . EXPIREDONSERVER ) ) ;
2016-01-18 12:59:57 +01:00
} else {
2017-07-07 20:43:12 +02:00
Log . error ( " Error on save new code: " + caught . getLocalizedMessage ( ) ) ;
2017-06-06 20:15:22 +02:00
UtilsGXT3 . alert ( " Error " , caught . getLocalizedMessage ( ) ) ;
2016-01-18 12:59:57 +01:00
}
caught . printStackTrace ( ) ;
2015-12-09 18:15:10 +01:00
2016-01-18 12:59:57 +01:00
}
@Override
2016-02-01 19:07:11 +01:00
public void onSuccess ( Project result ) {
2016-06-30 18:06:23 +02:00
project = result ;
2016-01-18 12:59:57 +01:00
fireProjectStatusMainCodeSetEvent ( ) ;
monitor . hide ( ) ;
}
} ) ;
}
2016-01-18 17:28:55 +01:00
2017-07-17 18:39:42 +02:00
public void setBinaryCode ( final InputData inputData , final ItemDescription itemDescription ) {
2017-06-09 18:35:45 +02:00
if ( project ! = null ) {
if ( project . getProjectConfig ( ) ! = null & & project . getProjectConfig ( ) . getProjectSupport ( ) ! = null
2017-06-30 18:51:18 +02:00
& & ( project . getProjectConfig ( ) . getProjectSupport ( ) instanceof ProjectSupportBlackBox
2017-07-17 18:39:42 +02:00
| | project . getProjectConfig ( ) . getProjectSupport ( ) instanceof ProjectSupportBashEdit ) ) {
saveInputDataForBinarySet ( inputData , itemDescription ) ;
2017-06-09 18:35:45 +02:00
}
} else {
}
}
2017-06-30 18:51:18 +02:00
private void saveInputDataForBinarySet ( final InputData inputData , final ItemDescription itemDescription ) {
2018-10-30 20:20:11 +01:00
final StatAlgoImporterMonitor monitor = new StatAlgoImporterMonitor ( ) ;
2017-06-19 19:18:14 +02:00
StatAlgoImporterServiceAsync . INSTANCE . saveProject ( inputData , new AsyncCallback < Void > ( ) {
@Override
public void onSuccess ( Void result ) {
2018-10-30 20:20:11 +01:00
setBinaryCodeOnServer ( itemDescription , monitor ) ;
2017-06-19 19:18:14 +02:00
}
@Override
public void onFailure ( Throwable caught ) {
2017-07-19 20:40:18 +02:00
monitor . hide ( ) ;
2017-06-19 19:18:14 +02:00
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 ( ) ;
}
} ) ;
}
2017-06-09 18:35:45 +02:00
2017-07-19 20:40:18 +02:00
private void setBinaryCodeOnServer ( final ItemDescription itemDescription , final StatAlgoImporterMonitor monitor ) {
2017-06-09 18:35:45 +02:00
Log . debug ( " Set Binary Code: " + itemDescription ) ;
StatAlgoImporterServiceAsync . INSTANCE . setBinaryCode ( itemDescription , new AsyncCallback < Project > ( ) {
@Override
public void onFailure ( Throwable caught ) {
2017-07-19 20:40:18 +02:00
monitor . hide ( ) ;
2017-06-09 18:35:45 +02:00
if ( caught instanceof StatAlgoImporterSessionExpiredException ) {
eventBus . fireEvent ( new SessionExpiredEvent ( SessionExpiredType . EXPIREDONSERVER ) ) ;
} else {
Log . error ( " Error setting code: " + caught . getLocalizedMessage ( ) ) ;
UtilsGXT3 . alert ( " Error " , caught . getLocalizedMessage ( ) ) ;
}
caught . printStackTrace ( ) ;
}
@Override
public void onSuccess ( Project result ) {
2017-07-19 20:40:18 +02:00
monitor . hide ( ) ;
2017-06-09 18:35:45 +02:00
project = result ;
fireProjectStatusBinaryCodeSetEvent ( ) ;
}
} ) ;
}
2016-01-22 13:07:41 +01:00
public void deleteItem ( final ItemDescription itemDescription ) {
2017-06-06 20:15:22 +02:00
if ( project ! = null & & project . getMainCode ( ) ! = null & & project . getMainCode ( ) . getItemDescription ( ) ! = null
& & itemDescription . getId ( ) . compareTo ( project . getMainCode ( ) . getItemDescription ( ) . getId ( ) ) = = 0 ) {
2016-01-22 16:08:06 +01:00
final ConfirmMessageBox mb = new ConfirmMessageBox ( " Delete " ,
2016-01-22 13:07:41 +01:00
" All previous configurations will be lost. Would you like to delete main code? " ) ;
mb . addDialogHideHandler ( new DialogHideHandler ( ) {
@Override
public void onDialogHide ( DialogHideEvent event ) {
switch ( event . getHideButton ( ) ) {
case NO :
break ;
case YES :
2016-01-22 16:08:06 +01:00
deleteItemOnServer ( itemDescription , true ) ;
2016-01-22 13:07:41 +01:00
break ;
default :
break ;
}
}
} ) ;
mb . setWidth ( 300 ) ;
mb . show ( ) ;
2016-01-22 16:08:06 +01:00
2016-01-22 13:07:41 +01:00
} else {
2017-06-06 20:15:22 +02:00
final ConfirmMessageBox mb = new ConfirmMessageBox ( " Delete " , " Would you like to delete this resource? " ) ;
2016-01-22 16:08:06 +01:00
mb . addDialogHideHandler ( new DialogHideHandler ( ) {
2018-10-30 20:20:11 +01:00
@Override
public void onDialogHide ( DialogHideEvent event ) {
switch ( event . getHideButton ( ) ) {
case NO :
break ;
case YES :
deleteItemOnServer ( itemDescription , false ) ;
break ;
default :
break ;
}
2016-01-22 16:08:06 +01:00
2018-10-30 20:20:11 +01:00
}
2016-01-22 16:08:06 +01:00
2018-10-30 20:20:11 +01:00
} ) ;
mb . setWidth ( 300 ) ;
mb . show ( ) ;
2017-07-17 18:39:42 +02:00
2018-10-30 20:20:11 +01:00
}
2016-01-22 16:08:06 +01:00
2016-01-22 13:07:41 +01:00
}
2016-01-22 16:08:06 +01:00
2017-06-06 20:15:22 +02:00
private void deleteItemOnServer ( ItemDescription itemDescription , final boolean mainCode ) {
2016-01-22 16:08:06 +01:00
final StatAlgoImporterMonitor monitor = new StatAlgoImporterMonitor ( ) ;
2016-01-22 13:07:41 +01:00
2017-06-06 20:15:22 +02:00
StatAlgoImporterServiceAsync . INSTANCE . deleteResourceOnProject ( itemDescription , new AsyncCallback < Project > ( ) {
2016-01-18 12:59:57 +01:00
2017-06-06 20:15:22 +02:00
@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 ( ) ;
}
2016-01-18 12:59:57 +01:00
2017-06-06 20:15:22 +02:00
@Override
public void onSuccess ( Project result ) {
monitor . hide ( ) ;
project = result ;
if ( mainCode ) {
fireProjectStatusDeleteMainCodeEvent ( ) ;
} else {
fireProjectStatusDeleteEvent ( ) ;
}
}
} ) ;
2016-01-18 12:59:57 +01:00
}
2016-02-01 16:08:07 +01:00
2016-01-26 16:31:34 +01:00
public void softwareRepackage ( ) {
if ( project ! = null ) {
2017-06-06 20:15:22 +02:00
final ConfirmMessageBox mb = new ConfirmMessageBox ( " Attention " ,
2016-01-26 16:31:34 +01:00
" 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 ( ) {
@Override
public void onDialogHide ( DialogHideEvent event ) {
switch ( event . getHideButton ( ) ) {
case NO :
break ;
case YES :
softwareRepackageOnServer ( ) ;
break ;
default :
break ;
}
}
} ) ;
mb . setWidth ( 300 ) ;
mb . show ( ) ;
} else {
Log . error ( " Project not open: " + project ) ;
UtilsGXT3 . alert ( " Error " , " Project not open! " ) ;
}
}
2016-02-01 16:08:07 +01:00
2016-01-26 16:31:34 +01:00
private void softwareRepackageOnServer ( ) {
2018-12-14 18:00:41 +01:00
Log . info ( " Software Repackage On Server " ) ;
2016-01-26 16:31:34 +01:00
final StatAlgoImporterMonitor monitor = new StatAlgoImporterMonitor ( ) ;
2017-06-06 20:15:22 +02:00
StatAlgoImporterServiceAsync . INSTANCE . repackageSoftware ( new AsyncCallback < Void > ( ) {
2016-01-26 16:31:34 +01:00
2017-06-06 20:15:22 +02:00
public void onFailure ( Throwable caught ) {
monitor . hide ( ) ;
if ( caught instanceof StatAlgoImporterSessionExpiredException ) {
eventBus . fireEvent ( new SessionExpiredEvent ( SessionExpiredType . EXPIREDONSERVER ) ) ;
} else {
UtilsGXT3 . alert ( " Error " , caught . getLocalizedMessage ( ) ) ;
fireProjectStatusExplorerRefreshEvent ( ) ;
}
}
2016-01-26 16:31:34 +01:00
2017-06-06 20:15:22 +02:00
public void onSuccess ( Void result ) {
monitor . hide ( ) ;
UtilsGXT3 . info ( " Repackage " , " The script has been repackaged! " ) ;
fireProjectStatusSoftwareRepackageEvent ( ) ;
}
2016-01-26 16:31:34 +01:00
2017-06-06 20:15:22 +02:00
} ) ;
2016-01-26 16:31:34 +01:00
}
2016-01-18 12:59:57 +01:00
2017-12-11 19:24:42 +01:00
private void softwarePublish ( final StatAlgoImporterMonitor monitor ) {
2019-01-17 15:15:09 +01:00
Log . debug ( " SoftwarePublish invocation " ) ;
2016-01-18 17:28:55 +01:00
if ( project ! = null ) {
2018-10-30 20:20:11 +01:00
softwarePublishOnServer ( monitor ) ;
2016-01-18 17:28:55 +01:00
} else {
2017-12-11 19:24:42 +01:00
monitor . hide ( ) ;
2016-01-22 13:07:41 +01:00
Log . error ( " Project not open: " + project ) ;
UtilsGXT3 . alert ( " Error " , " Project not open! " ) ;
2016-01-18 17:28:55 +01:00
}
}
2017-07-17 18:39:42 +02:00
// TODO
2017-12-11 19:24:42 +01:00
private void softwarePublishOnServer ( final StatAlgoImporterMonitor monitor ) {
2019-01-17 15:15:09 +01:00
Log . info ( " SoftwarePublish On Server " ) ;
2017-07-17 18:39:42 +02:00
StatAlgoImporterServiceAsync . INSTANCE . publishSoftware ( new AsyncCallback < String > ( ) {
2016-01-18 17:28:55 +01:00
2017-06-06 20:15:22 +02:00
public void onFailure ( Throwable caught ) {
monitor . hide ( ) ;
if ( caught instanceof StatAlgoImporterSessionExpiredException ) {
eventBus . fireEvent ( new SessionExpiredEvent ( SessionExpiredType . EXPIREDONSERVER ) ) ;
} else {
UtilsGXT3 . alert ( " Error " , caught . getLocalizedMessage ( ) ) ;
fireProjectStatusExplorerRefreshEvent ( ) ;
2016-01-18 17:28:55 +01:00
2017-06-06 20:15:22 +02:00
}
}
2016-01-18 17:28:55 +01:00
2017-07-17 18:39:42 +02:00
public void onSuccess ( String operationId ) {
Log . debug ( " Publish result: " + operationId ) ;
if ( saiDescriptor ! = null & & saiDescriptor . getPoolManagerConfig ( ) ! = null
& & saiDescriptor . getPoolManagerConfig ( ) . isEnable ( ) ) {
if ( operationId ! = null & & ! operationId . isEmpty ( ) ) {
monitorOperationDeployStatus ( operationId , monitor ) ;
} else {
monitor . hide ( ) ;
Log . info (
" Publish, the software has been published, but no autodeploy on server is enable so some time is required for installation by administrators! " ) ;
2018-10-30 20:20:11 +01:00
UtilsGXT3 . info ( " Publish " ,
" The software has been published! The Cloud system is being updated. Your process will be available on the DataMiner system within some minutes by administrators. " ) ;
2017-07-17 18:39:42 +02:00
fireProjectStatusSoftwarePublishEvent ( ) ;
}
} else {
monitor . hide ( ) ;
2018-10-30 20:20:11 +01:00
UtilsGXT3 . info ( " Publish " ,
" The software has been published! The Cloud system is being updated. Your process will be available on the DataMiner system within some minutes by administrators. " ) ;
2017-07-17 18:39:42 +02:00
fireProjectStatusSoftwarePublishEvent ( ) ;
}
}
} ) ;
}
// TODO
private void monitorOperationDeployStatus ( final String operationId , final StatAlgoImporterMonitor monitor ) {
final MonitorDeployOperation monitorDeployOperation = new MonitorDeployOperation ( ) ;
MonitorDeployOperationEventHandler handler = new MonitorDeployOperationEventHandler ( ) {
@Override
public void onMonitor ( MonitorDeployOperationEvent event ) {
2018-10-30 20:20:11 +01:00
StatAlgoImporterServiceAsync . INSTANCE . getDeployOperationStatus ( operationId ,
new AsyncCallback < String > ( ) {
public void onFailure ( Throwable caught ) {
monitorDeployOperation . stop ( ) ;
monitor . hide ( ) ;
if ( caught instanceof StatAlgoImporterSessionExpiredException ) {
eventBus . fireEvent ( new SessionExpiredEvent ( SessionExpiredType . EXPIREDONSERVER ) ) ;
} else {
UtilsGXT3 . alert ( " Error " , caught . getLocalizedMessage ( ) ) ;
fireProjectStatusExplorerRefreshEvent ( ) ;
}
}
public void onSuccess ( String deployOperationStatus ) {
Log . debug ( " Deploy Operation Status: " + deployOperationStatus ) ;
if ( deployOperationStatus = = null ) {
monitorDeployOperation . repeat ( ) ;
}
switch ( deployOperationStatus ) {
case " COMPLETED " :
monitorDeployOperation . stop ( ) ;
monitor . hide ( ) ;
UtilsGXT3 . info ( " Publish " ,
" The software has been published! The Cloud system is being updated. Your process will be available on the DataMiner system within some minutes. " ) ;
fireProjectStatusSoftwarePublishEvent ( ) ;
break ;
case " FAILED " :
monitorDeployOperation . stop ( ) ;
retrieveOperationDeployLogs ( operationId , monitor ) ;
break ;
case " IN PROGRESS " :
monitorDeployOperation . repeat ( ) ;
break ;
default :
monitorDeployOperation . repeat ( ) ;
break ;
}
}
} ) ;
2017-07-17 18:39:42 +02:00
}
} ;
monitorDeployOperation . addHandler ( handler ) ;
monitorDeployOperation . start ( ) ;
}
2018-10-30 20:20:11 +01:00
2017-07-17 18:39:42 +02:00
private void retrieveOperationDeployLogs ( final String operationId , final StatAlgoImporterMonitor monitor ) {
StatAlgoImporterServiceAsync . INSTANCE . getDeployOperationLogs ( operationId , new AsyncCallback < String > ( ) {
public void onFailure ( Throwable caught ) {
2018-10-30 20:20:11 +01:00
2017-06-06 20:15:22 +02:00
monitor . hide ( ) ;
2017-07-17 18:39:42 +02:00
if ( caught instanceof StatAlgoImporterSessionExpiredException ) {
eventBus . fireEvent ( new SessionExpiredEvent ( SessionExpiredType . EXPIREDONSERVER ) ) ;
} else {
UtilsGXT3 . alert ( " Error " , caught . getLocalizedMessage ( ) ) ;
fireProjectStatusExplorerRefreshEvent ( ) ;
}
2017-06-06 20:15:22 +02:00
}
2016-01-18 17:28:55 +01:00
2017-07-17 18:39:42 +02:00
public void onSuccess ( String logs ) {
Log . debug ( " Deploy Operation Logs: " + logs ) ;
monitor . hide ( ) ;
2018-10-30 20:20:11 +01:00
UtilsGXT3 . alert ( " Error " , " Error deploying the algorithm: <a href=' " + logs + " '>Logs</a> " ) ;
2017-07-17 18:39:42 +02:00
fireProjectStatusExplorerRefreshEvent ( ) ;
2018-10-30 20:20:11 +01:00
2017-07-17 18:39:42 +02:00
}
2017-06-06 20:15:22 +02:00
} ) ;
2018-10-30 20:20:11 +01:00
2016-01-18 17:28:55 +01:00
}
2016-01-27 09:31:02 +01:00
public void startProjectManager ( ) {
2017-06-06 20:15:22 +02:00
retrieveSAIDescriptor ( null ) ;
}
public void startProjectManager ( String restoreValue ) {
retrieveSAIDescriptor ( restoreValue ) ;
}
private void retrieveSAIDescriptor ( final String restoreValue ) {
2019-09-18 17:26:29 +02:00
StatAlgoImporterServiceAsync . INSTANCE . getSAIDescriptor ( new AsyncCallback < SAIDescriptor > ( ) {
2017-06-06 20:15:22 +02:00
@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 ;
2017-06-07 19:46:05 +02:00
fireWorkAreaSetupEvent ( ) ;
2017-06-06 20:15:22 +02:00
}
}
} ) ;
2016-01-27 09:31:02 +01:00
}
2017-06-07 19:46:05 +02:00
private void fireWorkAreaSetupEvent ( ) {
WorkAreaEvent workAreaEvent = new WorkAreaEvent ( WorkAreaEventType . WORK_AREA_SETUP , project ) ;
Log . debug ( " Project Manager workAreaEvent fire! " + workAreaEvent ) ;
eventBus . fireEvent ( workAreaEvent ) ;
2016-01-27 09:31:02 +01:00
}
@SuppressWarnings ( " unused " )
private void fireProjectStatusSaveProjectEvent ( ) {
2017-06-06 20:15:22 +02:00
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent ( ProjectStatusEventType . SAVE , project ) ;
2017-06-07 19:46:05 +02:00
Log . debug ( " Project Manager ProjectStatusEvent fire! " + projectStatusEvent ) ;
2016-01-27 09:31:02 +01:00
eventBus . fireEvent ( projectStatusEvent ) ;
2017-06-07 19:46:05 +02:00
2016-01-27 09:31:02 +01:00
}
private void fireProjectStatusAddResourceEvent ( ) {
2017-06-06 20:15:22 +02:00
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent ( ProjectStatusEventType . ADD_RESOURCE , project ) ;
2017-06-07 19:46:05 +02:00
Log . debug ( " Project Manager ProjectStatusEvent fire! " + projectStatusEvent ) ;
2016-01-27 09:31:02 +01:00
eventBus . fireEvent ( projectStatusEvent ) ;
}
private void fireProjectStatusDeleteEvent ( ) {
2017-06-06 20:15:22 +02:00
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent ( ProjectStatusEventType . DELETE_RESOURCE , project ) ;
2017-06-07 19:46:05 +02:00
Log . debug ( " Project Manager ProjectStatusEvent fire! " + projectStatusEvent ) ;
2016-01-27 09:31:02 +01:00
eventBus . fireEvent ( projectStatusEvent ) ;
}
private void fireProjectStatusDeleteMainCodeEvent ( ) {
2017-06-06 20:15:22 +02:00
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent ( ProjectStatusEventType . DELETE_MAIN_CODE ,
project ) ;
2017-06-07 19:46:05 +02:00
Log . debug ( " Project Manager ProjectStatusEvent fire! " + projectStatusEvent ) ;
2016-01-27 09:31:02 +01:00
eventBus . fireEvent ( projectStatusEvent ) ;
}
@SuppressWarnings ( " unused " )
private void fireProjectStatusUpdateEvent ( ) {
2017-06-06 20:15:22 +02:00
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent ( ProjectStatusEventType . UPDATE , project ) ;
2017-06-07 19:46:05 +02:00
Log . debug ( " Project Manager ProjectStatusEvent fire! " + projectStatusEvent ) ;
2016-01-27 09:31:02 +01:00
eventBus . fireEvent ( projectStatusEvent ) ;
}
2016-02-01 16:08:07 +01:00
private void fireProjectStatusExplorerRefreshEvent ( ) {
2017-06-06 20:15:22 +02:00
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent ( ProjectStatusEventType . EXPLORER_REFRESH ,
project ) ;
2017-06-07 19:46:05 +02:00
Log . debug ( " Project Manager ProjectStatusEvent fire! " + projectStatusEvent ) ;
2016-02-01 16:08:07 +01:00
eventBus . fireEvent ( projectStatusEvent ) ;
2017-06-07 19:46:05 +02:00
2016-02-01 16:08:07 +01:00
}
2016-01-27 09:31:02 +01:00
private void fireProjectStatusMainCodeSetEvent ( ) {
2017-06-06 20:15:22 +02:00
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent ( ProjectStatusEventType . MAIN_CODE_SET , project ) ;
2017-06-07 19:46:05 +02:00
Log . debug ( " Project Manager ProjectStatusEvent fire! " + projectStatusEvent ) ;
2016-01-27 09:31:02 +01:00
eventBus . fireEvent ( projectStatusEvent ) ;
}
2017-06-30 18:51:18 +02:00
2017-06-09 18:35:45 +02:00
private void fireProjectStatusBinaryCodeSetEvent ( ) {
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent ( ProjectStatusEventType . BINARY_CODE_SET , project ) ;
Log . debug ( " Project Manager ProjectStatusEvent fire! " + projectStatusEvent ) ;
eventBus . fireEvent ( projectStatusEvent ) ;
}
2016-01-27 09:31:02 +01:00
2017-12-11 19:24:42 +01:00
/ *
2018-10-30 20:20:11 +01:00
* private void fireProjectStatusSoftwareCreatedEvent ( ) { ProjectStatusEvent
* projectStatusEvent = new
* ProjectStatusEvent ( ProjectStatusEventType . SOFTWARE_CREATED , project ) ;
* Log . debug ( " Project Manager ProjectStatusEvent fire! " +
* projectStatusEvent ) ; eventBus . fireEvent ( projectStatusEvent ) ;
*
* }
* /
2016-02-01 16:08:07 +01:00
2016-01-27 09:31:02 +01:00
private void fireProjectStatusSoftwarePublishEvent ( ) {
2017-06-06 20:15:22 +02:00
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent ( ProjectStatusEventType . SOFTWARE_PUBLISH ,
project ) ;
2017-06-07 19:46:05 +02:00
Log . debug ( " Project Manager ProjectStatusEvent fire! " + projectStatusEvent ) ;
2016-01-27 09:31:02 +01:00
eventBus . fireEvent ( projectStatusEvent ) ;
2017-06-07 19:46:05 +02:00
2016-01-27 09:31:02 +01:00
}
2016-02-01 16:08:07 +01:00
2016-01-27 09:31:02 +01:00
private void fireProjectStatusSoftwareRepackageEvent ( ) {
2017-06-06 20:15:22 +02:00
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent ( ProjectStatusEventType . SOFTWARE_REPACKAGE ,
project ) ;
2017-06-07 19:46:05 +02:00
Log . debug ( " Project Manager ProjectStatusEvent fire! " + projectStatusEvent ) ;
2016-01-27 09:31:02 +01:00
eventBus . fireEvent ( projectStatusEvent ) ;
}
private void fireProjectStatusStartEvent ( ) {
2017-06-06 20:15:22 +02:00
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent ( ProjectStatusEventType . START , project ) ;
2017-06-07 19:46:05 +02:00
Log . debug ( " Project Manager ProjectStatusEvent fire! " + projectStatusEvent ) ;
eventBus . fireEvent ( projectStatusEvent ) ;
}
2017-06-09 18:35:45 +02:00
/ *
2017-06-30 18:51:18 +02:00
* private void fireProjectStatusOpenEvent ( ) { ProjectStatusEvent
* projectStatusEvent = new ProjectStatusEvent ( ProjectStatusEventType . OPEN ,
* project ) ; Log . debug ( " Project Manager ProjectStatusEvent fire! " +
* projectStatusEvent ) ; eventBus . fireEvent ( projectStatusEvent ) ;
*
* }
* /
2016-01-27 09:31:02 +01:00
2015-12-04 18:45:47 +01:00
}