use of com.haulmont.cuba.core.global.Metadata in project cuba by cuba-platform.
the class DynamicAttributesCache method resolveTargetMetaClass.
protected MetaClass resolveTargetMetaClass(MetaClass metaClass) {
if (metaClass == null) {
return null;
}
Metadata metadata = AppBeans.get(Metadata.NAME);
MetaClass targetMetaClass = metadata.getExtendedEntities().getOriginalMetaClass(metaClass);
if (targetMetaClass == null) {
targetMetaClass = metaClass;
}
return targetMetaClass;
}
use of com.haulmont.cuba.core.global.Metadata in project cuba by cuba-platform.
the class EntityImportView method addLocalProperties.
public EntityImportView addLocalProperties() {
Metadata metadata = AppBeans.get(Metadata.class);
MetaClass metaClass = metadata.getClassNN(entityClass);
MetadataTools metadataTools = metadata.getTools();
metaClass.getProperties().stream().filter(property -> !property.getRange().isClass() && !metadataTools.isSystem(property)).forEach(metaProperty -> addLocalProperty(metaProperty.getName()));
return this;
}
use of com.haulmont.cuba.core.global.Metadata in project cuba by cuba-platform.
the class EntitySnapshot method init.
@PostConstruct
public void init() {
Metadata metadata = AppBeans.get(Metadata.NAME);
entity = metadata.create(ReferenceToEntity.class);
}
use of com.haulmont.cuba.core.global.Metadata in project cuba by cuba-platform.
the class EntityBasicPropertyDiff method getCollectionString.
private String getCollectionString(Object collection) {
if (DynamicAttributesUtils.isDynamicAttribute(propertyName)) {
Metadata metadata = AppBeans.get(Metadata.class);
com.haulmont.chile.core.model.MetaClass metaClass = metadata.getClassNN(metaClassName);
MetaPropertyPath path = DynamicAttributesUtils.getMetaPropertyPath(metaClass, propertyName);
return metadata.getTools().format(collection, path.getMetaProperty());
}
return String.valueOf(beforeValue);
}
use of com.haulmont.cuba.core.global.Metadata in project cuba by cuba-platform.
the class SearchPickerFieldLoader method loadComponent.
@Override
public void loadComponent() {
super.loadComponent();
SearchPickerField searchPickerField = (SearchPickerField) resultComponent;
String metaClass = element.attributeValue("metaClass");
if (!StringUtils.isEmpty(metaClass)) {
Metadata metadata = AppBeans.get(Metadata.NAME);
searchPickerField.setMetaClass(metadata.getSession().getClass(metaClass));
}
loadActions(searchPickerField, element);
if (searchPickerField.getActions().isEmpty()) {
searchPickerField.addLookupAction();
searchPickerField.addOpenAction();
}
String minSearchStringLength = element.attributeValue("minSearchStringLength");
if (StringUtils.isNotEmpty(minSearchStringLength)) {
searchPickerField.setMinSearchStringLength(Integer.parseInt(minSearchStringLength));
}
}
Aggregations