Search in sources :

Example 1 with IMDMJobTemplate

use of org.talend.mdm.repository.ui.wizards.process.IMDMJobTemplate in project tmdm-studio-se by Talend.

the class NewProcessAction method generateJobTemplate.

public void generateJobTemplate(int type, String processName, String[] returnMessages, boolean enableRedirect, String redirectUrl, List<IMDMJobTemplate> jobTemplates) {
    if (type == ITransformerV2NodeConsDef.TYPE_SMARTVIEW) {
        // don't create job if smartview
        return;
    }
    if (returnMessages == null || returnMessages.length < 2) {
        throw new IllegalArgumentException();
    }
    String infoType = null;
    String pMessage = null;
    if (type == ITransformerV2NodeConsDef.TYPE_BEFOREDEL || type == ITransformerV2NodeConsDef.TYPE_BEFORESAVE) {
        infoType = returnMessages[0];
        pMessage = returnMessages[1];
    }
    if (type == ITransformerV2NodeConsDef.TYPE_ENTITYACTION || type == ITransformerV2NodeConsDef.TYPE_WELCOMEACTION) {
        if (enableRedirect) {
            pMessage = // $NON-NLS-1$
            "<results><item><attr>" + redirectUrl + // $NON-NLS-1$
            "</attr></item></results>";
        } else {
            // $NON-NLS-1$
            pMessage = "";
        }
    }
    IValidateService validateService = (IValidateService) GlobalServiceRegister.getDefault().getService(IValidateService.class);
    for (IMDMJobTemplate job : jobTemplates) {
        boolean result = true;
        // $NON-NLS-1$//$NON-NLS-2$
        processName = processName.replaceAll("#|\\$", "");
        if (validateService != null) {
            // $NON-NLS-1$
            result = validateService.validateAndAlertObjectExistence(ERepositoryObjectType.PROCESS, processName, "Job");
        }
        if (result) {
            closeEditor(processName);
            job.generateJobTemplate(type, processName, infoType, pMessage);
        }
    }
}
Also used : IMDMJobTemplate(org.talend.mdm.repository.ui.wizards.process.IMDMJobTemplate) IValidateService(com.amalto.workbench.service.IValidateService)

Example 2 with IMDMJobTemplate

use of org.talend.mdm.repository.ui.wizards.process.IMDMJobTemplate in project tmdm-studio-se by Talend.

the class JobTemplateUtil method getJobTemplateGenPages.

public static List<IMDMJobTemplate> getJobTemplateGenPages() {
    try {
        IExtensionRegistry registry = Platform.getExtensionRegistry();
        IConfigurationElement[] configurationElements = registry.getConfigurationElementsFor(EXTENSION_POINT);
        List<IMDMJobTemplate> models = new ArrayList<IMDMJobTemplate>();
        for (int i = 0; i < configurationElements.length; i++) {
            IConfigurationElement element = configurationElements[i];
            IMDMJobTemplate modelcalss = (IMDMJobTemplate) element.createExecutableExtension(CLASS);
            models.add(modelcalss);
        }
        return models;
    } catch (Exception e) {
        log.error(e.getMessage(), e);
    }
    return new ArrayList<IMDMJobTemplate>();
}
Also used : IMDMJobTemplate(org.talend.mdm.repository.ui.wizards.process.IMDMJobTemplate) ArrayList(java.util.ArrayList) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement) IExtensionRegistry(org.eclipse.core.runtime.IExtensionRegistry)

Aggregations

IMDMJobTemplate (org.talend.mdm.repository.ui.wizards.process.IMDMJobTemplate)2 IValidateService (com.amalto.workbench.service.IValidateService)1 ArrayList (java.util.ArrayList)1 IConfigurationElement (org.eclipse.core.runtime.IConfigurationElement)1 IExtensionRegistry (org.eclipse.core.runtime.IExtensionRegistry)1