use of org.jaffa.rules.meta.ClassMetaData in project jaffa-framework by jaffa-projects.
the class TestConfig method testModelMeta.
@Bean
public ClassMetaData testModelMeta() {
ClassMetaData data = classMetaData(TestModel.class);
data.property("field1").label("[Field1]").mandatory().maxLength("10").minLength("2").caseType("upper").foreignKey(TestModel.class.getName()).genericForeignKey(TestModel.class.getName(), "field1", null, TestValueClass.class.getName()).partialForeignKey(TestModel.class.getName()).primaryKey("field1").candidateKey("field1", true).comment("fifo").pattern(// IP Address Reg Exp;
"\\b(?:\\d{1,3}\\.){3}\\d{1,3}\\b").inList("in list").notInList("not in list").initialize(FieldInitializerTest.FIELD1_INIT_VALUE);
data.property("field2").label("[Field2]").maxValue("10").minValue("2").initialize(FieldInitializerTest.FIELD2_INIT_VALUE.toString(), "field2");
data.property("field3").initialize(Integer.toString(FieldInitializerTest.FIELD3_INIT_VALUE), "field3");
data.setExecutionRealm("business");
data.setVariation("DEF");
data.register();
return data;
}
use of org.jaffa.rules.meta.ClassMetaData in project jaffa-framework by jaffa-projects.
the class RuleInitializerFactoryTest method before.
/**
* Setup common data.
*/
@Before
public void before() {
VariationContext.setVariation("A");
Realm realm = new Realm("realm");
realm.setSource("Test");
realm.regex(TestModel.class.getName());
realm.register();
ClassMetaData data = new ClassMetaData(TestModel.class);
data.property("field1").initialize(FieldInitializerTest.FIELD1_INIT_VALUE);
data.property("field2").initialize(FieldInitializerTest.FIELD2_INIT_VALUE.toString());
data.setExecutionRealm(realm.getName());
data.setVariation(VariationContext.getVariation());
data.register();
new TestConfig().initializeRule();
target = new RuleInitializerFactory();
}
Aggregations