use of org.talend.daikon.properties.property.Property in project tdi-studio-se by Talend.
the class GenericContextUtil method setPropertyValue.
private static void setPropertyValue(ComponentProperties componentProperties, String propertyName, String propertyValue, boolean isContextMode) {
Property property = componentProperties.getValuedProperty(propertyName);
if (property != null) {
property.setTaggedValue(IGenericConstants.IS_CONTEXT_MODE, isContextMode);
property.setValue(propertyValue);
}
}
use of org.talend.daikon.properties.property.Property in project tdi-studio-se by Talend.
the class GenericUIBuilder method createWidgetUIByPropertyType.
private void createWidgetUIByPropertyType(Composite parent, Widget widget) {
NamedThing property = getProperty(widget);
if (property == null) {
return;
}
int hSpan = widget.getOrder();
if (property instanceof PresentationItem) {
PresentationItem item = (PresentationItem) property;
createLabel(parent, item.getDisplayName(), hSpan);
return;
} else if (property instanceof Property) {
Property element = (Property) property;
String displayName = element.getDisplayName();
String type = element.getType();
if (type == null) {
createLabel(parent, displayName, hSpan);
return;
}
if (GenericTypeUtils.isStringType(type)) {
new LabelledText(parent, displayName, hSpan);
} else if (GenericTypeUtils.isBooleanType(type)) {
// nothing
} else {
new LabelledText(parent, element.getDisplayName(), hSpan);
}
}
}
use of org.talend.daikon.properties.property.Property in project tdi-studio-se by Talend.
the class Component method getElementParameterValueFromComponentProperties.
@Override
public Object getElementParameterValueFromComponentProperties(INode iNode, IElementParameter param) {
if (iNode != null) {
ComponentProperties iNodeComponentProperties = iNode.getComponentProperties();
if (iNodeComponentProperties != null && param instanceof GenericElementParameter) {
Properties paramProperties = ComponentsUtils.getCurrentProperties(iNodeComponentProperties, param.getName());
if (paramProperties != null) {
// update repository value
Property property = iNodeComponentProperties.getValuedProperty(param.getName());
if (property != null) {
if (property.getTaggedValue(IGenericConstants.REPOSITORY_VALUE) != null) {
param.setRepositoryValue(param.getName());
param.setRepositoryValueUsed(true);
}
}
Object value = ComponentsUtils.getGenericPropertyValue(iNodeComponentProperties, param.getName());
if (value == null && EParameterFieldType.TABLE.equals(param.getFieldType())) {
value = GenericTableUtils.getTableValues(iNodeComponentProperties.getProperties(param.getName()), param);
}
return value;
}
}
}
return null;
}
use of org.talend.daikon.properties.property.Property in project tdi-studio-se by Talend.
the class GenericTableUtils method setTableValues.
public static void setTableValues(Properties tableProperties, List<Map<String, Object>> value, IElementParameter param) {
List<Map<String, String>> table = ElementParameterParser.createTableValues(value, param);
for (String column : param.getListItemsDisplayCodeName()) {
Property property = tableProperties.getValuedProperty(column);
if (property.getValue() instanceof List) {
((List) property.getValue()).clear();
}
}
for (Map<String, String> line : table) {
for (String column : line.keySet()) {
Property property = tableProperties.getValuedProperty(column);
List<String> values = new ArrayList<>();
if (property.getValue() == null || (!(property.getValue() instanceof List))) {
property.setValue(values);
} else {
values = (List) property.getValue();
}
values.add(line.get(column));
}
}
}
use of org.talend.daikon.properties.property.Property in project tdi-studio-se by Talend.
the class Salesforce620Migration method updateSubProperties.
/**
* DOC nrousseau Comment method "updateSubProperties".
*
* @param properties
* @param newProperties
*/
private void updateSubProperties(ComponentProperties properties, ComponentProperties newProperties) {
if (newProperties == null) {
return;
}
for (NamedThing nt : properties.getProperties()) {
if (nt instanceof Property) {
Property property = (Property) nt;
Object storedValue = property.getStoredValue();
if (storedValue instanceof String) {
String stringValue = (String) storedValue;
if (ContextParameterUtils.isContainContextParam(stringValue)) {
continue;
}
Property newProperty = (Property) newProperties.getProperty(property.getName());
if (newProperty != null) {
if (GenericTypeUtils.isBooleanType(newProperty)) {
if (stringValue.isEmpty()) {
property.setValue(Boolean.FALSE);
} else {
property.setValue(new Boolean(stringValue));
}
} else if (GenericTypeUtils.isEnumType(newProperty) && (!(newProperty instanceof EnumProperty))) {
property.setStoredValue(TalendQuoteUtils.removeQuotes(stringValue));
} else if (GenericTypeUtils.isEnumType(newProperty)) {
List<?> propertyPossibleValues = ((Property<?>) newProperty).getPossibleValues();
if (propertyPossibleValues != null) {
for (Object possibleValue : propertyPossibleValues) {
if (possibleValue.toString().equals(storedValue)) {
property.setStoredValue(possibleValue);
break;
}
}
}
}
}
}
} else if (nt instanceof ComponentProperties) {
updateSubProperties((ComponentProperties) nt, (ComponentProperties) newProperties.getProperty(nt.getName()));
}
}
}
Aggregations