Java Code Examples for org.apache.wicket.request.mapper.parameter.PageParameters#get()
The following examples show how to use
org.apache.wicket.request.mapper.parameter.PageParameters#get() .
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: AbstractListPage.java From projectforge-webapp with GNU General Public License v3.0 | 6 votes |
protected AbstractListPage(final PageParameters parameters, final ISelectCallerPage caller, final String selectProperty, final String i18nPrefix) { super(parameters); if (parameters.get(PARAMETER_KEY_STORE_FILTER) != null) { final Boolean flag = WicketUtils.getAsBooleanObject(parameters, PARAMETER_KEY_STORE_FILTER); if (flag != null && flag == false) { storeFilter = false; } } if (parameters.get(PARAMETER_HIGHLIGHTED_ROW) != null) { setHighlightedRowId(WicketUtils.getAsInteger(parameters, PARAMETER_HIGHLIGHTED_ROW)); } this.i18nPrefix = i18nPrefix; this.caller = caller; this.selectProperty = selectProperty; setup(); preInit(); evaluateInitialPageParameters(parameters); }
Example 2
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 3
Source File: AnnotationPage.java From webanno with Apache License 2.0 | 6 votes |
public AnnotationPage(final PageParameters aPageParameters) { super(aPageParameters); LOG.debug("Setting up annotation page with parameters: {}", aPageParameters); setModel(Model.of(new AnnotatorStateImpl(Mode.ANNOTATION))); // Ensure that a user is set getModelObject().setUser(userRepository.getCurrentUser()); StringValue project = aPageParameters.get(PAGE_PARAM_PROJECT_ID); StringValue projectName = aPageParameters.get(PAGE_PARAM_PROJECT_NAME); StringValue document = aPageParameters.get(PAGE_PARAM_DOCUMENT_ID); StringValue name = aPageParameters.get(PAGE_PARAM_DOCUMENT_NAME); StringValue focus = aPageParameters.get(PAGE_PARAM_FOCUS); if (focus == null) { focus = StringValue.valueOf(0); } handleParameters(project, projectName, document, name, focus, true); commonInit(focus); }
Example 4
Source File: CurationPage.java From webanno with Apache License 2.0 | 5 votes |
public CurationPage(final PageParameters aPageParameters) { super(aPageParameters); LOG.debug("Setting up curation page with parameters: {}", aPageParameters); commonInit(); StringValue project = aPageParameters.get(PAGE_PARAM_PROJECT_ID); StringValue document = aPageParameters.get(PAGE_PARAM_DOCUMENT_ID); StringValue focus = aPageParameters.get(PAGE_PARAM_FOCUS); handleParameters(null, project, document, focus, true); }
Example 5
Source File: WicketUtils.java From projectforge-webapp with GNU General Public License v3.0 | 5 votes |
public static String getAsString(final PageParameters parameters, final String name) { final StringValue sval = parameters.get(name); if (sval == null || sval.isNull() == true) { return null; } else { return sval.toString(); } }
Example 6
Source File: ProductDetailPage.java From AppStash with Apache License 2.0 | 5 votes |
private LoadableDetachableModel<ProductInfo> getProductInfoModelByUrlName(final PageParameters pageParameters) { return new LoadableDetachableModel<ProductInfo>() { @Override protected ProductInfo load() { StringValue value = pageParameters.get("urlname"); return productService.findByUrlname(value.toString()); } }; }
Example 7
Source File: WicketUtils.java From projectforge-webapp with GNU General Public License v3.0 | 5 votes |
public static boolean getAsBoolean(final PageParameters parameters, final String name) { final StringValue sval = parameters.get(name); if (sval == null || sval.isNull() == true) { return false; } else { return sval.toBoolean(); } }
Example 8
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(); } }
Example 9
Source File: MonitoringPage.java From webanno with Apache License 2.0 | 5 votes |
public MonitoringPage(final PageParameters aPageParameters) { super(aPageParameters); commonInit(); projectSelectionForm.setVisibilityAllowed(false); User user = userRepository.getCurrentUser(); // Get current project from parameters StringValue projectParameter = aPageParameters.get(PAGE_PARAM_PROJECT_ID); Optional<Project> project = getProjectFromParameters(projectParameter); if (project.isPresent()) { // Check access to project if (project != null && !(projectService.isCurator(project.get(), user) || projectService.isManager(project.get(), user))) { error("You have no permission to access project [" + project.get().getId() + "]"); setResponsePage(getApplication().getHomePage()); } projectSelectionForm.selectProject(project.get()); } else { error("Project [" + projectParameter + "] does not exist"); setResponsePage(getApplication().getHomePage()); } }
Example 10
Source File: TransparentParameterPageEncoder.java From Orienteer with Apache License 2.0 | 5 votes |
@Override public Url encodePageParameters(PageParameters pageParameters) { StringValue sv = pageParameters.get(parameter); if (!sv.isEmpty()) { pageParameters.remove(parameter); } Url ret = super.encodePageParameters(pageParameters); if (!sv.isEmpty()) { pageParameters.add(parameter, sv.toString()); } return ret; }
Example 11
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 12
Source File: MysqlPatcher.java From openmeetings with Apache License 2.0 | 5 votes |
@Override protected String getUrl(String inUrl, String host, String inPort, String inDb) { Url url = Url.parse(inUrl); url.setHost(host); url.setPort((inPort == null) ? 3306 : Integer.valueOf(inPort)); url.getSegments().set(1, (inDb == null) ? DEFAULT_DB_NAME : inDb); PageParameters pp = new PageParametersEncoder().decodePageParameters(url); StringValue tz = pp.get(TZ_PARAM); if (tz.isEmpty()) { url.setQueryParameter(TZ_PARAM, TimeZone.getDefault().getID()); } return url.toString(Url.StringMode.FULL); }
Example 13
Source File: TestPatcher.java From openmeetings with Apache License 2.0 | 5 votes |
@Test public void test() throws Exception { for (DbType dbType : DbType.values()) { ConnectionProperties props = ConnectionPropertiesPatcher.patch(dbType, HOST, PORT, DB, USER, PASS); assertEquals(dbType, props.getDbType(), "DB type should match"); if (DbType.MYSQL == dbType) { Url url = Url.parse(props.getURL()); PageParameters pp = new PageParametersEncoder().decodePageParameters(url); StringValue tz = pp.get("serverTimezone"); assertEquals(TimeZone.getDefault().getID(), tz.toString(), "serverTimezone parameter is mandatory for MySql"); } } }
Example 14
Source File: WicketUtils.java From projectforge-webapp with GNU General Public License v3.0 | 5 votes |
public static Integer getAsInteger(final PageParameters parameters, final String name) { final StringValue sval = parameters.get(name); if (sval == null || sval.isNull() == true) { return null; } else { return sval.toInteger(); } }
Example 15
Source File: GroupCustomCssResourceReference.java From openmeetings with Apache License 2.0 | 5 votes |
@Override public IResource getResource() { return new FileSystemResource() { private static final long serialVersionUID = 1L; @Override protected String getMimeType() throws IOException { return "text/css"; } @Override protected ResourceResponse newResourceResponse(Attributes attr) { PageParameters params = attr.getParameters(); StringValue idStr = params.get("id"); Long id = null; try { id = idStr.toOptionalLong(); } catch (NumberFormatException e) { //no-op expected } File file = getGroupCss(id, true); if (file != null) { ResourceResponse rr = createResourceResponse(attr, file.toPath()); rr.setFileName(file.getName()); return rr; } else { log.debug("Custom CSS was not found"); return null; } } }; }
Example 16
Source File: AddressCampaignValueEditPage.java From projectforge-webapp with GNU General Public License v3.0 | 5 votes |
public AddressCampaignValueEditPage(final PageParameters parameters) { super(parameters, "plugins.marketing.addressCampaign"); StringValue sval = parameters.get(AbstractEditPage.PARAMETER_KEY_ID); final Integer id = sval.isEmpty() == true ? null : sval.toInteger(); if (id == null) { // Create new entry. sval = parameters.get(PARAMETER_ADDRESS_ID); final Integer addressId = sval.isEmpty() ? null : sval.toInteger(); sval = parameters.get(PARAMETER_ADDRESS_CAMPAIGN_ID); final Integer addressCampaignId = sval.isEmpty() || "null".equals(sval.toString()) ? null : sval.toInteger(); if (addressId == null || addressCampaignId == null) { throw new UserException("plugins.marketing.addressCampaignValue.error.addressOrCampaignNotGiven"); } final AddressDO address = addressDao.getById(addressId); final AddressCampaignDO addressCampaign = addressCampaignDao.getById(addressCampaignId); if (address == null || addressCampaign == null) { throw new UserException("plugins.marketing.addressCampaignValue.error.addressOrCampaignNotGiven"); } AddressCampaignValueDO data = addressCampaignValueDao.get(addressId, addressCampaignId); if (data == null) { data = new AddressCampaignValueDO(); data.setAddress(address); data.setAddressCampaign(addressCampaign); } init(data); } else { init(); } }
Example 17
Source File: ActivatePage.java From openmeetings with Apache License 2.0 | 5 votes |
public ActivatePage(PageParameters pp) { StringValue userHash = pp.get(ACTIVATION_PARAM); if (!userHash.isEmpty()) { User user = userDao.getByActivationHash(userHash.toString()); if (user != null && !AuthLevelUtil.hasLoginLevel(user.getRights())) { // activate user.getRights().add(Right.LOGIN); user.setActivatehash(null); userDao.update(user, user.getId()); } } setResponsePage(Application.get().getSignInPageClass()); }
Example 18
Source File: WicketUtils.java From projectforge-webapp with GNU General Public License v3.0 | 5 votes |
public static boolean contains(final PageParameters parameters, final String name) { final StringValue sval = parameters.get(name); if (sval == null) { return false; } else { return sval.isNull() == false; } }
Example 19
Source File: ShoppingCartPage.java From yes-cart with Apache License 2.0 | 4 votes |
@Override protected void onBeforeRender() { executeHttpPostedCommands(); addOrReplace( new FeedbackPanel(FEEDBACK) ).addOrReplace( new ShoppingCartView(CART_VIEW) ).addOrReplace( new StandardFooter(FOOTER) ).addOrReplace( new StandardHeader(HEADER) ).addOrReplace( new ServerSideJs("serverSideJs") ).addOrReplace( new HeaderMetaInclude("headerInclude") ); final PageParameters params = getPageParameters(); final StringValue checkoutError = params.get("e"); if (!checkoutError.isEmpty()) { if ("ec".equals(checkoutError.toString())) { warn(getLocalizer().getString("orderErrorCouponInvalid", this, new Model<>(new ValueMap(Collections.singletonMap("coupon", params.get("ec").toString()))))); } else if ("es".equals(checkoutError.toString())) { warn(getLocalizer().getString("orderErrorSkuInvalid", this, new Model<>(new ValueMap(Collections.singletonMap("sku", params.get("es").toString()))))); } else { error(getLocalizer().getString("orderErrorGeneral", this)); } } addOrReplace(new WishListNotification("wishListNotification")); super.onBeforeRender(); final ShoppingCart cart = getCurrentCart(); final boolean cartModified = cart.isModified(); if (!cartModified && cart.getCartItemsCount() > 0) { // Refresh prices on cart view getShoppingCartCommandFactory().execute(ShoppingCartCommand.CMD_RECALCULATEPRICE, cart, (Map) Collections.singletonMap(ShoppingCartCommand.CMD_RECALCULATEPRICE, ShoppingCartCommand.CMD_RECALCULATEPRICE)); } persistCartIfNecessary(); if (cartModified) { // redirect to clear all command parameters throw new RestartResponseException(ShoppingCartPage.class); } }
Example 20
Source File: WicketUtils.java From projectforge-webapp with GNU General Public License v3.0 | 4 votes |
public static boolean hasParameter(final PageParameters parameters, final String name) { final StringValue sval = parameters.get(name); return sval != null && sval.isNull() == false; }