• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java AttributeDefinition类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.kuali.rice.krad.datadictionary.AttributeDefinition的典型用法代码示例。如果您正苦于以下问题:Java AttributeDefinition类的具体用法?Java AttributeDefinition怎么用?Java AttributeDefinition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AttributeDefinition类属于org.kuali.rice.krad.datadictionary包,在下文中一共展示了AttributeDefinition类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: verifyDefaultedControl_stringProperty

import org.kuali.rice.krad.datadictionary.AttributeDefinition; //导入依赖的package包/类
@Test
public void verifyDefaultedControl_stringProperty() {
    DataObjectEntry dataObjectEntry = getDataObjectEntry(MAIN_DATA_OBJECT_FOR_TESTING);
    String propertyName = "stringProperty";
    AttributeDefinition attributeDefinition = dataObjectEntry.getAttributeDefinition(propertyName);
    assertNotNull(propertyName + " should have been present in the attribute list", attributeDefinition );

    assertNotNull( "the ControlField should not have been null", attributeDefinition.getControlField() );
    assertTrue("Type of control field is incorrect", attributeDefinition.getControlField() instanceof TextControl);
    assertEquals("Size of control is incorrect", 40,
            ((TextControl) attributeDefinition.getControlField()).getSize());
    assertNotNull( "MaxLength of control is missing", ((TextControl) attributeDefinition.getControlField()).getMaxLength() );
    assertEquals("MaxLength of control is incorrect", 40,
            ((TextControl) attributeDefinition.getControlField()).getMaxLength().intValue());
    assertEquals("textExpand property incorrect", false,
            ((TextControl) attributeDefinition.getControlField()).isTextExpand());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:18,代码来源:DataDictionaryMetadataDefaultingTest.java


示例2: verifyDefaultedControl_longStringProperty

import org.kuali.rice.krad.datadictionary.AttributeDefinition; //导入依赖的package包/类
@Test
public void verifyDefaultedControl_longStringProperty() {
    DataObjectEntry dataObjectEntry = getDataObjectEntry(MAIN_DATA_OBJECT_FOR_TESTING);
    String propertyName = "longStringProperty";
    AttributeDefinition attributeDefinition = dataObjectEntry.getAttributeDefinition(propertyName);
    assertNotNull(propertyName + " should have been present in the attribute list", attributeDefinition );

    assertNotNull( "the ControlField should not have been null", attributeDefinition.getControlField() );
    assertTrue("Type of control field is incorrect", attributeDefinition.getControlField() instanceof TextControl);
    assertEquals("Size of control is incorrect", 200,
            ((TextControl) attributeDefinition.getControlField()).getSize());
    assertNotNull( "MaxLength of control is missing", ((TextControl) attributeDefinition.getControlField()).getMaxLength() );
    assertEquals("MaxLength of control is incorrect", 200,
            ((TextControl) attributeDefinition.getControlField()).getMaxLength().intValue());
    assertEquals("textExpand property incorrect", true,
            ((TextControl) attributeDefinition.getControlField()).isTextExpand());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:18,代码来源:DataDictionaryMetadataDefaultingTest.java


示例3: 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() );
        }
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:26,代码来源:UifDefaultingServiceImpl.java


示例4: getAttributeLabel

import org.kuali.rice.krad.datadictionary.AttributeDefinition; //导入依赖的package包/类
/**
 * @see org.kuali.rice.krad.service.DataDictionaryService#getAttributeLabel(java.lang.String)
 */
