Search in sources :

Example 1 with XmlFileConnectionImpl

use of org.talend.core.model.metadata.builder.connection.impl.XmlFileConnectionImpl in project tdi-studio-se by Talend.

the class ChangeValuesFromRepository method undo.

@Override
public void undo() {
    // Force redraw of Commponents propoerties
    elem.setPropertyValue(updataComponentParamName, new Boolean(true));
    if (propertyName.split(":")[1].equals(propertyTypeName) && (EmfComponent.BUILTIN.equals(value))) {
        //$NON-NLS-1$
        for (IElementParameter param : elem.getElementParameters()) {
            String repositoryValue = param.getRepositoryValue();
            if (param.isShow(elem.getElementParameters()) && (repositoryValue != null) && (!param.getName().equals(propertyTypeName))) {
                boolean paramFlag = JobSettingsConstants.isExtraParameter(param.getName());
                boolean extraFlag = JobSettingsConstants.isExtraParameter(propertyTypeName);
                if (paramFlag == extraFlag) {
                    // for job settings extra.(feature 2710)
                    param.setRepositoryValueUsed(true);
                }
            }
        }
    } else {
        for (IElementParameter param : elem.getElementParameters()) {
            String repositoryValue = param.getRepositoryValue();
            if (param.isShow(elem.getElementParameters()) && (repositoryValue != null)) {
                Object objectValue = RepositoryToComponentProperty.getValue(connection, repositoryValue, null);
                if (dragAndDropAction == true && connection instanceof XmlFileConnectionImpl) {
                    objectValue = RepositoryToComponentProperty.getXmlAndXSDFileValue((XmlFileConnection) connection, repositoryValue);
                    dragAndDropAction = false;
                }
                if (objectValue != null) {
                    elem.setPropertyValue(param.getName(), oldValues.get(param.getName()));
                    param.setRepositoryValueUsed(false);
                }
            }
        }
    }
    IElementParameter currentParam = elem.getElementParameter(propertyName);
    if (propertyName.split(":")[1].equals(propertyTypeName)) {
        //$NON-NLS-1$
        if (value.equals(EmfComponent.BUILTIN)) {
            currentParam.setValue(EmfComponent.REPOSITORY);
        } else {
            currentParam.setValue(EmfComponent.BUILTIN);
            IElementParameter schemaParam = elem.getElementParameterFromField(EParameterFieldType.SCHEMA_TYPE, currentParam.getCategory());
            if (schemaParam == null) {
                schemaParam = elem.getElementParameterFromField(EParameterFieldType.SCHEMA_REFERENCE, currentParam.getCategory());
            }
            if (schemaParam != null) {
                IElementParameter schemaType = schemaParam.getChildParameters().get(EParameterName.SCHEMA_TYPE.getName());
                schemaType.setValue(EmfComponent.BUILTIN);
            }
            IElementParameter queryParam = elem.getElementParameterFromField(EParameterFieldType.QUERYSTORE_TYPE, currentParam.getCategory());
            if (queryParam != null) {
                IElementParameter queryStoreType = queryParam.getChildParameters().get(EParameterName.QUERYSTORE_TYPE.getName());
                queryStoreType.setValue(EmfComponent.BUILTIN);
            }
        }
    } else {
        elem.setPropertyValue(propertyName, oldMetadata);
    }
    JobSettings.switchToCurJobSettingsView();
}
Also used : XmlFileConnection(org.talend.core.model.metadata.builder.connection.XmlFileConnection) IElementParameter(org.talend.core.model.process.IElementParameter) XmlFileConnectionImpl(org.talend.core.model.metadata.builder.connection.impl.XmlFileConnectionImpl)

Aggregations

XmlFileConnection (org.talend.core.model.metadata.builder.connection.XmlFileConnection)1 XmlFileConnectionImpl (org.talend.core.model.metadata.builder.connection.impl.XmlFileConnectionImpl)1 IElementParameter (org.talend.core.model.process.IElementParameter)1