• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java ValidationPattern类的典型用法和代码示例

java 1次浏览

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

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

示例1: validateAPOAmount

点赞 3

import org.kuali.rice.krad.datadictionary.validation.ValidationPattern; //导入依赖的package包/类
/**
 * Validates that the APO amount is a valid amount according to
 * the FixedPointValidationPattern (i.e. non negative number with the precision and scale
 * as defined in the data dictionary).
 *
 * @param apoAmount
 * @param attributeDefinition
 * @return
 */
boolean validateAPOAmount(KualiDecimal apoAmount, AttributeDefinition attributeDefinition) {
    boolean valid = true;

    if (ObjectUtils.isNotNull(attributeDefinition)) {
        final ValidationPattern validationPattern = attributeDefinition.getValidationPattern();

        if (ObjectUtils.isNotNull(validationPattern) && validationPattern instanceof FixedPointValidationPattern) {
            FixedPointValidationPattern fixedPointPattern = (FixedPointValidationPattern) validationPattern;
            if (!fixedPointPattern.matches(apoAmount.toString())) {
                valid &= false;
                String scale = Integer.toString(fixedPointPattern.getScale());
                String precision = Integer.toString(fixedPointPattern.getPrecision());
                GlobalVariables.getMessageMap().putError(attributeDefinition.getName(), attributeDefinition.getValidationPattern().getValidationErrorMessageKey(), attributeDefinition.getLabel(), precision, scale);
            }
        }
    }

    return valid;

}
 

开发者ID:kuali,
项目名称:kfs,
代码行数:30,
代码来源:VendorRule.java

示例2: testZero_Percision_And_Scale_invalid8

点赞 2

import org.kuali.rice.krad.datadictionary.validation.ValidationPattern; //导入依赖的package包/类
@Test(expected=ValidationPattern.ValidationPatternException.class)
public final void testZero_Percision_And_Scale_invalid8() {
    //what happens when precision & scale are not set in DD
	pattern.setPrecision(0);
    pattern.setScale(0);
    pattern.completeValidation();
}
 

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

示例3: getValidationPattern

点赞 2

import org.kuali.rice.krad.datadictionary.validation.ValidationPattern; //导入依赖的package包/类
/**
 * @see org.kuali.rice.krad.datadictionary.AttributeDefinition#getValidationPattern()
 */
@Override
public ValidationPattern getValidationPattern() {
    ValidationPattern validationPattern = super.getValidationPattern();
    if (validationPattern == null) {
        validationPattern = getDelegate().getValidationPattern();
    }

    return validationPattern;
}
 

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

示例4: getAttributeValidatingErrorMessageKey

点赞 2

import org.kuali.rice.krad.datadictionary.validation.ValidationPattern; //导入依赖的package包/类
/**
 * @see org.kuali.rice.krad.service.DataDictionaryService#getAttributeValidatingErrorMessageKey(java.lang.String, java.lang.String)
 */
@Override
public String getAttributeValidatingErrorMessageKey(String entryName, String attributeName) {
    AttributeDefinition attributeDefinition = getAttributeDefinition(entryName, attributeName);
    if (attributeDefinition != null) {
        if (attributeDefinition.hasValidationPattern()) {
            ValidationPattern validationPattern = attributeDefinition.getValidationPattern();
            return validationPattern.getValidationErrorMessageKey();
        }
    }
    return null;
}
 

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

示例5: getAttributeValidatingErrorMessageParameters

点赞 2

import org.kuali.rice.krad.datadictionary.validation.ValidationPattern; //导入依赖的package包/类
/**
 * @see org.kuali.rice.krad.service.DataDictionaryService#getAttributeValidatingErrorMessageParameters(java.lang.String, java.lang.String)
 */
@Override
public String[] getAttributeValidatingErrorMessageParameters(String entryName, String attributeName) {
    AttributeDefinition attributeDefinition = getAttributeDefinition(entryName, attributeName);
    if (attributeDefinition != null) {
        if (attributeDefinition.hasValidationPattern()) {
            ValidationPattern validationPattern = attributeDefinition.getValidationPattern();
            String attributeLabel = getAttributeErrorLabel(entryName, attributeName);
            return validationPattern.getValidationErrorMessageParameters(attributeLabel);
        }
    }
    return null;
}
 

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

示例6: getAttributeValidatingErrorMessageKey

点赞 2

import org.kuali.rice.krad.datadictionary.validation.ValidationPattern; //导入依赖的package包/类
/**
    * @see org.kuali.rice.krad.service.DataDictionaryService#getAttributeValidatingErrorMessageKey(java.lang.String, java.lang.String)
    */
   @Override
