Search in sources :

Example 21 with ChangeValuesFromRepository

use of org.talend.designer.core.ui.editor.cmd.ChangeValuesFromRepository in project tdi-studio-se by Talend.

the class ProjectSettingManager method reloadStatsAndLogFromProjectSettings.

public static void reloadStatsAndLogFromProjectSettings(Element process, Project pro, StatsAndLogsComposite statsComposite) {
    Element elem = createStatsAndLogsElement(pro);
    ParametersType stats = pro.getEmfProject().getStatAndLogsSettings().getParameters();
    ElementParameterType eleType = ElementParameter2ParameterType.findElementParameterType(stats, //$NON-NLS-1$
    EParameterName.PROPERTY_TYPE.getName() + ":" + EParameterName.REPOSITORY_PROPERTY_TYPE.getName());
    if (eleType != null) {
        String value = eleType.getValue();
        if (value != null && !"".equals(value) && !RepositoryNode.NO_ID.equals(value)) {
            //$NON-NLS-1$
            ElementParameterType propertyType = ElementParameter2ParameterType.findElementParameterType(stats, //$NON-NLS-1$
            EParameterName.PROPERTY_TYPE.getName() + ":" + EParameterName.PROPERTY_TYPE.getName());
            if (propertyType != null) {
                String propertyTypeValue = propertyType.getValue();
                if (//$NON-NLS-1$
                propertyTypeValue != null && !"".equals(propertyTypeValue) && !EmfComponent.BUILTIN.equals(propertyTypeValue)) {
                    IRepositoryViewObject lastVersion = UpdateRepositoryUtils.getRepositoryObjectById(value);
                    if (lastVersion == null || lastVersion.getProperty() == null || lastVersion.getProperty().getItem() == null) {
                        ChangeValuesFromRepository changeValuesFromRepository = new ChangeValuesFromRepository(elem, null, //$NON-NLS-1$
                        EParameterName.PROPERTY_TYPE.getName() + ":" + EParameterName.PROPERTY_TYPE.getName(), EmfComponent.BUILTIN);
                        changeValuesFromRepository.execute();
                        saveStatsAndLogToProjectSettings(elem, pro);
                    }
                }
            }
        }
        // load the project settings to process
        ElementParameter2ParameterType.loadElementParameters(process, stats, //$NON-NLS-1$
        EParameterName.PROPERTY_TYPE.getName() + ":" + EParameterName.PROPERTY_TYPE.getName());
    // change repository item
    // TODO
    // StatsAndLogsHelper.changeRepositoryConnection(process, statsComposite);
    }
}
Also used : ElementParameterType(org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType) ChangeValuesFromRepository(org.talend.designer.core.ui.editor.cmd.ChangeValuesFromRepository) Element(org.talend.core.model.process.Element) IElement(org.talend.core.model.process.IElement) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) ParametersType(org.talend.designer.core.model.utils.emf.talendfile.ParametersType)

Example 22 with ChangeValuesFromRepository

use of org.talend.designer.core.ui.editor.cmd.ChangeValuesFromRepository in project tesb-studio-se by Talend.

the class ESBService method repositoryChange.

private void repositoryChange(RepositoryNode repNode, INode node, IProcess2 process) {
    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.REPOSITORY);
        param.getChildParameters().get(EParameterName.REPOSITORY_PROPERTY_TYPE.getName()).setValue("");
        connectionItem.getProperty().getId();
        ((PortRepositoryObject) repNode.getParent().getObject()).getId();
        ((OperationRepositoryObject) repNode.getObject()).getId();
        ChangeValuesFromRepository command2 = new ChangeValuesFromRepository(node, null, param.getName() + ":" + EParameterName.PROPERTY_TYPE.getName(), //$NON-NLS-1$
        "BUILT_IN");
        IEditorPart editor = process.getEditor();
        if (editor == null) {
            command2.execute();
        } else {
            ((AbstractMultiPageTalendEditor) editor).getTalendEditor().getCommandStack().execute(command2);
        }
    }
}
Also used : ChangeValuesFromRepository(org.talend.designer.core.ui.editor.cmd.ChangeValuesFromRepository) ConnectionItem(org.talend.core.model.properties.ConnectionItem) AbstractMultiPageTalendEditor(org.talend.designer.core.ui.AbstractMultiPageTalendEditor) IElementParameter(org.talend.core.model.process.IElementParameter) PortRepositoryObject(org.talend.repository.services.utils.PortRepositoryObject) IEditorPart(org.eclipse.ui.IEditorPart) OperationRepositoryObject(org.talend.repository.services.utils.OperationRepositoryObject)

