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);
}
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);
}
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;
}
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);
}
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;
}
Aggregations