public String getAttributeValidatingErrorMessageKey(String entryName, String attributeName) {
       AttributeDefinition attributeDefinition = getAttributeDefinition(entryName, attributeName);
       if (attributeDefinition != null) {
           if (attributeDefinition.hasValidationPattern()) {
               ValidationPattern validationPattern = attributeDefinition.getValidationPattern();
               return validationPattern.getValidationErrorMessageKey();
           }
       }
       return null;
   }
 

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

示例7: getAttributeValidatingErrorMessageParameters

点赞 2

import org.kuali.rice.krad.datadictionary.validation.ValidationPattern; //导入依赖的package包/类
/**
    * @see org.kuali.rice.krad.service.DataDictionaryService#getAttributeValidatingErrorMessageParameters(java.lang.String, java.lang.String)
    */
   @Override
public String[] getAttributeValidatingErrorMessageParameters(String entryName, String attributeName) {
       AttributeDefinition attributeDefinition = getAttributeDefinition(entryName, attributeName);
       if (attributeDefinition != null) {
           if (attributeDefinition.hasValidationPattern()) {
               ValidationPattern validationPattern = attributeDefinition.getValidationPattern();
               String attributeLabel = getAttributeErrorLabel(entryName, attributeName);
               return validationPattern.getValidationErrorMessageParameters(attributeLabel);
           }
       }
       return null;
   }
 

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

示例8: usesDateValidation

点赞 2

import org.kuali.rice.krad.datadictionary.validation.ValidationPattern; //导入依赖的package包/类
/**
 * Determines if this method uses a date validation pattern, in which case, a date picker should be rendered
 * @param propertyName the property of the field being checked from the command line
 * @param accountingLineToRender the accounting line which is being rendered
 * @return true if the property does use date validation, false otherwise
 */
protected boolean usesDateValidation(String propertyName, Object businessObject) {
    final org.kuali.rice.krad.datadictionary.BusinessObjectEntry entry = SpringContext.getBean(DataDictionaryService.class).getDataDictionary().getBusinessObjectEntry(businessObject.getClass().getName());
    AttributeDefinition attributeDefinition = entry.getAttributeDefinition(propertyName);
    
    if (attributeDefinition == null) {
        if (!propertyName.contains(".")) return false;
        final int firstNestingPoint = propertyName.indexOf(".");
        final String toNestingPoint = propertyName.substring(0, firstNestingPoint);
        final String fromNestingPoint = propertyName.substring(firstNestingPoint+1);
        Object childObject = null;
        try {
            final Class childClass = PropertyUtils.getPropertyType(businessObject, toNestingPoint);
            childObject = childClass.newInstance();
        }
        catch (IllegalAccessException iae) {
            new UnsupportedOperationException(iae);
        }
        catch (InvocationTargetException ite) {
            new UnsupportedOperationException(ite);
        }
        catch (NoSuchMethodException nsme) {
            new UnsupportedOperationException(nsme);
        }
        catch (InstantiationException ie) {
            throw new UnsupportedOperationException(ie);
        }
        return usesDateValidation(fromNestingPoint, childObject);
    }
    
    final ValidationPattern validationPattern = attributeDefinition.getValidationPattern();
    if (validationPattern == null) return false; // no validation for sure means we ain't using date validation
    return validationPattern instanceof DateValidationPattern;
}
 

开发者ID:VU-libtech,
项目名称:OLE-INST,
代码行数:40,
代码来源:AccountingLineRenderingServiceImpl.java

示例9: isValidAccountNumberLength

点赞 2

import org.kuali.rice.krad.datadictionary.validation.ValidationPattern; //导入依赖的package包/类
/**
 * Checks an account numbers exact length
 *
 * @param accountNumber
 * @param size to be returned
 * @return
 */
protected boolean isValidAccountNumberLength(String accountNumber, AccountCreationStatusDTO accountCreationStatus){

    boolean isValid = false;
    int fieldSize = -1;

    //grab account number length from DD and set size
    final org.kuali.rice.krad.datadictionary.BusinessObjectEntry entry = dataDictionaryService.getDataDictionary().getBusinessObjectEntry(Account.class.getName());
    AttributeDefinition attributeDefinition = entry.getAttributeDefinition(KFSPropertyConstants.ACCOUNT_NUMBER);

    if(ObjectUtils.isNotNull(attributeDefinition)){
        final ValidationPattern validationPattern = attributeDefinition.getValidationPattern();

        if(ObjectUtils.isNotNull(validationPattern) && validationPattern instanceof AlphaNumericValidationPattern){
            AlphaNumericValidationPattern alphaPattern = (AlphaNumericValidationPattern)validationPattern;
            fieldSize = alphaPattern.getExactLength();
        }
    }

    //skip if account number null
    if(ObjectUtils.isNotNull(accountNumber)){

        //data dictionary defined size must equal length of incoming value
        if(fieldSize == accountNumber.length()){
            isValid = true;
        }
    }

    if(isValid == false){
        setFailStatus( accountCreationStatus, KcUtils.getErrorMessage(KcConstants.AccountCreationService.ERROR_KR_ALPHANUMERIC_VALIDATION_EXACT_LENGTH, new String[]{"account number", String.valueOf(fieldSize)}));
    }

    return isValid;
}
 

