use of org.talend.designer.core.ui.views.properties.MultipleThreadDynamicComposite in project tdi-studio-se by Talend.
the class JobSettingsView method createTabComposite.
private IDynamicProperty createTabComposite(Composite parent, Object data, EComponentCategory category) {
final int style = SWT.H_SCROLL | SWT.V_SCROLL | SWT.NO_FOCUS;
IDynamicProperty dynamicComposite = null;
if (EComponentCategory.EXTRA.equals(category)) {
// achen modify to fix bug 0006241
Process process = getElement();
boolean isJoblet = AbstractProcessProvider.isExtensionProcessForJoblet(process);
if (isJoblet) {
dynamicComposite = new MultipleThreadDynamicComposite(parent, style, category, (Element) data, true);
} else {
dynamicComposite = new ExtraComposite(parent, style, category, (Element) data, true);
CoreUIPlugin.setCSSId(dynamicComposite.getComposite(), //$NON-NLS-1$
"org-talend-designer-core-ui-views-jobsettings-JobSettingsView-ExtraComposite");
}
} else if (EComponentCategory.STATSANDLOGS.equals(category)) {
dynamicComposite = new StatsAndLogsComposite(parent, style, category, (Element) data);
CoreUIPlugin.setCSSId(dynamicComposite.getComposite(), //$NON-NLS-1$
"org-talend-designer-core-ui-views-jobsettings-JobSettingsView-StatsAndLogsComposite");
} else if (EComponentCategory.CONTEXT.equals(category)) {
// TODO
// dynamicComposite = new ContextDynamicComposite(parent, style, category, element);
} else if (EComponentCategory.MAIN.equals(category)) {
dynamicComposite = new MainComposite(parent, SWT.NONE, tabFactory, (IRepositoryViewObject) data);
} else if (EComponentCategory.VERSIONS.equals(category)) {
if (allowVerchange) {
dynamicComposite = new ProcessVersionComposite(parent, SWT.NONE, tabFactory.getWidgetFactory(), (IRepositoryViewObject) data);
}
} else if (EComponentCategory.HEADERFOOTER.equals(category)) {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IHeaderFooterProviderService.class)) {
IHeaderFooterProviderService headerFooterService = (IHeaderFooterProviderService) GlobalServiceRegister.getDefault().getService(IHeaderFooterProviderService.class);
if (headerFooterService.isVisible()) {
dynamicComposite = new HeaderFooterComposite(parent, SWT.NONE, tabFactory.getWidgetFactory(), (IRepositoryViewObject) data);
}
}
} else if (EComponentCategory.SVNHISTORY.equals(category) && svnUIService != null) {
dynamicComposite = svnUIService.createProcessSVNHistoryComposite(parent, tabFactory.getWidgetFactory(), (IRepositoryViewObject) data);
} else if (EComponentCategory.GITHISTORY.equals(category) && gitUIService != null) {
dynamicComposite = gitUIService.createProcessGitHistoryComposite(parent, this, tabFactory.getWidgetFactory(), (IRepositoryViewObject) data);
} else if (EComponentCategory.APPEARANCE.equals(category)) {
dynamicComposite = (IDynamicProperty) CorePlugin.getDefault().getDiagramModelService().getBusinessAppearanceComposite(parent, SWT.NONE, tabFactory.getWidgetFactory(), selectedModel);
} else if (EComponentCategory.RULERS_AND_GRID.equals(category)) {
dynamicComposite = (IDynamicProperty) CorePlugin.getDefault().getDiagramModelService().getBusinessRulersAndGridComposite(parent, SWT.NONE, tabFactory.getWidgetFactory(), null);
} else if (EComponentCategory.ASSIGNMENT.equals(category)) {
dynamicComposite = (IDynamicProperty) CorePlugin.getDefault().getDiagramModelService().getBusinessAssignmentComposite(parent, SWT.NONE, tabFactory.getWidgetFactory(), selectedModel);
} else if (EComponentCategory.DEPLOYMENT.equals(category)) {
dynamicComposite = new DeploymentComposite(parent, SWT.NONE, tabFactory.getWidgetFactory(), (IRepositoryViewObject) data);
}
if (dynamicComposite != null) {
dynamicComposite.refresh();
}
currentSelectedTab.setPropertyComposite(dynamicComposite);
return dynamicComposite;
}
use of org.talend.designer.core.ui.views.properties.MultipleThreadDynamicComposite in project tdi-studio-se by Talend.
the class ProcessView method createDynamicComposite.
public void createDynamicComposite(Composite parent, Element element, EComponentCategory category) {
contextComposite.setVisible(true);
moveButton.setVisible(true);
if (moveButton.getText().equals(">>")) {
//$NON-NLS-1$
sash.setWeights(new int[] { 18, 5 });
} else if (moveButton.getText().equals("<<")) {
//$NON-NLS-1$
sash.setWeights(new int[] { 23, 1 });
}
if (category == EComponentCategory.BASICRUN) {
processComposite = new ProcessComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.NO_FOCUS);
dc = processComposite;
} else if (category == EComponentCategory.DEBUGRUN) {
debugTisProcessComposite = this.debugViewHelper.getDebugComposite(parent);
// CSS
CoreUIPlugin.setCSSClass(debugTisProcessComposite, TraceDebugProcessComposite.class.getSimpleName());
dc = debugTisProcessComposite;
} else if (category == EComponentCategory.ADVANCESETTING) {
advanceComposite = new AdvanceSettingComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.NO_FOCUS);
dc = advanceComposite;
} else if (category == EComponentCategory.TARGET) {
targetComposite = new TargetExecComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.NO_FOCUS);
dc = targetComposite;
} else if (category == EComponentCategory.MEMORYRUN) {
memoryRunComposite = new MemoryRuntimeComposite(findProcessView(), parent, processContext, SWT.H_SCROLL | SWT.V_SCROLL | SWT.NO_FOCUS);
dc = memoryRunComposite;
contextComposite.setVisible(false);
moveButton.setVisible(false);
sash.setWeights(new int[] { 90, 1 });
}
if (EComponentCategory.MAPREDUCE_JOB_CONFIG_FOR_HADOOP.equals(category) || EComponentCategory.STORM_JOB_CONFIG.equals(category) || EComponentCategory.SPARK_JOB_CONFIG.equals(category)) {
if (processContext != null) {
dc = new MultipleThreadDynamicComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.NO_FOCUS, category, (Element) processContext.getProcess(), true, Display.getCurrent().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
// CSS
CoreUIPlugin.setCSSClass(dc, dc.getClass().getSimpleName());
} else {
dc = null;
}
sash.setWeights(new int[] { 24, 0 });
}
refresh();
if (dc != null) {
dc.refresh();
}
}
use of org.talend.designer.core.ui.views.properties.MultipleThreadDynamicComposite in project tdi-studio-se by Talend.
the class PropertyTypeController method createButtonCommand.
/*
* (non-Javadoc)
*
* @see
* org.talend.designer.core.ui.editor.properties.controllers.AbstractRepositoryController#createControl(org.eclipse
* .swt.widgets.Composite, org.talend.core.model.process.IElementParameter, int, int, int,
* org.eclipse.swt.widgets.Control)
*/
@Override
protected Command createButtonCommand(Button button) {
// hwang add for feature 6484
FileItem repositoryFileItem = null;
LinkRulesItem linkItem = null;
Map<String, FileItem> repositoryFileItemMap = null;
Map<String, LinkRulesItem> repositoryLinkRulesItemMap = null;
String paramName = (String) button.getData(PARAMETER_NAME);
IElementParameter param = elem.getElementParameter(paramName);
Object data = button.getData(NAME);
if (data != null && data.equals(REPOSITORY_CHOICE)) {
IElementParameter dbTypeParam = null;
if (elem instanceof org.talend.designer.core.ui.editor.process.Process || elem instanceof StatsAndLogsElement || elem instanceof ImplicitContextLoadElement) {
if (EParameterName.PROPERTY_TYPE.getName().equals(paramName)) {
dbTypeParam = elem.getElementParameter(EParameterName.DB_TYPE.getName());
} else if (JobSettingsConstants.getExtraParameterName(EParameterName.PROPERTY_TYPE.getName()).equals(paramName)) {
dbTypeParam = elem.getElementParameter(JobSettingsConstants.getExtraParameterName(EParameterName.DB_TYPE.getName()));
}
}
Item item = null;
String id = null;
RepositoryNode selectNode = null;
if (id == null) {
RepositoryReviewDialog dialog = null;
if (dbTypeParam != null) {
String[] listRepositoryItems = dbTypeParam.getListRepositoryItems();
dialog = new RepositoryReviewDialog(Display.getCurrent().getActiveShell(), ERepositoryObjectType.METADATA, param.getRepositoryValue(), listRepositoryItems);
} else {
// Added TDQ-11688
ITDQPatternService service = null;
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITDQPatternService.class)) {
service = (ITDQPatternService) GlobalServiceRegister.getDefault().getService(ITDQPatternService.class);
}
if (service != null && service.isSinglePatternNode(elem)) {
return processPattern(elem);
}
// ~
dialog = new RepositoryReviewDialog(Display.getCurrent().getActiveShell(), ERepositoryObjectType.METADATA, elem, param);
}
if (dialog.open() == RepositoryReviewDialog.OK) {
selectNode = dialog.getResult();
id = selectNode.getObject().getId();
}
}
if (id != null && !"".equals(id)) {
//$NON-NLS-1$
IElementParameter repositoryParam = param.getChildParameters().get(EParameterName.REPOSITORY_PROPERTY_TYPE.getName());
//$NON-NLS-1$
String fullParamName = paramName + ":" + getRepositoryChoiceParamName();
Connection repositoryConnection = null;
// Map<String, ConnectionItem> repositoryConnectionItemMap =
// dynamicProperty.getRepositoryConnectionItemMap();
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
try {
IRepositoryViewObject repobj = factory.getLastVersion(id);
if (repobj != null) {
Property property = repobj.getProperty();
if (property != null) {
item = property.getItem();
}
}
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
if (item != null) {
if (item instanceof ConnectionItem) {
repositoryConnection = ((ConnectionItem) item).getConnection();
}
} else {
repositoryConnection = null;
if (repositoryParam != null) {
item = selectNode.getObject().getProperty().getItem();
if (item instanceof ConnectionItem) {
repositoryConnection = ((ConnectionItem) item).getConnection();
}
}
}
if (repositoryConnection != null) {
CompoundCommand compoundCommand = new CompoundCommand();
ChangeValuesFromRepository changeValuesFromRepository = null;
if (selectNode.getObjectType() == ERepositoryObjectType.SERVICESOPERATION && GlobalServiceRegister.getDefault().isServiceRegistered(IESBService.class)) {
IESBService service = (IESBService) GlobalServiceRegister.getDefault().getService(IESBService.class);
IProcess2 process = (IProcess2) RepositoryPlugin.getDefault().getDesignerCoreService().getCurrentProcess();
String currentJobId = process.getProperty().getId();
String serviceId = item.getProperty().getId();
String portId = selectNode.getParent().getObject().getId();
String operationId = selectNode.getObject().getId();
changeValuesFromRepository = new ChangeValuesFromRepository(elem, repositoryConnection, param.getName() + ":" + //$NON-NLS-1$
EParameterName.REPOSITORY_PROPERTY_TYPE.getName(), //$NON-NLS-1$ //$NON-NLS-2$
serviceId + " - " + portId + " - " + operationId);
service.deleteOldRelation(currentJobId);
//$NON-NLS-1$ //$NON-NLS-2$
service.updateOperation((INode) elem, serviceId + " - " + portId + " - " + operationId, selectNode);
} else {
changeValuesFromRepository = new ChangeValuesFromRepository(elem, repositoryConnection, fullParamName, id);
}
if (changeValuesFromRepository != null) {
compoundCommand.add(changeValuesFromRepository);
}
updateDBType(compoundCommand, repositoryConnection);
return compoundCommand;
}
// for ruleItem,hywang add
if (dynamicProperty instanceof MultipleThreadDynamicComposite) {
repositoryFileItemMap = ((MultipleThreadDynamicComposite) dynamicProperty).getRepositoryFileItemMap();
repositoryLinkRulesItemMap = ((MultipleThreadDynamicComposite) dynamicProperty).getRepositoryLinkRulesItemMap();
}
if (repositoryFileItemMap.containsKey(id)) {
repositoryFileItem = repositoryFileItemMap.get(id);
} else if (repositoryLinkRulesItemMap.containsKey(id)) {
linkItem = repositoryLinkRulesItemMap.get(id);
} else {
if (!repositoryFileItemMap.isEmpty()) {
repositoryFileItem = repositoryFileItemMap.values().iterator().next();
} else {
repositoryFileItem = null;
}
}
if (repositoryFileItem == null && item instanceof FileItem) {
repositoryFileItem = (FileItem) item;
}
if (repositoryFileItem != null) {
CompoundCommand compoundCommand = new CompoundCommand();
final String showId = repositoryFileItem.getProperty().getId();
Command command = new PropertyChangeCommand(elem, EParameterName.REPOSITORY_PROPERTY_TYPE.getName(), showId);
compoundCommand.add(command);
return compoundCommand;
}
if (linkItem != null) {
CompoundCommand compoundCommand = new CompoundCommand();
final String showId = linkItem.getProperty().getId();
Command command = new PropertyChangeCommand(elem, EParameterName.REPOSITORY_PROPERTY_TYPE.getName(), showId);
compoundCommand.add(command);
return compoundCommand;
}
}
} else {
// 1. open wizard
if (elem instanceof INode) {
INode node = (INode) elem;
final IRepositoryService repositoryService = CorePlugin.getDefault().getRepositoryService();
if (param != null) {
RepositoryNode realNode = null;
String repositoryValue = param.getRepositoryValue();
if (repositoryValue != null && repositoryValue.startsWith(ERepositoryCategoryType.DATABASE.getName())) {
realNode = (RepositoryNode) repositoryService.getRootRepositoryNode(ERepositoryObjectType.METADATA_CONNECTIONS);
} else // file delimited
if (ERepositoryCategoryType.DELIMITED.getName().equals(repositoryValue)) {
realNode = (RepositoryNode) repositoryService.getRootRepositoryNode(ERepositoryObjectType.METADATA_FILE_DELIMITED);
}
// file positional
if (ERepositoryCategoryType.POSITIONAL.getName().equals(repositoryValue)) {
realNode = (RepositoryNode) repositoryService.getRootRepositoryNode(ERepositoryObjectType.METADATA_FILE_POSITIONAL);
}
// file regexp
if (ERepositoryCategoryType.REGEX.getName().equals(repositoryValue)) {
realNode = (RepositoryNode) repositoryService.getRootRepositoryNode(ERepositoryObjectType.METADATA_FILE_REGEXP);
}
// file xml
if (ERepositoryCategoryType.XML.getName().equals(repositoryValue) || // bug 18012
repositoryValue.startsWith(ERepositoryCategoryType.XML.getName())) {
realNode = (RepositoryNode) repositoryService.getRootRepositoryNode(ERepositoryObjectType.METADATA_FILE_XML);
}
// file ldif
if (ERepositoryCategoryType.LDIF.getName().equals(repositoryValue)) {
realNode = (RepositoryNode) repositoryService.getRootRepositoryNode(ERepositoryObjectType.METADATA_FILE_LDIF);
}
// excel
if (ERepositoryCategoryType.EXCEL.getName().equals(repositoryValue)) {
realNode = (RepositoryNode) repositoryService.getRootRepositoryNode(ERepositoryObjectType.METADATA_FILE_EXCEL);
}
// generic schema
if (ERepositoryCategoryType.GENERIC.getName().equals(repositoryValue)) {
realNode = (RepositoryNode) repositoryService.getRootRepositoryNode(ERepositoryObjectType.METADATA_GENERIC_SCHEMA);
}
// ldap
if (ERepositoryCategoryType.LDAP.getName().equals(repositoryValue)) {
realNode = (RepositoryNode) repositoryService.getRootRepositoryNode(ERepositoryObjectType.METADATA_LDAP_SCHEMA);
}
// wsdl
if (ERepositoryCategoryType.WSDL.getName().equals(repositoryValue)) {
realNode = (RepositoryNode) repositoryService.getRootRepositoryNode(ERepositoryObjectType.METADATA_WSDL_SCHEMA);
}
if (ERepositoryCategoryType.WEBSERVICE.getName().equals(repositoryValue)) {
realNode = (RepositoryNode) repositoryService.getRootRepositoryNode(ERepositoryObjectType.METADATA_WSDL_SCHEMA);
}
// salesforce
if (ERepositoryCategoryType.SALESFORCE.getName().equals(repositoryValue)) {
realNode = (RepositoryNode) repositoryService.getRootRepositoryNode(ERepositoryObjectType.METADATA_SALESFORCE_SCHEMA);
}
// ebcdic
if (ERepositoryCategoryType.EBCDIC.getName().equals(repositoryValue)) {
realNode = (RepositoryNode) repositoryService.getRootRepositoryNode(ERepositoryObjectType.METADATA_FILE_EBCDIC);
}
// mdm
if (ERepositoryCategoryType.MDM.getName().equals(repositoryValue)) {
realNode = (RepositoryNode) repositoryService.getRootRepositoryNode(ERepositoryObjectType.METADATA_MDMCONNECTION);
}
// sap
if (ERepositoryCategoryType.SAP.getName().equals(repositoryValue)) {
realNode = (RepositoryNode) repositoryService.getRootRepositoryNode(ERepositoryObjectType.METADATA_SAPCONNECTIONS);
}
// sapIDoc
if (ERepositoryCategoryType.SAPIDOC.getName().equals(repositoryValue)) {
realNode = (RepositoryNode) repositoryService.getRootRepositoryNode(ERepositoryObjectType.METADATA_SAP_IDOC);
}
if (ERepositoryCategoryType.HEADERFOOTER.getName().equals(repositoryValue)) {
realNode = (RepositoryNode) repositoryService.getRootRepositoryNode(ERepositoryObjectType.METADATA_HEADER_FOOTER);
}
// brms
if (ERepositoryCategoryType.BRMS.getName().equals(repositoryValue)) {
realNode = (RepositoryNode) repositoryService.getRootRepositoryNode(ERepositoryObjectType.METADATA_FILE_BRMS);
}
// hl7
if (ERepositoryCategoryType.HL7.getName().equals(repositoryValue)) {
realNode = (RepositoryNode) repositoryService.getRootRepositoryNode(ERepositoryObjectType.METADATA_FILE_HL7);
}
// last resort we assume that the repository value was named after the root component type key
if (realNode == null) {
realNode = (RepositoryNode) repositoryService.getRootRepositoryNode(ERepositoryObjectType.getTypeFromKey(repositoryValue));
}
if (realNode != null) {
final IMetadataService metadataService = CorePlugin.getDefault().getMetadataService();
if (metadataService != null) {
ConnectionItem connItem = metadataService.openMetadataConnection(true, realNode, node);
if (connItem != null) {
IElementParameter propertyParam = elem.getElementParameterFromField(EParameterFieldType.PROPERTY_TYPE);
propertyParam.getChildParameters().get(EParameterName.PROPERTY_TYPE.getName()).setValue(EmfComponent.REPOSITORY);
// 2. commnd
Command cmd = new ChangeValuesFromRepository(node, connItem.getConnection(), //$NON-NLS-1$
propertyParam.getName() + ":" + EParameterName.REPOSITORY_PROPERTY_TYPE.getName(), connItem.getProperty().getId());
executeCommand(cmd);
// see bug in feature 5998.refresh repositoryList.
if (dynamicProperty instanceof MultipleThreadDynamicComposite) {
((MultipleThreadDynamicComposite) dynamicProperty).updateRepositoryList();
}
}
}
}
}
}
}
return null;
}
use of org.talend.designer.core.ui.views.properties.MultipleThreadDynamicComposite in project tdi-studio-se by Talend.
the class ProcessView method refresh.
public void refresh() {
RunProcessContext activeContext = RunProcessPlugin.getDefault().getRunProcessContextManager().getActiveContext();
boolean disableAll = false;
if (activeContext != null) {
disableAll = activeContext.getProcess().disableRunJobView();
}
processContext = activeContext;
rubjobManager.setProcessContext(processContext);
// }
if (contextComposite.isDisposed()) {
return;
}
if (activeContext != null && !activeContext.getProcess().getComponentsType().equals(oldJobType)) {
oldJobType = activeContext.getProcess().getComponentsType();
setElement();
}
contextComposite.setProcess(((activeContext != null) && !disableAll ? activeContext.getProcess() : null));
// clearPerfAction.setProcess(activeContext != null ? activeContext.getProcess() : null);
rubjobManager.setSelectContext(contextComposite.getSelectedContext());
if (activeContext != null) {
activeContext.setSelectedContext(contextComposite.getSelectedContext());
}
if (dc != null && dc == processComposite) {
processComposite.setProcessContext(activeContext);
} else if (dc != null && dc == debugTisProcessComposite) {
debugTisProcessComposite.setProcessContext(activeContext);
debugTisProcessComposite.setContextComposite(this.contextComposite);
} else if (dc != null && dc == advanceComposite) {
advanceComposite.setProcessContext(activeContext);
} else if (dc != null && dc == targetComposite) {
targetComposite.setProcessContext(activeContext);
} else if (dc != null && dc == memoryRunComposite) {
memoryRunComposite.setProcessContext(activeContext);
} else if (dc != null) {
if (processContext != null && processContext.getProcess() != null) {
if (dc instanceof MultipleThreadDynamicComposite) {
if (dc.getElement() != processContext.getProcess()) {
for (Control curControl : tabFactory.getTabComposite().getChildren()) {
curControl.dispose();
}
dc = new MultipleThreadDynamicComposite(tabFactory.getTabComposite(), SWT.H_SCROLL | SWT.V_SCROLL | SWT.NO_FOCUS, currentSelectedTab.getCategory(), (Element) processContext.getProcess(), true, Display.getCurrent().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
}
dc.refresh();
}
}
if (processContext == null || processContext.getProcess() == null) {
for (Control curControl : tabFactory.getTabComposite().getChildren()) {
curControl.dispose();
}
}
}
if (activeContext != null) {
//$NON-NLS-1$
String jobName = Messages.getString("ProcessView.jobName");
if (activeContext.getProcess().disableRunJobView()) {
// ?? joblet
//$NON-NLS-1$
jobName = "Joblet";
}
//$NON-NLS-1$
jobName = jobName + " " + activeContext.getProcess().getLabel();
setTitleToolTip(jobName);
//$NON-NLS-1$
setPartName(Messages.getString("ProcessView.title", jobName));
// processNameLab.setText(jobName);
tabFactory.setTitle(jobName, null);
} else {
//$NON-NLS-1$
setPartName(Messages.getString("ProcessView.titleEmpty"));
//processNameLab.setText(Messages.getString("ProcessView.subtitleEmpty")); //$NON-NLS-1$
tabFactory.setTitle(Messages.getString("ProcessView.subtitleEmpty"), null);
}
// processNameLab.getParent().layout(true, true);
}
use of org.talend.designer.core.ui.views.properties.MultipleThreadDynamicComposite in project tdi-studio-se by Talend.
the class PropertyTypeController method createComboCommand.
/*
* (non-Javadoc)
*
* @see
* org.talend.designer.core.ui.editor.properties.controllers.AbstractRepositoryController#createComboCommand(org
* .eclipse.swt.custom.CCombo)
*/
@Override
protected Command createComboCommand(CCombo combo) {
Connection repositoryConnection = null;
ConnectionItem repositoryConnectionItem = null;
// hwang add
FileItem repositoryFileItem = null;
String paramName = (String) combo.getData(PARAMETER_NAME);
IElementParameter param = elem.getElementParameter(paramName);
String value = combo.getText();
for (int j = 0; j < param.getListItemsValue().length; j++) {
if (combo.getText().equals(param.getListItemsDisplayName()[j])) {
value = (String) param.getListItemsValue()[j];
}
}
if (value.equals(param.getValue())) {
return null;
}
// Map<String, ConnectionItem> repositoryConnectionItemMap = null;
IElementParameter repositoryParam = null;
// hywang add for feature 6484
Map<String, FileItem> repositoryFileItemMap = null;
if (value.equals(EmfComponent.REPOSITORY)) {
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
if (dynamicProperty instanceof MultipleThreadDynamicComposite) {
repositoryFileItemMap = ((MultipleThreadDynamicComposite) dynamicProperty).getRepositoryFileItemMap();
}
repositoryParam = param.getParentParameter().getChildParameters().get(EParameterName.REPOSITORY_PROPERTY_TYPE.getName());
String connectionSelected = (String) repositoryParam.getValue();
// if (repositoryConnectionItemMap.containsKey(connectionSelected)) {
try {
Item item = null;
if (!StringUtils.isEmpty(connectionSelected)) {
IRepositoryViewObject repobj = factory.getLastVersion(connectionSelected);
if (repobj != null) {
Property property = repobj.getProperty();
if (property != null) {
item = property.getItem();
}
}
if (item != null && item instanceof ConnectionItem) {
repositoryConnectionItem = (ConnectionItem) factory.getLastVersion(connectionSelected).getProperty().getItem();
repositoryConnection = repositoryConnectionItem.getConnection();
} else {
repositoryConnection = null;
}
}
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
// for ruleItem,hywang add
if (repositoryFileItemMap.containsKey(connectionSelected)) {
repositoryFileItem = repositoryFileItemMap.get(connectionSelected);
} else {
if (!repositoryFileItemMap.isEmpty()) {
repositoryFileItem = repositoryFileItemMap.values().iterator().next();
} else {
repositoryFileItem = null;
}
}
}
CompoundCommand cc = new CompoundCommand();
if (repositoryConnectionItem != null) {
initCDC(cc, repositoryConnectionItem);
}
ChangeValuesFromRepository changeValuesFromRepository1 = new ChangeValuesFromRepository(elem, repositoryConnection, paramName, value);
cc.add(changeValuesFromRepository1);
if (repositoryConnection != null) {
ChangeValuesFromRepository changeValuesFromRepository2 = new ChangeValuesFromRepository(elem, repositoryConnection, repositoryParam.getParentParameter().getName() + ":" + repositoryParam.getName(), //$NON-NLS-1$
repositoryConnectionItem.getProperty().getId());
cc.add(changeValuesFromRepository2);
}
// hywang add for feature 6484
if (repositoryFileItem != null) {
final String id = repositoryFileItem.getProperty().getId();
cc.add(new Command() {
@Override
public void execute() {
IElementParameter elementParameter = elem.getElementParameter(EParameterName.PROPERTY_TYPE.getName());
if (elementParameter != null) {
elementParameter = elementParameter.getChildParameters().get(EParameterName.REPOSITORY_PROPERTY_TYPE.getName());
if (elementParameter != null) {
elementParameter.setValue(id);
}
}
}
});
}
if (value.equals(EmfComponent.REPOSITORY)) {
updateDBType(cc, repositoryConnection);
}
return cc;
}
Aggregations