use of org.mongodb.morphia.mapping.Mapper in project morphia by mongodb.
the class QueryValidatorTest method shouldNotAllowStringValueWithTypeThatIsNotString.
@Test
public void shouldNotAllowStringValueWithTypeThatIsNotString() {
// expect
MappedClass mappedClass = new MappedClass(SimpleEntity.class, new Mapper());
MappedField mappedField = mappedClass.getMappedField("name");
assertThat(QueryValidator.isCompatibleForOperator(mappedClass, mappedField, Integer.class, EQUAL, "value", new ArrayList<ValidationFailure>()), is(false));
}
use of org.mongodb.morphia.mapping.Mapper in project webprotege by protegeproject.
the class MorphiaProvider method get.
@Override
public Morphia get() {
Morphia morphia = new Morphia();
Mapper mapper = morphia.getMapper();
mapper.getOptions().setStoreEmpties(true);
mapper.getOptions().setObjectFactory(new CustomMorphiaObjectFactory());
Converters converters = mapper.getConverters();
converters.addConverter(userIdConverter);
converters.addConverter(entityConverter);
converters.addConverter(projectIdConverter);
converters.addConverter(threadIdConverter);
converters.addConverter(commentIdConverter);
FormDataValueConverter formDataValueConverter = new FormDataValueConverter(new OWLDataFactoryImpl(), entityConverter);
converters.addConverter(formDataValueConverter);
converters.addConverter(new FormDataConverter(formDataValueConverter));
converters.addConverter(collectionIdConverter);
converters.addConverter(formIdConverter);
converters.addConverter(tagIdConverter);
converters.addConverter(colorConverter);
converters.addConverter(new CollectionIdConverter());
converters.addConverter(new CollectionItemConverter());
morphia.map(EntityDiscussionThread.class);
morphia.map(UserActivityRecord.class);
morphia.map(RoleAssignment.class);
return morphia;
}
Aggregations