Package com.wordpress.salaboy.model.command

Examples of com.wordpress.salaboy.model.command.Command


        MessageConsumerWorker emergencyDetailsWorker = new MessageConsumerWorker("emergencyDetailsWorldUI", new MessageConsumerWorkerHandler<EmergencyDetailsMessage>() {

            @Override
            public void handleMessage(final EmergencyDetailsMessage message) {
                //Changes emergency animation
                renderCommands.add(new Command() {

                    public void execute() {
                        System.out.println("EmergencyDetailsMessage received");
                        if (emergencies.get(message.getEmergency().getCall().getId())==null){
                            System.out.println("Unknown emergency for call "+message.getEmergency().getCall().getId());
                            return;
                        }
                       
                        emergencies.get(message.getEmergency().getCall().getId()).setAnimation(AnimationFactory.getEmergencyAnimation(message.getType(), message.getNumberOfPeople()));
                        notifyAboutEmergencyStatusChange(message.getEmergency().getCall().getId(), message.getRemaining());
                    }
                });
            }
        });
       
        MessageConsumerWorker vehicleDispatchedWorker = new MessageConsumerWorker("vehicleDispatchedWorldUI", new MessageConsumerWorkerHandler<VehicleDispatchedMessage>() {

            @Override
            public void handleMessage(final VehicleDispatchedMessage message) {
                String callId = trackingService.getCallAttachedToEmergency(message.getEmergencyId());
               
                if (callId == null){
                    throw new IllegalArgumentException("No Call attached to Emergency "+message.getEmergencyId());
                }
               
                if (emergencies.get(callId)==null){
                    throw new IllegalArgumentException("Unknown emergency for call Id "+callId);
                }
               
                Vehicle vehicle = persistenceService.loadVehicle(message.getVehicleId());
                switchToEmergency(callId);
                assignVehicleToEmergency(callId, vehicle);
            }
        });

       
        MessageConsumerWorker hospitalSelectedWorker = new MessageConsumerWorker("hospitalSelectedWorldUI", new MessageConsumerWorkerHandler<HospitalSelectedMessage>() {

            @Override
            public void handleMessage(final HospitalSelectedMessage message) {
                //Changes emergency animation
                renderCommands.add(new Command() {

                    public void execute() {
                      
                        if (emergencies.get(message.getCallId())==null){
                            System.out.println("Unknown emergency for call Id "+message.getCallId());
                            return;
                        }
                        selectHospitalForEmergency(message.getCallId(), message.getHospital());
                       
                    }

                });
            }
        });
       
        MessageConsumerWorker firefigthersDepartmentWorker = new MessageConsumerWorker("firefigthersDepartmentWorldUI", new MessageConsumerWorkerHandler<FirefightersDepartmentSelectedMessage>() {

            @Override
            public void handleMessage(final FirefightersDepartmentSelectedMessage message) {
                //Changes emergency animation
                renderCommands.add(new Command() {

                    public void execute() {
                      
                        if (emergencies.get(message.getCallId())==null){
                            System.out.println("Unknown emergency for call Id "+message.getCallId());
                            return;
                        }
                        selectFirefighterDepartmentForEmergency(message.getCallId(), message.getFirefightersDepartment());
                       
                    }

                });
            }
        });
       
        MessageConsumerWorker fireTruckOutOfWaterWorker = new MessageConsumerWorker("fireTruckOutOfWaterWorkerUI", new MessageConsumerWorkerHandler<FireTruckOutOfWaterMessage>() {

            @Override
            public void handleMessage(final FireTruckOutOfWaterMessage message) {
                //Changes emergency animation
                renderCommands.add(new Command() {

                    @Override
                    public void execute() {
                        String callId = trackingService.getCallAttachedToEmergency(message.getEmergencyId());
                       
                        if (callId == null){
                            System.out.println("The emergency "+message.getEmergencyId()+" doesn't have any associated call!");
                            return;
                        }
                        if (emergencies.get(callId)==null){
                            System.out.println("Unknown emergency for call Id "+callId);
                            return;
                        }
                       
                        notifyAboutFireTruckOutOfWaterToEmergency(callId, message.getVehicleId());
                       
                    }

                });
            }
        });
       
       
        MessageConsumerWorker fireTruckWaterRefilledWorker = new MessageConsumerWorker("fireTruckWaterRefilledWorkerUI", new MessageConsumerWorkerHandler<FireTruckWaterRefilledMessage>() {

            @Override
            public void handleMessage(final FireTruckWaterRefilledMessage message) {
                //Changes emergency animation
                renderCommands.add(new Command() {

                    @Override
                    public void execute() {
                        String callId = trackingService.getCallAttachedToEmergency(message.getEmergencyId());
                       
View Full Code Here


       
        this.sendWaterLevelDecreased();

        //refresh the number
        this.ui.addRenderCommand(new Command() {

            @Override
            public void execute() {
                if (emergency != null){
                    emergency.setAnimation(AnimationFactory.getEmergencyAnimation(realEmergency.getType(), realEmergency.getNroOfPeople()));
View Full Code Here

TOP

Related Classes of com.wordpress.salaboy.model.command.Command

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.