Search in sources :

Example 1 with JobOptionsDialog

use of org.talend.mdm.repository.ui.dialogs.job.JobOptionsDialog in project tmdm-studio-se by Talend.

the class GenerateJobTriggerAction method doRun.

@Override
protected void doRun() {
    selectObj = getSelectedObject().get(0);
    JobOptionsDialog dialog = new JobOptionsDialog(getShell(), Messages.JobProcesssDialogTiggerTitle_title, Execution.EMBEDDED);
    dialog.setBlockOnOpen(true);
    int ret = dialog.open();
    if (ret == Dialog.CANCEL) {
        return;
    }
    // $NON-NLS-1$
    String jobName = "";
    // $NON-NLS-1$
    String jobVersion = "";
    if (selectObj instanceof IRepositoryViewObject) {
        jobName = ((IRepositoryViewObject) selectObj).getProperty().getLabel();
        jobVersion = ((IRepositoryViewObject) selectObj).getProperty().getVersion();
    }
    // check exist
    IValidateService validateService = (IValidateService) GlobalServiceRegister.getDefault().getService(IValidateService.class);
    if (validateService != null) {
        boolean result = validateService.validateAndAlertObjectExistence(IServerObjectRepositoryType.TYPE_ROUTINGRULE, getNewTriggerName(jobName), null);
        if (!result) {
            return;
        }
    }
    // 
    WSRoutingRuleE routingRule = createTrigger(jobName, jobVersion, dialog);
    // if the new objectect is opened ,than close it before regenerating
    IRepositoryViewObject toDelete = RepositoryResourceUtil.findViewObjectByName(IServerObjectRepositoryType.TYPE_ROUTINGRULE, PREFIX + jobName);
    if (toDelete != null) {
        IEditorPart openedEditor = UIUtil.findOpenedEditor(toDelete);
        if (openedEditor != null) {
            UIUtil.closeEditor(openedEditor, false);
        }
        // delete directly
        RepositoryResourceUtil.removeViewObjectPhysically(toDelete, jobVersion);
    }
    AttachToTriggerView(jobName, routingRule);
}
Also used : IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) WSRoutingRuleE(org.talend.mdm.repository.model.mdmserverobject.WSRoutingRuleE) IEditorPart(org.eclipse.ui.IEditorPart) JobOptionsDialog(org.talend.mdm.repository.ui.dialogs.job.JobOptionsDialog) IValidateService(com.amalto.workbench.service.IValidateService)

Example 2 with JobOptionsDialog

use of org.talend.mdm.repository.ui.dialogs.job.JobOptionsDialog in project tmdm-studio-se by Talend.

the class GenerateJobTransformerAction method doRun.

@Override
protected void doRun() {
    selectObj = getSelectedObject().get(0);
    JobOptionsDialog dialog = new JobOptionsDialog(getShell(), Messages.JobProcesssOptionsDialogTitle_title, Execution.EMBEDDED);
    dialog.setBlockOnOpen(true);
    int ret = dialog.open();
    if (ret == Dialog.CANCEL) {
        return;
    }
    // $NON-NLS-1$
    String jobName = "";
    // $NON-NLS-1$
    String jobVersion = "";
    // $NON-NLS-1$
    String path = "/other";
    if (selectObj instanceof IRepositoryViewObject) {
        Property property = ((IRepositoryViewObject) selectObj).getProperty();
        if (property != null) {
            jobName = property.getLabel();
            jobVersion = property.getVersion();
        }
    }
    // check exist
    IValidateService validateService = (IValidateService) GlobalServiceRegister.getDefault().getService(IValidateService.class);
    if (validateService != null) {
        boolean result = validateService.validateAndAlertObjectExistence(IServerObjectRepositoryType.TYPE_TRANSFORMERV2, getNewProcessName(jobName), null);
        if (!result) {
            return;
        }
    }
    WSTransformerV2E transformer = createTransformer(jobName, jobVersion, dialog);
    // if the new objectect is opened ,than close it before regenerating
    IRepositoryViewObject toDelete = RepositoryResourceUtil.findViewObjectByName(IServerObjectRepositoryType.TYPE_TRANSFORMERV2, PREFIX + jobName);
    if (toDelete != null) {
        IEditorPart openedEditor = UIUtil.findOpenedEditor(toDelete);
        if (openedEditor != null) {
            UIUtil.closeEditor(openedEditor, false);
        }
        // delete directly
        RepositoryResourceUtil.removeViewObjectPhysically(toDelete, jobVersion);
    }
    AttachToProcessView(jobName, transformer);
}
Also used : WSTransformerV2E(org.talend.mdm.repository.model.mdmserverobject.WSTransformerV2E) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IEditorPart(org.eclipse.ui.IEditorPart) JobOptionsDialog(org.talend.mdm.repository.ui.dialogs.job.JobOptionsDialog) Property(org.talend.core.model.properties.Property) IValidateService(com.amalto.workbench.service.IValidateService)

Aggregations

IValidateService (com.amalto.workbench.service.IValidateService)2 IEditorPart (org.eclipse.ui.IEditorPart)2 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)2 JobOptionsDialog (org.talend.mdm.repository.ui.dialogs.job.JobOptionsDialog)2 Property (org.talend.core.model.properties.Property)1 WSRoutingRuleE (org.talend.mdm.repository.model.mdmserverobject.WSRoutingRuleE)1 WSTransformerV2E (org.talend.mdm.repository.model.mdmserverobject.WSTransformerV2E)1