本文整理汇总了Java中org.kuali.rice.krad.datadictionary.uif.UifDictionaryBean.getPropertyExpressions方法的典型用法代码示例。如果您正苦于以下问题:Java UifDictionaryBean.getPropertyExpressions方法的具体用法?Java UifDictionaryBean.getPropertyExpressions怎么用?Java UifDictionaryBean.getPropertyExpressions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kuali.rice.krad.datadictionary.uif.UifDictionaryBean
的用法示例。
在下文中一共展示了UifDictionaryBean.getPropertyExpressions方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: evaluatePropertyExpression
import org.kuali.rice.krad.datadictionary.uif.UifDictionaryBean; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void evaluatePropertyExpression(View view, Map<String, Object> evaluationParameters,
UifDictionaryBean expressionConfigurable, String propertyName, boolean removeExpression) {
Map<String, String> propertyExpressions = expressionConfigurable.getPropertyExpressions();
if ((propertyExpressions == null) || !propertyExpressions.containsKey(propertyName)) {
return;
}
String expression = propertyExpressions.get(propertyName);
// If the property name is a default value which grabs a new sequence number don't evaluate the expression
// since a new sequence number has already been retrieved.
if (StringUtils.equals(propertyName, UifConstants.ComponentProperties.DEFAULT_VALUE) &&
StringUtils.contains(expression, UifConstants.SEQUENCE_PREFIX)) {
return;
}
// check whether expression should be evaluated or property should retain the expression
if (CopyUtils.fieldHasAnnotation(expressionConfigurable.getClass(), propertyName, KeepExpression.class)) {
// set expression as property value to be handled by the component
ObjectPropertyUtils.setPropertyValue(expressionConfigurable, propertyName, expression);
return;
}
Object propertyValue = null;
// replace binding prefixes (lp, dp, fp) in expression before evaluation
String adjustedExpression = replaceBindingPrefixes(view, expressionConfigurable, expression);
// determine whether the expression is a string template, or evaluates to another object type
if (StringUtils.startsWith(adjustedExpression, UifConstants.EL_PLACEHOLDER_PREFIX) && StringUtils.endsWith(
adjustedExpression, UifConstants.EL_PLACEHOLDER_SUFFIX) && (StringUtils.countMatches(adjustedExpression,
UifConstants.EL_PLACEHOLDER_PREFIX) == 1)) {
propertyValue = evaluateExpression(evaluationParameters, adjustedExpression);
} else {
// treat as string template
propertyValue = evaluateExpressionTemplate(evaluationParameters, adjustedExpression);
}
// if property name has the special indicator then we need to add the expression result to the property
// value instead of replace
if (StringUtils.endsWith(propertyName, ExpressionEvaluator.EMBEDDED_PROPERTY_NAME_ADD_INDICATOR)) {
StringUtils.removeEnd(propertyName, ExpressionEvaluator.EMBEDDED_PROPERTY_NAME_ADD_INDICATOR);
Collection collectionValue = ObjectPropertyUtils.getPropertyValue(expressionConfigurable, propertyName);
if (collectionValue == null) {
throw new RuntimeException("Property name: " + propertyName
+ " with collection type was not initialized. Cannot add expression result");
}
collectionValue.add(propertyValue);
} else {
ObjectPropertyUtils.setPropertyValue(expressionConfigurable, propertyName, propertyValue);
}
if (removeExpression) {
propertyExpressions.remove(propertyName);
}
}
示例2: evaluatePropertyExpressions
import org.kuali.rice.krad.datadictionary.uif.UifDictionaryBean; //导入方法依赖的package包/类
/**
* Iterates through the keys of the property expressions map and invokes
* {@link #evaluatePropertyExpression(org.kuali.rice.krad.uif.view.View, java.util.Map,
* org.kuali.rice.krad.datadictionary.uif.UifDictionaryBean, String, boolean)}
*
* <p>
* If the expression is an el template (part static text and part expression), only the
* expression part will be replaced with the result. More than one expressions may be contained
* within the template
* </p>
*
* @param view - view instance that is being rendered
* @param expressionConfigurable - object instance to evaluate expressions for
* @param evaluationParameters - map of additional parameters that may be used within the
* expressions
*/
protected void evaluatePropertyExpressions(View view, UifDictionaryBean expressionConfigurable,
Map<String, Object> evaluationParameters) {
if (expressionConfigurable == null) {
return;
}
Map<String, String> propertyExpressions = expressionConfigurable.getPropertyExpressions();
if (propertyExpressions == null) {
return;
}
for (String propertyName : propertyExpressions.keySet()) {
evaluatePropertyExpression(view, evaluationParameters, expressionConfigurable, propertyName, false);
}
}
示例3: evaluatePropertyExpression
import org.kuali.rice.krad.datadictionary.uif.UifDictionaryBean; //导入方法依赖的package包/类
/**
* @see org.kuali.rice.krad.uif.view.ExpressionEvaluator#evaluatePropertyExpression(View, java.util.Map,
* org.kuali.rice.krad.datadictionary.uif.UifDictionaryBean, String, boolean)
*/
public void evaluatePropertyExpression(View view, Map<String, Object> evaluationParameters,
UifDictionaryBean expressionConfigurable, String propertyName, boolean removeExpression) {
Map<String, String> propertyExpressions = expressionConfigurable.getPropertyExpressions();
if ((propertyExpressions == null) || !propertyExpressions.containsKey(propertyName)) {
return;
}
String expression = propertyExpressions.get(propertyName);
// check whether expression should be evaluated or property should retain the expression
if (CloneUtils.fieldHasAnnotation(expressionConfigurable.getClass(), propertyName, KeepExpression.class)) {
// set expression as property value to be handled by the component
ObjectPropertyUtils.setPropertyValue(expressionConfigurable, propertyName, expression);
return;
}
Object propertyValue = null;
// replace binding prefixes (lp, dp, fp) in expression before evaluation
String adjustedExpression = replaceBindingPrefixes(view, expressionConfigurable, expression);
// determine whether the expression is a string template, or evaluates to another object type
if (StringUtils.startsWith(adjustedExpression, UifConstants.EL_PLACEHOLDER_PREFIX) && StringUtils.endsWith(
adjustedExpression, UifConstants.EL_PLACEHOLDER_SUFFIX) && (StringUtils.countMatches(adjustedExpression,
UifConstants.EL_PLACEHOLDER_PREFIX) == 1)) {
propertyValue = evaluateExpression(evaluationParameters, adjustedExpression);
} else {
// treat as string template
propertyValue = evaluateExpressionTemplate(evaluationParameters, adjustedExpression);
}
// if property name has the special indicator then we need to add the expression result to the property
// value instead of replace
if (StringUtils.endsWith(propertyName, ExpressionEvaluator.EMBEDDED_PROPERTY_NAME_ADD_INDICATOR)) {
StringUtils.removeEnd(propertyName, ExpressionEvaluator.EMBEDDED_PROPERTY_NAME_ADD_INDICATOR);
Collection collectionValue = ObjectPropertyUtils.getPropertyValue(expressionConfigurable, propertyName);
if (collectionValue == null) {
throw new RuntimeException("Property name: "
+ propertyName
+ " with collection type was not initialized. Cannot add expression result");
}
collectionValue.add(propertyValue);
} else {
ObjectPropertyUtils.setPropertyValue(expressionConfigurable, propertyName, propertyValue);
}
if (removeExpression) {
propertyExpressions.remove(propertyName);
}
}
示例4: evaluatePropertyExpressions
import org.kuali.rice.krad.datadictionary.uif.UifDictionaryBean; //导入方法依赖的package包/类
/**
* Iterates through the keys of the property expressions map and invokes
* {@link #evaluatePropertyExpression(org.kuali.rice.krad.uif.view.View, java.util.Map,
* org.kuali.rice.krad.datadictionary.uif.UifDictionaryBean, String, boolean)}
*
* <p>
* If the expression is an el template (part static text and part expression), only the expression
* part will be replaced with the result. More than one expressions may be contained within the template
* </p>
*
* @param view - view instance that is being rendered
* @param expressionConfigurable - object instance to evaluate expressions for
* @param evaluationParameters - map of additional parameters that may be used within the expressions
*/
protected void evaluatePropertyExpressions(View view, UifDictionaryBean expressionConfigurable,
Map<String, Object> evaluationParameters) {
Map<String, String> propertyExpressions = expressionConfigurable.getPropertyExpressions();
for (String propertyName : propertyExpressions.keySet()) {
evaluatePropertyExpression(view, evaluationParameters, expressionConfigurable, propertyName, false);
}
}
示例5: hasValueOrPropertyExpression
import org.kuali.rice.krad.datadictionary.uif.UifDictionaryBean; //导入方法依赖的package包/类
/**
* Helper function to check if value or property expression exists
*
* @param defaultValue
* @param dictionaryBean
* @param expressionName
* @return
*/
private boolean hasValueOrPropertyExpression(String defaultValue, UifDictionaryBean dictionaryBean, String expressionName) {
return StringUtils.isNotBlank(defaultValue) || (dictionaryBean != null && dictionaryBean.getPropertyExpressions() != null &&
StringUtils.isNotBlank(dictionaryBean.getPropertyExpression(expressionName)));
}