Package org.jrebirth.af.core.exception

Examples of org.jrebirth.af.core.exception.CoreException


        if (responseWaveType != null) {

            // No service result type defined into a WaveItem
            if (((WaveTypeBase) responseWaveType).getWaveItemList().isEmpty()) {
                LOGGER.log(NO_RETURNED_WAVE_ITEM);
                throw new CoreException(NO_RETURNED_WAVE_ITEM);
            }

            // Get the first (and unique) WaveItem used to define the service result type
            final WaveItem<T> resultWaveItem = (WaveItem<T>) ((WaveTypeBase) responseWaveType).getWaveItemList().get(0);

            // Try to retrieve the command class, could be null
            final Class<? extends Command> responseCommandClass = this.service.getReturnCommand(this.wave.getWaveType());

            if (responseCommandClass != null) {

                // If a Command Class is provided, call it with the right WaveItem to get the real result type
                returnWave = WaveBuilder.create()
                        .waveGroup(WaveGroup.CALL_COMMAND)
                        .fromClass(this.service.getClass())
                        .relatedClass(responseCommandClass)
                        .data(WaveData.build(resultWaveItem, res))
                        .build();
            } else {

                // Otherwise send a generic wave that can be handled by any component
                returnWave = WaveBuilder.create()
                        .waveType(responseWaveType)
                        .fromClass(this.service.getClass())
                        .data(WaveData.build(resultWaveItem, res))
                        .build();
            }

            returnWave.setRelatedWave(this.wave);
            returnWave.addWaveListener(new ServiceTaskReturnWaveListener());

            // Send the return wave to interested components
            this.service.sendWave(returnWave);
        } else {
            // No service return wave Type defined
            LOGGER.log(NO_RETURNED_WAVE_TYPE_DEFINED, this.wave.getWaveType());
            throw new CoreException(NO_RETURNED_WAVE_ITEM, this.wave.getWaveType());
        }
    }
View Full Code Here

TOP

Related Classes of org.jrebirth.af.core.exception.CoreException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.