开发者ID:kuali,
项目名称:kfs,
代码行数:41,
代码来源:AccountCreationServiceImpl.java

示例10: getValidationPattern

点赞 2

import org.kuali.rice.krad.datadictionary.validation.ValidationPattern; //导入依赖的package包/类
/**
 * @see org.kuali.rice.krad.datadictionary.AttributeDefinition#getValidationPattern()
 */
public ValidationPattern getValidationPattern() {
    ValidationPattern validationPattern = super.getValidationPattern();
    if (validationPattern == null) {
        validationPattern = getDelegate().getValidationPattern();
    }

    return validationPattern;
}
 

开发者ID:aapotts,
项目名称:kuali_rice,
代码行数:12,
代码来源:ExternalizableAttributeDefinitionProxy.java

示例11: getAttributeValidatingErrorMessageKey

点赞 2

import org.kuali.rice.krad.datadictionary.validation.ValidationPattern; //导入依赖的package包/类
/**
 * @see org.kuali.rice.krad.service.DataDictionaryService#getAttributeValidatingErrorMessageKey(java.lang.String, java.lang.String)
 */
public String getAttributeValidatingErrorMessageKey(String entryName, String attributeName) {
    AttributeDefinition attributeDefinition = getAttributeDefinition(entryName, attributeName);
    if (attributeDefinition != null) {
        if (attributeDefinition.hasValidationPattern()) {
            ValidationPattern validationPattern = attributeDefinition.getValidationPattern();
            return validationPattern.getValidationErrorMessageKey();
        }
    }
    return null;
}
 

开发者ID:aapotts,
项目名称:kuali_rice,
代码行数:14,
代码来源:DataDictionaryServiceImpl.java

示例12: getAttributeValidatingErrorMessageParameters

点赞 2

import org.kuali.rice.krad.datadictionary.validation.ValidationPattern; //导入依赖的package包/类
/**
 * @see org.kuali.rice.krad.service.DataDictionaryService#getAttributeValidatingErrorMessageParameters(java.lang.String, java.lang.String)
 */
public String[] getAttributeValidatingErrorMessageParameters(String entryName, String attributeName) {
    AttributeDefinition attributeDefinition = getAttributeDefinition(entryName, attributeName);
    if (attributeDefinition != null) {
        if (attributeDefinition.hasValidationPattern()) {
            ValidationPattern validationPattern = attributeDefinition.getValidationPattern();
            String attributeLabel = getAttributeErrorLabel(entryName, attributeName);
            return validationPattern.getValidationErrorMessageParameters(attributeLabel);
        }
    }
    return null;
}
 

开发者ID:aapotts,
项目名称:kuali_rice,
代码行数:15,
代码来源:DataDictionaryServiceImpl.java

示例13: testPrecision_Less_Than_Scale_invalid9

点赞 2

import org.kuali.rice.krad.datadictionary.validation.ValidationPattern; //导入依赖的package包/类
@Test(expected=ValidationPattern.ValidationPatternException.class)
public final void testPrecision_Less_Than_Scale_invalid9() {
	pattern.setPrecision(1);
    pattern.setScale(3);
    pattern.completeValidation();
}
 

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

示例14: testPrecision_And_Scale_Negative_invalid10

点赞 2

import org.kuali.rice.krad.datadictionary.validation.ValidationPattern; //导入依赖的package包/类
@Test(expected=ValidationPattern.ValidationPatternException.class)
public final void testPrecision_And_Scale_Negative_invalid10() {
	pattern.setPrecision(-3);
    pattern.setScale(-1);
    pattern.completeValidation();
}
 

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

示例15: toKimAttributeDefinition

点赞 2

