Search in sources :

Example 1 with Internal

use of io.jmix.core.annotation.Internal in project jmix by jmix-framework.

the class CompositeComponent method enableEventListeners.

@Internal
protected void enableEventListeners() {
    List<ApplicationListener> listeners = getUiEventListeners();
    if (CollectionUtils.isNotEmpty(listeners)) {
        AppUI ui = AppUI.getCurrent();
        UiEventsMulticaster multicaster = ui.getUiEventsMulticaster();
        for (ApplicationListener listener : uiEventListeners) {
            multicaster.addApplicationListener(listener);
        }
    }
}
Also used : ApplicationListener(org.springframework.context.ApplicationListener) UiEventsMulticaster(io.jmix.ui.sys.event.UiEventsMulticaster) AppUI(io.jmix.ui.AppUI) Internal(io.jmix.core.annotation.Internal)

Example 2 with Internal

use of io.jmix.core.annotation.Internal in project jmix by jmix-framework.

the class CompositeComponent method disableEventListeners.

@Internal
protected void disableEventListeners() {
    List<ApplicationListener> listeners = getUiEventListeners();
    if (CollectionUtils.isNotEmpty(listeners)) {
        AppUI ui = AppUI.getCurrent();
        UiEventsMulticaster multicaster = ui.getUiEventsMulticaster();
        for (ApplicationListener listener : uiEventListeners) {
            multicaster.removeApplicationListener(listener);
        }
    }
}
Also used : ApplicationListener(org.springframework.context.ApplicationListener) UiEventsMulticaster(io.jmix.ui.sys.event.UiEventsMulticaster) AppUI(io.jmix.ui.AppUI) Internal(io.jmix.core.annotation.Internal)

Example 3 with Internal

use of io.jmix.core.annotation.Internal in project jmix by jmix-framework.

the class PersistenceImpl method dispose.

/**
 * INTERNAL.
 * Destroys the persistence configuration. Further use of this bean instance is impossible.
 */
@Internal
public void dispose() {
    jpaEmf.close();
    for (String store : stores.getAdditional()) {
        EntityManagerFactory emf = (EntityManagerFactory) applicationContext.getBean("entityManagerFactory_" + store);
        emf.close();
    }
}
Also used : EntityManagerFactory(javax.persistence.EntityManagerFactory) Internal(io.jmix.core.annotation.Internal)

Example 4 with Internal

use of io.jmix.core.annotation.Internal in project jmix by jmix-framework.

the class FilterDelegateSettingsUtils method applyMaxResultsSettings.

/**
 * INTERNAL API. Is used by {@link CubaFilterSettingsBinder}.
 *
 * @param delegate   filter delegate bean
 * @param maxResults max result to apply
 */
@Internal
public static void applyMaxResultsSettings(FilterDelegate delegate, int maxResults) {
    if (delegate instanceof FilterDelegateImpl) {
        Element componentElement = DocumentHelper.createDocument().addElement("component");
        componentElement.addElement("maxResults").setText(String.valueOf(maxResults));
        ((FilterDelegateImpl) delegate).applyMaxResultsSettings(componentElement);
    }
}
Also used : Element(org.dom4j.Element) Internal(io.jmix.core.annotation.Internal)

Example 5 with Internal

use of io.jmix.core.annotation.Internal in project jmix by jmix-framework.

the class EntityChangedEvent method getResolvableType.

/**
 * INTERNAL.
 */
@Internal
@Override
public ResolvableType getResolvableType() {
    Metadata metadata = AppBeans.get(Metadata.class);
    ExtendedEntities extendedEntities = metadata.getExtendedEntities();
    MetaClass metaClass = extendedEntities.getOriginalOrThisMetaClass(metadata.getClassNN(entityId.getEntityClass()));
    MetaProperty pkProperty = metadata.getTools().getPrimaryKeyProperty(metaClass);
    if (pkProperty == null) {
        throw new IllegalStateException("Unable to send EntityChangedEvent for " + metaClass + " because it has no primary key");
    }
    return ResolvableType.forClassWithGenerics(getClass(), ResolvableType.forClass(metaClass.getJavaClass()), ResolvableType.forClass(pkProperty.getJavaType()));
}
Also used : ExtendedEntities(io.jmix.core.ExtendedEntities) MetaClass(io.jmix.core.metamodel.model.MetaClass) Metadata(com.haulmont.cuba.core.global.Metadata) MetaProperty(io.jmix.core.metamodel.model.MetaProperty) Internal(io.jmix.core.annotation.Internal)

Aggregations

Internal (io.jmix.core.annotation.Internal)5 AppUI (io.jmix.ui.AppUI)2 UiEventsMulticaster (io.jmix.ui.sys.event.UiEventsMulticaster)2 ApplicationListener (org.springframework.context.ApplicationListener)2 Metadata (com.haulmont.cuba.core.global.Metadata)1 ExtendedEntities (io.jmix.core.ExtendedEntities)1 MetaClass (io.jmix.core.metamodel.model.MetaClass)1 MetaProperty (io.jmix.core.metamodel.model.MetaProperty)1 EntityManagerFactory (javax.persistence.EntityManagerFactory)1 Element (org.dom4j.Element)1