本文整理汇总了Java中org.kuali.rice.krad.util.KRADUtils.buildAttributeTitleString方法的典型用法代码示例。如果您正苦于以下问题:Java KRADUtils.buildAttributeTitleString方法的具体用法?Java KRADUtils.buildAttributeTitleString怎么用?Java KRADUtils.buildAttributeTitleString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kuali.rice.krad.util.KRADUtils
的用法示例。
在下文中一共展示了KRADUtils.buildAttributeTitleString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createTitleText
import org.kuali.rice.krad.util.KRADUtils; //导入方法依赖的package包/类
/**
* Gets text to prepend to the inquiry link title
*
* @param dataObjectClass data object class being inquired into
* @return inquiry link title
*/
public String createTitleText(Class<?> dataObjectClass, Map<String,String> inquiryKeyValues) {
// use manually configured title if exists
if (StringUtils.isNotBlank(getTitle())) {
return getTitle();
}
List<String> titleTexts = new ArrayList<String>();
// get the title prefix
String titlePrefix = CoreApiServiceLocator.getKualiConfigurationService().getPropertyValueAsString(
INQUIRY_TITLE_PREFIX);
// if the title prefix is available, add it to the title text
if (StringUtils.isNotBlank(titlePrefix)) {
titleTexts.add(titlePrefix);
}
// get the data object label
DataObjectEntry dataObjectEntry = KRADServiceLocatorWeb.getDataDictionaryService().getDataDictionary()
.getDataObjectEntry(dataObjectClass.getName());
String dataObjectLabel = dataObjectEntry != null ? dataObjectEntry.getObjectLabel() : null;
// if the data object label is available, then add it to the title text
if (StringUtils.isNotBlank(dataObjectLabel)) {
titleTexts.add(dataObjectLabel);
}
// get the prepend text configuration
String titleUrlPrependText = CoreApiServiceLocator.getKualiConfigurationService().getPropertyValueAsString(
KRADConstants.Lookup.TITLE_ACTION_URL_PREPENDTEXT_PROPERTY);
// if the prepend text is available and there are primary key values, then add it to the link label
if (StringUtils.isNotBlank(titleUrlPrependText) && !inquiryKeyValues.isEmpty()) {
titleTexts.add(titleUrlPrependText);
}
String titleText = StringUtils.defaultIfBlank(StringUtils.join(titleTexts, " "), StringUtils.EMPTY);
return KRADUtils.buildAttributeTitleString(titleText, dataObjectClass, inquiryKeyValues);
}
示例2: buildReturnUrlForResult
import org.kuali.rice.krad.util.KRADUtils; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void buildReturnUrlForResult(Link returnLink, Object model) {
LookupForm lookupForm = (LookupForm) model;
Map<String, Object> returnLinkContext = returnLink.getContext();
LookupView lookupView = returnLinkContext == null ? null : (LookupView) returnLinkContext.get(
UifConstants.ContextVariableNames.VIEW);
Object dataObject = returnLinkContext == null ? null : returnLinkContext.get(
UifConstants.ContextVariableNames.LINE);
// don't render return link if the object is null or if the row is not returnable
if ((dataObject == null) || (!isResultReturnable(dataObject))) {
returnLink.setRender(false);
return;
}
String dataReturnValue = "true";
if (lookupForm.isReturnByScript()) {
Map<String, String> translatedKeyValues = getTranslatedReturnKeyValues(lookupView, lookupForm, dataObject);
dataReturnValue = ScriptUtils.translateValue(translatedKeyValues);
returnLink.setHref("#");
String dialogId = lookupForm.getShowDialogId();
if (StringUtils.isNotBlank(dialogId)) {
returnLink.setHref(returnLink.getHref() + dialogId);
}
} else if (StringUtils.isBlank(returnLink.getHref())) {
String href = getReturnUrl(lookupView, lookupForm, dataObject);
if (StringUtils.isNotBlank(href)) {
returnLink.setHref(href);
} else {
returnLink.setRender(false);
return;
}
String target = lookupForm.getReturnTarget();
if (StringUtils.isNotBlank(target)) {
returnLink.setTarget(target);
}
}
// add data attribute for attaching event handlers on the return links
returnLink.addDataAttribute(UifConstants.DataAttributes.RETURN, dataReturnValue);
// build return link title if not already set
if (StringUtils.isBlank(returnLink.getTitle())) {
String linkLabel = StringUtils.defaultIfBlank(getConfigurationService().getPropertyValueAsString(
KRADConstants.Lookup.TITLE_RETURN_URL_PREPENDTEXT_PROPERTY), StringUtils.EMPTY);
Map<String, String> returnKeyValues = getReturnKeyValues(lookupView, lookupForm, dataObject);
String title = KRADUtils.buildAttributeTitleString(linkLabel, getDataObjectClass(), returnKeyValues);
returnLink.setTitle(title);
}
}
示例3: buildMaintenanceActionLink
import org.kuali.rice.krad.util.KRADUtils; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void buildMaintenanceActionLink(Link actionLink, Object model, String maintenanceMethodToCall) {
LookupForm lookupForm = (LookupForm) model;
Map<String, Object> actionLinkContext = actionLink.getContext();
Object dataObject = actionLinkContext == null ? null : actionLinkContext.get(
UifConstants.ContextVariableNames.LINE);
List<String> pkNames = getLegacyDataAdapter().listPrimaryKeyFieldNames(getDataObjectClass());
// build maintenance link href if needed
if (StringUtils.isBlank(actionLink.getHref())) {
String href = getMaintenanceActionUrl(lookupForm, dataObject, maintenanceMethodToCall, pkNames);
if (StringUtils.isBlank(href)) {
actionLink.setRender(false);
return;
}
actionLink.setHref(href);
}
// build action title if not set
if (StringUtils.isBlank(actionLink.getTitle())) {
List<String> linkLabels = new ArrayList<String>();
// get the link text
String linkText = actionLink.getLinkText();
// if the link text is available, then add it to the link label
if (StringUtils.isNotBlank(linkText)) {
linkLabels.add(linkText);
}
// get the data object label
DataObjectEntry dataObjectEntry = getDataDictionaryService().getDataDictionary().getDataObjectEntry(
getDataObjectClass().getName());
String dataObjectLabel = dataObjectEntry != null ? dataObjectEntry.getObjectLabel() : null;
// if the data object label is available, then add it to the link label
if (StringUtils.isNotBlank(dataObjectLabel)) {
linkLabels.add(dataObjectLabel);
}
// get the prepend text
String titleActionUrlPrependText = getConfigurationService().getPropertyValueAsString(
KRADConstants.Lookup.TITLE_ACTION_URL_PREPENDTEXT_PROPERTY);
// get the primary keys for the object
Map<String, String> primaryKeyValues = KRADUtils.getPropertyKeyValuesFromDataObject(pkNames, dataObject);
// if the prepend text is available and there are primary key values, then add it to the link label
if (StringUtils.isNotBlank(titleActionUrlPrependText) && !primaryKeyValues.isEmpty()) {
linkLabels.add(titleActionUrlPrependText);
}
String linkLabel = StringUtils.defaultIfBlank(StringUtils.join(linkLabels, " "), StringUtils.EMPTY);
String title = KRADUtils.buildAttributeTitleString(linkLabel, getDataObjectClass(), primaryKeyValues);
actionLink.setTitle(title);
}
}