use of com.haulmont.cuba.core.global.Metadata in project cuba by cuba-platform.
the class SuggestionPickerFieldLoader method loadMetaClass.
protected void loadMetaClass(SuggestionPickerField suggestionField, Element element) {
String metaClass = element.attributeValue("metaClass");
if (!StringUtils.isEmpty(metaClass)) {
Metadata metadata = AppBeans.get(Metadata.NAME);
suggestionField.setMetaClass(metadata.getSession().getClass(metaClass));
}
}
use of com.haulmont.cuba.core.global.Metadata in project cuba by cuba-platform.
the class WebTokenList method isInversePropertyAssignableFromDsClass.
protected boolean isInversePropertyAssignableFromDsClass(MetaProperty inverseProp) {
Metadata metadata = AppBeans.get(Metadata.NAME);
ExtendedEntities extendedEntities = metadata.getExtendedEntities();
Class inversePropClass = extendedEntities.getEffectiveClass(inverseProp.getDomain());
Class dsClass = extendedEntities.getEffectiveClass(datasource.getMetaClass());
// noinspection unchecked
return inversePropClass.isAssignableFrom(dsClass);
}
use of com.haulmont.cuba.core.global.Metadata in project cuba by cuba-platform.
the class EntitySerializationExceptionHandler method isEntityClass.
private boolean isEntityClass(String className) {
Metadata metadata = AppBeans.get(Metadata.NAME);
try {
Class entityClass = ReflectionHelper.loadClass(className);
MetaClass metaClass = metadata.getClass(entityClass);
return metaClass != null;
} catch (ClassNotFoundException e) {
return false;
}
}
use of com.haulmont.cuba.core.global.Metadata in project cuba by cuba-platform.
the class FakeFilterSupport method createFakeFilterEntity.
public FilterEntity createFakeFilterEntity(String xml) {
if (filterEntity != null) {
return filterEntity;
}
Metadata metadata = AppBeans.get(Metadata.NAME);
FilterEntity fakeFilterEntity = metadata.create(FilterEntity.class);
fakeFilterEntity.setXml(xml);
return fakeFilterEntity;
}
use of com.haulmont.cuba.core.global.Metadata in project cuba by cuba-platform.
the class EntityChangedEvent method getResolvableType.
/**
* INTERNAL.
*/
@Override
public ResolvableType getResolvableType() {
Metadata metadata = AppBeans.get(Metadata.NAME);
ExtendedEntities extendedEntities = metadata.getExtendedEntities();
MetaClass metaClass = extendedEntities.getOriginalOrThisMetaClass(metadata.getClassNN(entityId.getEntityClass()));
MetaProperty pkProperty = metadata.getTools().getPrimaryKeyProperty(metaClass);
if (pkProperty == null) {
throw new IllegalStateException("Unable to send EntityChangedEvent for " + metaClass + " because it has no primary key");
}
if (BaseDbGeneratedIdEntity.class.isAssignableFrom(metaClass.getJavaClass())) {
return ResolvableType.forClassWithGenerics(getClass(), ResolvableType.forClass(metaClass.getJavaClass()), ResolvableType.forClassWithGenerics(IdProxy.class, ResolvableType.forClass(pkProperty.getJavaType())));
} else {
return ResolvableType.forClassWithGenerics(getClass(), ResolvableType.forClass(metaClass.getJavaClass()), ResolvableType.forClass(pkProperty.getJavaType()));
}
}
Aggregations