use of org.talend.daikon.properties.Properties in project tdi-studio-se by Talend.
the class ComponentsUtils method getCurrentProperties.
public static Properties getCurrentProperties(Properties componentProperties, String paramName) {
if (componentProperties == null || paramName == null) {
return null;
}
String compPropertiesPath = getPropertyPath(paramName);
if (StringUtils.isEmpty(compPropertiesPath)) {
return componentProperties;
}
NamedThing property = componentProperties.getProperty(compPropertiesPath);
if (property == null) {
return getCurrentPropertiesSpecial(componentProperties, paramName);
}
if (property instanceof Properties) {
return (Properties) property;
}
return null;
}
use of org.talend.daikon.properties.Properties in project tdi-studio-se by Talend.
the class ComponentsUtils method getGenericPropertyValue.
public static Object getGenericPropertyValue(ComponentProperties componentProperties, String paramName) {
if (componentProperties == null || paramName == null) {
return null;
}
Properties currentProperties = getCurrentProperties(componentProperties, paramName);
if (currentProperties == null) {
return null;
}
Property property = componentProperties.getValuedProperty(paramName);
if (property != null) {
return property.getStoredValue();
}
return null;
}
use of org.talend.daikon.properties.Properties in project tdi-studio-se by Talend.
the class ComponentsUtils method getCurrentPropertiesSpecial.
private static Properties getCurrentPropertiesSpecial(Properties componentProperties, String paramName) {
Properties currentComponentProperties = null;
if (componentProperties == null || paramName == null) {
return null;
}
List<NamedThing> allProps = componentProperties.getProperties();
for (NamedThing namedThing : allProps) {
if (paramName.equals(namedThing.getName())) {
currentComponentProperties = componentProperties;
break;
}
if (namedThing instanceof Properties) {
Properties childComponentProperties = (Properties) namedThing;
currentComponentProperties = getCurrentProperties(childComponentProperties, paramName);
}
if (currentComponentProperties != null) {
break;
}
}
return currentComponentProperties;
}
use of org.talend.daikon.properties.Properties in project tdi-studio-se by Talend.
the class Component method processCodegenPropInfos.
protected void processCodegenPropInfos(List<CodegenPropInfo> propList, Properties props, String fieldString) {
for (NamedThing prop : props.getProperties()) {
if (prop instanceof Properties) {
if (prop instanceof ComponentReferenceProperties) {
ComponentReferenceProperties crp = (ComponentReferenceProperties) prop;
crp.componentInstanceId.setTaggedValue(IGenericConstants.ADD_QUOTES, true);
crp.referenceDefinitionName.setTaggedValue(IGenericConstants.ADD_QUOTES, true);
}
CodegenPropInfo childPropInfo = new CodegenPropInfo();
if (fieldString.equals("")) {
//$NON-NLS-1$
//$NON-NLS-1$
childPropInfo.fieldName = "." + prop.getName();
} else {
//$NON-NLS-1$
childPropInfo.fieldName = fieldString + "." + prop.getName();
}
childPropInfo.className = prop.getClass().getName();
childPropInfo.props = (Properties) prop;
propList.add(childPropInfo);
processCodegenPropInfos(propList, childPropInfo.props, childPropInfo.fieldName);
}
}
}
use of org.talend.daikon.properties.Properties in project tdi-studio-se by Talend.
the class DynamicComposite method resetParameters.
public List<ElementParameter> resetParameters() {
final List<ElementParameter> newParameters = new ArrayList<>();
List<ElementParameter> currentParameters = (List<ElementParameter>) element.getElementParameters();
List<ElementParameter> parameters = new ArrayList<>();
ComponentService componentService = internalService.getComponentService();
Connection theConnection = null;
if (connectionItem != null) {
theConnection = connectionItem.getConnection();
}
Properties properties = null;
PropertyValueEvaluator evaluator = null;
if (element instanceof FakeElement) {
properties = form.getProperties();
evaluator = new MetadataContextPropertyValueEvaluator(theConnection);
currentParameters.clear();
} else {
properties = ((INode) element).getComponentProperties();
evaluator = new ComponentContextPropertyValueEvaluator((INode) element);
}
if (properties instanceof ComponentProperties) {
if (form != null) {
properties.setValueEvaluator(evaluator);
properties.refreshLayout(form);
}
// For context display.
properties.setValueEvaluator(null);
boolean isInitializing = false;
if (element instanceof INode) {
INode node = (INode) element;
IComponent component = node.getComponent();
if (component instanceof AbstractBasicComponent) {
isInitializing = ((AbstractBasicComponent) component).isInitializing();
}
}
parameters = ComponentsUtils.getParametersFromForm(element, isInitializing, section, (ComponentProperties) properties, form);
addUpdateParameterIfNotExist(parameters);
properties.setValueEvaluator(evaluator);
}
for (ElementParameter parameter : parameters) {
if (parameter instanceof GenericElementParameter) {
GenericElementParameter genericElementParameter = (GenericElementParameter) parameter;
genericElementParameter.setComponentService(componentService);
genericElementParameter.setDrivedByForm(drivedByForm);
genericElementParameter.callBeforePresent();
genericElementParameter.removePropertyChangeListener(this);
genericElementParameter.addPropertyChangeListener(this);
if (wizardPropertyChangeListener != null && IGenericConstants.NAME_PROPERTY.equals(parameter.getName())) {
genericElementParameter.addPropertyChangeListener(wizardPropertyChangeListener);
}
if (EParameterFieldType.SCHEMA_REFERENCE.equals(genericElementParameter.getFieldType())) {
if (genericElementParameter.getChildParameters().size() == 0) {
IElementParameter schemaParameter = element.getElementParameterFromField(EParameterFieldType.SCHEMA_REFERENCE, section);
genericElementParameter.getChildParameters().putAll(schemaParameter.getChildParameters());
}
} else if (EParameterFieldType.NAME_SELECTION_AREA.equals(genericElementParameter.getFieldType()) && theConnection != null) {
List<NamedThing> values = new ArrayList<>();
List<MetadataTable> metadataTables = SchemaUtils.getMetadataTables(theConnection, SubContainer.class);
List<String> tableLabels = new ArrayList<>();
for (MetadataTable metaTable : metadataTables) {
tableLabels.add(metaTable.getLabel());
}
List<NamedThing> possibleValues = ComponentsUtils.getFormalPossibleValues(genericElementParameter);
for (NamedThing possibleValue : possibleValues) {
if (tableLabels.contains(possibleValue.getName())) {
values.add(possibleValue);
}
}
genericElementParameter.setValue(values);
}
if (properties != null && isRepository(element)) {
String repositoryValue = genericElementParameter.getRepositoryValue();
if (genericElementParameter.isShow(currentParameters) && (repositoryValue != null) && (!genericElementParameter.getName().equals(EParameterName.PROPERTY_TYPE.getName())) && genericElementParameter.getCategory() == section) {
org.talend.daikon.properties.property.Property property = properties.getValuedProperty(genericElementParameter.getName());
if (property != null && property.getTaggedValue(IGenericConstants.REPOSITORY_VALUE) != null) {
genericElementParameter.setRepositoryValueUsed(true);
genericElementParameter.setReadOnly(true);
}
}
}
}
}
boolean added = false;
for (ElementParameter currentParameter : currentParameters) {
if (EParameterName.UPDATE_COMPONENTS.getName().equals(currentParameter.getName())) {
currentParameter.setValue(true);
}
if (currentParameter.isSerialized() && currentParameter.getCategory().equals(section)) {
if (!added) {
newParameters.addAll(parameters);
added = true;
}
continue;
}
newParameters.add(currentParameter);
}
if (element instanceof FakeElement) {
newParameters.addAll(reverseParameters(parameters));
}
element.setElementParameters(newParameters);
return newParameters;
}
Aggregations