Java Code Examples for org.apache.wicket.util.string.StringValue#toLong()
The following examples show how to use
org.apache.wicket.util.string.StringValue#toLong() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CustomerEditPage.java From wicket-spring-boot with Apache License 2.0 | 6 votes |
public CustomerEditPage(PageParameters params){ super(); StringValue customerIdParam = params.get(CUSTOMER_ID_PARAM); if(customerIdParam.isEmpty() || !StringUtils.isNumeric(customerIdParam.toString())){ getSession().error(MessageFormat.format(getString("param.customer.id.missing"), customerIdParam)); // "Missing customer id " + stringValue setResponsePage(CustomerListPage.class); } Long customerId = customerIdParam.toLong(); Customer customer = service.findById(customerId); if(customer == null){ getSession().error(MessageFormat.format(getString("customer.not-found"), customerId.toString())); setResponsePage(CustomerListPage.class); } StringValue pageReferfenceIdParam = params.get(PAGE_REFERENCE_ID); if(!pageReferfenceIdParam.isEmpty() || StringUtils.isNumeric(pageReferfenceIdParam.toString())){ setPageReferenceId(pageReferfenceIdParam.toInteger()); } getCustomerModel().setObject(customer); }
Example 2
Source File: KnowledgeBasePage.java From inception with Apache License 2.0 | 5 votes |
public KnowledgeBasePage(PageParameters aPageParameters) { super(aPageParameters); User user = userRepository.getCurrentUser(); // Project has been specified when the page was opened Project project = null; StringValue projectParam = aPageParameters.get(PAGE_PARAM_PROJECT_ID); if (!projectParam.isEmpty()) { long projectId = projectParam.toLong(); try { project = projectService.getProject(projectId); // Check access to project if (!projectService.isAnnotator(project, user)) { error("You have no permission to access project [" + project.getId() + "]"); abort(); } } catch (NoResultException e) { error("Project [" + projectId + "] does not exist"); abort(); } } // If a KB id was specified in the URL, we try to get it KnowledgeBase kb = null; String kbName = aPageParameters.get("kb").toOptionalString(); if (project != null && kbName != null) { kb = kbService.getKnowledgeBaseByName(project, kbName).orElse(null); } commonInit(project, kb); }
Example 3
Source File: CurationPage.java From webanno with Apache License 2.0 | 5 votes |
private Project getProjectFromParameters(StringValue projectParam) { Project project = null; if (projectParam != null && !projectParam.isEmpty()) { long projectId = projectParam.toLong(); project = projectService.getProject(projectId); } return project; }
Example 4
Source File: CurationPage.java From webanno with Apache License 2.0 | 5 votes |
private SourceDocument getDocumentFromParameters(Project aProject, StringValue documentParam) { SourceDocument document = null; if (documentParam != null && !documentParam.isEmpty()) { long documentId = documentParam.toLong(); document = documentService.getSourceDocument(aProject.getId(), documentId); } return document; }
Example 5
Source File: AnnotationPage.java From webanno with Apache License 2.0 | 5 votes |
private Project getProjectFromParameters(StringValue projectParam, StringValue projectNameParam) { Project project = null; if (projectParam != null && !projectParam.isEmpty()) { long projectId = projectParam.toLong(); project = projectService.getProject(projectId); } else if (projectNameParam != null && !projectNameParam.isEmpty()) { project = projectService.getProject(projectNameParam.toString()); } return project; }
Example 6
Source File: AnnotationPage.java From webanno with Apache License 2.0 | 5 votes |
private SourceDocument getDocumentFromParameters(Project aProject, StringValue documentParam, StringValue nameParam) { SourceDocument document = null; if (documentParam != null && !documentParam.isEmpty()) { long documentId = documentParam.toLong(); document = documentService.getSourceDocument(aProject.getId(), documentId); } else if (nameParam != null && !nameParam.isEmpty()) { document = documentService.getSourceDocument(aProject, nameParam.toString()); } return document; }
Example 7
Source File: WicketUtils.java From projectforge-webapp with GNU General Public License v3.0 | 5 votes |
public static Long getAsLong(final PageParameters parameters, final String name) { final StringValue sval = parameters.get(name); if (sval == null || sval.isNull() == true) { return null; } else { return sval.toLong(); } }