Example 23 with ChangeValuesFromRepository

use of org.talend.designer.core.ui.editor.cmd.ChangeValuesFromRepository in project tesb-studio-se by Talend.

the class AssignJobAction method repositoryChange.

private void repositoryChange(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.REPOSITORY);
        String serviceId = connectionItem.getProperty().getId();
        String portId = ((PortRepositoryObject) repNode.getParent().getObject()).getId();
        String operationId = ((OperationRepositoryObject) repNode.getObject()).getId();
        ChangeValuesFromRepository command2 = new ChangeValuesFromRepository(node, connectionItem.getConnection(), param.getName() + ":" + EParameterName.REPOSITORY_PROPERTY_TYPE.getName(), //$NON-NLS-1$
        serviceId + " - " + portId + " - " + operationId);
        command2.execute();
    }
}
Also used : ChangeValuesFromRepository(org.talend.designer.core.ui.editor.cmd.ChangeValuesFromRepository) ConnectionItem(org.talend.core.model.properties.ConnectionItem) IElementParameter(org.talend.core.model.process.IElementParameter) PortRepositoryObject(org.talend.repository.services.utils.PortRepositoryObject) OperationRepositoryObject(org.talend.repository.services.utils.OperationRepositoryObject)

Example 24 with ChangeValuesFromRepository

use of org.talend.designer.core.ui.editor.cmd.ChangeValuesFromRepository in project tdi-studio-se by Talend.

the class RepositoryUpdateTest method updateNodeConnectionOnly.

private void updateNodeConnectionOnly(String id, Node node, GenericConnection connection) {
    IElementParameter propertyParam = node.getElementParameterFromField(EParameterFieldType.PROPERTY_TYPE);
    propertyParam.getChildParameters().get(EParameterName.PROPERTY_TYPE.getName()).setValue(EmfComponent.REPOSITORY);
    propertyParam.getChildParameters().get(EParameterName.REPOSITORY_PROPERTY_TYPE.getName()).setValue(id);
    ChangeValuesFromRepository command = new ChangeValuesFromRepository(node, connection, null, propertyParam.getName() + ":" + EParameterName.REPOSITORY_PROPERTY_TYPE.getName(), id, //$NON-NLS-1$
    true);
    command.execute(true);
}
Also used : ChangeValuesFromRepository(org.talend.designer.core.ui.editor.cmd.ChangeValuesFromRepository) IElementParameter(org.talend.core.model.process.IElementParameter)

Aggregations

ChangeValuesFromRepository (org.talend.designer.core.ui.editor.cmd.ChangeValuesFromRepository)24 IElementParameter (org.talend.core.model.process.IElementParameter)19 ConnectionItem (org.talend.core.model.properties.ConnectionItem)18 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)14 Connection (org.talend.core.model.metadata.builder.connection.Connection)13 PersistenceException (org.talend.commons.exception.PersistenceException)11 Item (org.talend.core.model.properties.Item)10 Property (org.talend.core.model.properties.Property)9 DatabaseConnection (org.talend.core.model.metadata.builder.connection.DatabaseConnection)8 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)8 DatabaseConnectionItem (org.talend.core.model.properties.DatabaseConnectionItem)7 CompoundCommand (org.eclipse.gef.commands.CompoundCommand)5 ProcessItem (org.talend.core.model.properties.ProcessItem)5 AbstractMultiPageTalendEditor (org.talend.designer.core.ui.AbstractMultiPageTalendEditor)5 CommandStack (org.eclipse.gef.commands.CommandStack)4 CDCConnection (org.talend.core.model.metadata.builder.connection.CDCConnection)4 Element (org.talend.core.model.process.Element)4 FileItem (org.talend.core.model.properties.FileItem)4 LinkRulesItem (org.talend.core.model.properties.LinkRulesItem)4 Command (org.eclipse.gef.commands.Command)3