use of org.talend.core.model.process.Element in project tdi-studio-se by Talend.
the class AbstractJobSettingsPage method updateProjectSetting.
public void updateProjectSetting() {
String[] split = getRepositoryPropertyName().split(":");
String parentParamName = split[0];
Element elementParams = elem;
IElementParameter elementParameter = elementParams.getElementParameter(parentParamName);
if (elementParameter != null && elementParameter.isShow(elem.getElementParameters()) && elementParameter.getChildParameters() != null) {
if (elementParameter.getChildParameters().get("PROPERTY_TYPE") != null && !EmfComponent.BUILTIN.equals(elementParameter.getChildParameters().get("PROPERTY_TYPE").getValue())) {
DatabaseConnection connection = null;
String id = (String) elementParameter.getChildParameters().get("REPOSITORY_PROPERTY_TYPE").getValue();
IRepositoryViewObject lastVersion = UpdateRepositoryUtils.getRepositoryObjectById(id);
if (lastVersion != null && lastVersion.getProperty() != null) {
Item item = lastVersion.getProperty().getItem();
if (item instanceof DatabaseConnectionItem) {
DatabaseConnectionItem dbItem = (DatabaseConnectionItem) item;
connection = (DatabaseConnection) dbItem.getConnection();
}
}
if (connection != null) {
boolean sameValues = true;
for (IElementParameter param : elementParams.getElementParameters()) {
String repositoryValue = param.getRepositoryValue();
if (param.isShow(elementParams.getElementParameters()) && repositoryValue != null && !param.getName().equals("PROPERTY_TYPE")) {
Object repValue = RepositoryToComponentProperty.getValue(connection, repositoryValue, null);
if (repValue == null) {
continue;
}
if (repositoryValue.equals(UpdatesConstants.TYPE)) {
// datebase type
boolean found = false;
String[] list = param.getListRepositoryItems();
for (int i = 0; (i < list.length) && (!found); i++) {
if (repValue.equals(list[i])) {
found = true;
}
}
if (!found) {
sameValues = false;
break;
}
} else {
// check the value
if (!param.getValue().equals(repValue)) {
sameValues = false;
break;
}
}
}
}
if (!sameValues) {
boolean ok = MessageDialog.openQuestion(getShell(), getDisplayName(), "Connection has been changed , do you want to change value from repository ?");
if (ok) {
ChangeValuesFromRepository changeValuesFromRepository = new ChangeValuesFromRepository(elem, connection, getRepositoryPropertyName(), id);
changeValuesFromRepository.execute();
isConnectionChanged = true;
}
}
} else {
MessageDialog.openInformation(getShell(), getDisplayName(), "Connection has been deleted ,change to build in automaticlly");
ChangeValuesFromRepository changeValuesFromRepository1 = new ChangeValuesFromRepository(elem, null, getPropertyTypeName(), EmfComponent.BUILTIN);
changeValuesFromRepository1.execute();
isConnectionChanged = true;
}
}
}
}
use of org.talend.core.model.process.Element in project tdi-studio-se by Talend.
the class CodeGeneratorService method refreshTemplates.
/*
* (non-Javadoc)
*
* @see org.talend.designer.codegen.ICodeGeneratorService#refreshTemplates()
*/
@Override
public Job refreshTemplates() {
Element oldComponent = null;
IComponentSettingsView viewer = null;
if (!CommonUIPlugin.isFullyHeadless()) {
// TDI-25866:In case select a component and sctrl+shift+f3,need clean its componentSetting view
IWorkbenchWindow wwindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (wwindow != null && wwindow.getActivePage() != null) {
viewer = (IComponentSettingsView) wwindow.getActivePage().findView(IComponentSettingsView.ID);
if (viewer != null) {
oldComponent = viewer.getElement();
viewer.cleanDisplay();
}
}
}
ComponentCompilations.deleteMarkers();
ComponentsFactoryProvider.getInstance().resetCache();
ILibraryManagerService librairesManagerService = (ILibraryManagerService) GlobalServiceRegister.getDefault().getService(ILibraryManagerService.class);
librairesManagerService.clearCache();
CorePlugin.getDefault().getLibrariesService().syncLibraries();
Job job = CodeGeneratorEmittersPoolFactory.initialize();
// achen modify to record ctrl+shift+f3 is pressed to fix bug 0006107
IDesignerCoreService designerCoreService = (IDesignerCoreService) GlobalServiceRegister.getDefault().getService(IDesignerCoreService.class);
designerCoreService.getLastGeneratedJobsDateMap().clear();
if (oldComponent != null && viewer != null) {
viewer.setElement(oldComponent);
}
if (!CommonUIPlugin.isFullyHeadless()) {
CorePlugin.getDefault().getDesignerCoreService().synchronizeDesignerUI(new PropertyChangeEvent(this, IComponentConstants.NORMAL, null, null));
}
return job;
}
use of org.talend.core.model.process.Element in project tesb-studio-se by Talend.
the class CheckCXFNodesService method checkNode.
/*
* (non-Javadoc)
*
* @see
* org.talend.designer.core.ICheckNodesService#checkNode(org.talend.designer
* .core.ui.editor.nodes.Node)
*/
public void checkNode(Node node) {
if (!node.getComponent().getName().equals("cSOAP")) {
// $NON-NLS-1$
return;
}
// $NON-NLS-1$
final IElementParameter serviceParam = node.getElementParameter("SERVICE_TYPE");
// Select WSDL
if (serviceParam != null && "wsdlURL".equals(serviceParam.getValue())) {
// $NON-NLS-1$
// $NON-NLS-1$
final IElementParameter wsdlFileParam = node.getElementParameter("WSDL_FILE");
// $NON-NLS-1$
final IElementParameter wsdlTypeParam = node.getElementParameter("WSDL_TYPE");
// Select File
if (wsdlTypeParam != null && "file".equals(wsdlTypeParam.getValue())) {
// WSDL file is empty
if (wsdlFileParam == null || wsdlFileParam.getValue() == null || wsdlFileParam.getValue().toString().isEmpty() || wsdlFileParam.getValue().toString().equals("\"\"")) {
// $NON-NLS-1$
String errorMessage = // $NON-NLS-1$
MessageFormat.format(// $NON-NLS-1$
CamelDesignerMessages.getString("CheckCXFNodesService_emptyError"), wsdlFileParam == null ? "" : wsdlFileParam.getDisplayName());
Problems.add(ProblemStatus.ERROR, (Element) node, errorMessage);
}
} else // Select Repository
if (wsdlTypeParam != null && "repo".equals(wsdlTypeParam.getValue())) {
// $NON-NLS-1$
final IElementParameter resourceParam = node.getElementParameterFromField(EParameterFieldType.ROUTE_RESOURCE_TYPE);
// WSDL file is empty
// $NON-NLS-1$
String errorMessage = "";
if (resourceParam == null || resourceParam.getValue() == null || resourceParam.getValue().toString().isEmpty()) {
errorMessage = // $NON-NLS-1$
MessageFormat.format(// $NON-NLS-1$
CamelDesignerMessages.getString("CheckCXFNodesService_emptyError"), wsdlFileParam.getDisplayName());
Problems.add(ProblemStatus.ERROR, (Element) node, errorMessage);
} else {
String id = (String) resourceParam.getValue();
try {
IRepositoryViewObject lastVersion = ProxyRepositoryFactory.getInstance().getLastVersion(id);
if (lastVersion == null) {
errorMessage = // $NON-NLS-1$
MessageFormat.format(// $NON-NLS-1$
CamelDesignerMessages.getString("CheckCXFNodesService_nonexistError"), wsdlFileParam.getDisplayName());
Problems.add(ProblemStatus.ERROR, (Element) node, errorMessage);
} else if (lastVersion.isDeleted()) {
errorMessage = // $NON-NLS-1$
MessageFormat.format(// $NON-NLS-1$
CamelDesignerMessages.getString("CheckCXFNodesService_removedError"), resourceParam.getDisplayName());
Problems.add(ProblemStatus.ERROR, (Element) node, errorMessage);
}
} catch (PersistenceException e) {
errorMessage = // $NON-NLS-1$
MessageFormat.format(// $NON-NLS-1$
CamelDesignerMessages.getString("CheckCXFNodesService_emptyError"), wsdlFileParam.getDisplayName());
Problems.add(ProblemStatus.ERROR, (Element) node, errorMessage);
}
}
}
} else // Select Service class
if (serviceParam != null && "serviceClass".equals(serviceParam.getValue())) {
// $NON-NLS-1$
// $NON-NLS-1$
final IElementParameter clazzParam = node.getElementParameter("SERVICE_CLASS");
// Service class is empty
if (clazzParam == null || clazzParam.getValue() == null || clazzParam.getValue().toString().isEmpty()) {
String errorMessage = // $NON-NLS-1$
MessageFormat.format(// $NON-NLS-1$
CamelDesignerMessages.getString("CheckCXFNodesService_emptyError"), clazzParam.getDisplayName());
Problems.add(ProblemStatus.ERROR, (Element) node, errorMessage);
}
}
}
use of org.talend.core.model.process.Element in project tesb-studio-se by Talend.
the class CheckMultiRestRequestNodes method checkNode.
@Override
public void checkNode(Node node) {
String name = node.getComponent().getName();
if (!RESTREQUEST_COMPONENT.equals(name)) {
return;
}
IProcess process = node.getProcess();
if (process.getNodesOfType(RESTREQUEST_COMPONENT).size() > 1) {
Problems.add(ProblemStatus.ERROR, (Element) node, "Only one " + RESTREQUEST_COMPONENT + " component is allowed in a Job!");
} else if (process.getNodesOfType(ESBPROVIDER_COMPONENT).size() > 0) {
Problems.add(ProblemStatus.ERROR, (Element) node, RESTREQUEST_COMPONENT + " and " + ESBPROVIDER_COMPONENT + " can't present in a same Job!");
}
}
use of org.talend.core.model.process.Element in project tdi-studio-se by Talend.
the class SubjobBasicComposite method refresh.
@Override
public void refresh() {
super.refresh();
Element element = getElement();
if (element != null && element instanceof SubjobContainer) {
SubjobContainer process = (SubjobContainer) element;
if (reloadBtn != null && !reloadBtn.isDisposed()) {
reloadBtn.setEnabled(!process.isReadOnly());
}
if (saveBtn != null && !saveBtn.isDisposed()) {
saveBtn.setEnabled(!process.isReadOnly());
}
}
}
Aggregations