use of org.talend.core.ui.IJobletProviderService in project tdi-studio-se by Talend.
the class SetupProcessDependenciesRoutinesAction method doRun.
@Override
protected void doRun() {
ISelection selection = getSelection();
Object obj = ((IStructuredSelection) selection).getFirstElement();
if (obj == null) {
return;
}
RepositoryNode node = (RepositoryNode) obj;
boolean readonly = false;
IRepositoryService service = DesignerPlugin.getDefault().getRepositoryService();
IProxyRepositoryFactory repFactory = service.getProxyRepositoryFactory();
ERepositoryStatus status = repFactory.getStatus(node.getObject());
if (!repFactory.isPotentiallyEditable(node.getObject()) || status == ERepositoryStatus.LOCK_BY_OTHER || status == ERepositoryStatus.LOCK_BY_USER) {
readonly = true;
}
Item item = node.getObject().getProperty().getItem();
if (item instanceof ProcessItem) {
ProcessItem processItem = (ProcessItem) item;
ProcessType process = processItem.getProcess();
SetupProcessDependenciesRoutinesDialog dialog = new SetupProcessDependenciesRoutinesDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), process, readonly);
if (dialog.open() == Window.OK && !readonly) {
process.getParameters().getRoutinesParameter().clear();
createRoutinesDependencies(process, dialog.getSystemRoutines());
createRoutinesDependencies(process, dialog.getUserRoutines());
try {
CorePlugin.getDefault().getRepositoryService().getProxyRepositoryFactory().save(processItem);
RelationshipItemBuilder.getInstance().addOrUpdateItem(processItem);
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
}
} else if (item instanceof JobletProcessItem) {
JobletProcessItem jobProcessItem = (JobletProcessItem) item;
ProcessType process = jobProcessItem.getJobletProcess();
SetupProcessDependenciesRoutinesDialog dialog = new SetupProcessDependenciesRoutinesDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), process, readonly);
if (dialog.open() == Window.OK && !readonly) {
process.getParameters().getRoutinesParameter().clear();
createRoutinesDependencies(process, dialog.getSystemRoutines());
createRoutinesDependencies(process, dialog.getUserRoutines());
try {
CorePlugin.getDefault().getRepositoryService().getProxyRepositoryFactory().save(jobProcessItem);
IJobletProviderService jobletService = (IJobletProviderService) GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
if (jobletService != null) {
jobletService.loadComponentsFromProviders();
}
RelationshipItemBuilder.getInstance().addOrUpdateItem(jobProcessItem);
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
}
}
}
use of org.talend.core.ui.IJobletProviderService in project tdi-studio-se by Talend.
the class JobletUtil method createTriggerConnector.
private void createTriggerConnector(List<INodeConnector> listConnector, INode jobletNode) {
IJobletProviderService service = (IJobletProviderService) GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
if (service != null) {
List<INode> triggerNodes = service.getTriggerNodes(jobletNode.getJobletNode());
for (INode node : triggerNodes) {
// INode node = jobletNode;
EConnectionType triggerConnType = service.getTriggerNodeConnType(node);
if (triggerConnType == null) {
continue;
}
boolean isInput = service.isTriggerInputNode(node);
INodeConnector nodeConnector = null;
String name = node.getUniqueName();
nodeConnector = new NodeConnector(jobletNode);
nodeConnector.setName(name);
nodeConnector.setBaseSchema(triggerConnType.getName());
nodeConnector.setBuiltIn(true);
nodeConnector.setMaxLinkOutput(isInput ? 0 : 1);
nodeConnector.setMinLinkOutput(0);
nodeConnector.setMaxLinkInput(isInput ? 1 : 0);
nodeConnector.setMinLinkInput(0);
String displayName = conDisplayName(node.getLabel(), name);
//$NON-NLS-1$ //$NON-NLS-2$
nodeConnector.setLinkName(triggerConnType.getDefaultLinkName() + " (" + displayName + ")");
//$NON-NLS-1$ //$NON-NLS-2$
nodeConnector.setMenuName(triggerConnType.getDefaultMenuName() + " (" + displayName + ")");
nodeConnector.setDefaultConnectionType(triggerConnType);
nodeConnector.addConnectionProperty(triggerConnType, triggerConnType.getRGB(), triggerConnType.getDefaultLineStyle());
listConnector.add(nodeConnector);
}
}
}
use of org.talend.core.ui.IJobletProviderService in project tdi-studio-se by Talend.
the class JobletUtil method cloneNode.
public Node cloneNode(Node node, IProcess process, Map<String, List<? extends IElementParameter>> paraMap, boolean lockByOther) {
NodePart nodePart = new NodePart();
IJobletProviderService service = (IJobletProviderService) GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
boolean isInOut = false;
if (service != null) {
isInOut = service.isJobletInOutComponent(node);
}
Node cloneNode = new Node(node.getComponent(), (IProcess2) process, node.getUniqueName());
nodePart.setModel(cloneNode);
if (lockByOther) {
cloneNode.setReadOnly(true);
} else {
cloneNode.setReadOnly(false);
}
cloneNode.setDummy(node.isDummy());
cloneNode.setActivate(node.isActivate());
List<? extends IElementParameter> elementParas = null;
if (paraMap.containsKey(node.getUniqueName())) {
elementParas = paraMap.get(node.getUniqueName());
} else {
elementParas = node.getElementParameters();
}
for (IElementParameter elementPara : elementParas) {
if (elementPara.getName() != null && !elementPara.getName().equals("UNIQUE_NAME")) {
IElementParameter cloneElement = cloneNode.getElementParameter(elementPara.getName());
Object paValue = elementPara.getValue();
if (paValue instanceof List) {
List list = new ArrayList();
list.addAll((List) paValue);
cloneElement.setValue(list);
} else {
// TDI-25599
cloneElement.setContextMode(elementPara.isContextMode());
cloneElement.setValue(elementPara.getValue());
}
if (lockByOther) {
cloneElement.setReadOnly(true);
} else {
cloneElement.setReadOnly(elementPara.isReadOnly());
}
if (elementPara.getChildParameters() != null) {
Map<String, IElementParameter> elementParaChild = elementPara.getChildParameters();
Map<String, IElementParameter> cloneElementChild = cloneElement.getChildParameters();
Iterator<Entry<String, IElementParameter>> ite = elementParaChild.entrySet().iterator();
while (ite.hasNext()) {
Entry<String, IElementParameter> entry = ite.next();
String key = entry.getKey();
IElementParameter c = entry.getValue();
if (key != null && c != null) {
IElementParameter cloneC = cloneElementChild.get(key);
if (cloneC != null) {
cloneC.setValue(c.getValue());
if (lockByOther) {
cloneC.setReadOnly(true);
} else {
cloneC.setReadOnly(c.isReadOnly());
}
}
}
}
}
}
}
for (IElementParameter param : cloneNode.getElementParameters()) {
String repositoryValue = param.getRepositoryValue();
if (param.isShow(cloneNode.getElementParameters()) && (repositoryValue != null) && (!param.getName().equals(EParameterName.PROPERTY_TYPE.getName())) && param.getFieldType() != EParameterFieldType.MEMO_SQL) {
param.setRepositoryValueUsed(true);
param.setReadOnly(true);
}
}
cloneNode.setMetadataList(node.getMetadataList());
cloneNode.setListConnector(node.getListConnector());
cloneNode.setConnectionName(node.getConnectionName());
cloneNode.setLocation(node.getLocation());
IExternalNode externalNode = cloneNode.getExternalNode();
if (externalNode != null) {
if (node.getExternalData() != null) {
try {
externalNode.setExternalData(node.getExternalData().clone());
} catch (CloneNotSupportedException e) {
ExceptionHandler.process(e);
}
cloneNode.setExternalData(externalNode.getExternalData());
}
if (node.getExternalNode().getExternalEmfData() != null) {
externalNode.setExternalEmfData(EcoreUtil.copy(node.getExternalNode().getExternalEmfData()));
}
// when copy a external node, should also copy screeshot
if (node.getExternalNode() != null) {
ImageDescriptor screenshot = node.getExternalNode().getScreenshot();
if (screenshot != null) {
externalNode.setScreenshot(screenshot);
}
}
}
if (node.getElementParameter(EParameterName.LABEL.getName()) != null) {
cloneNode.setPropertyValue(EParameterName.LABEL.getName(), node.getElementParameter(EParameterName.LABEL.getName()).getValue());
} else {
cloneNode.setPropertyValue(EParameterName.LABEL.getName(), node.getLabel());
}
boolean found = false;
for (INode inode : process.getGraphicalNodes()) {
if (inode.getUniqueName().equals(cloneNode.getUniqueName())) {
found = true;
}
}
if (!found) {
((IProcess2) process).removeUniqueNodeName(cloneNode.getUniqueName());
}
return cloneNode;
}
use of org.talend.core.ui.IJobletProviderService in project tdi-studio-se by Talend.
the class NodePart method performRequest.
@Override
public void performRequest(Request req) {
Node node = (Node) getModel();
IExternalData oldExternalData = node.getExternalData();
if (req.getType().equals(RequestConstants.REQ_OPEN)) {
IExternalNode externalNode = null;
if (node.isExternalNode()) {
IElementParameter externalParam = node.getElementParameterFromField(EParameterFieldType.EXTERNAL);
if (externalParam != null && externalParam.isShow(node.getElementParameters())) {
externalNode = ExternalUtilities.getExternalNodeReadyToOpen(node);
}
}
IWorkbenchPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
if (externalNode != null && (part instanceof AbstractMultiPageTalendEditor)) {
boolean isOriginalNode = false;
ITestContainerProviderService testContainerService = null;
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
testContainerService = (ITestContainerProviderService) GlobalServiceRegister.getDefault().getService(ITestContainerProviderService.class);
if (testContainerService != null) {
isOriginalNode = testContainerService.isOriginalNode(node);
if (isOriginalNode) {
testContainerService.renameConnection(node, true);
}
}
}
int returnValue = externalNode.open(getViewer().getControl().getShell());
if (!node.isReadOnly()) {
if (returnValue == SWT.OK) {
Command cmd = new ExternalNodeChangeCommand(node, externalNode, oldExternalData);
CommandStack cmdStack = (CommandStack) part.getAdapter(CommandStack.class);
cmdStack.execute(cmd);
} else {
externalNode.setExternalData(oldExternalData);
}
}
if (isOriginalNode && (testContainerService != null)) {
testContainerService.renameConnection(node, false);
}
} else {
// add for feature 13361
boolean isJoblet = false;
if (PluginChecker.isJobLetPluginLoaded()) {
AbstractProcessProvider jobletProcessProvider = AbstractProcessProvider.findProcessProviderFromPID(IComponent.JOBLET_PID);
final IJobletProviderService service = (IJobletProviderService) GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
boolean isAvoidShowJobletAfterDoubleClick = false;
if (GlobalServiceRegister.getDefault().isServiceRegistered(IComponentsLocalProviderService.class)) {
IComponentsLocalProviderService componentService = (IComponentsLocalProviderService) GlobalServiceRegister.getDefault().getService(IComponentsLocalProviderService.class);
if (componentService != null) {
isAvoidShowJobletAfterDoubleClick = componentService.isAvoidToShowJobletAfterDoubleClick();
}
}
if (service != null && service.isJobletComponent(node) && !isAvoidShowJobletAfterDoubleClick) {
isJoblet = true;
String version = (String) node.getPropertyValue(EParameterName.PROCESS_TYPE_VERSION.getName());
final Item jobletItem = jobletProcessProvider.getJobletItem(node, version);
RepositoryWorkUnit<Object> repositoryWorkUnit = new RepositoryWorkUnit<Object>("", this) {
@Override
protected void run() throws LoginException, PersistenceException {
if (jobletItem != null) {
service.openJobletItem((JobletProcessItem) jobletItem);
}
}
};
repositoryWorkUnit.setAvoidUnloadResources(true);
CoreRuntimePlugin.getInstance().getProxyRepositoryFactory().executeRepositoryWorkUnit(repositoryWorkUnit);
}
}
if (!isJoblet) {
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
String processName = (String) node.getPropertyValue(EParameterName.PROCESS_TYPE_PROCESS.getName());
String version = (String) node.getPropertyValue(EParameterName.PROCESS_TYPE_VERSION.getName());
boolean isAvoidShowJobAfterDoubleClick = false;
if (GlobalServiceRegister.getDefault().isServiceRegistered(IComponentsLocalProviderService.class)) {
IComponentsLocalProviderService service = (IComponentsLocalProviderService) GlobalServiceRegister.getDefault().getService(IComponentsLocalProviderService.class);
if (service != null) {
isAvoidShowJobAfterDoubleClick = service.isAvoidToShowJobAfterDoubleClick();
}
}
// bug 20796
boolean isSelectUseDynamic = false;
Object useDynamicJobValue = node.getPropertyValue(EParameterName.USE_DYNAMIC_JOB.getName());
if (useDynamicJobValue != null && useDynamicJobValue instanceof Boolean) {
isSelectUseDynamic = (Boolean) useDynamicJobValue;
}
if (processName != null && !"".equals(processName) && !isAvoidShowJobAfterDoubleClick && !isSelectUseDynamic) {
//$NON-NLS-1$
ItemCacheManager.clearCache();
ProcessItem processItem = ItemCacheManager.getProcessItem(processName, version);
if (processItem == null) {
return;
}
Property updatedProperty = null;
try {
updatedProperty = ProxyRepositoryFactory.getInstance().getLastVersion(new Project(ProjectManager.getInstance().getProject(processItem)), processName).getProperty();
} catch (PersistenceException e) {
CommonExceptionHandler.process(e);
}
// update the property of the node repository object
// node.getObject().setProperty(updatedProperty);
processItem = (ProcessItem) updatedProperty.getItem();
final ProcessItem item = processItem;
RepositoryWorkUnit<Object> repositoryWorkUnit = new RepositoryWorkUnit<Object>("", this) {
@Override
protected void run() throws LoginException, PersistenceException {
try {
if (item != null) {
ERepositoryObjectType repObjType = ERepositoryObjectType.getItemType(item);
IJobEditorHandler editorInputFactory = JobEditorHandlerManager.getInstance().extractEditorInputFactory(repObjType.getType());
editorInputFactory.openJobEditor(editorInputFactory.createJobEditorInput(item, true));
}
} catch (PartInitException e) {
MessageBoxExceptionHandler.process(e);
}
}
};
repositoryWorkUnit.setAvoidUnloadResources(true);
CoreRuntimePlugin.getInstance().getProxyRepositoryFactory().executeRepositoryWorkUnit(repositoryWorkUnit);
} else {
try {
// modified for feature 2454.
page.showView(ComponentSettingsView.ID);
} catch (PartInitException e) {
CommonExceptionHandler.process(e);
}
}
}
}
}
super.performRequest(req);
}
use of org.talend.core.ui.IJobletProviderService in project tdi-studio-se by Talend.
the class PropertyChangeCommand method execute.
@Override
public void execute() {
IElementParameter currentParam = elem.getElementParameter(propName);
changeMetadataCommands.clear();
oldElementValues.clear();
if (currentParam == null) {
return;
}
if (currentParam instanceof ElementParameter) {
((ElementParameter) currentParam).setTaggedValue(UpdatesConstants.CHANGED_BY_USER, true);
}
if (currentParam.isRepositoryValueUsed()) {
if (currentParam.getFieldType() == EParameterFieldType.MEMO_SQL) {
Object queryStoreValue = elem.getPropertyValue(EParameterName.QUERYSTORE_TYPE.getName());
if (!EmfComponent.BUILTIN.equals(queryStoreValue) || !EmfComponent.TNS_FILE.equals(queryStoreValue)) {
elem.setPropertyValue(EParameterName.QUERYSTORE_TYPE.getName(), EmfComponent.BUILTIN);
}
currentParam.setRepositoryValueUsed(false);
} else {
toUpdate = true;
Object value = elem.getPropertyValue(propName);
if (value == null || (!value.toString().endsWith("xsd") && !value.toString().endsWith("xsd\""))) {
elem.setPropertyValue(propertyTypeName, EmfComponent.BUILTIN);
}
for (IElementParameter param : elem.getElementParameters()) {
if (param.getRepositoryProperty() == null || param.getRepositoryProperty().equals(currentParam.getName())) {
param.setRepositoryValueUsed(false);
}
}
}
repositoryValueWasUsed = true;
} else {
repositoryValueWasUsed = false;
}
oldValue = elem.getPropertyValue(propName);
elem.setPropertyValue(propName, newValue);
if (currentParam.getFieldType().equals(EParameterFieldType.CONNECTION_LIST) && currentParam.getContext() != null && (elem instanceof Node)) {
String connParaname = currentParam.getContext() + ":" + currentParam.getName();
if (connParaname.equals(propName)) {
IConnection selectedConn = null;
for (IConnection conn : ((Node) elem).getIncomingConnections()) {
if (conn.getUniqueName().equals(newValue)) {
selectedConn = conn;
break;
}
}
if (selectedConn != null && getTakeSchema()) {
((Node) selectedConn.getSource()).takeSchemaFrom((Node) elem, currentParam.getContext());
}
}
}
if ("ELT_TABLE_NAME".equals(propName) || "ELT_SCHEMA_NAME".equals(propName)) {
//$NON-NLS-1$ //$NON-NLS-2$
//$NON-NLS-1$
String oldELTValue = "";
//$NON-NLS-1$
String newELTValue = "";
String oldParamValue = TalendQuoteUtils.removeQuotes((String) oldValue);
String newParamValue = TalendQuoteUtils.removeQuotes((String) newValue);
if ("ELT_TABLE_NAME".equals(propName)) {
//$NON-NLS-1$
//$NON-NLS-1$
String schemaName = TalendQuoteUtils.removeQuotes((String) elem.getPropertyValue("ELT_SCHEMA_NAME"));
if (schemaName == null || "".equals(schemaName.trim())) {
//$NON-NLS-1$
oldELTValue = oldParamValue;
newELTValue = newParamValue;
} else {
//$NON-NLS-1$
oldELTValue = schemaName + "." + oldParamValue;
//$NON-NLS-1$
newELTValue = schemaName + "." + newParamValue;
}
} else {
//$NON-NLS-1$
String tableName = TalendQuoteUtils.removeQuotes((String) elem.getPropertyValue("ELT_TABLE_NAME"));
if (oldParamValue != null && !"".equals(oldParamValue.trim())) {
//$NON-NLS-1$
oldELTValue = oldParamValue + ".";
}
if (newParamValue != null && !"".equals(newParamValue.trim())) {
//$NON-NLS-1$
newELTValue = newParamValue + ".";
}
// $NON-NLS-1$
oldELTValue = oldELTValue + tableName;
// $NON-NLS-1$
newELTValue = newELTValue + tableName;
}
List<? extends IConnection> connections = ((Node) elem).getOutgoingConnections();
for (IConnection connection : connections) {
INode targetNode = connection.getTarget();
String componentName = targetNode.getComponent().getName();
if (componentName.matches("tELT.+Map")) {
//$NON-NLS-1$
if (GlobalServiceRegister.getDefault().isServiceRegistered(IDbMapDesignerService.class)) {
IDbMapDesignerService service = (IDbMapDesignerService) GlobalServiceRegister.getDefault().getService(IDbMapDesignerService.class);
updateELTMapComponentCommand = service.getUpdateELTMapComponentCommand(targetNode, connection, oldELTValue, newELTValue);
updateELTMapComponentCommand.execute();
}
}
}
}
// add for bug TDI-26632 by fwang in 11 July, 2013. can't edit parameters if use repository connection.
IElementParameter propertyTypeParam = elem.getElementParameter(EParameterName.PROPERTY_TYPE.getName());
IElementParameter repositoryTypeParam = elem.getElementParameter(EParameterName.REPOSITORY_PROPERTY_TYPE.getName());
if (("USE_EXISTING_CONNECTION").equals(propName) && elem instanceof Node && propertyTypeParam != null && "REPOSITORY".equals(propertyTypeParam.getValue()) && repositoryTypeParam != null && !("").equals(repositoryTypeParam.getValue())) {
Node node = (Node) elem;
for (IElementParameter param : node.getElementParameters()) {
String repositoryValue = param.getRepositoryValue();
if ((repositoryValue != null) && (!param.getName().equals(EParameterName.PROPERTY_TYPE.getName())) && param.getFieldType() != EParameterFieldType.MEMO_SQL && !("tMDMReceive".equals(node.getComponent().getName()) && "XPATH_PREFIX".equals(//$NON-NLS-1$ //$NON-NLS-2$
param.getRepositoryValue())) && !("tSAPOutput".equals(node.getComponent().getName()) && param.getName().equals(UpdatesConstants.MAPPING)) && !("tFileInputEBCDIC".equals(node.getComponent().getName()) && "DATA_FILE".equals(repositoryValue))) {
param.setRepositoryValueUsed(true);
if (!(EParameterName.DB_VERSION.getName()).equals(param.getName())) {
param.setReadOnly(true);
}
}
}
}
// feature 19312
if (propName.contains(EParameterName.USE_DYNAMIC_JOB.getName()) && newValue.equals(false)) {
IElementParameter processParam = elem.getElementParameter(EParameterName.PROCESS.getName());
IElementParameter processTypeParameter = elem.getElementParameter(EParameterName.PROCESS_TYPE_PROCESS.getName());
//$NON-NLS-1$
final String parentName = processParam.getName() + ":";
//$NON-NLS-1$
elem.setPropertyValue(parentName + processTypeParameter.getName(), "");
//$NON-NLS-1$
elem.setPropertyValue(processParam.getName(), "");
}
if (propName.contains(EParameterName.PROCESS_TYPE_PROCESS.getName())) {
boolean isSelectUseDynamic = false;
IElementParameter useDynamicJobParameter = elem.getElementParameter(EParameterName.USE_DYNAMIC_JOB.getName());
if (useDynamicJobParameter != null && useDynamicJobParameter instanceof IElementParameter) {
Object useDynamicJobValue = useDynamicJobParameter.getValue();
if (useDynamicJobValue != null && useDynamicJobValue instanceof Boolean) {
isSelectUseDynamic = (Boolean) useDynamicJobValue;
}
}
if (isSelectUseDynamic) {
StringBuffer labels = new StringBuffer("");
if (newValue != null) {
String[] strValues = newValue.toString().split(";");
for (int i = 0; i < strValues.length; i++) {
String strValue = strValues[i];
// newValue is the id of the job
ProcessItem processItem = ItemCacheManager.getProcessItem(strValue);
if (processItem != null) {
String label = processItem.getProperty().getLabel();
if (i > 0) {
labels.append(";");
}
labels.append(label);
}
}
}
currentParam.getParentParameter().setValue(labels.toString());
} else {
// newValue is the id of the job
ProcessItem processItem = ItemCacheManager.getProcessItem((String) newValue);
if (processItem != null) {
currentParam.getParentParameter().setValue(processItem.getProperty().getLabel());
}
}
}
if (propName.contains(EParameterName.PROCESS_TYPE_VERSION.getName())) {
// newValue is the id of the job
// hywang add for feature 6549
// 1.to see current component if is a jobletComponent by "elem"
boolean isJobletComponent = false;
// Node jobletNode = null;
IJobletProviderService service = null;
if (PluginChecker.isJobLetPluginLoaded()) {
service = (IJobletProviderService) GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
}
if (elem instanceof Node) {
// jobletNode = (Node) elem;
if (service != null) {
isJobletComponent = service.isJobletComponent((Node) elem);
}
}
if (isJobletComponent) {
// 2.if it is a jobletcomponent,reload the component by the version
String id = service.getJobletComponentItem((Node) elem).getId();
String version = (String) newValue;
IComponent newComponent = service.setPropertyForJobletComponent(id, version);
reloadNode((Node) elem, newComponent);
} else {
IElementParameter processIdParam = currentParam.getParentParameter().getChildParameters().get(EParameterName.PROCESS_TYPE_PROCESS.getName());
ProcessItem processItem = ItemCacheManager.getProcessItem((String) processIdParam.getValue(), (String) newValue);
if (processItem != null) {
currentParam.getParentParameter().setValue(processItem.getProperty().getLabel());
}
}
}
if (propName.contains(EParameterName.PROCESS_TYPE_CONTEXT.getName())) {
if (elem instanceof Node) {
Node node = (Node) elem;
List<IContext> listContext = node.getProcess().getContextManager().getListContext();
List<String> values = new ArrayList<String>();
for (IContext context : listContext) {
values.add(context.getName());
}
currentParam.setListItemsDisplayName(values.toArray(new String[0]));
currentParam.setListItemsValue(values.toArray(new String[0]));
currentParam.setValue(newValue);
}
}
if (propName.equals(EParameterName.VALIDATION_RULES.getName())) {
if (elem instanceof INode) {
ValidationRulesUtil.createRejectConnector((INode) elem);
ValidationRulesUtil.updateRejectMetatable((INode) elem, null);
if (newValue != null && (!(Boolean) newValue)) {
ValidationRulesUtil.removeRejectConnector((INode) elem);
ValidationRulesUtil.removeRejectConnection((INode) elem);
}
}
}
String dbType = "";
if (newValue instanceof String) {
dbType = (String) newValue;
}
IElementParameter schemaParameter = null;
if (propName.equals(EParameterName.DB_TYPE.getName())) {
IElementParameter elementParameter = elem.getElementParameter(EParameterName.DB_VERSION.getName());
schemaParameter = elem.getElementParameter(EParameterName.SCHEMA_DB.getName());
JobSettingVersionUtil.setDbVersion(elementParameter, dbType, true);
DesignerUtilities.setSchemaDB(schemaParameter, newValue);
} else if (propName.equals(JobSettingsConstants.getExtraParameterName(EParameterName.DB_TYPE.getName()))) {
IElementParameter elementParameter = elem.getElementParameter(JobSettingsConstants.getExtraParameterName(EParameterName.DB_VERSION.getName()));
schemaParameter = elem.getElementParameter(JobSettingsConstants.getExtraParameterName(EParameterName.SCHEMA_DB.getName()));
JobSettingVersionUtil.setDbVersion(elementParameter, dbType, true);
DesignerUtilities.setSchemaDB(schemaParameter, newValue);
}
// Some DB not need fill the schema parameter for the JobSetting View "Extra" ,"Stats&Logs"
if (schemaParameter != null && !schemaParameter.isShow(elem.getElementParameters()) && !schemaParameter.getValue().equals("")) {
schemaParameter.setValue("");
}
if (!toUpdate && (currentParam.getFieldType().equals(EParameterFieldType.RADIO) || currentParam.getFieldType().equals(EParameterFieldType.CLOSED_LIST) || currentParam.getFieldType().equals(EParameterFieldType.OPENED_LIST) || currentParam.getFieldType().equals(EParameterFieldType.CHECK) || currentParam.getFieldType().equals(EParameterFieldType.AS400_CHECK) || currentParam.getFieldType().equals(EParameterFieldType.COMPONENT_LIST))) {
toUpdate = false;
setDefaultValues(currentParam, elem);
}
if (currentParam.getName().equals(EParameterName.PROCESS_TYPE_PROCESS.getName())) {
toUpdate = true;
}
if (toUpdate) {
elem.setPropertyValue(updataComponentParamName, Boolean.TRUE);
}
// see bug 9151:100% CPU when typing text.
if (getNewValue() instanceof String && elem instanceof INode) {
INode curNode = (INode) elem;
String uniqueName = curNode.getUniqueName();
IProcess process = curNode.getProcess();
if (process != null && process instanceof IProcess2) {
IProcess2 process2 = (IProcess2) process;
List<? extends INode> generatingNodes = null;
if (process2.isProcessModified()) {
process2.setProcessModified(false);
generatingNodes = process2.getGeneratingNodes();
if (generatingNodes != null) {
for (INode genNode : new ArrayList<INode>(generatingNodes)) {
if (genNode.getUniqueName().equals(uniqueName)) {
IElementParameter genParam = genNode.getElementParameter(propName);
if (genParam != null) {
genParam.setValue(newValue);
break;
}
}
}
}
process2.setProcessModified(true);
codeViewUpdater.startIfExecutable(elem);
}
}
}
updateRelativeNodesIfNeeded(currentParam);
checkProcess.startIfExecutable(elem);
// See feature 3902
if (needUpdateMonitorConnection()) {
((Connection) elem).setMonitorConnection((Boolean) currentParam.getValue());
}
refreshMR(propName);
}
Aggregations