本文整理汇总了Java中org.kuali.rice.krad.datadictionary.validation.SingleAttributeValueReader类的典型用法代码示例。如果您正苦于以下问题:Java SingleAttributeValueReader类的具体用法?Java SingleAttributeValueReader怎么用?Java SingleAttributeValueReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SingleAttributeValueReader类属于org.kuali.rice.krad.datadictionary.validation包,在下文中一共展示了SingleAttributeValueReader类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testPresenceOfRequiredSingleAttributeSuccess
import org.kuali.rice.krad.datadictionary.validation.SingleAttributeValueReader; //导入依赖的package包/类
@Test
public void testPresenceOfRequiredSingleAttributeSuccess() {
AttributeValueReader attributeValueReader = new SingleAttributeValueReader(noPostalCodeAddress.getCity(),
"org.kuali.rice.kns.datadictionary.validation.MockAddress", "city", cityRequiredDefinition);
Object value = attributeValueReader.getValue();
DictionaryValidationResult dictionaryValidationResult = new DictionaryValidationResult();
// This means that we do track everything above and including 'ok' results
dictionaryValidationResult.setErrorLevel(ErrorLevel.OK);
ConstraintValidationResult constraintValidationResult = processor.process(dictionaryValidationResult, value,
cityRequiredDefinition.getSimpleConstraint(), attributeValueReader)
.getFirstConstraintValidationResult();
// Make sure that the constraint we were looking for got run
Assert.assertEquals(new ExistenceConstraintProcessor().getName(),
constraintValidationResult.getConstraintName());
// Make sure that it's status is OK
Assert.assertEquals(ErrorLevel.OK, constraintValidationResult.getStatus());
Assert.assertEquals(0, dictionaryValidationResult.getNumberOfErrors());
}
示例2: testPresenceNotRequiredSingleAttributeSuccess
import org.kuali.rice.krad.datadictionary.validation.SingleAttributeValueReader; //导入依赖的package包/类
@Test
public void testPresenceNotRequiredSingleAttributeSuccess() {
AttributeValueReader attributeValueReader = new SingleAttributeValueReader(noPostalCodeAddress.getCountry(),
"org.kuali.rice.kns.datadictionary.validation.MockAddress", "country", countryNotRequiredDefinition);
Object value = attributeValueReader.getValue();
DictionaryValidationResult dictionaryValidationResult = new DictionaryValidationResult();
// This means that we do track everything above and including 'ok' results
dictionaryValidationResult.setErrorLevel(ErrorLevel.OK);
ConstraintValidationResult constraintValidationResult = processor.process(dictionaryValidationResult, value,
countryNotRequiredDefinition.getSimpleConstraint(), attributeValueReader)
.getFirstConstraintValidationResult();
// Make sure that the constraint we were looking for got run
Assert.assertEquals(new ExistenceConstraintProcessor().getName(),
constraintValidationResult.getConstraintName());
// Make sure that it's status is OK
Assert.assertEquals(ErrorLevel.INAPPLICABLE, constraintValidationResult.getStatus());
Assert.assertEquals(0, dictionaryValidationResult.getNumberOfErrors());
}
示例3: testAbsenceNotRequiredSingleAttributeSuccess
import org.kuali.rice.krad.datadictionary.validation.SingleAttributeValueReader; //导入依赖的package包/类
@Test
public void testAbsenceNotRequiredSingleAttributeSuccess() {
AttributeValueReader attributeValueReader = new SingleAttributeValueReader(
noPostalCodeOrCountryAddress.getCountry(), "org.kuali.rice.kns.datadictionary.validation.MockAddress",
"country", countryNotRequiredDefinition);
Object value = attributeValueReader.getValue();
DictionaryValidationResult dictionaryValidationResult = new DictionaryValidationResult();
// This means that we do track everything above and including 'ok' results
dictionaryValidationResult.setErrorLevel(ErrorLevel.OK);
ConstraintValidationResult constraintValidationResult = processor.process(dictionaryValidationResult, value,
countryNotRequiredDefinition.getSimpleConstraint(), attributeValueReader)
.getFirstConstraintValidationResult();
// Make sure that the constraint we were looking for got run
Assert.assertEquals(new ExistenceConstraintProcessor().getName(),
constraintValidationResult.getConstraintName());
// Make sure that it's status is OK
Assert.assertEquals(ErrorLevel.INAPPLICABLE, constraintValidationResult.getStatus());
Assert.assertEquals(0, dictionaryValidationResult.getNumberOfErrors());
}
示例4: testPresenceNoConstraintSingleAttributeSuccess
import org.kuali.rice.krad.datadictionary.validation.SingleAttributeValueReader; //导入依赖的package包/类
@Test
public void testPresenceNoConstraintSingleAttributeSuccess() {
AttributeValueReader attributeValueReader = new SingleAttributeValueReader(noPostalCodeAddress.getCountry(),
"org.kuali.rice.kns.datadictionary.validation.MockAddress", "country", countryNoConstraintDefinition);
Object value = attributeValueReader.getValue();
DictionaryValidationResult dictionaryValidationResult = new DictionaryValidationResult();
// This means that we do track everything above and including 'ok' results
dictionaryValidationResult.setErrorLevel(ErrorLevel.OK);
ConstraintValidationResult constraintValidationResult = processor.process(dictionaryValidationResult, value,
countryNoConstraintDefinition.getSimpleConstraint(), attributeValueReader)
.getFirstConstraintValidationResult();
// Make sure that the constraint we were looking for got run
Assert.assertEquals(new ExistenceConstraintProcessor().getName(),
constraintValidationResult.getConstraintName());
// Make sure that it's status is OK
Assert.assertEquals(ErrorLevel.NOCONSTRAINT, constraintValidationResult.getStatus());
Assert.assertEquals(0, dictionaryValidationResult.getNumberOfErrors());
}
示例5: testAbsenceNoConstraintSingleAttributeSuccess
import org.kuali.rice.krad.datadictionary.validation.SingleAttributeValueReader; //导入依赖的package包/类
@Test
public void testAbsenceNoConstraintSingleAttributeSuccess() {
AttributeValueReader attributeValueReader = new SingleAttributeValueReader(
noPostalCodeOrCountryAddress.getCountry(), "org.kuali.rice.kns.datadictionary.validation.MockAddress",
"country", countryNoConstraintDefinition);
Object value = attributeValueReader.getValue();
DictionaryValidationResult dictionaryValidationResult = new DictionaryValidationResult();
// This means that we do track everything above and including 'ok' results
dictionaryValidationResult.setErrorLevel(ErrorLevel.OK);
ConstraintValidationResult constraintValidationResult = processor.process(dictionaryValidationResult, value,
countryNoConstraintDefinition.getSimpleConstraint(), attributeValueReader)
.getFirstConstraintValidationResult();
// Make sure that the constraint we were looking for got run
Assert.assertEquals(new ExistenceConstraintProcessor().getName(),
constraintValidationResult.getConstraintName());
// Make sure that it's status is OK
Assert.assertEquals(ErrorLevel.NOCONSTRAINT, constraintValidationResult.getStatus());
Assert.assertEquals(0, dictionaryValidationResult.getNumberOfErrors());
}
示例6: testAbsenceOfRequiredSingleAttributeFailure
import org.kuali.rice.krad.datadictionary.validation.SingleAttributeValueReader; //导入依赖的package包/类
@Test
public void testAbsenceOfRequiredSingleAttributeFailure() {
AttributeValueReader attributeValueReader = new SingleAttributeValueReader(noPostalCodeOrCityAddress.getCity(),
"org.kuali.rice.kns.datadictionary.validation.MockAddress", "city", cityRequiredDefinition);
Object value = attributeValueReader.getValue();
DictionaryValidationResult dictionaryValidationResult = new DictionaryValidationResult();
ConstraintValidationResult constraintValidationResult = processor.process(dictionaryValidationResult, value,
cityRequiredDefinition.getSimpleConstraint(), attributeValueReader)
.getFirstConstraintValidationResult();
// Make sure that the constraint we were looking for got run
Assert.assertEquals(new ExistenceConstraintProcessor().getName(),
constraintValidationResult.getConstraintName());
// Make sure that it's status is ERROR
Assert.assertEquals(ErrorLevel.ERROR, constraintValidationResult.getStatus());
Assert.assertEquals(1, dictionaryValidationResult.getNumberOfErrors());
Assert.assertEquals(RiceKeyConstants.ERROR_REQUIRED, constraintValidationResult.getErrorKey());
// Make sure that the iterator works too
int countConstraints = 0;
if (dictionaryValidationResult.getNumberOfErrors() > 0) {
for (Iterator<ConstraintValidationResult> iterator = dictionaryValidationResult.iterator();
iterator.hasNext(); ) {
ConstraintValidationResult r = iterator.next();
if (r.getStatus().getLevel() >= ErrorLevel.WARN.getLevel()) {
countConstraints++;
}
}
}
Assert.assertEquals(1, countConstraints);
}
示例7: process
import org.kuali.rice.krad.datadictionary.validation.SingleAttributeValueReader; //导入依赖的package包/类
protected ConstraintValidationResult process(DictionaryValidationResult result, Object value, DataTypeConstraint constraint) {
AttributeDefinition definition = new AttributeDefinition();
definition.setName("testAttribute");
attributeValueReader = new SingleAttributeValueReader(value, "testEntry", "testAttribute", definition);
return processor.process(result, value, constraint, attributeValueReader).getFirstConstraintValidationResult();
}
示例8: process
import org.kuali.rice.krad.datadictionary.validation.SingleAttributeValueReader; //导入依赖的package包/类
private ConstraintValidationResult process(Object object, String attributeName, ValidCharactersConstraint constraint) {
AttributeValueReader attributeValueReader = new SingleAttributeValueReader(object, "org.kuali.rice.kns.datadictionary.validation.MockAddress", attributeName, monthDefinition);
Object value = attributeValueReader.getValue();
return processor.process(dictionaryValidationResult, value, constraint, attributeValueReader).getFirstConstraintValidationResult();
}
示例9: process
import org.kuali.rice.krad.datadictionary.validation.SingleAttributeValueReader; //导入依赖的package包/类
private ConstraintValidationResult process(Object object, String attributeName, ValidCharactersConstraint constraint) {
AttributeValueReader attributeValueReader = new SingleAttributeValueReader(object, "org.kuali.rice.kns.datadictionary.validation.MockAddress", attributeName, yearDefinition);
Object value = attributeValueReader.getValue();
return processor.process(dictionaryValidationResult, value, constraint, attributeValueReader).getFirstConstraintValidationResult();
}
示例10: process
import org.kuali.rice.krad.datadictionary.validation.SingleAttributeValueReader; //导入依赖的package包/类
private ConstraintValidationResult process(Object object, String attributeName, ValidCharactersConstraint constraint) {
AttributeValueReader attributeValueReader = new SingleAttributeValueReader(object, "org.kuali.rice.kns.datadictionary.validation.MockAddress", attributeName, timestampDefinition);
Object value = attributeValueReader.getValue();
return processor.process(dictionaryValidationResult, value, constraint, attributeValueReader).getFirstConstraintValidationResult();
}
示例11: process
import org.kuali.rice.krad.datadictionary.validation.SingleAttributeValueReader; //导入依赖的package包/类
private ConstraintValidationResult process(Object object, String attributeName, ValidCharactersConstraint constraint) {
AttributeValueReader attributeValueReader = new SingleAttributeValueReader(object, "org.kuali.rice.kns.datadictionary.validation.MockAddress", attributeName, javaClassDefinition);
Object value = attributeValueReader.getValue();
return processor.process(dictionaryValidationResult, value, constraint, attributeValueReader).getFirstConstraintValidationResult();
}
示例12: process
import org.kuali.rice.krad.datadictionary.validation.SingleAttributeValueReader; //导入依赖的package包/类
private ConstraintValidationResult process(Object object, String attributeName, ValidCharactersConstraint constraint) {
AttributeValueReader attributeValueReader = new SingleAttributeValueReader(object, "org.kuali.rice.kns.datadictionary.validation.MockAddress", attributeName, dateDefinition);
Object value = attributeValueReader.getValue();
return processor.process(dictionaryValidationResult, value, constraint, attributeValueReader).getFirstConstraintValidationResult();
}