import org.kuali.rice.krad.datadictionary.validation.ValidationPattern; //导入依赖的package包/类
public static KimAttributeDefinition toKimAttributeDefinition(KimAttributeField field) {
    if (field == null) {
        throw new IllegalArgumentException("field is null");
    }

    KimAttributeDefinition ad = new KimAttributeDefinition();
    ad.setKimAttrDefnId(field.getId());
    ad.setUnique(field.isUnique());

    final RemotableAttributeField attr = field.getAttributeField();
    ad.setName(attr.getName());
    ad.setDataType(attr.getDataType());
    ad.setShortLabel(attr.getShortLabel());
    ad.setLabel(attr.getLongLabel());
    ad.setSummary(attr.getHelpSummary());
    ad.setConstraintText(attr.getConstraintText());
    ad.setDescription(attr.getHelpDescription());
    ad.setForceUppercase(attr.isForceUpperCase());
    ad.setMinLength(attr.getMinLength());
    ad.setMaxLength(attr.getMaxLength());
    ad.setExclusiveMin(attr.getMinValue() != null ? attr.getMinValue().toString() : null);
    ad.setInclusiveMax(attr.getMaxValue() != null ? attr.getMaxValue().toString() : null);
    if (StringUtils.isNotBlank(attr.getRegexConstraint())) {
        ValidationPattern pattern = new ValidationPattern() {

            @Override
            public Pattern getRegexPattern() {
                return Pattern.compile(getRegexString());
            }

            @Override
            protected String getRegexString() {
                return attr.getRegexConstraint();
            }

            @Override
            public ExportMap buildExportMap(String exportKey) {
                ExportMap exportMap = new ExportMap(exportKey);
                exportMap.set("type", "regex");
                exportMap.set("pattern", getRegexString());

                return exportMap;
            }

            @Override
            public String getValidationErrorMessageKey() {
                return attr.getRegexContraintMsg();
            }
        };
        ad.setValidationPattern(pattern);
    }
    ad.setRequired(attr.isRequired());

    final RemotableControlContract control = field.getAttributeField().getControl();

    if (control != null) {
        ControlDefinition d = toControlDefinition(control, ad);
        for (RemotableAbstractWidget widget : field.getAttributeField().getWidgets()) {
            if(widget instanceof RemotableQuickFinder) {
                ad.setLookupBoClass(((RemotableQuickFinder) widget).getDataObjectClass());
                ad.setLookupInputPropertyConversions(((RemotableQuickFinder) widget).getLookupParameters());
                ad.setLookupReturnPropertyConversions(((RemotableQuickFinder) widget).getFieldConversions());
            } else if (widget instanceof RemotableDatepicker && d != null) {
                d.setDatePicker(true);
            } else if (widget instanceof RemotableTextExpand && d != null) {
                d.setExpandedTextArea(true);
            }
        }
        ad.setControl(d);
    }

    return ad;
}
 

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

示例16: setValidationPattern

点赞 1

import org.kuali.rice.krad.datadictionary.validation.ValidationPattern; //导入依赖的package包/类
/**
 * The validationPattern element defines the allowable character-level or
 * field-level values for an attribute.
 *
 * JSTL: validationPattern is a Map which is accessed using a key of
 * "validationPattern". Each entry may contain some of the keys listed
 * below. The keys that may be present for a given attribute are dependent
 * upon the type of validationPattern.
 *
 * maxLength (String) exactLength type allowWhitespace allowUnderscore
 * allowPeriod validChars precision scale allowNegative
 *
 * The allowable keys (in addition to type) for each type are: Type****
 * ***Keys*** alphanumeric exactLength maxLength allowWhitespace
 * allowUnderscore allowPeriod
 *
 * alpha exactLength maxLength allowWhitespace
 *
 * anyCharacter exactLength maxLength allowWhitespace
 *
 * charset validChars
 *
 * numeric exactLength maxLength
 *
 * fixedPoint allowNegative precision scale
 *
 * floatingPoint allowNegative
 *
 * date n/a emailAddress n/a javaClass n/a month n/a phoneNumber n/a
 * timestamp n/a year n/a zipcode n/a
 *
 * Note: maxLength and exactLength are mutually exclusive. If one is
 * entered, the other may not be entered.
 *
 * Note: See ApplicationResources.properties for exact regex patterns. e.g.
 * validationPatternRegex.date for regex used in date validation.
 */
@Deprecated
public void setValidationPattern(ValidationPattern validationPattern) {
    this.validationPattern = validationPattern;
}
 

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

示例17: getValidationPattern

点赞 1

