Search in sources :

Example 1 with ProcessClassInfo

use of de.metas.process.ProcessClassInfo in project metasfresh-webui-api by metasfresh.

the class WebuiProcessClassInfo method createWebuiProcessClassInfo.

private static WebuiProcessClassInfo createWebuiProcessClassInfo(final Class<?> processClass) throws Exception {
    final ProcessClassInfo processClassInfo = ProcessClassInfo.of(processClass);
    final WebuiProcess webuiProcessAnn = processClass.getAnnotation(WebuiProcess.class);
    @SuppressWarnings("unchecked") final Set<Method> lookupValuesProviderMethods = ReflectionUtils.getAllMethods(processClass, ReflectionUtils.withAnnotation(ProcessParamLookupValuesProvider.class));
    final ImmutableMap<String, LookupDescriptorProvider> paramLookupValuesProviders = lookupValuesProviderMethods.stream().map(method -> createParamLookupValuesProvider(method)).collect(GuavaCollectors.toImmutableMap());
    // Check is there were no settings at all so we could return our NULL instance
    if (ProcessClassInfo.isNull(processClassInfo) && paramLookupValuesProviders.isEmpty()) {
        return NULL;
    }
    return new WebuiProcessClassInfo(processClassInfo, webuiProcessAnn, paramLookupValuesProviders);
}
Also used : LogManager(de.metas.logging.LogManager) LoadingCache(com.google.common.cache.LoadingCache) GuavaCollectors(org.adempiere.util.GuavaCollectors) LookupDescriptorProvider(de.metas.ui.web.window.descriptor.LookupDescriptorProvider) Function(java.util.function.Function) ProcessClassInfo(de.metas.process.ProcessClassInfo) ListLookupDescriptor(de.metas.ui.web.window.descriptor.ListLookupDescriptor) LookupDescriptor(de.metas.ui.web.window.descriptor.LookupDescriptor) ImmutableList(com.google.common.collect.ImmutableList) Map(java.util.Map) LookupValuesList(de.metas.ui.web.window.datatypes.LookupValuesList) PanelLayoutType(de.metas.ui.web.window.datatypes.PanelLayoutType) Method(java.lang.reflect.Method) Nullable(javax.annotation.Nullable) Logger(org.slf4j.Logger) LookupDataSourceContext(de.metas.ui.web.window.model.lookup.LookupDataSourceContext) ImmutableMap(com.google.common.collect.ImmutableMap) Set(java.util.Set) MoreObjects(com.google.common.base.MoreObjects) JavaProcess(de.metas.process.JavaProcess) InvocationTargetException(java.lang.reflect.InvocationTargetException) CacheLoader(com.google.common.cache.CacheLoader) List(java.util.List) Stream(java.util.stream.Stream) AdempiereException(org.adempiere.exceptions.AdempiereException) Check(org.adempiere.util.Check) ProcessParamLookupValuesProvider(de.metas.ui.web.process.descriptor.ProcessParamLookupValuesProvider) ReflectionUtils(org.reflections.ReflectionUtils) CacheBuilder(com.google.common.cache.CacheBuilder) ProcessParamLookupValuesProvider(de.metas.ui.web.process.descriptor.ProcessParamLookupValuesProvider) Method(java.lang.reflect.Method) ProcessClassInfo(de.metas.process.ProcessClassInfo) LookupDescriptorProvider(de.metas.ui.web.window.descriptor.LookupDescriptorProvider)

Aggregations

MoreObjects (com.google.common.base.MoreObjects)1 CacheBuilder (com.google.common.cache.CacheBuilder)1 CacheLoader (com.google.common.cache.CacheLoader)1 LoadingCache (com.google.common.cache.LoadingCache)1 ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 LogManager (de.metas.logging.LogManager)1 JavaProcess (de.metas.process.JavaProcess)1 ProcessClassInfo (de.metas.process.ProcessClassInfo)1 ProcessParamLookupValuesProvider (de.metas.ui.web.process.descriptor.ProcessParamLookupValuesProvider)1 LookupValuesList (de.metas.ui.web.window.datatypes.LookupValuesList)1 PanelLayoutType (de.metas.ui.web.window.datatypes.PanelLayoutType)1 ListLookupDescriptor (de.metas.ui.web.window.descriptor.ListLookupDescriptor)1 LookupDescriptor (de.metas.ui.web.window.descriptor.LookupDescriptor)1 LookupDescriptorProvider (de.metas.ui.web.window.descriptor.LookupDescriptorProvider)1 LookupDataSourceContext (de.metas.ui.web.window.model.lookup.LookupDataSourceContext)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Method (java.lang.reflect.Method)1 List (java.util.List)1 Map (java.util.Map)1