TUP-3619:Implementation of when the module/schema generated by the
salesforce wizard is dragged to the design surface(TUP-3462)
This commit is contained in:
@@ -2000,7 +2000,7 @@ public class Component extends AbstractComponent {
|
||||
Deserialized fromSerialized = ComponentProperties.fromSerialized(propertiesStr);
|
||||
if (fromSerialized != null) {
|
||||
ComponentProperties componentProperties = fromSerialized.properties;
|
||||
SchemaElement ses = componentProperties.getProperty(value);
|
||||
SchemaElement ses = ComponentsUtils.getGenericSchemaElement(componentProperties, value);
|
||||
if (ses != null) {
|
||||
return componentProperties.getValue(ses);
|
||||
}
|
||||
@@ -2013,7 +2013,7 @@ public class Component extends AbstractComponent {
|
||||
if (param != null) {
|
||||
ComponentProperties componentProperties = ComponentsUtils.getComponentProperties(getName());
|
||||
if (componentProperties != null) {
|
||||
SchemaElement ses = componentProperties.getProperty(param.getName());
|
||||
SchemaElement ses = ComponentsUtils.getGenericSchemaElement(componentProperties, param.getName());
|
||||
if (ses != null) {
|
||||
componentProperties.setValue(ses, param.getValue());
|
||||
return componentProperties.toSerialized();
|
||||
|
||||
@@ -276,19 +276,25 @@ public class ComponentsUtils {
|
||||
return elementParameters;
|
||||
}
|
||||
|
||||
public static Object getGenericRepositoryValue(ComponentProperties componentProperties, String value) {
|
||||
if (componentProperties == null) {
|
||||
public static SchemaElement getGenericSchemaElement(ComponentProperties componentProperties, String name) {
|
||||
SchemaElement schemaElement = null;
|
||||
if (componentProperties == null || name == null) {
|
||||
return null;
|
||||
}
|
||||
List<SchemaElement> schemaElements = componentProperties.getProperties();
|
||||
for (SchemaElement schemaElement : schemaElements) {
|
||||
if (schemaElement instanceof ComponentProperties) {
|
||||
ComponentProperties childComponentProperties = (ComponentProperties) schemaElement;
|
||||
getGenericRepositoryValue(childComponentProperties, value);
|
||||
} else if (schemaElement.getName().equals(value)) {
|
||||
return componentProperties.getValue(schemaElement);
|
||||
for (SchemaElement se : schemaElements) {
|
||||
if (name.equals(se.getName())) {
|
||||
schemaElement = se;
|
||||
break;
|
||||
}
|
||||
if (se instanceof ComponentProperties) {
|
||||
ComponentProperties childComponentProperties = (ComponentProperties) se;
|
||||
schemaElement = getGenericSchemaElement(childComponentProperties, name);
|
||||
}
|
||||
if (schemaElement != null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return schemaElement;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.utils.IComponentName;
|
||||
import org.talend.core.repository.RepositoryComponentSetting;
|
||||
import org.talend.designer.core.model.components.AbstractComponent;
|
||||
import org.talend.repository.model.RepositoryNode;
|
||||
|
||||
/**
|
||||
@@ -76,7 +77,10 @@ public class GenericDragAndDropHandler extends AbstractComponentDragAndDropHandl
|
||||
Deserialized fromSerialized = ComponentProperties.fromSerialized(compPropertiesStr);
|
||||
if (fromSerialized != null) {
|
||||
ComponentProperties componentProperties = fromSerialized.properties;
|
||||
return ComponentsUtils.getGenericRepositoryValue(componentProperties, value);
|
||||
SchemaElement ses = ComponentsUtils.getGenericSchemaElement(componentProperties, value);
|
||||
if (ses != null) {
|
||||
return componentProperties.getValue(ses);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@@ -149,17 +153,11 @@ public class GenericDragAndDropHandler extends AbstractComponentDragAndDropHandl
|
||||
|
||||
private void setGenericRepositoryValue(GenericConnection connection, INode node, IElementParameter param) {
|
||||
if (connection != null) {
|
||||
String compPropertiesStr = connection.getCompProperties();
|
||||
if (compPropertiesStr != null) {
|
||||
Deserialized fromSerialized = ComponentProperties.fromSerialized(compPropertiesStr);
|
||||
if (fromSerialized != null) {
|
||||
ComponentProperties componentProperties = fromSerialized.properties;
|
||||
SchemaElement ses = componentProperties.getProperty(param.getName());
|
||||
if (ses != null) {
|
||||
componentProperties.setValue(ses, param.getValue());
|
||||
connection.setCompProperties(compPropertiesStr);
|
||||
}
|
||||
}
|
||||
IComponent component = node.getComponent();
|
||||
if (component != null && component instanceof AbstractComponent) {
|
||||
AbstractComponent comp = (AbstractComponent) component;
|
||||
String compProperties = comp.genericToSerialized(param);
|
||||
connection.setCompProperties(compProperties);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user