本文整理汇总了Java中org.kuali.rice.krad.uif.component.MethodInvokerConfig类的典型用法代码示例。如果您正苦于以下问题:Java MethodInvokerConfig类的具体用法?Java MethodInvokerConfig怎么用?Java MethodInvokerConfig使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MethodInvokerConfig类属于org.kuali.rice.krad.uif.component包,在下文中一共展示了MethodInvokerConfig类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AttributeQuery
import org.kuali.rice.krad.uif.component.MethodInvokerConfig; //导入依赖的package包/类
public AttributeQuery() {
renderNotFoundMessage = true;
queryFieldMapping = new HashMap<String, String>();
returnFieldMapping = new HashMap<String, String>();
additionalCriteria = new HashMap<String, String>();
sortPropertyNames = new ArrayList<String>();
queryMethodArgumentFieldList = new ArrayList<String>();
queryMethodInvokerConfig = new MethodInvokerConfig();
}
示例2: checkGetArgumentTypes
import org.kuali.rice.krad.uif.component.MethodInvokerConfig; //导入依赖的package包/类
protected void checkGetArgumentTypes(Class targetClass, String methodName, int argumentTypeSize, int expectedSize) {
MethodInvokerConfig methodInvokerConfig = new MethodInvokerConfig();
methodInvokerConfig.setTargetClass(targetClass);
methodInvokerConfig.setTargetMethod(methodName);
methodInvokerConfig.setArguments(new Object[argumentTypeSize]);
Class[] classes = methodInvokerConfig.getArgumentTypes();
Assert.assertEquals("Should return " + argumentTypeSize + " classes", expectedSize, classes.length);
}
示例3: invokeBusinessRuleMethod
import org.kuali.rice.krad.uif.component.MethodInvokerConfig; //导入依赖的package包/类
/**
* local helper method to invoke the business rule method
*
* @param rule the business rule class that the method to invoke belongs to
* @param event the document event the rule applies to
* @return a boolean to indicate whether the method invocation was a succes or not
*/
public boolean invokeBusinessRuleMethod(BusinessRule rule, DocumentEvent event) {
boolean success = true;
String methodName = event.getRuleMethodName();
MethodInvokerConfig methodInvoker = new MethodInvokerConfig();
methodInvoker.setTargetClass(rule.getClass());
methodInvoker.setTargetMethod(methodName);
Object[] arguments = new Object[1];
arguments[0] = event;
methodInvoker.setArguments(arguments);
// invoke rule method
try {
LOG.debug("Invoking rule method: " + methodInvoker.getTargetMethod() + " for class: " + rule.getClass()
.getName());
methodInvoker.prepare();
Class<?> methodReturnType = methodInvoker.getPreparedMethod().getReturnType();
if (StringUtils.equals("void", methodReturnType.getName())) {
methodInvoker.invoke();
} else {
success &= (Boolean) methodInvoker.invoke();
}
} catch (Exception e) {
LOG.error("Error invoking rule method for class: " + rule.getClass().getName(), e);
throw new RuntimeException("Error invoking rule method for class: " + rule.getClass().getName(), e);
}
return success;
}
示例4: performApplyModel
import org.kuali.rice.krad.uif.component.MethodInvokerConfig; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void performApplyModel(Object model, LifecycleElement parent) {
super.performApplyModel(model, parent);
if (!(parent instanceof InputField)) {
return;
}
InputField field = (InputField) parent;
field.getAdditionalHiddenPropertyNames().add(principalIdPropertyName);
if (isRender() && !isHidden() && !Boolean.TRUE.equals(getReadOnly())) {
ViewLifecycle.getViewPostMetadata().addAccessibleBindingPath(principalIdPropertyName);
}
if (!Boolean.TRUE.equals(field.getReadOnly())) {
// add information fields
if (StringUtils.isNotBlank(personNamePropertyName)) {
field.getPropertyNamesForAdditionalDisplay().add(personNamePropertyName);
} else {
field.getPropertyNamesForAdditionalDisplay().add(
personObjectPropertyName + "." + KimConstants.AttributeConstants.NAME);
}
// setup script to clear id field when name is modified
String idPropertyPath = field.getBindingInfo().getPropertyAdjustedBindingPath(principalIdPropertyName);
String onChangeScript = UifConstants.JsFunctions.SET_VALUE
+ "('"
+ ScriptUtils.escapeName(idPropertyPath)
+ "','');";
if (StringUtils.isNotBlank(getOnChangeScript())) {
onChangeScript = getOnChangeScript() + onChangeScript;
}
setOnChangeScript(onChangeScript);
}
if (Boolean.TRUE.equals(field.getReadOnly()) && StringUtils.isBlank(field.getReadOnlyDisplaySuffixPropertyName())) {
if (StringUtils.isNotBlank(personNamePropertyName)) {
field.setReadOnlyDisplaySuffixPropertyName(personNamePropertyName);
} else {
field.setReadOnlyDisplaySuffixPropertyName(
personObjectPropertyName + "." + KimConstants.AttributeConstants.NAME);
}
}
// setup field query for displaying name
AttributeQuery attributeQuery = new AttributeQuery();
MethodInvokerConfig methodInvokerConfig = new MethodInvokerConfig();
PersonService personService = KimApiServiceLocator.getPersonService();
methodInvokerConfig.setTargetObject(personService);
attributeQuery.setQueryMethodInvokerConfig(methodInvokerConfig);
attributeQuery.setQueryMethodToCall("getPersonByPrincipalName");
attributeQuery.getQueryMethodArgumentFieldList().add(field.getPropertyName());
attributeQuery.getReturnFieldMapping().put(KimConstants.AttributeConstants.PRINCIPAL_ID,
principalIdPropertyName);
if (StringUtils.isNotBlank(personNamePropertyName)) {
attributeQuery.getReturnFieldMapping().put(KimConstants.AttributeConstants.NAME, personNamePropertyName);
} else {
attributeQuery.getReturnFieldMapping().put(KimConstants.AttributeConstants.NAME,
personObjectPropertyName + "." + KimConstants.AttributeConstants.NAME);
}
field.setAttributeQuery(attributeQuery);
buildUserQuickfinder(model, field);
}
示例5: setCallbackMethod
import org.kuali.rice.krad.uif.component.MethodInvokerConfig; //导入依赖的package包/类
/**
* @see QuickFinder#getCallbackMethod()
*/
public void setCallbackMethod(MethodInvokerConfig callbackMethod) {
this.callbackMethod = callbackMethod;
}
示例6: performApplyModel
import org.kuali.rice.krad.uif.component.MethodInvokerConfig; //导入依赖的package包/类
/**
* @see org.kuali.rice.krad.uif.component.ComponentBase#performApplyModel(org.kuali.rice.krad.uif.view.View,
* java.lang.Object, org.kuali.rice.krad.uif.component.Component)
*/
@Override
public void performApplyModel(View view, Object model, Component parent) {
super.performApplyModel(view, model, parent);
if (!(parent instanceof InputField)) {
return;
}
InputField field = (InputField) parent;
field.getAdditionalHiddenPropertyNames().add(principalIdPropertyName);
if (!field.isReadOnly()) {
// add information fields
if (StringUtils.isNotBlank(personNamePropertyName)) {
field.getPropertyNamesForAdditionalDisplay().add(personNamePropertyName);
} else {
field.getPropertyNamesForAdditionalDisplay().add(personObjectPropertyName + ".name");
}
// setup script to clear id field when name is modified
String idPropertyPath = field.getBindingInfo().getPropertyAdjustedBindingPath(principalIdPropertyName);
String onChangeScript = "setValue('" + ScriptUtils.escapeName(idPropertyPath) + "','');";
if (StringUtils.isNotBlank(getOnChangeScript())) {
onChangeScript = getOnChangeScript() + onChangeScript;
}
setOnChangeScript(onChangeScript);
}
if (field.isReadOnly() && StringUtils.isBlank(field.getReadOnlyDisplaySuffixPropertyName())) {
if (StringUtils.isNotBlank(personNamePropertyName)) {
field.setReadOnlyDisplaySuffixPropertyName(personNamePropertyName);
} else {
field.setReadOnlyDisplaySuffixPropertyName(personObjectPropertyName + ".name");
}
}
// setup field query for displaying name
AttributeQuery attributeQuery = new AttributeQuery();
MethodInvokerConfig methodInvokerConfig = new MethodInvokerConfig();
PersonService personService = KimApiServiceLocator.getPersonService();
methodInvokerConfig.setTargetObject(personService);
attributeQuery.setQueryMethodInvokerConfig(methodInvokerConfig);
attributeQuery.setQueryMethodToCall("getPersonByPrincipalName");
attributeQuery.getQueryMethodArgumentFieldList().add(field.getPropertyName());
attributeQuery.getReturnFieldMapping().put("principalId", principalIdPropertyName);
if (StringUtils.isNotBlank(personNamePropertyName)) {
attributeQuery.getReturnFieldMapping().put("name", personNamePropertyName);
} else {
attributeQuery.getReturnFieldMapping().put("name", personObjectPropertyName + ".name");
}
field.setAttributeQuery(attributeQuery);
// setup field lookup
QuickFinder quickFinder = field.getQuickfinder();
if (quickFinder.isRender()) {
if (StringUtils.isBlank(quickFinder.getDataObjectClassName())) {
quickFinder.setDataObjectClassName(Person.class.getName());
}
if (quickFinder.getFieldConversions().isEmpty()) {
quickFinder.getFieldConversions().put("principalId", principalIdPropertyName);
if (StringUtils.isNotBlank(personNamePropertyName)) {
quickFinder.getFieldConversions().put("name", personNamePropertyName);
} else {
quickFinder.getFieldConversions().put("name", personObjectPropertyName + ".name");
}
quickFinder.getFieldConversions().put("principalName", field.getPropertyName());
}
}
}
示例7: getQueryMethodInvokerConfig
import org.kuali.rice.krad.uif.component.MethodInvokerConfig; //导入依赖的package包/类
/**
* Configures the query method target class/object and method name
*
* <p>
* When the query method is not contained on the <code>ViewHelperService</code>, this
* can be configured for declaring the target class/object and method. The target class
* can be set in which case a new instance will be created and the given method invoked.
* Alternatively, the target object instance for the invocation can be given. Or finally
* a static method can be configured
* </p>
*
* @return query method config
*/
@BeanTagAttribute
public MethodInvokerConfig getQueryMethodInvokerConfig() {
return queryMethodInvokerConfig;
}
示例8: setQueryMethodInvokerConfig
import org.kuali.rice.krad.uif.component.MethodInvokerConfig; //导入依赖的package包/类
/**
* Setter for the query method config
*
* @param queryMethodInvokerConfig
*/
public void setQueryMethodInvokerConfig(MethodInvokerConfig queryMethodInvokerConfig) {
this.queryMethodInvokerConfig = queryMethodInvokerConfig;
}
示例9: getFetchingMethodInvoker
import org.kuali.rice.krad.uif.component.MethodInvokerConfig; //导入依赖的package包/类
/**
* Configuration for the method to invoke for retrieving the list of remotable fields
*
* <p>
* Through the method invoker config, a service or static class can be configured along with the
* method name that will be invoked. The method name must accept the view, model object, and parent
* container as arguments, and return a list of {@link RemotableAttributeField} instances.
* </p>
*
* <p>
* Note the {@link org.kuali.rice.krad.uif.component.MethodInvokerConfig#getTargetMethod()} property can
* be configured, or the {@link #getFetchingMethodToCall()}. In the case of both configurations, the target
* method on the method invoker config will be used
* </p>
*
* @return MethodInvokerConfig instance containing method configuration
*/
@BeanTagAttribute(type = BeanTagAttribute.AttributeType.SINGLEBEAN)
public MethodInvokerConfig getFetchingMethodInvoker() {
return fetchingMethodInvoker;
}
示例10: setFetchingMethodInvoker
import org.kuali.rice.krad.uif.component.MethodInvokerConfig; //导入依赖的package包/类
/**
* Setter for the fetching method to invoke configuration
*
* @param fetchingMethodInvoker
*/
public void setFetchingMethodInvoker(MethodInvokerConfig fetchingMethodInvoker) {
this.fetchingMethodInvoker = fetchingMethodInvoker;
}
示例11: getCallbackMethod
import org.kuali.rice.krad.uif.component.MethodInvokerConfig; //导入依赖的package包/类
/**
* The specific method invoker to use to invoke the callback method to call.
*
* @return callbackMethod - the method invoker
*/
public MethodInvokerConfig getCallbackMethod() {
return callbackMethod;
}
示例12: getQueryMethodInvokerConfig
import org.kuali.rice.krad.uif.component.MethodInvokerConfig; //导入依赖的package包/类
/**
* Configures the query method target class/object and method name
*
* <p>
* When the query method is not contained on the <code>ViewHelperService</code>, this
* can be configured for declaring the target class/object and method. The target class
* can be set in which case a new instance will be created and the given method invoked.
* Alternatively, the target object instance for the invocation can be given. Or finally
* a static method can be configured
* </p>
*
* @return query method config
*/
@BeanTagAttribute(name="queryMethodInvokerConfig",type= BeanTagAttribute.AttributeType.SINGLEBEAN)
public MethodInvokerConfig getQueryMethodInvokerConfig() {
return queryMethodInvokerConfig;
}
示例13: getFetchingMethodInvoker
import org.kuali.rice.krad.uif.component.MethodInvokerConfig; //导入依赖的package包/类
/**
* Configuration for the method to invoke for retrieving the list of remotable fields
*
* <p>
* Through the method invoker config, a service or static class can be configured along with the
* method name that will be invoked. The method name must accept the view, model object, and parent
* container as arguments, and return a list of {@link RemotableAttributeField} instances.
* </p>
*
* <p>
* Note the {@link org.kuali.rice.krad.uif.component.MethodInvokerConfig#getTargetMethod()} property can
* be configured, or the {@link #getFetchingMethodToCall()}. In the case of both configurations, the target
* method on the method invoker config will be used
* </p>
*
* @return MethodInvokerConfig instance containing method configuration
*/
@BeanTagAttribute(name = "fetchingMethodInvoker", type = BeanTagAttribute.AttributeType.SINGLEBEAN)
public MethodInvokerConfig getFetchingMethodInvoker() {
return fetchingMethodInvoker;
}