本文整理汇总了Java中com.vaadin.server.ServiceException类的典型用法代码示例。如果您正苦于以下问题:Java ServiceException类的具体用法?Java ServiceException怎么用?Java ServiceException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ServiceException类属于com.vaadin.server包,在下文中一共展示了ServiceException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: show
import com.vaadin.server.ServiceException; //导入依赖的package包/类
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();
}
示例2: generateYouthAttendee
import com.vaadin.server.ServiceException; //导入依赖的package包/类
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;
}
示例3: createRequestHandlers
import com.vaadin.server.ServiceException; //导入依赖的package包/类
@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;
}
示例4: servletInitialized
import com.vaadin.server.ServiceException; //导入依赖的package包/类
@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);
}
});
}
示例5: portletInitialized
import com.vaadin.server.ServiceException; //导入依赖的package包/类
@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);
}
}
});
}
示例6: TestSpringVaadinServletService
import com.vaadin.server.ServiceException; //导入依赖的package包/类
public TestSpringVaadinServletService(VaadinServlet servlet, WebApplicationContext applicationContext)
throws ServiceException {
super(servlet, new DefaultDeploymentConfiguration(TestSpringVaadinServletService.class, new Properties()),
"");
this.appContext = applicationContext;
init();
}
示例7: createServletService
import com.vaadin.server.ServiceException; //导入依赖的package包/类
@Override
protected VaadinServletService createServletService(DeploymentConfiguration deploymentConfiguration)
throws ServiceException {
JMeterService service = new JMeterService(this, deploymentConfiguration);
service.init();
return service;
}
示例8: createServletService
import com.vaadin.server.ServiceException; //导入依赖的package包/类
@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;
}
示例9: servletInitialized
import com.vaadin.server.ServiceException; //导入依赖的package包/类
@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;
}
}
});
}
});
}
示例10: showBadges
import com.vaadin.server.ServiceException; //导入依赖的package包/类
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());
}
示例11: generateDemoAttendee
import com.vaadin.server.ServiceException; //导入依赖的package包/类
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;
}
示例12: generateChildAttendee
import com.vaadin.server.ServiceException; //导入依赖的package包/类
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;
}
示例13: getCostForAge
import com.vaadin.server.ServiceException; //导入依赖的package包/类
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));
}
示例14: servletInitialized
import com.vaadin.server.ServiceException; //导入依赖的package包/类
@Override
protected void servletInitialized() throws ServletException {
super.servletInitialized();
getService().addSessionInitListener(new SessionInitListener() {
@Override
public void sessionInit(SessionInitEvent event)
throws ServiceException {
event.getSession().addBootstrapListener(bootstrapListener);
}
});
}
示例15: createServletService
import com.vaadin.server.ServiceException; //导入依赖的package包/类
@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;
}