当前位置: 首页>>代码示例>>Java>>正文


Java Formatter.getFormatter方法代码示例

本文整理汇总了Java中org.kuali.rice.core.web.format.Formatter.getFormatter方法的典型用法代码示例。如果您正苦于以下问题:Java Formatter.getFormatter方法的具体用法?Java Formatter.getFormatter怎么用?Java Formatter.getFormatter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.kuali.rice.core.web.format.Formatter的用法示例。


在下文中一共展示了Formatter.getFormatter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: retrieveFormValueForLookupInquiryParameters

import org.kuali.rice.core.web.format.Formatter; //导入方法依赖的package包/类
/**
   * Retrieves a value from the form for the purposes of passing it as a parameter into the lookup or inquiry frameworks 
   * 
   * @param parameterName the name of the parameter, as expected by the lookup or inquiry frameworks
   * @param parameterValueLocation the name of the property containing the value of the parameter
   * @return the value of the parameter
   */
  public String retrieveFormValueForLookupInquiryParameters(String parameterName, String parameterValueLocation) {
  	// dereference literal values by simply trimming of the prefix
  	if (parameterValueLocation.startsWith(literalPrefixAndDelimiter)) {
  		return parameterValueLocation.substring(literalPrefixAndDelimiter.length());
  	}

  	Object value = ObjectUtils.getPropertyValue(this, parameterValueLocation);
if (value == null) {
	return null;
}
if (value instanceof String) {
	return (String) value;
}
Formatter formatter = Formatter.getFormatter(value.getClass());
return (String) formatter.format(value);	
  }
 
开发者ID:kuali,项目名称:kc-rice,代码行数:24,代码来源:KualiForm.java

示例2: copyParametersToBO

