Search in sources :

Example 6 with Metadata

use of com.haulmont.cuba.core.global.Metadata in project cuba by cuba-platform.

the class EntityLogAttr method getClassFromEntityName.

private com.haulmont.chile.core.model.MetaClass getClassFromEntityName(String entityName) {
    Metadata metadata = AppBeans.get(Metadata.NAME);
    com.haulmont.chile.core.model.MetaClass metaClass = metadata.getSession().getClass(entityName);
    return metaClass == null ? null : metadata.getExtendedEntities().getEffectiveMetaClass(metaClass);
}
Also used : Metadata(com.haulmont.cuba.core.global.Metadata)

Example 7 with Metadata

use of com.haulmont.cuba.core.global.Metadata in project cuba by cuba-platform.

the class EntityLogItem method init.

@PostConstruct
public void init() {
    Metadata metadata = AppBeans.get(Metadata.NAME);
    entityRef = metadata.create(ReferenceToEntity.class);
}
Also used : Metadata(com.haulmont.cuba.core.global.Metadata) ReferenceToEntity(com.haulmont.cuba.core.entity.ReferenceToEntity) PostConstruct(javax.annotation.PostConstruct)

Example 8 with Metadata

use of com.haulmont.cuba.core.global.Metadata in project cuba by cuba-platform.

the class EntityImportView method addSystemProperties.

public EntityImportView addSystemProperties() {
    Metadata metadata = AppBeans.get(Metadata.class);
    MetaClass metaClass = metadata.getClassNN(entityClass);
    MetadataTools metadataTools = metadata.getTools();
    metaClass.getProperties().stream().filter(metadataTools::isSystem).forEach(metaProperty -> addLocalProperty(metaProperty.getName()));
    return this;
}
Also used : MetadataTools(com.haulmont.cuba.core.global.MetadataTools) MetaClass(com.haulmont.chile.core.model.MetaClass) Metadata(com.haulmont.cuba.core.global.Metadata)

Example 9 with Metadata

use of com.haulmont.cuba.core.global.Metadata in project cuba by cuba-platform.

the class CategoryAttribute method init.

@PostConstruct
public void init() {
    Metadata metadata = AppBeans.get(Metadata.NAME);
    defaultEntity = metadata.create(ReferenceToEntity.class);
}
Also used : Metadata(com.haulmont.cuba.core.global.Metadata) PostConstruct(javax.annotation.PostConstruct)

Example 10 with Metadata

use of com.haulmont.cuba.core.global.Metadata in project cuba by cuba-platform.

the class FileDescriptor method fromUrlParam.

/**
 * Used by the framework to transfer file between application tiers.
 */
public static FileDescriptor fromUrlParam(String urlParam) {
    String[] parts = urlParam.split(",");
    if (parts.length != 3 && parts.length != 4) {
        throw new IllegalArgumentException("Invalid FileDescriptor format");
    }
    Metadata metadata = AppBeans.get(Metadata.NAME);
    FileDescriptor fd = metadata.create(FileDescriptor.class);
    fd.setId(UuidProvider.fromString(parts[0]));
    fd.setExtension(parts[1]);
    fd.setCreateDate(new Date(Long.parseLong(parts[2])));
    if (parts.length == 4) {
        fd.setSize(Long.parseLong(parts[3]));
    }
    return fd;
}
Also used : Metadata(com.haulmont.cuba.core.global.Metadata) Date(java.util.Date)

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