本文整理汇总了Java中org.kuali.rice.krad.util.ObjectUtils.getNestedValue方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectUtils.getNestedValue方法的具体用法?Java ObjectUtils.getNestedValue怎么用?Java ObjectUtils.getNestedValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kuali.rice.krad.util.ObjectUtils
的用法示例。
在下文中一共展示了ObjectUtils.getNestedValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateUserFields
import org.kuali.rice.krad.util.ObjectUtils; //导入方法依赖的package包/类
/**
* Updates fields of type kualiuser sets the universal user id and/or name if required.
*
* @param field
* @param businessObject
*/
private static final void updateUserFields(Field field, BusinessObject businessObject){
// for user fields, attempt to pull the principal ID and person's name from the source object
if ( field.getFieldType().equals(Field.KUALIUSER) ) {
// this is supplemental, so catch and log any errors
try {
if ( StringUtils.isNotBlank(field.getUniversalIdAttributeName()) ) {
Object principalId = ObjectUtils.getNestedValue(businessObject, field.getUniversalIdAttributeName());
if ( principalId != null ) {
field.setUniversalIdValue(principalId.toString());
}
}
if ( StringUtils.isNotBlank(field.getPersonNameAttributeName()) ) {
Object personName = ObjectUtils.getNestedValue(businessObject, field.getPersonNameAttributeName());
if ( personName != null ) {
field.setPersonNameValue( personName.toString() );
}
}
} catch ( Exception ex ) {
LOG.warn( "Unable to get principal ID or person name property in SectionBridge.", ex );
}
}
}
示例2: populateReadableField
import org.kuali.rice.krad.util.ObjectUtils; //导入方法依赖的package包/类
public static void populateReadableField(Field field, BusinessObject businessObject){
Object obj = ObjectUtils.getNestedValue(businessObject, field.getPropertyName());
// For files the FormFile is not being persisted instead the file data is stored in
// individual fields as defined by PersistableAttachment.
if (Field.FILE.equals(field.getFieldType())) {
Object fileName = ObjectUtils.getNestedValue(businessObject, KRADConstants.BO_ATTACHMENT_FILE_NAME);
Object fileType = ObjectUtils.getNestedValue(businessObject, KRADConstants.BO_ATTACHMENT_FILE_CONTENT_TYPE);
field.setImageSrc(WebUtils.getAttachmentImageForUrl((String)fileType));
field.setPropertyValue(fileName);
}
if (obj != null) {
String formattedValue = ObjectUtils.getFormattedPropertyValueUsingDataDictionary(businessObject, field.getPropertyName());
field.setPropertyValue(formattedValue);
// for user fields, attempt to pull the principal ID and person's name from the source object
if ( field.getFieldType().equals(Field.KUALIUSER) ) {
// this is supplemental, so catch and log any errors
try {
if ( StringUtils.isNotBlank(field.getUniversalIdAttributeName()) ) {
Object principalId = ObjectUtils.getNestedValue(businessObject, field.getUniversalIdAttributeName());
if ( principalId != null ) {
field.setUniversalIdValue(principalId.toString());
}
}
if ( StringUtils.isNotBlank(field.getPersonNameAttributeName()) ) {
Object personName = ObjectUtils.getNestedValue(businessObject, field.getPersonNameAttributeName());
if ( personName != null ) {
field.setPersonNameValue( personName.toString() );
}
}
} catch ( Exception ex ) {
LOG.warn( "Unable to get principal ID or person name property in FieldBridge.", ex );
}
}
}
populateSecureField(field, obj);
}
示例3: invoke
import org.kuali.rice.krad.util.ObjectUtils; //导入方法依赖的package包/类
/**
* This method intercepts "getReturnUrl" and returns this objects returnUrl attribute. It proxies access to nested
* BusinessObjects to ensure that the application plugin classloader is used to resolve OJB proxies. And, it translates booleans
* for the UI, using the BooleanFormatter.
*
* @see net.sf.cglib.proxy.InvocationHandler#invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[]
* args)
*
*/
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
ClassLoader oldClassloader = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(classLoader);
if ("getReturnUrl".equals(method.getName())) {
return returnUrl;
}
else if ("getWorkflowLookupableResult".equals(method.getName())) {
return Enhancer.create(HashMap.class, new Class[] { WorkflowLookupableResult.class }, this);
}
else if ("get".equals(method.getName())) {
Object propertyValue = ObjectUtils.getNestedValue(proxiedBusinessObject, args[0].toString());
if (propertyValue instanceof BusinessObject) {
return Enhancer.create(propertyValue.getClass(), new WorkflowLookupableInvocationHandler((BusinessObject) propertyValue, classLoader));
}
else {
if (propertyValue instanceof Boolean) {
return new BooleanFormatter().format(propertyValue);
}
return propertyValue;
}
}
else {
return method.invoke(proxiedBusinessObject, args);
}
}
catch (Exception e) {
throw (e.getCause() != null ? e.getCause() : e);
}
finally {
Thread.currentThread().setContextClassLoader(oldClassloader);
}
}
示例4: getNestedValue
import org.kuali.rice.krad.util.ObjectUtils; //导入方法依赖的package包/类
@Override
public Object getNestedValue(Object bo, String fieldName){
return ObjectUtils.getNestedValue(bo,fieldName);
}
示例5: addMaintainableItemRestrictions
import org.kuali.rice.krad.util.ObjectUtils; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
protected void addMaintainableItemRestrictions(List<? extends MaintainableItemDefinition> itemDefinitions,
MaintenanceDocumentAuthorizer authorizer,
MaintenanceDocumentRestrictions restrictions,
MaintenanceDocument maintenanceDocument,
BusinessObject businessObject, String propertyPrefix, Person user) {
for (MaintainableItemDefinition maintainableItemDefinition : itemDefinitions) {
if (maintainableItemDefinition instanceof MaintainableCollectionDefinition) {
try {
MaintainableCollectionDefinition maintainableCollectionDefinition = (MaintainableCollectionDefinition) maintainableItemDefinition;
Collection<BusinessObject> collection = (Collection<BusinessObject>) ObjectUtils
.getNestedValue(businessObject,
maintainableItemDefinition.getName());
BusinessObjectEntry collectionBusinessObjectEntry = (BusinessObjectEntry) getDataDictionaryService()
.getDataDictionary().getBusinessObjectEntry(
maintainableCollectionDefinition.getBusinessObjectClass().getName());
if (CollectionUtils.isNotEmpty(collection)) {
//if (collection != null && !collection.isEmpty()) {
int i = 0;
for (Iterator<BusinessObject> iterator = collection.iterator(); iterator
.hasNext();) {
String newPropertyPrefix = propertyPrefix + maintainableItemDefinition.getName() + "[" + i + "].";
BusinessObject collectionBusinessObject = iterator.next();
considerBusinessObjectFieldUnmaskAuthorization(
collectionBusinessObject, user, restrictions,
newPropertyPrefix, maintenanceDocument);
considerBusinessObjectFieldViewAuthorization(
collectionBusinessObjectEntry, maintenanceDocument, collectionBusinessObject, user,
authorizer, restrictions, newPropertyPrefix);
considerBusinessObjectFieldModifyAuthorization(
collectionBusinessObjectEntry, maintenanceDocument, collectionBusinessObject, user,
authorizer, restrictions, newPropertyPrefix);
addMaintainableItemRestrictions(
((MaintainableCollectionDefinition) maintainableItemDefinition)
.getMaintainableCollections(),
authorizer, restrictions, maintenanceDocument,
collectionBusinessObject, newPropertyPrefix,
user);
addMaintainableItemRestrictions(
((MaintainableCollectionDefinition) maintainableItemDefinition)
.getMaintainableFields(), authorizer,
restrictions, maintenanceDocument,
collectionBusinessObject, newPropertyPrefix,
user);
i++;
}
}
} catch (Exception e) {
throw new RuntimeException(
"Unable to resolve collection property: "
+ businessObject.getClass() + ":"
+ maintainableItemDefinition.getName(), e);
}
}
}
}