use of org.kie.soup.project.datamodel.oracle.ModelField in project drools-wb by kiegroup.
the class FieldTypeProducer method getFactTypes.
public FactTypes getFactTypes() {
final FactTypes factTypes = new FactTypes();
final Map<String, ModelField[]> filteredFactTypes = ((AsyncPackageDataModelOracleImpl) oracle).getFilteredFactTypes();
for (final String factTypeName : filteredFactTypes.keySet()) {
final Set<FactTypes.Field> fields = new HashSet<>();
for (final ModelField modelField : filteredFactTypes.get(factTypeName)) {
fields.add(new FactTypes.Field(modelField.getName(), modelField.getType()));
}
factTypes.add(new FactTypes.FactType(factTypeName, fields));
}
return factTypes;
}
use of org.kie.soup.project.datamodel.oracle.ModelField in project drools-wb by kiegroup.
the class TestGuidedDecisionTableFileIndexer method getModuleDataModelOracle.
@Override
protected ModuleDataModelOracle getModuleDataModelOracle(final Path path) {
final ModuleDataModelOracle dmo = new ModuleDataModelOracleImpl();
dmo.addModuleModelFields(new HashMap<String, ModelField[]>() {
{
put(Applicant.class.getCanonicalName(), new ModelField[] { new ModelField("age", Integer.class.getName(), ModelField.FIELD_CLASS_TYPE.REGULAR_CLASS, ModelField.FIELD_ORIGIN.DECLARED, FieldAccessorsAndMutators.ACCESSOR, DataType.TYPE_NUMERIC_INTEGER) });
put(Mortgage.class.getCanonicalName(), new ModelField[] { new ModelField("amount", Integer.class.getName(), ModelField.FIELD_CLASS_TYPE.REGULAR_CLASS, ModelField.FIELD_ORIGIN.DECLARED, FieldAccessorsAndMutators.ACCESSOR, DataType.TYPE_NUMERIC_INTEGER), new ModelField("applicant", Applicant.class.getCanonicalName(), ModelField.FIELD_CLASS_TYPE.REGULAR_CLASS, ModelField.FIELD_ORIGIN.DECLARED, FieldAccessorsAndMutators.ACCESSOR, Applicant.class.getCanonicalName()) });
}
});
return dmo;
}
use of org.kie.soup.project.datamodel.oracle.ModelField in project drools-wb by kiegroup.
the class GuidedDecisionTableGeneratorListenerTest method addModelField.
private void addModelField(final String factName, final String fieldName, final String clazz, final String type) {
ModelField[] modelFields = new ModelField[1];
modelFields[0] = new ModelField(fieldName, clazz, ModelField.FIELD_CLASS_TYPE.TYPE_DECLARATION_CLASS, ModelField.FIELD_ORIGIN.DECLARED, FieldAccessorsAndMutators.BOTH, type);
if (packageModelFields.containsKey(factName)) {
final List<ModelField> existingModelFields = new ArrayList<ModelField>(Arrays.asList(packageModelFields.get(factName)));
existingModelFields.add(modelFields[0]);
modelFields = existingModelFields.toArray(modelFields);
}
packageModelFields.put(factName, modelFields);
}
use of org.kie.soup.project.datamodel.oracle.ModelField in project drools-wb by kiegroup.
the class TestEnumFileIndexer method getModuleDataModelOracle.
@Override
protected ModuleDataModelOracle getModuleDataModelOracle(final Path path) {
final ModuleDataModelOracle dmo = new ModuleDataModelOracleImpl();
dmo.addModuleModelFields(new HashMap<String, ModelField[]>() {
{
put("org.drools.workbench.screens.enums.backend.server.indexing.classes.Applicant", new ModelField[] { new ModelField("age", "java.lang.Integer", ModelField.FIELD_CLASS_TYPE.REGULAR_CLASS, ModelField.FIELD_ORIGIN.DECLARED, FieldAccessorsAndMutators.ACCESSOR, DataType.TYPE_NUMERIC_INTEGER) });
put("org.drools.workbench.screens.enums.backend.server.indexing.classes.Mortgage", new ModelField[] { new ModelField("amount", "java.lang.Integer", ModelField.FIELD_CLASS_TYPE.REGULAR_CLASS, ModelField.FIELD_ORIGIN.DECLARED, FieldAccessorsAndMutators.ACCESSOR, DataType.TYPE_NUMERIC_INTEGER), new ModelField("applicant", "org.drools.workbench.screens.enums.backend.server.indexing.classes.Applicant", ModelField.FIELD_CLASS_TYPE.REGULAR_CLASS, ModelField.FIELD_ORIGIN.DECLARED, FieldAccessorsAndMutators.ACCESSOR, "org.drools.workbench.screens.enums.backend.server.indexing.classes.Applicant") });
}
});
return dmo;
}
use of org.kie.soup.project.datamodel.oracle.ModelField in project drools-wb by kiegroup.
the class TestDrlFileIndexer method getModuleDataModelOracle.
@Override
protected ModuleDataModelOracle getModuleDataModelOracle(final Path path) {
final ModuleDataModelOracle dmo = new ModuleDataModelOracleImpl();
dmo.addModuleModelFields(new HashMap<String, ModelField[]>() {
{
put("org.drools.workbench.screens.drltext.backend.server.indexing.classes.Applicant", new ModelField[] { new ModelField("age", "java.lang.Integer", ModelField.FIELD_CLASS_TYPE.REGULAR_CLASS, ModelField.FIELD_ORIGIN.DECLARED, FieldAccessorsAndMutators.ACCESSOR, DataType.TYPE_NUMERIC_INTEGER) });
put("org.drools.workbench.screens.drltext.backend.server.indexing.classes.Mortgage", new ModelField[] { new ModelField("amount", "java.lang.Integer", ModelField.FIELD_CLASS_TYPE.REGULAR_CLASS, ModelField.FIELD_ORIGIN.DECLARED, FieldAccessorsAndMutators.ACCESSOR, DataType.TYPE_NUMERIC_INTEGER), new ModelField("applicant", "org.drools.workbench.screens.drltext.backend.server.indexing.classes.Applicant", ModelField.FIELD_CLASS_TYPE.REGULAR_CLASS, ModelField.FIELD_ORIGIN.DECLARED, FieldAccessorsAndMutators.ACCESSOR, "org.drools.workbench.screens.drltext.backend.server.indexing.classes.Applicant") });
}
});
return dmo;
}
Aggregations