Search in sources :

Example 1 with KaleoAPIException

use of com.liferay.ide.kaleo.core.KaleoAPIException in project liferay-ide by liferay.

the class PublishWorkflowDefinitionAction method perform.

@Override
public void perform(Object node) {
    if (getSelectionProvider() instanceof CommonViewer && node instanceof WorkflowDefinitionEntry) {
        WorkflowDefinitionEntry definitionNode = (WorkflowDefinitionEntry) node;
        Job publishJob = new Job("Publishing workflow draft definition") {

            @Override
            protected IStatus run(IProgressMonitor monitor) {
                IKaleoConnection kaleoConnection = KaleoCore.getKaleoConnection(definitionNode.getParent().getParent());
                try {
                    kaleoConnection.publishKaleoDraftDefinition(definitionNode.getName(), definitionNode.getTitleMap(), definitionNode.getContent(), definitionNode.getCompanyId() + "", definitionNode.getUserId() + "", definitionNode.getGroupId() + "");
                } catch (KaleoAPIException kapie) {
                    kapie.printStackTrace();
                }
                WorkflowDefinitionsFolder definitionsFolder = (WorkflowDefinitionsFolder) definitionNode.getParent();
                CommonViewer viewer = (CommonViewer) getSelectionProvider();
                Display.getDefault().asyncExec(new Runnable() {

                    public void run() {
                        definitionsFolder.clearCache();
                        viewer.refresh(true);
                    }
                });
                return Status.OK_STATUS;
            }
        };
        publishJob.schedule();
    }
}
Also used : WorkflowDefinitionEntry(com.liferay.ide.kaleo.ui.navigator.WorkflowDefinitionEntry) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) IKaleoConnection(com.liferay.ide.kaleo.core.IKaleoConnection) CommonViewer(org.eclipse.ui.navigator.CommonViewer) KaleoAPIException(com.liferay.ide.kaleo.core.KaleoAPIException) Job(org.eclipse.core.runtime.jobs.Job) WorkflowDefinitionsFolder(com.liferay.ide.kaleo.ui.navigator.WorkflowDefinitionsFolder)

Aggregations

IKaleoConnection (com.liferay.ide.kaleo.core.IKaleoConnection)1 KaleoAPIException (com.liferay.ide.kaleo.core.KaleoAPIException)1 WorkflowDefinitionEntry (com.liferay.ide.kaleo.ui.navigator.WorkflowDefinitionEntry)1 WorkflowDefinitionsFolder (com.liferay.ide.kaleo.ui.navigator.WorkflowDefinitionsFolder)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 Job (org.eclipse.core.runtime.jobs.Job)1 CommonViewer (org.eclipse.ui.navigator.CommonViewer)1