import org.kuali.rice.krad.datadictionary.validation.ValidationPattern; //导入依赖的package包/类
/**
 * Defines the allowable character-level or
 * field-level values for an attribute
 *
 * <p>
 * ValidationPattern is a Map which is accessed using a key of "validationPattern". Each entry may contain
 * some of the keys listed below. The keys that may be present for a given attribute are dependent
 * upon the type of validationPattern.
 *
 * maxLength (String) exactLength type allowWhitespace allowUnderscore
 * allowPeriod validChars precision scale allowNegative
 *
 * The allowable keys (in addition to type) for each type are: Type****
 * ***Keys*** alphanumeric exactLength maxLength allowWhitespace
 * allowUnderscore allowPeriod
 *
 * alpha exactLength maxLength allowWhitespace
 *
 * anyCharacter exactLength maxLength allowWhitespace
 *
 * charset validChars
 *
 * numeric exactLength maxLength
 *
 * fixedPoint allowNegative precision scale
 *
 * floatingPoint allowNegative
 *
 * date n/a emailAddress n/a javaClass n/a month n/a phoneNumber n/a
 * timestamp n/a year n/a zipcode n/a
 *
 * Note: maxLength and exactLength are mutually exclusive. If one is
 * entered, the other may not be entered.
 *
 * Note: See ApplicationResources.properties for exact regex patterns. e.g.
 * validationPatternRegex.date for regex used in date validation.
 * </p>
 *
 * @return ValidationPattern
 */
@Deprecated
public ValidationPattern getValidationPattern() {
    return this.validationPattern;
}
 

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

示例18: setValidationPattern

点赞 1

import org.kuali.rice.krad.datadictionary.validation.ValidationPattern; //导入依赖的package包/类
/**
 * The validationPattern element defines the allowable character-level or
 * field-level values for an attribute.
 *
 * JSTL: validationPattern is a Map which is accessed using a key of
 * "validationPattern". Each entry may contain some of the keys listed
 * below. The keys that may be present for a given attribute are dependent
 * upon the type of validationPattern.
 *
 * maxLength (String) exactLength type allowWhitespace allowUnderscore
 * allowPeriod validChars precision scale allowNegative
 *
 * The allowable keys (in addition to type) for each type are: Type****
 * ***Keys*** alphanumeric exactLength maxLength allowWhitespace
 * allowUnderscore allowPeriod
 *
 * alpha exactLength maxLength allowWhitespace
 *
 * anyCharacter exactLength maxLength allowWhitespace
 *
 * charset validChars
 *
 * numeric exactLength maxLength
 *
 * fixedPoint allowNegative precision scale
 *
 * floatingPoint allowNegative
 *
 * date n/a emailAddress n/a javaClass n/a month n/a phoneNumber n/a
 * timestamp n/a year n/a zipcode n/a
 *
 * Note: maxLength and exactLength are mutually exclusive. If one is
 * entered, the other may not be entered.
 *
 * Note: See ApplicationResources.properties for exact regex patterns. e.g.
 * validationPatternRegex.date for regex used in date validation.
 */
public void setValidationPattern(ValidationPattern validationPattern) {
    this.validationPattern = validationPattern;
}
 

开发者ID:aapotts,
项目名称:kuali_rice,
代码行数:41,
代码来源:AttributeDefinition.java

示例19: getValidationPattern

点赞 1

import org.kuali.rice.krad.datadictionary.validation.ValidationPattern; //导入依赖的package包/类
/**
 * Defines the allowable character-level or
 * field-level values for an attribute
 *
 * <p>
 * ValidationPattern is a Map which is accessed using a key of "validationPattern". Each entry may contain
 * some of the keys listed below. The keys that may be present for a given attribute are dependent
 * upon the type of validationPattern.
 *
 * maxLength (String) exactLength type allowWhitespace allowUnderscore
 * allowPeriod validChars precision scale allowNegative
 *
 * The allowable keys (in addition to type) for each type are: Type****
 * ***Keys*** alphanumeric exactLength maxLength allowWhitespace
 * allowUnderscore allowPeriod
 *
 * alpha exactLength maxLength allowWhitespace
 *
 * anyCharacter exactLength maxLength allowWhitespace
 *
 * charset validChars
 *
 * numeric exactLength maxLength
 *
 * fixedPoint allowNegative precision scale
 *
 * floatingPoint allowNegative
 *
 * date n/a emailAddress n/a javaClass n/a month n/a phoneNumber n/a
 * timestamp n/a year n/a zipcode n/a
 *
 * Note: maxLength and exactLength are mutually exclusive. If one is
 * entered, the other may not be entered.
 *
 * Note: See ApplicationResources.properties for exact regex patterns. e.g.
 * validationPatternRegex.date for regex used in date validation.
 * </p>
 *
 * @return ValidationPattern
 */
public ValidationPattern getValidationPattern() {
    return this.validationPattern;
}
 

开发者ID:aapotts,
项目名称:kuali_rice,
代码行数:44,
代码来源:AttributeDefinition.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)