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);
}
}
}
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>();
}
Aggregations