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


Java Constrainable类代码示例

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


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

示例1: validateAttribute

import org.kuali.rice.krad.datadictionary.validation.capability.Constrainable; //导入依赖的package包/类
/**
 * Validates the attribute specified by definition
 *
 * @param definition -   the constrainable attribute definition of a specific attribute name
 * @throws AttributeValidationException
 */
protected void validateAttribute(DictionaryValidationResult result, Constrainable definition,
        AttributeValueReader attributeValueReader, boolean checkIfRequired, String validationState,
        StateMapping stateMapping) throws AttributeValidationException {

    if (definition == null) {
        throw new AttributeValidationException(
                "Unable to validate constraints for attribute \"" + attributeValueReader.getAttributeName() +
                        "\" on entry \"" + attributeValueReader.getEntryName() +
                        "\" because no attribute definition can be found.");
    }

    Object value = attributeValueReader.getValue();

    processElementConstraints(result, value, definition, attributeValueReader, checkIfRequired, validationState,
            stateMapping);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:23,代码来源:DictionaryValidationServiceImpl.java

示例2: validateAttribute

import org.kuali.rice.krad.datadictionary.validation.capability.Constrainable; //导入依赖的package包/类
/**
 * Validates the attribute specified by definition
 *
 * @param definition -   the constrainable attribute definition of a specific attribute name
 * @throws AttributeValidationException
 * @see #validateAttribute(DictionaryValidationResult, AttributeValueReader, boolean) for the other parameters
 */
protected void validateAttribute(DictionaryValidationResult result, Constrainable definition,
        AttributeValueReader attributeValueReader, boolean checkIfRequired, String validationState,
        StateMapping stateMapping) throws AttributeValidationException {

    if (definition == null) {
        throw new AttributeValidationException(
                "Unable to validate constraints for attribute \"" + attributeValueReader.getAttributeName() +
                        "\" on entry \"" + attributeValueReader.getEntryName() +
                        "\" because no attribute definition can be found.");
    }

    Object value = attributeValueReader.getValue();

    processElementConstraints(result, value, definition, attributeValueReader, checkIfRequired, validationState,
            stateMapping);
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:24,代码来源:DictionaryValidationServiceImpl.java

示例3: getType

import org.kuali.rice.krad.datadictionary.validation.capability.Constrainable; //导入依赖的package包/类
@Override
public Class<?> getType(String selectedAttributeName) {
    Constrainable attributeDefinition = getDefinition(selectedAttributeName);

    if (attributeDefinition != null && attributeDefinition instanceof DataTypeConstraint) {
        DataTypeConstraint dataTypeConstraint = (DataTypeConstraint) attributeDefinition;
        if (dataTypeConstraint.getDataType() != null) {
            return dataTypeConstraint.getDataType().getType();
        }
    }

    // Assuming we can reliably guess
    return value != null ? value.getClass() : null;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:15,代码来源:SingleAttributeValueReader.java

示例4: getValue

import org.kuali.rice.krad.datadictionary.validation.capability.Constrainable; //导入依赖的package包/类
@Override
public <X> X getValue(String attributeName) throws AttributeValidationException {
    Constrainable attributeDefinition = getDefinition(attributeName);

    if (attributeDefinition != null) {
        return (X) value;
    }

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

示例5: isSupported

import org.kuali.rice.krad.datadictionary.validation.capability.Constrainable; //导入依赖的package包/类
/**
 * @see org.kuali.rice.krad.datadictionary.validation.constraint.provider.ConstraintProvider#isSupported(org.kuali.rice.krad.datadictionary.validation.capability.Constrainable)
 */
@Override
public boolean isSupported(Constrainable definition) {

    if (definition instanceof ComplexAttributeDefinition) {
        return true;
    }

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

示例6: isSupported

import org.kuali.rice.krad.datadictionary.validation.capability.Constrainable; //导入依赖的package包/类
/**
 * @see org.kuali.rice.krad.datadictionary.validation.constraint.provider.ConstraintProvider#isSupported(org.kuali.rice.krad.datadictionary.validation.capability.Constrainable)
 */
@Override
public boolean isSupported(Constrainable definition) {

    if (definition instanceof CollectionDefinition) {
        return true;
    }

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

示例7: isSupported

import org.kuali.rice.krad.datadictionary.validation.capability.Constrainable; //导入依赖的package包/类
/**
 * @see org.kuali.rice.krad.datadictionary.validation.constraint.provider.ConstraintProvider#isSupported(org.kuali.rice.krad.datadictionary.validation.capability.Constrainable)
 */
@Override
public boolean isSupported(Constrainable definition) {

    if (definition instanceof DataObjectEntry) {
        return true;
    }

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

示例8: isSupported

import org.kuali.rice.krad.datadictionary.validation.capability.Constrainable; //导入依赖的package包/类
/**
 * @see org.kuali.rice.krad.datadictionary.validation.constraint.provider.ConstraintProvider#isSupported(org.kuali.rice.krad.datadictionary.validation.capability.Constrainable)
 */
@Override
public boolean isSupported(Constrainable definition) {

    if (definition instanceof AttributeDefinition
            || definition instanceof InputField
            || definition instanceof ViewAttributeValueReader.InputFieldConstrainableInfo) {
        return true;
    }

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

示例9: getDefinition

import org.kuali.rice.krad.datadictionary.validation.capability.Constrainable; //导入依赖的package包/类
/**
 * Gets the definition which is an InputField on the View/Page
 */
@Override
public Constrainable getDefinition(String attributeName) {
    InputFieldConstrainableInfo field = inputFieldMap.get(attributeName);
    if (field != null) {
        return field;
    } else {
        return null;
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:13,代码来源:ViewAttributeValueReader.java

示例10: getDefinitions

import org.kuali.rice.krad.datadictionary.validation.capability.Constrainable; //导入依赖的package包/类
@Override
public List<Constrainable> getDefinitions() {
    if (entry instanceof DataDictionaryEntryBase) {
        DataDictionaryEntryBase entryBase = (DataDictionaryEntryBase) entry;
        List<Constrainable> definitions = new ArrayList<Constrainable>();
        List<AttributeDefinition> attributeDefinitions = entryBase.getAttributes();
        definitions.addAll(attributeDefinitions);
        return definitions;
    }

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

示例11: getEntry

import org.kuali.rice.krad.datadictionary.validation.capability.Constrainable; //导入依赖的package包/类
@Override
public Constrainable getEntry() {
    if (entry instanceof Constrainable) {
        return (Constrainable) entry;
    }

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

示例12: processSingleValidCharacterConstraint

import org.kuali.rice.krad.datadictionary.validation.capability.Constrainable; //导入依赖的package包/类
protected ConstraintValidationResult processSingleValidCharacterConstraint(DictionaryValidationResult result,
        Object value, ValidCharactersConstraint constraint,
        AttributeValueReader attributeValueReader) throws AttributeValidationException {

    if (constraint == null) {
        return result.addNoConstraint(attributeValueReader, CONSTRAINT_NAME);
    }

    if (ValidationUtils.isNullOrEmpty(value)) {
        return result.addSkipped(attributeValueReader, CONSTRAINT_NAME);
    }

    // This mix-in interface is here to allow some definitions to avoid the extra processing that goes on in KNS
    // to decipher and validate things like date range strings -- something that looks like "02/02/2002..03/03/2003"
    Constrainable definition = attributeValueReader.getDefinition(attributeValueReader.getAttributeName());
    if (definition instanceof Formatable) {
        return doProcessFormattableValidCharConstraint(result, constraint, (Formatable) definition, value,
                attributeValueReader);
    }

    ConstraintValidationResult constraintValidationResult = doProcessValidCharConstraint(constraint, value);
    if (constraintValidationResult == null) {
        return result.addSuccess(attributeValueReader, CONSTRAINT_NAME);
    }

    result.addConstraintValidationResult(attributeValueReader, constraintValidationResult);
    constraintValidationResult.setConstraintLabelKey(constraint.getMessageKey());
    constraintValidationResult.setErrorParameters(constraint.getValidationMessageParamsArray());
    return constraintValidationResult;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:31,代码来源:ValidCharactersConstraintProcessor.java

示例13: isSupported

import org.kuali.rice.krad.datadictionary.validation.capability.Constrainable; //导入依赖的package包/类
/**
 * @see org.kuali.rice.krad.datadictionary.validation.constraint.provider.ConstraintProvider#isSupported(org.kuali.rice.krad.datadictionary.validation.capability.Constrainable)
 */
@Override
public boolean isSupported(Constrainable definition) {

    if (definition instanceof AttributeDefinition || definition instanceof InputField) {
        return true;
    }

    return false;
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:13,代码来源:AttributeDefinitionConstraintProvider.java

示例14: getDefinition

import org.kuali.rice.krad.datadictionary.validation.capability.Constrainable; //导入依赖的package包/类
/**
 * Gets the definition which is an InputField on the View/Page
 */
@Override
public Constrainable getDefinition(String attributeName) {
    InputField field = inputFieldMap.get(attributeName);
    if (field != null) {
        return field;
    } else {
        return null;
    }
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:13,代码来源:ViewAttributeValueReader.java

示例15: getDefinition

import org.kuali.rice.krad.datadictionary.validation.capability.Constrainable; //导入依赖的package包/类
@Override
public Constrainable getDefinition(String attributeName) {
    // Only return the definition if you have it, and if it's the definition for the passed attribute name
    return definition != null && definition.getName() != null && definition.getName().equals(attributeName) ?
            definition : null;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:7,代码来源:SingleAttributeValueReader.java


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