Search in sources :

Example 21 with Metadata

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;
}
Also used : MetaClass(com.haulmont.chile.core.model.MetaClass) Metadata(com.haulmont.cuba.core.global.Metadata)

Example 22 with Metadata

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;
}
Also used : MetadataTools(com.haulmont.cuba.core.global.MetadataTools) Collection(java.util.Collection) Map(java.util.Map) HashMap(java.util.HashMap) AppBeans(com.haulmont.cuba.core.global.AppBeans) MetaClass(com.haulmont.chile.core.model.MetaClass) Entity(com.haulmont.cuba.core.entity.Entity) Metadata(com.haulmont.cuba.core.global.Metadata) Serializable(java.io.Serializable) MetadataTools(com.haulmont.cuba.core.global.MetadataTools) MetaClass(com.haulmont.chile.core.model.MetaClass) Metadata(com.haulmont.cuba.core.global.Metadata)

Example 23 with Metadata

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);
}
Also used : Metadata(com.haulmont.cuba.core.global.Metadata) PostConstruct(javax.annotation.PostConstruct)

Example 24 with Metadata

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);
}
Also used : Metadata(com.haulmont.cuba.core.global.Metadata) MetaPropertyPath(com.haulmont.chile.core.model.MetaPropertyPath)

Example 25 with Metadata

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));
    }
}
Also used : SearchPickerField(com.haulmont.cuba.gui.components.SearchPickerField) Metadata(com.haulmont.cuba.core.global.Metadata)

Aggregations

Metadata (com.haulmont.cuba.core.global.Metadata)25 MetaClass (com.haulmont.chile.core.model.MetaClass)6 PostConstruct (javax.annotation.PostConstruct)3 MetaPropertyPath (com.haulmont.chile.core.model.MetaPropertyPath)2 EntityManager (com.haulmont.cuba.core.EntityManager)2 Transaction (com.haulmont.cuba.core.Transaction)2 AppBeans (com.haulmont.cuba.core.global.AppBeans)2 ExtendedEntities (com.haulmont.cuba.core.global.ExtendedEntities)2 MetadataTools (com.haulmont.cuba.core.global.MetadataTools)2 FilterEntity (com.haulmont.cuba.security.entity.FilterEntity)2 Collection (java.util.Collection)2 Before (org.junit.Before)2 CategoryAttribute (com.haulmont.cuba.core.entity.CategoryAttribute)1 Config (com.haulmont.cuba.core.entity.Config)1 Entity (com.haulmont.cuba.core.entity.Entity)1 ReferenceToEntity (com.haulmont.cuba.core.entity.ReferenceToEntity)1 Messages (com.haulmont.cuba.core.global.Messages)1 Scripting (com.haulmont.cuba.core.global.Scripting)1 View (com.haulmont.cuba.core.global.View)1 ViewRepository (com.haulmont.cuba.core.global.ViewRepository)1