import org.kuali.rice.core.web.format.Formatter; //导入方法依赖的package包/类
protected void copyParametersToBO(Map<String, String> parameters, PersistableBusinessObject newBO) throws Exception{
	for (String parmName : parameters.keySet()) {
		String propertyValue = parameters.get(parmName);

		if (StringUtils.isNotBlank(propertyValue)) {
			String propertyName = parmName;
			// set value of property in bo
			if (PropertyUtils.isWriteable(newBO, propertyName)) {
				Class type = ObjectUtils.easyGetPropertyType(newBO, propertyName);
				if (type != null && Formatter.getFormatter(type) != null) {
					Formatter formatter = Formatter.getFormatter(type);
					Object obj = formatter.convertFromPresentationFormat(propertyValue);
					ObjectUtils.setObjectProperty(newBO, propertyName, obj.getClass(), obj);
				}
				else {
					ObjectUtils.setObjectProperty(newBO, propertyName, String.class, propertyValue);
				}
			}
		}
	}
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:22,代码来源:KualiMaintenanceDocumentAction.java

示例3: buildFormatterForType

import org.kuali.rice.core.web.format.Formatter; //导入方法依赖的package包/类
private Formatter buildFormatterForType(Class propertyType) {
    Formatter formatter = null;

    if (Formatter.findFormatter(propertyType) != null) {
        formatter = Formatter.getFormatter(propertyType);
    }
    return formatter;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:9,代码来源:PojoFormBase.java

示例4: getAttributeFormatter

import org.kuali.rice.core.web.format.Formatter; //导入方法依赖的package包/类
protected Formatter getAttributeFormatter(KimAttributeField definition) {
    if (definition.getAttributeField().getDataType() == null) {
        return null;
    }

    return Formatter.getFormatter(definition.getAttributeField().getDataType().getType());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:8,代码来源:DataDictionaryTypeServiceBase.java

示例5: testFormat

import org.kuali.rice.core.web.format.Formatter; //导入方法依赖的package包/类
@Test 
public void testFormat() throws Exception {
    Formatter testFormatter = Formatter.getFormatter(KualiPercent.class, null);
            
    KualiDecimal decimal1 = new KualiDecimal(52);
    KualiDecimal decimal2 = new KualiDecimal(32.3); 

    String percent1 = (String)testFormatter.format(decimal1);
    String percent2 = (String)testFormatter.format(decimal2);
    
    assertEquals("52 percent", percent1);
    assertEquals("32.3 percent", percent2);

}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:15,代码来源:KualiPercentTest.java

示例6: getTableCellValues

import org.kuali.rice.core.web.format.Formatter; //导入方法依赖的package包/类
/**
 * Returns the values in a list of the passed in business object in order of the spring definition. The value for the
 * "EMPTY_CELL" entry is an empty string.
 * 
 * @param businessObject for which to return the values
 * @param allowColspan indicate whether colspan definition can be applied
 * @return the values being put into the table cells
 */
public List<String> getTableCellValues(BusinessObject businessObject, boolean allowColspan) {
    List<String> tableCellValues = new ArrayList<String>();

    for (Map.Entry<String, String> entry : orderedPropertyNameToHeaderLabelMap.entrySet()) {
        String attributeName = entry.getKey();

        if (attributeName.startsWith(OLEConstants.ReportConstants.EMPTY_CELL_ENTRY_KEY_PREFIX)) {
            tableCellValues.add(StringUtils.EMPTY);
        }
        else {
            try {
                Object propertyValue = retrievePropertyValue(businessObject, attributeName);
                
                if (ObjectUtils.isNotNull(propertyValue)) {
                    Formatter formatter = Formatter.getFormatter(propertyValue.getClass());
                    if(ObjectUtils.isNotNull(formatter) && ObjectUtils.isNotNull(propertyValue)) {
                        propertyValue = formatter.format(propertyValue);
                    }
                    else {
                        propertyValue = StringUtils.EMPTY;
                    }
                } else {
                    propertyValue = StringUtils.EMPTY;
                }
                
                tableCellValues.add(propertyValue.toString());
            }
            catch (Exception e) {
                throw new RuntimeException("Failed getting propertyName=" + entry.getKey() + " from businessObjecName=" + dataDictionaryBusinessObjectClass.getName(), e);
            }
        }
    }
    
    if(allowColspan) {
        this.applyColspanOnCellValues(tableCellValues);
    }

    return tableCellValues;
}
 
开发者ID:VU-libtech,项目名称:OLE-INST,代码行数:48,代码来源:BusinessObjectReportHelper.java

示例7: getActionUrlHref

import org.kuali.rice.core.web.format.Formatter; //导入方法依赖的package包/类
/**
 * Used by getActionUrls to print the url on the Vendor Lookup page for the links to edit a Vendor or to create a new division.
 * We won't provide a link to copy a vendor because we decided it wouldn't make sense to copy a vendor. We should display the
 * link to create a new division only if the vendor is a parent vendor, and also remove the vendor detail assigned id from the
 * query string in the link to create a new division. We'll add the vendor detail assigned id in the query string if the vendor
 * is not a parent, or if the vendor is a parent and the link is not the create new division link (i.e. if the link is "edit").
 * We'll always add the vendor header id in the query string in all links.
 *
 * @see org.kuali.rice.kns.lookup.AbstractLookupableHelperServiceImpl#getActionUrlHref(org.kuali.rice.krad.bo.BusinessObject, java.lang.String, java.util.List)
 */
@Override
protected String getActionUrlHref(BusinessObject businessObject, String methodToCall, List pkNames){
    if (!methodToCall.equals(OLEConstants.COPY_METHOD)) {
        Properties parameters = new Properties();
        parameters.put(OLEConstants.DISPATCH_REQUEST_PARAMETER, methodToCall);
        parameters.put(OLEConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE, businessObject.getClass().getName());

        for (Iterator<String> iter = pkNames.iterator(); iter.hasNext();) {
            String fieldNm = iter.next();
            if (!fieldNm.equals(VendorPropertyConstants.VENDOR_DETAIL_ASSIGNED_ID) ||
                    !((VendorDetail) businessObject).isVendorParentIndicator()
                    || (((VendorDetail) businessObject).isVendorParentIndicator())
                    && !methodToCall.equals(OLEConstants.MAINTENANCE_NEWWITHEXISTING_ACTION)) {
                Object fieldVal = ObjectUtils.getPropertyValue(businessObject, fieldNm);
                if (fieldVal == null) {
                    fieldVal = OLEConstants.EMPTY_STRING;
                }
                if (fieldVal instanceof java.sql.Date) {
                    String formattedString = OLEConstants.EMPTY_STRING;
                    if (Formatter.findFormatter(fieldVal.getClass()) != null) {
                        Formatter formatter = Formatter.getFormatter(fieldVal.getClass());
                        formattedString = (String) formatter.format(fieldVal);
                        fieldVal = formattedString;
                    }
                }
                parameters.put(fieldNm, fieldVal.toString());
            }
        }
        return UrlFactory.parameterizeUrl(OLEConstants.MAINTENANCE_ACTION, parameters);
    } else {
        return OLEConstants.EMPTY_STRING;
    }
}
 
开发者ID:VU-libtech,项目名称:OLE-INST,代码行数:44,代码来源:VendorLookupableHelperServiceImpl.java

示例8: getTableCellValues

import org.kuali.rice.core.web.format.Formatter; //导入方法依赖的package包/类
/**
 * Returns the values in a list of the passed in business object in order of the spring definition. The value for the
 * "EMPTY_CELL" entry is an empty string.
 * 
 * @param businessObject for which to return the values
 * @param allowColspan indicate whether colspan definition can be applied
 * @return the values being put into the table cells
 */
public List<String> getTableCellValues(BusinessObject businessObject, boolean allowColspan) {
    List<String> tableCellValues = new ArrayList<String>();

    for (Map.Entry<String, String> entry : orderedPropertyNameToHeaderLabelMap.entrySet()) {
        String attributeName = entry.getKey();

        if (attributeName.startsWith(KFSConstants.ReportConstants.EMPTY_CELL_ENTRY_KEY_PREFIX)) {
            tableCellValues.add(StringUtils.EMPTY);
        }
        else {
            try {
                Object propertyValue = retrievePropertyValue(businessObject, attributeName);
                
                if (ObjectUtils.isNotNull(propertyValue)) {
                    Formatter formatter = Formatter.getFormatter(propertyValue.getClass());
                    if(ObjectUtils.isNotNull(formatter) && ObjectUtils.isNotNull(propertyValue)) {
                        propertyValue = formatter.format(propertyValue);
                    }
                    else {
                        propertyValue = StringUtils.EMPTY;
                    }
                } else {
                    propertyValue = StringUtils.EMPTY;
                }
                
                tableCellValues.add(propertyValue.toString());
            }
            catch (Exception e) {
                throw new RuntimeException("Failed getting propertyName=" + entry.getKey() + " from businessObjecName=" + dataDictionaryBusinessObjectClass.getName(), e);
            }
        }
    }
    
    if(allowColspan) {
        this.applyColspanOnCellValues(tableCellValues);
    }

    return tableCellValues;
}
 
开发者ID:kuali,项目名称:kfs,代码行数:48,代码来源:BusinessObjectReportHelper.java

示例9: getActionUrlHref

import org.kuali.rice.core.web.format.Formatter; //导入方法依赖的package包/类
/**
 * Used by getActionUrls to print the url on the Vendor Lookup page for the links to edit a Vendor or to create a new division.
 * We won't provide a link to copy a vendor because we decided it wouldn't make sense to copy a vendor. We should display the
 * link to create a new division only if the vendor is a parent vendor, and also remove the vendor detail assigned id from the
 * query string in the link to create a new division. We'll add the vendor detail assigned id in the query string if the vendor
 * is not a parent, or if the vendor is a parent and the link is not the create new division link (i.e. if the link is "edit").
 * We'll always add the vendor header id in the query string in all links.
 *
 * @see org.kuali.rice.kns.lookup.AbstractLookupableHelperServiceImpl#getActionUrlHref(org.kuali.rice.krad.bo.BusinessObject, java.lang.String, java.util.List)
 */
@Override
protected String getActionUrlHref(BusinessObject businessObject, String methodToCall, List pkNames){
    if (!methodToCall.equals(KFSConstants.COPY_METHOD)) {
        Properties parameters = new Properties();
        parameters.put(KFSConstants.DISPATCH_REQUEST_PARAMETER, methodToCall);
        parameters.put(KFSConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE, businessObject.getClass().getName());

        for (Iterator<String> iter = pkNames.iterator(); iter.hasNext();) {
            String fieldNm = iter.next();
            if (!fieldNm.equals(VendorPropertyConstants.VENDOR_DETAIL_ASSIGNED_ID) ||
                    !((VendorDetail) businessObject).isVendorParentIndicator()
                    || (((VendorDetail) businessObject).isVendorParentIndicator())
                    && !methodToCall.equals(KFSConstants.MAINTENANCE_NEWWITHEXISTING_ACTION)) {
                Object fieldVal = ObjectUtils.getPropertyValue(businessObject, fieldNm);
                if (fieldVal == null) {
                    fieldVal = KFSConstants.EMPTY_STRING;
                }
                if (fieldVal instanceof java.sql.Date) {
                    String formattedString = KFSConstants.EMPTY_STRING;
                    if (Formatter.findFormatter(fieldVal.getClass()) != null) {
                        Formatter formatter = Formatter.getFormatter(fieldVal.getClass());
                        formattedString = (String) formatter.format(fieldVal);
                        fieldVal = formattedString;
                    }
                }
                parameters.put(fieldNm, fieldVal.toString());
            }
        }
        return UrlFactory.parameterizeUrl(KFSConstants.MAINTENANCE_ACTION, parameters);
    } else {
        return KFSConstants.EMPTY_STRING;
    }
}
 
开发者ID:kuali,项目名称:kfs,代码行数:44,代码来源:VendorLookupableHelperServiceImpl.java

示例10: getParametersFromPrimaryKey

import org.kuali.rice.core.web.format.Formatter; //导入方法依赖的package包/类
protected Properties getParametersFromPrimaryKey(BusinessObject businessObject, List pkNames) {
    Properties parameters = new Properties();
    for (Iterator iter = pkNames.iterator(); iter.hasNext();) {
        String fieldNm = (String) iter.next();

        Object fieldVal = ObjectUtils.getPropertyValue(businessObject, fieldNm);
        if (fieldVal == null) {
            fieldVal = KRADConstants.EMPTY_STRING;
        }
        if (fieldVal instanceof java.sql.Date) {
            String formattedString = "";
            if (Formatter.findFormatter(fieldVal.getClass()) != null) {
                Formatter formatter = Formatter.getFormatter(fieldVal.getClass());
                formattedString = (String) formatter.format(fieldVal);
                fieldVal = formattedString;
            }
        }

        // Encrypt value if it is a secure field
        if (getBusinessObjectAuthorizationService().attributeValueNeedsToBeEncryptedOnFormsAndLinks(businessObjectClass, fieldNm)) {
            try {
                if(CoreApiServiceLocator.getEncryptionService().isEnabled()) {
                    fieldVal = getEncryptionService().encrypt(fieldVal) + EncryptionService.ENCRYPTION_POST_PREFIX;
                }
            } catch (GeneralSecurityException e) {
                LOG.error("Exception while trying to encrypted value for inquiry framework.", e);
                throw new RuntimeException(e);
            }

        }

        parameters.put(fieldNm, fieldVal.toString());
    }
    return parameters;
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:36,代码来源:AbstractLookupableHelperServiceImpl.java

示例11: putInactivationBlockingErrorOnPage

import org.kuali.rice.core.web.format.Formatter; //导入方法依赖的package包/类
/**
 * If there is a violation of an InactivationBlockingMetadata, it prints out an appropriate error into the error
 * map
 *
 * @param document
 * @param inactivationBlockingMetadata
 */
protected void putInactivationBlockingErrorOnPage(MaintenanceDocument document,
        InactivationBlockingMetadata inactivationBlockingMetadata) {
    if (!persistenceStructureService.hasPrimaryKeyFieldValues(newBo)) {
        throw new RuntimeException("Maintenance document did not have all primary key values filled in.");
    }
    Properties parameters = new Properties();
    parameters.put(KRADConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE,
            inactivationBlockingMetadata.getBlockedBusinessObjectClass().getName());
    parameters
            .put(KRADConstants.DISPATCH_REQUEST_PARAMETER, KRADConstants.METHOD_DISPLAY_ALL_INACTIVATION_BLOCKERS);

    List keys = new ArrayList();
    if (getPersistenceStructureService().isPersistable(newBo.getClass())) {
        keys = getPersistenceStructureService().listPrimaryKeyFieldNames(newBo.getClass());
    }

    // build key value url parameters used to retrieve the business object
    String keyName = null;
    for (Iterator iter = keys.iterator(); iter.hasNext(); ) {
        keyName = (String) iter.next();

        Object keyValue = null;
        if (keyName != null) {
            keyValue = ObjectUtils.getPropertyValue(newBo, keyName);
        }

        if (keyValue == null) {
            keyValue = "";
        } else if (keyValue instanceof java.sql.Date) { //format the date for passing in url
            if (Formatter.findFormatter(keyValue.getClass()) != null) {
                Formatter formatter = Formatter.getFormatter(keyValue.getClass());
                keyValue = (String) formatter.format(keyValue);
            }
        } else {
            keyValue = keyValue.toString();
        }

        // Encrypt value if it is a secure field
        if (businessObjectAuthorizationService.attributeValueNeedsToBeEncryptedOnFormsAndLinks(
                inactivationBlockingMetadata.getBlockedBusinessObjectClass(), keyName)) {
            try {
                if(CoreApiServiceLocator.getEncryptionService().isEnabled()) {
                    keyValue = CoreApiServiceLocator.getEncryptionService().encrypt(keyValue);
                }
            } catch (GeneralSecurityException e) {
                LOG.error("Exception while trying to encrypted value for inquiry framework.", e);
                throw new RuntimeException(e);
            }
        }

        parameters.put(keyName, keyValue);
    }

    String blockingUrl =
            UrlFactory.parameterizeUrl(KRADConstants.DISPLAY_ALL_INACTIVATION_BLOCKERS_ACTION, parameters);

    // post an error about the locked document
    GlobalVariables.getMessageMap()
            .putError(KRADConstants.GLOBAL_ERRORS, RiceKeyConstants.ERROR_INACTIVATION_BLOCKED, blockingUrl);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:68,代码来源:MaintenanceDocumentRuleBase.java

示例12: getParametersFromPrimaryKey

import org.kuali.rice.core.web.format.Formatter; //导入方法依赖的package包/类
protected Properties getParametersFromPrimaryKey(BusinessObject businessObject, List pkNames) {
    Properties parameters = new Properties();
    for (Iterator iter = pkNames.iterator(); iter.hasNext();) {
        String fieldNm = (String) iter.next();

        // If we cannot find the attribute in the data dictionary, then we cannot determine whether it should be encrypted
        if (getDataDictionaryService().getAttributeDefinition(businessObjectClass.getName(), fieldNm) == null) {
            String errorMessage = "The field " + fieldNm + " could not be found in the data dictionary for class "
                    + businessObjectClass.getName() + ", and thus it could not be determined whether it is a secure field.";

            if (ConfigContext.getCurrentContextConfig().getBooleanProperty(KNSConstants.EXCEPTION_ON_MISSING_FIELD_CONVERSION_ATTRIBUTE, false)) {
                throw new RuntimeException(errorMessage);
            } else {
                LOG.error(errorMessage);
                continue;
            }
        }

        Object fieldVal = ObjectUtils.getPropertyValue(businessObject, fieldNm);
        if (fieldVal == null) {
            fieldVal = KRADConstants.EMPTY_STRING;
        }
        if (fieldVal instanceof java.sql.Date) {
            String formattedString = "";
            if (Formatter.findFormatter(fieldVal.getClass()) != null) {
                Formatter formatter = Formatter.getFormatter(fieldVal.getClass());
                formattedString = (String) formatter.format(fieldVal);
                fieldVal = formattedString;
            }
        }

        // secure values are not passed in urls
        if (getBusinessObjectAuthorizationService().attributeValueNeedsToBeEncryptedOnFormsAndLinks(businessObjectClass, fieldNm)) {
            LOG.warn("field name " + fieldNm + " is a secure value and not included in pk parameter results");
            continue;
        }

        parameters.put(fieldNm, fieldVal.toString());
    }
    return parameters;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:42,代码来源:AbstractLookupableHelperServiceImpl.java

示例13: getFormatterForDataType

import org.kuali.rice.core.web.format.Formatter; //导入方法依赖的package包/类
public static Formatter getFormatterForDataType(DataType dataType) {
    return Formatter.getFormatter(dataType.getType());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:4,代码来源:FieldUtils.java

示例14: retrieveLookupParameterValue

import org.kuali.rice.core.web.format.Formatter; //导入方法依赖的package包/类
public static String retrieveLookupParameterValue(UifFormBase form, HttpServletRequest request,
		Class<?> lookupObjectClass, String propertyName, String propertyValueName) {
	String parameterValue = "";

	// get literal parameter values first
	if (StringUtils.startsWith(propertyValueName, "'") && StringUtils.endsWith(propertyValueName, "'")) {
           parameterValue = StringUtils.removeStart(propertyValueName, "'");
		parameterValue = StringUtils.removeEnd(propertyValueName, "'");
	}
	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(propertyValueName)) {
		parameterValue = request.getParameter(propertyValueName);
	}
	// get parameter value from form object
	else {
		Object value = ObjectPropertyUtils.getPropertyValue(form, propertyValueName);
		if (value != null) {
			if (value instanceof String) {
				parameterValue = (String) value;
			}

			Formatter formatter = Formatter.getFormatter(value.getClass());
			parameterValue = (String) formatter.format(value);
		}
	}

	if (parameterValue != null
			&& lookupObjectClass != null
			&& KRADServiceLocatorWeb.getDataObjectAuthorizationService()
					.attributeValueNeedsToBeEncryptedOnFormsAndLinks(lookupObjectClass, propertyName)) {
		try {
               if(CoreApiServiceLocator.getEncryptionService().isEnabled()) {
			    parameterValue = CoreApiServiceLocator.getEncryptionService().encrypt(parameterValue)
				    	+ EncryptionService.ENCRYPTION_POST_PREFIX;
               }
		}
		catch (GeneralSecurityException e) {
			LOG.error("Unable to encrypt value for property name: " + propertyName);
			throw new RuntimeException(e);
		}
	}

	return parameterValue;
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:50,代码来源:LookupInquiryUtils.java

示例15: putInactivationBlockingErrorOnPage

import org.kuali.rice.core.web.format.Formatter; //导入方法依赖的package包/类
/**
 * If there is a violation of an InactivationBlockingMetadata, it prints out an appropriate error into the error
 * map
 *
 * @param document
 * @param inactivationBlockingMetadata
 */
protected void putInactivationBlockingErrorOnPage(MaintenanceDocument document,
        InactivationBlockingMetadata inactivationBlockingMetadata) {
    if (!getPersistenceStructureService().hasPrimaryKeyFieldValues(newDataObject)) {
        throw new RuntimeException("Maintenance document did not have all primary key values filled in.");
    }
    Properties parameters = new Properties();
    parameters.put(KRADConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE,
            inactivationBlockingMetadata.getBlockedBusinessObjectClass().getName());
    parameters.put(KRADConstants.DISPATCH_REQUEST_PARAMETER,
            KRADConstants.METHOD_DISPLAY_ALL_INACTIVATION_BLOCKERS);

    List keys = new ArrayList();
    if (getPersistenceStructureService().isPersistable(newDataObject.getClass())) {
        keys = getPersistenceStructureService().listPrimaryKeyFieldNames(newDataObject.getClass());
    }

    // build key value url parameters used to retrieve the business object
    String keyName = null;
    for (Iterator iter = keys.iterator(); iter.hasNext(); ) {
        keyName = (String) iter.next();

        Object keyValue = null;
        if (keyName != null) {
            keyValue = ObjectUtils.getPropertyValue(newDataObject, keyName);
        }

        if (keyValue == null) {
            keyValue = "";
        } else if (keyValue instanceof java.sql.Date) { //format the date for passing in url
            if (Formatter.findFormatter(keyValue.getClass()) != null) {
                Formatter formatter = Formatter.getFormatter(keyValue.getClass());
                keyValue = (String) formatter.format(keyValue);
            }
        } else {
            keyValue = keyValue.toString();
        }

        // Encrypt value if it is a secure field
        if (getDataObjectAuthorizationService().attributeValueNeedsToBeEncryptedOnFormsAndLinks(
                inactivationBlockingMetadata.getBlockedBusinessObjectClass(), keyName)) {
            try {
                if(CoreApiServiceLocator.getEncryptionService().isEnabled()) {
                    keyValue = CoreApiServiceLocator.getEncryptionService().encrypt(keyValue);
                }
            } catch (GeneralSecurityException e) {
                LOG.error("Exception while trying to encrypted value for inquiry framework.", e);
                throw new RuntimeException(e);
            }
        }

        parameters.put(keyName, keyValue);
    }

    String blockingUrl = UrlFactory.parameterizeUrl(KRADConstants.DISPLAY_ALL_INACTIVATION_BLOCKERS_ACTION,
            parameters);

    // post an error about the locked document
    GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS,
            RiceKeyConstants.ERROR_INACTIVATION_BLOCKED, blockingUrl);
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:68,代码来源:MaintenanceDocumentRuleBase.java


注:本文中的org.kuali.rice.core.web.format.Formatter.getFormatter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。