@Override
public String getAttributeLabel(String entryName, String attributeName) {
    String label = "";

    AttributeDefinition attributeDefinition = getAttributeDefinition(entryName, attributeName);
    if (attributeDefinition != null) {
        // KULRICE-4445 prevent NullPointerException by ensuring a label is set
        label = attributeDefinition.getLabel();
        if (!StringUtils.isEmpty(attributeDefinition.getDisplayLabelAttribute())) {
            attributeDefinition = getAttributeDefinition(entryName, attributeDefinition.getDisplayLabelAttribute());
            if (attributeDefinition != null) {
                label = attributeDefinition.getLabel();
            }
        }
    }

    return label;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:22,代码来源:TestDataDictionaryService.java


示例5: getAttributeShortLabel

import org.kuali.rice.krad.datadictionary.AttributeDefinition; //导入依赖的package包/类
/**
 * @see org.kuali.rice.krad.service.DataDictionaryService#getAttributeShortLabel(java.lang.String)
 */
@Override
public String getAttributeShortLabel(String entryName, String attributeName) {
    String shortLabel = "";

    AttributeDefinition attributeDefinition = getAttributeDefinition(entryName, attributeName);
    if (attributeDefinition != null) {
        if (!StringUtils.isEmpty(attributeDefinition.getDisplayLabelAttribute())) {
            attributeDefinition = getAttributeDefinition(entryName, attributeDefinition.getDisplayLabelAttribute());
            if (attributeDefinition != null) {
                shortLabel = attributeDefinition.getShortLabel();
            }
        } else {
            shortLabel = attributeDefinition.getShortLabel();
        }
    }

    return shortLabel;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:22,代码来源:TestDataDictionaryService.java


示例6: getAttributeForceUppercase

import org.kuali.rice.krad.datadictionary.AttributeDefinition; //导入依赖的package包/类
/**
 * @see org.kuali.rice.krad.service.DataDictionaryService#getAttributeForceUppercase(java.lang.String)
 */
@Override
public Boolean getAttributeForceUppercase(String entryName,
        String attributeName) throws UnknownBusinessClassAttributeException {
    Boolean forceUppercase = null;

    AttributeDefinition attributeDefinition = getAttributeDefinition(entryName, attributeName);
    if (attributeDefinition == null) {
        throw new UnknownBusinessClassAttributeException(
                "Could not find a matching data dictionary business class attribute entry for " + entryName + "." +
                        attributeName);
    }
    forceUppercase = attributeDefinition.getForceUppercase();

    return forceUppercase;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:19,代码来源:TestDataDictionaryService.java


示例7: getAttributeDefinition

import org.kuali.rice.krad.datadictionary.AttributeDefinition; //导入依赖的package包/类
/**
 * @param entryName - the qualified object name e.g. edu.sampleu.demo.kitchensink.TimeInfo
 * @param attributeName - an attribute name e.g. startTimeAmPm
 * @return AttributeDefinition for the given dataObjectClass and attribute name, or null if there is none
 * @throws IllegalArgumentException if the given Class is null or is not a BusinessObject class
 */
@Override
public AttributeDefinition getAttributeDefinition(String entryName, String attributeName) {
    if (StringUtils.isBlank(attributeName)) {
        throw new IllegalArgumentException("invalid (blank) attributeName");
    }
    AttributeDefinition attributeDefinition = null;

    DataDictionaryEntryBase entry =
            (DataDictionaryEntryBase) getDataDictionary().getDictionaryObjectEntry(entryName);
    if (entry != null) {
        attributeDefinition = entry.getAttributeDefinition(attributeName);
    }

    return attributeDefinition;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:22,代码来源:TestDataDictionaryService.java


示例8: considerBusinessObjectFieldUnmaskAuthorization

import org.kuali.rice.krad.datadictionary.AttributeDefinition; //导入依赖的package包/类
protected void considerBusinessObjectFieldUnmaskAuthorization(Object dataObject, Person user, BusinessObjectRestrictions businessObjectRestrictions, String propertyPrefix, Document document) {
	DataObjectEntry objectEntry = getDataDictionaryService().getDataDictionary().getDataObjectEntry(dataObject.getClass().getName());
	for (String attributeName : objectEntry.getAttributeNames()) {
		AttributeDefinition attributeDefinition = objectEntry.getAttributeDefinition(attributeName);
		if (attributeDefinition.getAttributeSecurity() != null) {
			if (attributeDefinition.getAttributeSecurity().isMask() &&
					!canFullyUnmaskField(user, dataObject.getClass(), attributeName, document)) {
				businessObjectRestrictions.addFullyMaskedField(propertyPrefix + attributeName, attributeDefinition.getAttributeSecurity().getMaskFormatter());
			}
			if (attributeDefinition.getAttributeSecurity().isPartialMask() &&
					!canPartiallyUnmaskField(user, dataObject.getClass(), attributeName, document)) {
				businessObjectRestrictions.addPartiallyMaskedField(propertyPrefix + attributeName, attributeDefinition.getAttributeSecurity().getPartialMaskFormatter());
			}
		}
	}
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:17,代码来源:BusinessObjectAuthorizationServiceImpl.java


示例9: setUp

import org.kuali.rice.krad.datadictionary.AttributeDefinition; //导入依赖的package包/类
@Before
public void setUp() throws Exception {

	processor = new ValidCharactersConstraintProcessor();

	dictionaryValidationResult = new DictionaryValidationResult();
	dictionaryValidationResult.setErrorLevel(ErrorLevel.NOCONSTRAINT);

	addressEntry = new BusinessObjectEntry();

	List<AttributeDefinition> attributes = new ArrayList<AttributeDefinition>();

	postalCodeNumericPatternConstraint = new NumericPatternConstraint();
       postalCodeNumericPatternConstraint.setMessageKey("validate.dummykey");
       postalCodeNumericPatternConstraint.setValidationMessageParams( new ArrayList<String>());

	postalCodeDefinition = new AttributeDefinition();
	postalCodeDefinition.setName("postalCode");
	postalCodeDefinition.setValidCharactersConstraint(postalCodeNumericPatternConstraint);
	attributes.add(postalCodeDefinition);

	addressEntry.setAttributes(attributes);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:24,代码来源:NumericPatternConstraintTest.java


示例10: setUp

import org.kuali.rice.krad.datadictionary.AttributeDefinition; //导入依赖的package包/类
@Before
public void setUp() throws Exception {

	String regex = getProperty(PATTERN_CONSTRAINT);

	processor = new ValidCharactersConstraintProcessor();

	dictionaryValidationResult = new DictionaryValidationResult();
	dictionaryValidationResult.setErrorLevel(ErrorLevel.NOCONSTRAINT);

	addressEntry = new BusinessObjectEntry();

	List<AttributeDefinition> attributes = new ArrayList<AttributeDefinition>();

	postalCodePatternConstraint = new ConfigurationBasedRegexPatternConstraint();
       postalCodePatternConstraint.setMessageKey("validate.dummykey");
       postalCodePatternConstraint.setValidationMessageParams( new ArrayList<String>());
	postalCodePatternConstraint.setValue(regex);

	postalCodeDefinition = new AttributeDefinition();
	postalCodeDefinition.setName("postalCode");
	postalCodeDefinition.setValidCharactersConstraint(postalCodePatternConstraint);
	attributes.add(postalCodeDefinition);

	addressEntry.setAttributes(attributes);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:27,代码来源:ZipcodePatternConstraintTest.java


示例11: getValues

import org.kuali.rice.krad.datadictionary.AttributeDefinition; //导入依赖的package包/类
/**
 * Will first try to retrieve options configured on the control.  If that doesn't return any values then will
 * try to use the optionfinder on the AttributeDefinition.
 *
 * @param attr - AttributeDefinition
 * @return Map of key value pairs
 */
protected Map<String, String> getValues(AttributeDefinition attr) {
    Control control = attr.getControlField();

    if ((control instanceof MultiValueControl)
            && (((MultiValueControl) control).getOptions() != null)
            && !((MultiValueControl) control).getOptions().isEmpty()) {
        List<KeyValue> keyValues = ((MultiValueControl) control).getOptions();
                Map<String, String> options = new HashMap<String, String> ();
                for (KeyValue keyValue : keyValues) {
                    options.put(keyValue.getKey(), keyValue.getValue());
                }
                return options;
    } else if (attr.getOptionsFinder() != null) {
        return attr.getOptionsFinder().getKeyLabelMap();
    }

    return Collections.emptyMap();
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:26,代码来源:DataDictionaryRemoteFieldServiceImpl.java


示例12: getAttributeLabel

import org.kuali.rice.krad.datadictionary.AttributeDefinition; //导入依赖的package包/类
@Override
public String getAttributeLabel(String entryName, String attributeName) {
       String label = "";

       AttributeDefinition attributeDefinition = getAttributeDefinition(entryName, attributeName);
       if (attributeDefinition != null) {
           // KULRICE-4445 prevent NullPointerException by ensuring a label is set
           label = attributeDefinition.getLabel();
           if (!StringUtils.isEmpty(attributeDefinition.getDisplayLabelAttribute())) {
               attributeDefinition = getAttributeDefinition(entryName, attributeDefinition.getDisplayLabelAttribute());
               if (attributeDefinition != null) {
                   label = attributeDefinition.getLabel();
               }
           }
       }

       return label;
   }
 
开发者ID:kuali,项目名称:kc-rice,代码行数:19,代码来源:DataDictionaryServiceImpl.java


示例13: getAttributeShortLabel

import org.kuali.rice.krad.datadictionary.AttributeDefinition; //导入依赖的package包/类
@Override
public String getAttributeShortLabel(String entryName, String attributeName) {
       String shortLabel = "";

       AttributeDefinition attributeDefinition = getAttributeDefinition(entryName, attributeName);
       if (attributeDefinition != null) {
           if (!StringUtils.isEmpty(attributeDefinition.getDisplayLabelAttribute())) {
               attributeDefinition = getAttributeDefinition(entryName, attributeDefinition.getDisplayLabelAttribute());
               if (attributeDefinition != null) {
                   shortLabel = attributeDefinition.getShortLabel();
               }
           } else {
               shortLabel = attributeDefinition.getShortLabel();
           }
       }

       return shortLabel;
   }
 
开发者ID:kuali,项目名称:kc-rice,代码行数:19,代码来源:DataDictionaryServiceImpl.java


示例14: getAttributeDefinition

import org.kuali.rice.krad.datadictionary.AttributeDefinition; //导入依赖的package包/类
/**
    * @param entryName - the qualified object name e.g. edu.sampleu.demo.kitchensink.TimeInfo
    * @param attributeName - an attribute name e.g. startTimeAmPm
    * @return AttributeDefinition for the given dataObjectClass and attribute name, or null if there is none
    * @throws IllegalArgumentException if the given Class is null or is not a BusinessObject class
    */
   @Override
public AttributeDefinition getAttributeDefinition(String entryName, String attributeName) {
       if (StringUtils.isBlank(attributeName)) {
           throw new IllegalArgumentException("invalid (blank) attributeName");
       }
       AttributeDefinition attributeDefinition = null;

       DataDictionaryEntryBase entry =
               (DataDictionaryEntryBase) getDataDictionary().getDictionaryObjectEntry(entryName);
       if (entry != null) {
           attributeDefinition = entry.getAttributeDefinition(attributeName);
       }

       return attributeDefinition;
   }
 
开发者ID:kuali,项目名称:kc-rice,代码行数:22,代码来源:DataDictionaryServiceImpl.java


示例15: getAttributeValidationPatternName

import org.kuali.rice.krad.datadictionary.AttributeDefinition; //导入依赖的package包/类
/**
 * @param attribute <code>{@link AttributeDefinition}</code>
 * @return String
 */
private String getAttributeValidationPatternName(AttributeDefinition attribute) throws Exception {
    String retval = new String();
    if (attribute.getValidationPattern() != null) {
        retval = attribute.getValidationPattern().getClass().getName();
    }

    if (retval.indexOf(".") > 0) {
        retval = retval.substring(retval.lastIndexOf(".") + 1);
    }
    if (retval.endsWith(VALIDATION_PATTERN_STRING)) {
        retval = retval.substring(0, retval.lastIndexOf(VALIDATION_PATTERN_STRING));
    }

    return retval;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:20,代码来源:KualiHelpAction.java


示例16: getFullyMaskedValue

import org.kuali.rice.krad.datadictionary.AttributeDefinition; //导入依赖的package包/类
public static String getFullyMaskedValue(String className, String fieldName, Object formObject, String propertyName) {
	String displayMaskValue = null;
	Object propertyValue = ObjectUtils.getPropertyValue(formObject, propertyName);

	DataDictionaryEntryBase entry = (DataDictionaryEntryBase) KRADServiceLocatorWeb.getDataDictionaryService()
			.getDataDictionary().getDictionaryObjectEntry(className);
	AttributeDefinition a = entry.getAttributeDefinition(fieldName);

	AttributeSecurity attributeSecurity = a.getAttributeSecurity();
	if (attributeSecurity != null && attributeSecurity.isMask()) {
		MaskFormatter maskFormatter = attributeSecurity.getMaskFormatter();
		displayMaskValue = maskFormatter.maskValue(propertyValue);

	}
	return displayMaskValue;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:17,代码来源:WebUtils.java


示例17: getPartiallyMaskedValue

import org.kuali.rice.krad.datadictionary.AttributeDefinition; //导入依赖的package包/类
public static String getPartiallyMaskedValue(String className, String fieldName, Object formObject,
		String propertyName) {
	String displayMaskValue = null;
	Object propertyValue = ObjectUtils.getPropertyValue(formObject, propertyName);

	DataDictionaryEntryBase entry = (DataDictionaryEntryBase) KRADServiceLocatorWeb.getDataDictionaryService()
			.getDataDictionary().getDictionaryObjectEntry(className);
	AttributeDefinition a = entry.getAttributeDefinition(fieldName);

	AttributeSecurity attributeSecurity = a.getAttributeSecurity();
	if (attributeSecurity != null && attributeSecurity.isPartialMask()) {
		MaskFormatter partialMaskFormatter = attributeSecurity.getPartialMaskFormatter();
		displayMaskValue = partialMaskFormatter.maskValue(propertyValue);

	}
	return displayMaskValue;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:18,代码来源:WebUtils.java


示例18: buildKeyLabelMap

import org.kuali.rice.krad.datadictionary.AttributeDefinition; //导入依赖的package包/类
private ExportMap buildKeyLabelMap(AttributeDefinition attribute) {

        ExportMap keyLabelMap = new ExportMap("keyLabelMap");

        List<Map.Entry<String, String>> keyLabelList = new ArrayList<Map.Entry<String, String>>(attribute.getOptionsFinder().getKeyLabelMap().entrySet());
        Collections.sort(keyLabelList, new Comparator<Map.Entry<String, String>>() {
            @Override
            public int compare(Map.Entry<String, String> o1, Map.Entry<String, String> o2) {
                 return o1.getValue().compareTo(o2.getValue());
            }
        });
        for (Map.Entry<String, String> entry : keyLabelList) {
            keyLabelMap.set(entry.getKey(), entry.getValue());
        }
        return keyLabelMap;
    }
 
开发者ID:kuali,项目名称:kc-rice,代码行数:17,代码来源:AttributesMapBuilder.java


示例19: verifyAttributeLabelOverrideFromSpringMetadata

import org.kuali.rice.krad.datadictionary.AttributeDefinition; //导入依赖的package包/类
@Test
public void verifyAttributeLabelOverrideFromSpringMetadata() {
    DataObjectEntry dataObjectEntry = getDataObjectEntry(MAIN_DATA_OBJECT_FOR_TESTING);
    AttributeDefinition attributeDefinition = dataObjectEntry.getAttributeDefinition("nonStandardDataType");
    assertNotNull("nonStandardDataType attribute did not exist",attributeDefinition);
    assertEquals(
            "Label on nonStandardDataType attribute not pulled from Spring metadata: " + attributeDefinition + "\n",
            "Non Standard Label-Spring", attributeDefinition.getLabel());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:10,代码来源:DataDictionaryMetadataDefaultingTest.java


示例20: getAttributeEntries

import org.kuali.rice.krad.datadictionary.AttributeDefinition; //导入依赖的package包/类
@Override
   public Map<String,Object> getAttributeEntries( List<KimAttributeField> definitions ) {
	final Map<String,Object> attributeEntries = new HashMap<String,Object>();
	if (definitions != null) {
        for (AttributeDefinition definition : DataDictionaryTypeServiceHelper.toKimAttributeDefinitions(definitions)) {
			final AttributesMapBuilder builder = new AttributesMapBuilder();
               final ExportMap map = builder.buildAttributeMap(definition, "");
               attributeEntries.put(definition.getName(),map.getExportData());
		}
	}
       return attributeEntries;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:13,代码来源:UiDocumentServiceImpl.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java StatisticsManagerServer类代码示例发布时间:2022-05-22
下一篇:
Java InvalidStackFrameException类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap