Java 类com.vaadin.server.ServiceException 实例源码

项目:kumoreg    文件:AttendeeDetailForm.java   
public void show(Attendee attendee) {
    attendeeBean = new BeanItem<>(attendee);
    fieldGroup.setItemDataSource(attendeeBean);
    if (attendee.getPaidAmount() == null) {
        try {
            paidAmount.setValue(attendee.getBadge().getCostForAge(attendee.getAge()).toString());
        } catch(ServiceException e) {
            Notification.show(e.getMessage());
        }
    }
    badge.select(attendee.getBadge());
    setMinorFieldsEnabled(attendee.isMinor());
    checkedIn.setVisible(attendee.getCheckedIn()); // Hide checked in checkbox if attendee is not checked in
    parentFormReceived.setVisible(attendee.getCheckedIn()); // Hide parentFormReceived if attendee is not checked in
    badgeNumber.setEnabled(false);
    showHistory(attendee.getHistory());
    firstName.focus();
}
项目:kumoreg    文件:AttendeeFactory.java   
public Attendee generateYouthAttendee(Badge badge) {
    Attendee attendee = generateDemoAttendee(badge);
    attendee.setFirstName("Firstname");
    attendee.setFanName("Fan Name");
    attendee.setBadgeNumber("TST12341");
    attendee.setBirthDate(LocalDate.now().minusYears(13L));
    attendee.setParentFullName(attendee.getEmergencyContactFullName());
    attendee.setParentPhone(attendee.getEmergencyContactPhone());
    attendee.setParentIsEmergencyContact(true);
    try {
        attendee.setPaidAmount(attendee.getBadge().getCostForAge(attendee.getAge()));
    } catch (ServiceException e) {
        log.error(e.getMessage(), e);
    }

    return attendee;
}
项目:vaadin-vertx-samples    文件:VertxVaadinService.java   
@Override
protected List<RequestHandler> createRequestHandlers()
    throws ServiceException {
    List<RequestHandler> handlers = super.createRequestHandlers();
    handlers.add(0, new ServletBootstrapHandler());
    handlers.add(new ServletUIInitHandler());
    if (isAtmosphereAvailable()) {
        handlers.add((RequestHandler) (session, request, response) -> {
            if (!ServletPortletHelper.isPushRequest(request)) {
                return false;
            }
            if (request instanceof VertxVaadinRequest) {
                ((VertxVaadinRequest) request).getRoutingContext().next();
            }
            return true;
        });
    }
    return handlers;
}
项目:kumoreg    文件:AttendeeDetailForm.java   
public void show(Attendee attendee) {
    attendeeBean = new BeanItem<>(attendee);
    fieldGroup.setItemDataSource(attendeeBean);
    if (attendee.getPaidAmount() == null) {
        try {
            paidAmount.setValue(attendee.getBadge().getCostForAge(attendee.getAge()).toString());
        } catch(ServiceException e) {
            Notification.show(e.getMessage());
        }
    }
    badge.select(attendee.getBadge());
    setMinorFieldsEnabled(attendee.isMinor());
    checkedIn.setVisible(attendee.getCheckedIn()); // Hide checked in checkbox if attendee is not checked in
    parentFormReceived.setVisible(attendee.getCheckedIn()); // Hide parentFormReceived if attendee is not checked in
    badgeNumber.setEnabled(false);
    showHistory(attendee.getHistory());
    firstName.focus();
}
项目:kumoreg    文件:AttendeeFactory.java   
public Attendee generateYouthAttendee(Badge badge) {
    Attendee attendee = generateDemoAttendee(badge);
    attendee.setFirstName("Firstname");
    attendee.setFanName("Fan Name");
    attendee.setBadgeNumber("TST12341");
    attendee.setBirthDate(LocalDate.now().minusYears(13L));
    attendee.setParentFullName(attendee.getEmergencyContactFullName());
    attendee.setParentPhone(attendee.getEmergencyContactPhone());
    attendee.setParentIsEmergencyContact(true);
    try {
        attendee.setPaidAmount(attendee.getBadge().getCostForAge(attendee.getAge()));
    } catch (ServiceException e) {
        log.error(e.getMessage(), e);
    }

    return attendee;
}
项目:KrishnasSpace    文件:CustomVaadinServlet.java   
@Override
protected void servletInitialized() throws ServletException {
    super.servletInitialized();
    getService().addSessionInitListener(new SessionInitListener() {

        /**
         * 
         */
        private static final long serialVersionUID = -8279023207169735541L;

        @Override
        public void sessionInit(SessionInitEvent event)
                throws ServiceException {
            event.getSession().addUIProvider(uiProvider);

        }
    });
}
项目:vaadin4spring    文件:SpringAwareVaadinPortlet.java   
@Override
protected void portletInitialized() throws PortletException {
    getService().addSessionInitListener(new SessionInitListener() {
        private static final long serialVersionUID = -4571879262155039969L;

        @Override
        public void sessionInit(SessionInitEvent event) throws ServiceException {
            try {
                ApplicationContext context = PortletApplicationContextUtils
                        .getRequiredWebApplicationContext(getPortletContext());
                SpringAwareUIProvider uiProvider = new SpringAwareUIProvider(context);
                event.getSession().addUIProvider(uiProvider);
            } catch (IllegalStateException e) {
                throw new ServiceException(e);
            }
        }
    });
}
项目:holon-vaadin7    文件:AbstractVaadinSpringTest.java   
public TestSpringVaadinServletService(VaadinServlet servlet, WebApplicationContext applicationContext)
        throws ServiceException {
    super(servlet, new DefaultDeploymentConfiguration(TestSpringVaadinServletService.class, new Properties()),
            "");
    this.appContext = applicationContext;
    init();
}
项目:esup-ecandidat    文件:AppServletJMeter.java   
@Override
protected VaadinServletService createServletService(DeploymentConfiguration deploymentConfiguration)
        throws ServiceException {
    JMeterService service = new JMeterService(this, deploymentConfiguration);
    service.init();
    return service;
}
项目:osc-core    文件:UiServlet.java   
@Override
protected VaadinServletService createServletService(DeploymentConfiguration deploymentConfiguration)
        throws ServiceException {
    VaadinServletService servletService = super.createServletService(deploymentConfiguration);
    servletService.addSessionInitListener(e -> e.getSession().addUIProvider(this.uiProvider));
    servletService.addSessionInitListener(e -> sessions.add(e.getSession()));
    servletService.addSessionDestroyListener(e -> sessions.remove(e.getSession()));
    return servletService;
}
项目:holon-vaadin    文件:AbstractVaadinSpringTest.java   
public TestSpringVaadinServletService(VaadinServlet servlet, WebApplicationContext applicationContext)
        throws ServiceException {
    super(servlet, new DefaultDeploymentConfiguration(TestSpringVaadinServletService.class, new Properties()),
            "");
    this.appContext = applicationContext;
    init();
}
项目:java-pwa    文件:MyUI.java   
@Override
protected void servletInitialized() throws ServletException {
    super.servletInitialized();

          HeaderTagHandler.init(getService());

    getService().addSessionInitListener(new SessionInitListener() {

        @Override
        public void sessionInit(SessionInitEvent event) throws ServiceException {
            event.getSession().addRequestHandler(new RequestHandler() {

                @Override
                public boolean handleRequest(VaadinSession session, VaadinRequest request,
                        VaadinResponse response) throws IOException {

                    String pathInfo = request.getPathInfo();
                    InputStream in = null;

                    if (pathInfo.endsWith("sw.js")) {
                        response.setContentType("application/javascript");
                        in = getClass().getResourceAsStream("/sw.js");
                    }

                    if (in != null) {
                        OutputStream out = response.getOutputStream();
                        IOUtils.copy(in, out);
                        in.close();
                        out.close();

                        return true;
                    } else {

                        return false;
                    }
                }
            });
        }
    });
}
项目:kumoreg    文件:HomeView.java   
public void showBadges(List<Badge> badges) {
    for (Badge badge : badges) {
        try {
            passTypesTable.addRow(badge.getName(),
                    badge.getCostForAge(35L),
                    badge.getCostForAge(17L),
                    badge.getCostForAge(11L),
                    badge.getCostForAge(4L));
        } catch (ServiceException e) {
            notifyError("Error getting age ranges for badge " + badge.getName());
        }
    }
    passTypesTable.setHeightByRows(badges.size());
}
项目:kumoreg    文件:AttendeeFactory.java   
public Attendee generateDemoAttendee(Badge badge) {
    Attendee attendee = new Attendee();
    attendee.setFirstName("Firstname");
    attendee.setLastName("Lastname");
    attendee.setFanName("Fan Name");
    attendee.setBadgeNumber("TST12340");
    attendee.setBadge(badge);
    attendee.setCountry("United States of America");
    attendee.setZip("97201");
    attendee.setPhoneNumber("123-123-1234");
    attendee.setCheckedIn(true);
    attendee.setEmergencyContactFullName("Mom");
    attendee.setEmergencyContactPhone("321-321-4321");
    attendee.setBirthDate(LocalDate.now().minusYears(30L));
    attendee.setPaid(true);
    attendee.setStaffDepartment("Membership");
    List<String> positions = new ArrayList<>();
    positions.addAll(Arrays.asList("Position 1", "Position 2", "Position 3"));
    attendee.setStaffPositions(positions);
    attendee.setStaffDepartmentColor("#FFDDDD");
    try {
        attendee.setPaidAmount(attendee.getBadge().getCostForAge(attendee.getAge()));
    } catch (ServiceException e) {
        log.error(e.getMessage(), e);
    }
    return attendee;
}
项目:kumoreg    文件:AttendeeFactory.java   
public Attendee generateChildAttendee(Badge badge) {
    Attendee attendee = generateDemoAttendee(badge);
    attendee.setFirstName("Firstname");
    attendee.setFanName("Fan Name");
    attendee.setBirthDate(LocalDate.now().minusYears(7L));
    attendee.setBadgeNumber("TST12342");
    try {
        attendee.setPaidAmount(attendee.getBadge().getCostForAge(attendee.getAge()));
    } catch (ServiceException e) {
        log.error(e.getMessage(), e);
    }
    return attendee;
}
项目:kumoreg    文件:Badge.java   
public BigDecimal getCostForAge(Long age) throws ServiceException {
    // No birthdate? Charge for adult badge
    if (age == null) { return getCostForAge(40L); }
    for (AgeRange ageRange : ageRanges) {
        if (ageRange.isValidForAge(age)) {
            return ageRange.getCost();
        }
    }
    throw new ServiceException("Error: No valid age range found in badge {} for age {}".format(this.name, age));
}
项目:kumoreg    文件:HomeView.java   
public void showBadges(List<Badge> badges) {
    for (Badge badge : badges) {
        try {
            passTypesTable.addRow(badge.getName(),
                    badge.getCostForAge(35L),
                    badge.getCostForAge(17L),
                    badge.getCostForAge(11L),
                    badge.getCostForAge(4L));
        } catch (ServiceException e) {
            notifyError("Error getting age ranges for badge " + badge.getName());
        }
    }
    passTypesTable.setHeightByRows(badges.size());
}
项目:kumoreg    文件:AttendeeFactory.java   
public Attendee generateDemoAttendee(Badge badge) {
    Attendee attendee = new Attendee();
    attendee.setFirstName("Firstname");
    attendee.setLastName("Lastname");
    attendee.setFanName("Fan Name");
    attendee.setBadgeNumber("TST12340");
    attendee.setBadge(badge);
    attendee.setCountry("United States of America");
    attendee.setZip("97201");
    attendee.setPhoneNumber("123-123-1234");
    attendee.setCheckedIn(true);
    attendee.setEmergencyContactFullName("Mom");
    attendee.setEmergencyContactPhone("321-321-4321");
    attendee.setBirthDate(LocalDate.now().minusYears(30L));
    attendee.setPaid(true);
    attendee.setStaffDepartment("Membership");
    List<String> positions = new ArrayList<>();
    positions.addAll(Arrays.asList("Position 1", "Position 2", "Position 3"));
    attendee.setStaffPositions(positions);
    attendee.setStaffDepartmentColor("#FFDDDD");
    try {
        attendee.setPaidAmount(attendee.getBadge().getCostForAge(attendee.getAge()));
    } catch (ServiceException e) {
        log.error(e.getMessage(), e);
    }
    return attendee;
}
项目:kumoreg    文件:AttendeeFactory.java   
public Attendee generateChildAttendee(Badge badge) {
    Attendee attendee = generateDemoAttendee(badge);
    attendee.setFirstName("Firstname");
    attendee.setFanName("Fan Name");
    attendee.setBirthDate(LocalDate.now().minusYears(7L));
    attendee.setBadgeNumber("TST12342");
    try {
        attendee.setPaidAmount(attendee.getBadge().getCostForAge(attendee.getAge()));
    } catch (ServiceException e) {
        log.error(e.getMessage(), e);
    }
    return attendee;
}
项目:kumoreg    文件:Badge.java   
public BigDecimal getCostForAge(Long age) throws ServiceException {
    // No birthdate? Charge for adult badge
    if (age == null) { return getCostForAge(40L); }
    for (AgeRange ageRange : ageRanges) {
        if (ageRange.isValidForAge(age)) {
            return ageRange.getCost();
        }
    }
    throw new ServiceException("Error: No valid age range found in badge {} for age {}".format(this.name, age));
}
项目:webcam    文件:GifBoothServlet.java   
@Override
protected void servletInitialized() throws ServletException {
    super.servletInitialized();
    getService().addSessionInitListener(new SessionInitListener() {

        @Override
        public void sessionInit(SessionInitEvent event)
                throws ServiceException {
            event.getSession().addBootstrapListener(bootstrapListener);
        }
    });
}
项目:vaadin-osgi    文件:BaseVaadinServlet.java   
@Override
protected VaadinServletService createServletService(DeploymentConfiguration deploymentConfiguration) throws ServiceException {
    VaadinServletService servletService = super.createServletService(deploymentConfiguration);
    servletService.addSessionInitListener(new SessionInitListener() {
        @Override
        public void sessionInit(SessionInitEvent sessionInitEvent) throws ServiceException {
            sessionInitEvent.getSession().addUIProvider(provider);
        }
    });
    return servletService;
}
项目:CloTouch    文件:MyServlet.java   
@Override
protected void servletInitialized() throws ServletException {
    super.servletInitialized();
    getService().addSessionInitListener(new SessionInitListener() {
        @Override
        public void sessionInit(SessionInitEvent event) throws ServiceException {
            event.getSession().addUIProvider(uiProvider);
        }
    });
}
项目:holon-vaadin7    文件:AbstractVaadinSpringTest.java   
public TestVaadinSpringSession(WebApplicationContext applicationContext) throws ServiceException {
    super(new TestSpringVaadinServletService(new SpringVaadinServlet(), applicationContext));
}
项目:esup-ecandidat    文件:AppServletJMeter.java   
public JMeterService(VaadinServlet servlet,
        DeploymentConfiguration deploymentConfiguration)
        throws ServiceException {
    super(servlet, deploymentConfiguration,null);
}
项目:esup-ecandidat    文件:AppServletJMeter.java   
@Override
protected VaadinSession createVaadinSession(VaadinRequest request)
        throws ServiceException {
    return new JMeterSession(this);
}
项目:holon-vaadin    文件:AbstractVaadinSpringTest.java   
public TestVaadinSpringSession(WebApplicationContext applicationContext) throws ServiceException {
    super(new TestSpringVaadinServletService(new SpringVaadinServlet(), applicationContext));
}
项目:vaadin-vertx-samples    文件:VertxVaadinService.java   
@Override
protected VaadinSession createVaadinSession(VaadinRequest request) throws ServiceException {
    return new VertxVaadinSession(this);
}
项目:jesterj    文件:IngestServlet.java   
@Override
public void sessionInit(SessionInitEvent event) throws ServiceException {
  event.getSession().addUIProvider(provider);
}
项目:panifex-platform    文件:ModularSessionInitListener.java   
@Override
public void sessionInit(SessionInitEvent event) throws ServiceException {
    event.getSession().addUIProvider(uiProvider);
}
项目:mideaas    文件:MideaasServlet.java   
@Override
public void sessionInit(SessionInitEvent event) throws ServiceException {
    // TODO Auto-generated method stub
    //System.out.println("Session created");
}
项目:touchkit    文件:TouchKitSettings.java   
@Override
public void sessionInit(SessionInitEvent event) throws ServiceException {
    event.getSession().addBootstrapListener(this);
}
项目:holon-vaadin    文件:TestVaadinSessionInitListener.java   
@Override
public void sessionInit(SessionInitEvent event) throws ServiceException {

}
项目:vaadin4spring    文件:Vaadin4SpringServletService.java   
/**
 * Create a servlet service instance that allows the use of a custom service
 * URL.
 *
 * @param servlet
 * @param deploymentConfiguration
 * @param serviceUrl              custom service URL to use (relative to context path, starting
 *                                with a slash) or null for default
 * @throws ServiceException
 */
public Vaadin4SpringServletService(VaadinServlet servlet, DeploymentConfiguration deploymentConfiguration, String serviceUrl) throws ServiceException {
    super(servlet, deploymentConfiguration, serviceUrl);
    logger.info("Using custom Vaadin4Spring servlet service");
    applicationContext = WebApplicationContextUtils.getWebApplicationContext(servlet.getServletContext());
}