本文整理汇总了Java中org.kuali.rice.krad.datadictionary.AttributeDefinition.getMaxLength方法的典型用法代码示例。如果您正苦于以下问题:Java AttributeDefinition.getMaxLength方法的具体用法?Java AttributeDefinition.getMaxLength怎么用?Java AttributeDefinition.getMaxLength使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kuali.rice.krad.datadictionary.AttributeDefinition
的用法示例。
在下文中一共展示了AttributeDefinition.getMaxLength方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: customizeControlInstance
import org.kuali.rice.krad.datadictionary.AttributeDefinition; //导入方法依赖的package包/类
protected void customizeControlInstance( Control c, AttributeDefinition attrDef, DataObjectAttribute dataObjectAttribute ) {
c.setRequired(attrDef.isRequired());
if ( c instanceof TextControl ) {
if ( attrDef.getMaxLength() != null ) {
((TextControl) c).setMaxLength( attrDef.getMaxLength() );
((TextControl) c).setSize( attrDef.getMaxLength() );
// If it's a larger field, add the expand icon by default
if ( attrDef.getMaxLength() > 80 ) { // JHK : yes, this was a mostly arbitrary choice
((TextControl) c).setTextExpand(true);
}
}
if ( attrDef.getMinLength() != null ) {
((TextControl) c).setMinLength( attrDef.getMinLength() );
}
}
if ( c instanceof TextAreaControl ) {
if ( attrDef.getMaxLength() != null ) {
((TextAreaControl) c).setMaxLength( attrDef.getMaxLength() );
((TextAreaControl) c).setRows(attrDef.getMaxLength()/((TextAreaControl) c).getCols());
}
if ( attrDef.getMinLength() != null ) {
((TextAreaControl) c).setMinLength( attrDef.getMinLength() );
}
}
}
示例2: getAttributeMaxLength
import org.kuali.rice.krad.datadictionary.AttributeDefinition; //导入方法依赖的package包/类
/**
* @see org.kuali.rice.krad.service.DataDictionaryService#getAttributeMaxLength(java.lang.String)
*/
@Override
public Integer getAttributeMaxLength(String entryName, String attributeName) {
Integer maxLength = null;
AttributeDefinition attributeDefinition = getAttributeDefinition(entryName, attributeName);
if (attributeDefinition != null) {
maxLength = attributeDefinition.getMaxLength();
}
return maxLength;
}
示例3: getAttributeMaxLength
import org.kuali.rice.krad.datadictionary.AttributeDefinition; //导入方法依赖的package包/类
@Override
public Integer getAttributeMaxLength(String entryName, String attributeName) {
Integer maxLength = null;
AttributeDefinition attributeDefinition = getAttributeDefinition(entryName, attributeName);
if (attributeDefinition != null) {
maxLength = attributeDefinition.getMaxLength();
}
return maxLength;
}
示例4: getControlInstance
import org.kuali.rice.krad.datadictionary.AttributeDefinition; //导入方法依赖的package包/类
protected Control getControlInstance( AttributeDefinition attrDef, DataObjectAttribute dataObjectAttribute ) {
Control c = null;
// Check for the hidden hint - if present - then use that control type
if ( dataObjectAttribute != null && hasHintOfType(dataObjectAttribute, UifDisplayHintType.HIDDEN) ) {
c = ComponentFactory.getHiddenControl();
} else if ( attrDef.getOptionsFinder() != null ) {
// if a values finder has been established, use a radio button group or drop-down list
if ( dataObjectAttribute != null && hasHintOfType(dataObjectAttribute, UifDisplayHintType.RADIO) ) {
c = ComponentFactory.getRadioGroupControl();
} else {
c = ComponentFactory.getSelectControl();
}
} else if ( attrDef.getName().endsWith( ".principalName" ) && dataObjectAttribute != null ) {
// FIXME: JHK: Yes, I know this is a *HORRIBLE* hack - but the alternative
// would look even more "hacky" and error-prone
c = ComponentFactory.getUserControl();
// Need to find the relationship information
// get the relationship ID by removing .principalName from the attribute name
String relationshipName = StringUtils.removeEnd(attrDef.getName(), ".principalName");
DataObjectMetadata metadata = dataObjectService.getMetadataRepository().getMetadata(
dataObjectAttribute.getOwningType());
if ( metadata != null ) {
DataObjectRelationship relationship = metadata.getRelationship(relationshipName);
if ( relationship != null && CollectionUtils.isNotEmpty(relationship.getAttributeRelationships())) {
((UserControl)c).setPrincipalIdPropertyName(relationship.getAttributeRelationships().get(0).getParentAttributeName());
((UserControl)c).setPersonNamePropertyName(relationshipName + "." + KimConstants.AttributeConstants.NAME);
((UserControl)c).setPersonObjectPropertyName(relationshipName);
}
} else {
LOG.warn( "Attempt to pull relationship name: " + relationshipName + " resulted in missing metadata when looking for: " + dataObjectAttribute.getOwningType() );
}
} else {
switch ( attrDef.getDataType() ) {
case STRING :
// TODO: Determine better way to store the "200" metric below
if ( attrDef.getMaxLength() != null && attrDef.getMaxLength().intValue() > 200 ) {
c = ComponentFactory.getTextAreaControl();
} else {
c = ComponentFactory.getTextControl();
}
break;
case BOOLEAN:
c = ComponentFactory.getCheckboxControl();
break;
case DATE:
case DATETIME:
case TRUNCATED_DATE:
c = ComponentFactory.getDateControl();
break;
case CURRENCY:
case DOUBLE:
case FLOAT:
case INTEGER:
case LARGE_INTEGER:
case LONG:
case PRECISE_DECIMAL:
c = ComponentFactory.getTextControl();
break;
case MARKUP:
c = ComponentFactory.getTextAreaControl();
break;
default:
c = ComponentFactory.getTextControl();
break;
}
}
return c;
}
示例5: copyFromAttributeDefinition
import org.kuali.rice.krad.datadictionary.AttributeDefinition; //导入方法依赖的package包/类
/**
* Override of InputField copy to setup properties necessary to make the field usable for inputting
* search criteria.
*
* <p>Note super is not being called because we don't want to add restirctions that can cause problems
* with the use of wildcard</p>
*
* {@inheritDoc}
*/
@Override
public void copyFromAttributeDefinition(AttributeDefinition attributeDefinition) {
// label
if (StringUtils.isEmpty(getLabel())) {
setLabel(attributeDefinition.getLabel());
}
// short label
if (StringUtils.isEmpty(getShortLabel())) {
setShortLabel(attributeDefinition.getShortLabel());
}
// security
if ((attributeDefinition.getAttributeSecurity() != null) && ((getDataFieldSecurity() == null) || (
getDataFieldSecurity().getAttributeSecurity() == null))) {
initializeComponentSecurity();
getDataFieldSecurity().setAttributeSecurity(attributeDefinition.getAttributeSecurity());
}
// options
if (getOptionsFinder() == null) {
setOptionsFinder(attributeDefinition.getOptionsFinder());
}
// use control from dictionary if not specified and convert for searching
if (getControl() == null) {
Control control = convertControlToLookupControl(attributeDefinition);
setControl(control);
}
// overwrite maxLength to allow for wildcards and ranges; set a minimum max length unless it is greater than 100
setMaxLength(100);
if ( attributeDefinition.getMaxLength()!=null && (attributeDefinition.getMaxLength() > 100)) {
setMaxLength(attributeDefinition.getMaxLength());
}
// set default value for active field to true
if (getDefaultValue() == null || (getDefaultValue() instanceof String && StringUtils.isEmpty((String)getDefaultValue()))) {
if ((StringUtils.equals(getPropertyName(), KRADPropertyConstants.ACTIVE))) {
setDefaultValue(KRADConstants.YES_INDICATOR_VALUE);
}
}
}
示例6: buildAttributeMap
import org.kuali.rice.krad.datadictionary.AttributeDefinition; //导入方法依赖的package包/类
public ExportMap buildAttributeMap(AttributeDefinition attribute, String fullClassName) {
ExportMap attributeMap = new ExportMap(attribute.getName());
// simple properties
attributeMap.set("name", attribute.getName());
attributeMap.set("forceUppercase", attribute.getForceUppercase().toString());
attributeMap.set("label", attribute.getLabel());
attributeMap.set("shortLabel", attribute.getShortLabel());
//KULRICE-9144 remove maxLength non null assumption
Integer maxLength = attribute.getMaxLength();
if (maxLength != null) {
attributeMap.set("maxLength", maxLength.toString());
}
String exclusiveMin = attribute.getExclusiveMin();
if (exclusiveMin != null) {
attributeMap.set("exclusiveMin", exclusiveMin/*.toString()*/);
}
String exclusiveMax = attribute.getInclusiveMax();
if (exclusiveMax != null) {
attributeMap.set("exclusiveMax", exclusiveMax/*.toString()*/);
}
if (attribute.isRequired() != null) {
attributeMap.set("required", attribute.isRequired().toString());
} else {
attributeMap.set("required", "false");
}
if (attribute.getSummary() != null) {
attributeMap.set("summary", attribute.getSummary());
}
if (attribute.getDescription() != null) {
attributeMap.set("description", attribute.getDescription());
}
if (attribute.hasFormatterClass()) {
attributeMap.set("formatterClass", attribute.getFormatterClass());
}
/**
// complex properties
if (attribute.hasValidationPattern()) {
attributeMap.set(attribute.getValidationPattern().buildExportMap("validationPattern"));
}
if(attribute.hasAttributeSecurity()){
attributeMap.set("attributeSecurityMask", String.valueOf(attribute.getAttributeSecurity().isMask()));
attributeMap.set("attributeSecurityPartialMask", String.valueOf(attribute.getAttributeSecurity().isPartialMask()));
attributeMap.set("attributeSecurityHide", String.valueOf(attribute.getAttributeSecurity().isHide()));
attributeMap.set("attributeSecurityReadOnly", String.valueOf(attribute.getAttributeSecurity().isReadOnly()));
// TODO: consider whether to export class names from the attribute security
}
*/
attributeMap.set(buildControlMap(attribute));
if (attribute.getOptionsFinder() != null) {
attributeMap.set(buildKeyLabelMap(attribute));
}
if (StringUtils.isNotBlank(fullClassName)) {
attributeMap.set("fullClassName", fullClassName);
}
return attributeMap;
}