本文整理汇总了Java中org.kuali.rice.krad.util.KRADUtils.isSecure方法的典型用法代码示例。如果您正苦于以下问题:Java KRADUtils.isSecure方法的具体用法?Java KRADUtils.isSecure怎么用?Java KRADUtils.isSecure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kuali.rice.krad.util.KRADUtils
的用法示例。
在下文中一共展示了KRADUtils.isSecure方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isSecure
import org.kuali.rice.krad.util.KRADUtils; //导入方法依赖的package包/类
/**
* Checks whether the given property is secure.
*
* @param wrappedClass class the property is associated with
* @param propertyPath path to the property
* @return boolean true if the property is secure, false if not
*/
protected boolean isSecure(Class<?> wrappedClass, String propertyPath) {
if (KRADUtils.isSecure(propertyPath, wrappedClass)) {
return true;
}
// since this is part of a set, we want to make sure nested paths grow
setAutoGrowNestedPaths(true);
BeanWrapperImpl beanWrapper;
try {
beanWrapper = getBeanWrapperForPropertyPath(propertyPath);
} catch (NotReadablePropertyException | NullValueInNestedPathException e) {
LOG.debug("Bean wrapper was not found for " + propertyPath
+ ", but since it cannot be accessed it will not be set as secure.", e);
return false;
}
if (org.apache.commons.lang.StringUtils.isNotBlank(beanWrapper.getNestedPath())) {
PropertyTokenHolder tokens = getPropertyNameTokens(propertyPath);
String nestedPropertyPath = org.apache.commons.lang.StringUtils.removeStart(tokens.canonicalName,
beanWrapper.getNestedPath());
return isSecure(beanWrapper.getWrappedClass(), nestedPropertyPath);
}
return false;
}
示例2: retrieveLookupParameterValue
import org.kuali.rice.krad.util.KRADUtils; //导入方法依赖的package包/类
/**
* Retrieves the value for the given parameter name to send as a lookup parameter.
*
* @param form form instance to retrieve values from
* @param request request object to retrieve parameters from
* @param lookupObjectClass data object class associated with the lookup, used to check whether the
* value needs to be encyrpted
* @param propertyName name of the property associated with the parameter, used to check whether the
* value needs to be encrypted
* @param parameterName name of the parameter to retrieve the value for
* @return String parameter value or empty string if no value was found
*/
public static String retrieveLookupParameterValue(UifFormBase form, HttpServletRequest request,
Class<?> lookupObjectClass, String propertyName, String parameterName) {
// return a null value if it is secure
if (KRADUtils.isSecure(propertyName, lookupObjectClass)) {
LOG.warn("field name " + propertyName + " is a secure value and not returned in parameter result value");
return null;
}
String parameterValue = "";
// get literal parameter values first
if (StringUtils.startsWith(parameterName, "'") && StringUtils.endsWith(parameterName, "'")) {
parameterValue = StringUtils.substringBetween(parameterName, "'");
} else if (parameterValue.startsWith(KRADConstants.LOOKUP_PARAMETER_LITERAL_PREFIX
+ KRADConstants.LOOKUP_PARAMETER_LITERAL_DELIMITER)) {
parameterValue = StringUtils.removeStart(parameterValue, KRADConstants.LOOKUP_PARAMETER_LITERAL_PREFIX
+ KRADConstants.LOOKUP_PARAMETER_LITERAL_DELIMITER);
}
// check if parameter is in request
else if (request.getParameterMap().containsKey(parameterName)) {
parameterValue = request.getParameter(parameterName);
}
// get parameter value from form object
else {
parameterValue = ObjectPropertyUtils.getPropertyValueAsText(form, parameterName);
}
return parameterValue;
}