use of org.talend.core.model.properties.ConnectionItem in project tesb-studio-se by Talend.
the class CreateNewJobAction method repositoryChange.
private void repositoryChange(RepositoryNode nodeOperation, Node nodeProviderRequest) {
IElementParameter param = nodeProviderRequest.getElementParameterFromField(EParameterFieldType.PROPERTY_TYPE);
if (param != null) {
param.getChildParameters().get(EParameterName.PROPERTY_TYPE.getName()).setValue(EmfComponent.REPOSITORY);
ConnectionItem connectionItem = (ConnectionItem) nodeOperation.getObject().getProperty().getItem();
String serviceId = connectionItem.getProperty().getId();
String portId = ((PortRepositoryObject) nodeOperation.getParent().getObject()).getId();
String operationId = ((OperationRepositoryObject) nodeOperation.getObject()).getId();
ChangeValuesFromRepository command2 = new ChangeValuesFromRepository(nodeProviderRequest, connectionItem.getConnection(), param.getName() + ':' + EParameterName.REPOSITORY_PROPERTY_TYPE.getName(), //$NON-NLS-1$
serviceId + " - " + portId + " - " + operationId);
command2.execute();
}
}
use of org.talend.core.model.properties.ConnectionItem in project tesb-studio-se by Talend.
the class PublishMetadataRunnable method initFileConnection.
private Collection<XmlFileConnectionItem> initFileConnection() throws URISyntaxException, PersistenceException {
Collection<String> paths = getAllPaths();
Collection<XmlFileConnectionItem> connItems = new ArrayList<XmlFileConnectionItem>();
for (ConnectionItem item : DesignerPlugin.getDefault().getProxyRepositoryFactory().getMetadataConnectionsItem()) {
if (item instanceof XmlFileConnectionItem && paths.contains(item.getState().getPath()) && !ConnectionHelper.getTables(item.getConnection()).isEmpty()) {
connItems.add((XmlFileConnectionItem) item);
}
}
return connItems;
}
use of org.talend.core.model.properties.ConnectionItem in project tesb-studio-se by Talend.
the class ESBService method copyJobForService.
private Item copyJobForService(final Item item, final IPath path, final String newName) {
try {
final Item newItem = ProxyRepositoryFactory.getInstance().copy(item, path, newName);
if (newItem instanceof ConnectionItem) {
Connection connection = ((ConnectionItem) newItem).getConnection();
if (connection != null) {
connection.setLabel(newName);
connection.setName(newName);
connection.getSupplierDependency().clear();
}
}
ProxyRepositoryFactory.getInstance().save(newItem);
return newItem;
} catch (PersistenceException e) {
ExceptionHandler.process(e);
} catch (BusinessException e) {
ExceptionHandler.process(e);
}
return null;
}
use of org.talend.core.model.properties.ConnectionItem in project tesb-studio-se by Talend.
the class AssignJobAction method repositoryChangeToBuildIn.
private void repositoryChangeToBuildIn(RepositoryNode repNode, INode node) {
IElementParameter param = node.getElementParameterFromField(EParameterFieldType.PROPERTY_TYPE);
ConnectionItem connectionItem = (ConnectionItem) repNode.getObject().getProperty().getItem();
if (param != null) {
param.getChildParameters().get(EParameterName.PROPERTY_TYPE.getName()).setValue(EmfComponent.BUILTIN);
ChangeValuesFromRepository command2 = new ChangeValuesFromRepository(node, connectionItem.getConnection(), param.getName() + ":" + EParameterName.PROPERTY_TYPE.getName(), //$NON-NLS-1$
EmfComponent.BUILTIN);
command2.execute();
command2 = new ChangeValuesFromRepository(node, connectionItem.getConnection(), param.getName() + ":" + EParameterName.REPOSITORY_PROPERTY_TYPE.getName(), //$NON-NLS-1$
"");
command2.execute();
}
}
use of org.talend.core.model.properties.ConnectionItem 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