use of io.jmix.core.accesscontext.CrudEntityContext in project jmix by jmix-framework.
the class CategoryBrowse method setupFieldsLock.
protected void setupFieldsLock() {
CrudEntityContext crudEntityContext = new CrudEntityContext(categoryDc.getEntityMetaClass());
accessManager.applyRegisteredConstraints(crudEntityContext);
if (!crudEntityContext.isUpdatePermitted()) {
applyChangesBtn.setEnabled(false);
}
}
use of io.jmix.core.accesscontext.CrudEntityContext in project jmix by jmix-framework.
the class CategoryEdit method initLocalizationTab.
protected void initLocalizationTab() {
if (coreProperties.getAvailableLocales().size() > 1) {
TabSheet.Tab localizationTab = tabSheet.getTab("localizationTab");
localizationTab.setVisible(true);
CrudEntityContext crudEntityContext = new CrudEntityContext(categoryDc.getEntityMetaClass());
accessManager.applyRegisteredConstraints(crudEntityContext);
VBoxLayout localizationTabComponent = (VBoxLayout) tabSheet.getTabComponent("localizationTab");
localizationFragment = fragments.create(this, AttributeLocalizationFragment.class);
localizationFragment.setNameMsgBundle(getEditedEntity().getLocaleNames());
localizationFragment.setEnabled(crudEntityContext.isUpdatePermitted());
Fragment fragment = localizationFragment.getFragment();
fragment.setWidth(Component.FULL_SIZE);
localizationTabComponent.add(fragment);
localizationTabComponent.expand(fragment);
}
}
use of io.jmix.core.accesscontext.CrudEntityContext in project jmix by jmix-framework.
the class EntitiesControllerManager method applyEntityConstraints.
protected CrudEntityContext applyEntityConstraints(MetaClass metaClass) {
CrudEntityContext entityContext = new CrudEntityContext(metaClass);
accessManager.applyRegisteredConstraints(entityContext);
return entityContext;
}
use of io.jmix.core.accesscontext.CrudEntityContext in project jmix by jmix-framework.
the class EntityQueryDataFetcher method applyEntityConstraints.
protected CrudEntityContext applyEntityConstraints(MetaClass metaClass) {
CrudEntityContext entityContext = new CrudEntityContext(metaClass);
accessManager.applyRegisteredConstraints(entityContext);
return entityContext;
}
use of io.jmix.core.accesscontext.CrudEntityContext in project jmix by jmix-framework.
the class MessagesDataFetcher method getEntityMessages.
protected List<MessageDetail> getEntityMessages(MetaClass metaClass, Locale locale) {
List<MessageDetail> messages = new ArrayList<>();
CrudEntityContext entityContext = new CrudEntityContext(metaClass);
accessManager.applyRegisteredConstraints(entityContext);
String metaClassName = metaClass.getName();
if (entityContext.isReadPermitted()) {
String entityCaption = messageTools.getEntityCaption(metaClass, locale);
messages.add(new MessageDetail(metaClassName, entityCaption));
}
for (MetaProperty metaProperty : metaClass.getProperties()) {
EntityAttributeContext attributeContext = new EntityAttributeContext(metaClass, metaProperty.getName());
accessManager.applyRegisteredConstraints(attributeContext);
if (attributeContext.canView()) {
String propertyCaption = messageTools.getPropertyCaption(metaProperty, locale);
messages.add(new MessageDetail(metaClassName + "." + metaProperty.getName(), propertyCaption));
}
}
return messages;
}
Aggregations