@Override public MetaClass getMetaClass() { return mainItem.getMetaClass(); }
toProcess.forEach(e -> entitiesByType.put(e.getMetaClass().getName(), e)); entitiesByType.keySet().forEach(entityType -> { MetaClass metaClass = metadata.getExtendedEntities().getOriginalOrThisMetaClass(metadata.getClass(entityType));
DynamicAttributes dynamicAttributesBean = AppBeans.get(DynamicAttributes.NAME); categoryAttributeValue.setCategoryAttribute( dynamicAttributesBean.getAttributeForMetaClass(getMetaClass(), attributeCode)); dynamicAttributes.put(attributeCode, categoryAttributeValue);
/** * Reload dynamic attributes on the entity */ @SuppressWarnings("unchecked") public void reloadDynamicAttributes(BaseGenericIdEntity entity) { MetaClass metaClass = entity.getMetaClass(); View view = new View(metaClass.getJavaClass(), false) .addProperty(metadata.getTools().getPrimaryKeyName(metaClass)); LoadContext loadContext = new LoadContext(metaClass) .setView(view) .setLoadDynamicAttributes(true) .setId(entity.getId()); BaseGenericIdEntity reloadedEntity = (BaseGenericIdEntity) dataManager.load(loadContext); if (reloadedEntity != null) { entity.setDynamicAttributes(reloadedEntity.getDynamicAttributes()); } } }
if (baseGenericIdEntity.getMetaClass().getProperty("category") != null) { baseGenericIdEntity.setValue("category", category);
&& categoryAttributeValue.getCode() != null) { CategoryAttribute attribute = getAttributeForMetaClass(entity.getMetaClass(), categoryAttributeValue.getCode()); categoryAttributeValue.setCategoryAttribute(attribute);