use of com.amalto.workbench.service.IValidateService 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 com.amalto.workbench.service.IValidateService 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);
}
use of com.amalto.workbench.service.IValidateService in project tmdm-studio-se by Talend.
the class AddBrowseItemsWizardR method toRecreateBrowserView.
private boolean toRecreateBrowserView(String viewName) {
IValidateService validateService = (IValidateService) GlobalServiceRegister.getDefault().getService(IValidateService.class);
boolean result = validateService.validateAndAlertObjectExistence(TreeObject.VIEW, viewName);
return result;
}
use of com.amalto.workbench.service.IValidateService 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);
}
Aggregations