List of usage examples for org.apache.wicket.util.string StringValue toString
@Override public final String toString()
From source file:org.apache.isis.viewer.wicket.model.common.PageParametersUtils.java
License:Apache License
/** * Creates a new instance of PageParameters that preserves some special request parameters * which should propagate in all links created by Isis * * @return a new PageParameters instance *//*w w w .j a v a2 s . co m*/ public static PageParameters newPageParameters() { final PageParameters newPageParameters = new PageParameters(); final RequestCycle cycle = RequestCycle.get(); if (cycle != null) { final IPageRequestHandler pageRequestHandler = PageRequestHandlerTracker.getFirstHandler(cycle); final PageParameters currentPageParameters = pageRequestHandler.getPageParameters(); if (currentPageParameters != null) { final StringValue noHeader = currentPageParameters.get(ISIS_NO_HEADER_PARAMETER_NAME); if (!noHeader.isNull()) { newPageParameters.set(ISIS_NO_HEADER_PARAMETER_NAME, noHeader.toString()); } final StringValue noFooter = currentPageParameters.get(ISIS_NO_FOOTER_PARAMETER_NAME); if (!noFooter.isNull()) { newPageParameters.set(ISIS_NO_FOOTER_PARAMETER_NAME, noFooter.toString()); } } } return newPageParameters; }
From source file:org.apache.isis.viewer.wicket.model.mementos.PageParameterNames.java
License:Apache License
public List<String> getListFrom(PageParameters pageParameters) { return Lists.transform(pageParameters.getValues(this.toString()), new Function<StringValue, String>() { @Override/*from w ww .ja v a 2 s . c om*/ public String apply(StringValue input) { return input.toString(); } }); }
From source file:org.apache.isis.viewer.wicket.ui.components.scalars.XEditableBehavior2.java
License:Apache License
protected AjaxEventBehavior newValidateListener() { return new AjaxEventBehavior("validate") { /**/*from ww w . ja v a 2s . com*/ * what's bound to "validate" event in Javascript, and sent to the server */ @Override protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { super.updateAjaxAttributes(attributes); attributes.getDynamicExtraParameters() .add("return [{'name':'newValue', 'value': attrs.event.extraData.newValue}]"); } /** * What's received at the server */ @Override protected void onEvent(AjaxRequestTarget target) { StringValue newValue = RequestCycle.get().getRequest().getRequestParameters() .getParameterValue("newValue"); onValidate(target, newValue.toString()); } }; }
From source file:org.apache.isis.viewer.wicket.ui.pages.accmngt.password_reset.PasswordResetPage.java
License:Apache License
@Override protected void onInitialize() { super.onInitialize(); add(new NotificationPanel("feedback")); StringValue uuidValue = getPageParameters().get(0); if (uuidValue.isEmpty()) { addPasswordResetEmailPanel(ID_CONTENT_PANEL); } else {//from w w w .ja v a2s .com String uuid = uuidValue.toString(); AccountConfirmationMap accountConfirmationMap = getApplication() .getMetaData(AccountConfirmationMap.KEY); final String email = accountConfirmationMap.get(uuid); if (Strings.isEmpty(email)) { error(getString("passwordResetExpiredOrInvalidToken")); addOrReplace(addPasswordResetEmailPanel(ID_CONTENT_PANEL)); } else { Boolean emailExists = IsisContext.doInSession(new Callable<Boolean>() { @Override public Boolean call() throws Exception { UserRegistrationService userRegistrationService = IsisContext.getPersistenceSession() .getServicesInjector().lookupService(UserRegistrationService.class); return userRegistrationService.emailExists(email); } }); if (!emailExists) { error(getString("noUserForAnEmailValidToken")); addOrReplace(addPasswordResetEmailPanel(ID_CONTENT_PANEL)); } else { addPasswordResetPanel(ID_CONTENT_PANEL, uuid); } } } }
From source file:org.apache.isis.viewer.wicket.ui.pages.accmngt.register.RegisterPage.java
License:Apache License
@Override protected void onInitialize() { super.onInitialize(); add(new NotificationPanel("feedback")); final StringValue uuidValue = getPageParameters().get(0); if (uuidValue.isEmpty()) { pageNavigationService.navigateTo(PageType.SIGN_IN); } else {/*from www.ja va 2s . co m*/ String uuid = uuidValue.toString(); AccountConfirmationMap accountConfirmationMap = getApplication() .getMetaData(AccountConfirmationMap.KEY); final String email = accountConfirmationMap.get(uuid); if (Strings.isEmpty(email)) { pageNavigationService.navigateTo(PageType.SIGN_IN); } else { UserDetails userDetails = newUserDetails(); addOrReplace(new RegisterPanel("content", userDetails, uuidValue.toString()) { @Override protected MarkupContainer newExtraFieldsContainer(String id) { return RegisterPage.this.newExtraFieldsContainer(id); } }); } } }
From source file:org.apache.openmeetings.core.remote.red5.ScopeApplicationAdapter.java
License:Apache License
@Override public boolean roomConnect(IConnection conn, Object[] params) { log.debug("roomConnect : "); IServiceCapableConnection service = (IServiceCapableConnection) conn; String streamId = conn.getClient().getId(); log.debug("### Client connected to OpenMeetings, register Client StreamId: " + streamId + " scope " + conn.getScope().getName()); // Set StreamId in Client service.invoke("setId", new Object[] { streamId }, this); Map<String, Object> map = conn.getConnectParams(); String swfURL = map.containsKey("swfUrl") ? (String) map.get("swfUrl") : ""; String tcUrl = map.containsKey("tcUrl") ? (String) map.get("tcUrl") : ""; Map<String, Object> connParams = getConnParams(params); String uid = (String) connParams.get("uid"); String securityCode = (String) connParams.get(SECURITY_CODE_PARAM); if (!Strings.isEmpty(securityCode)) { //FIXME TODO add better mechanism, this is for external applications like ffmpeg Client parent = sessionManager.getClientByPublicSID(securityCode, null); if (parent == null || !parent.getScope().equals(conn.getScope().getName())) { return rejectClient(); }/*from w w w . j ava 2s . co m*/ } if ("networktest".equals(uid)) { return true; } Client parentClient = null; //TODO add similar code for other connections if (map.containsKey("screenClient")) { String parentSid = (String) map.get("parentSid"); parentClient = sessionManager.getClientByPublicSID(parentSid, null); if (parentClient == null) { return rejectClient(); } } Client rcm = new Client(); rcm.setStreamid(conn.getClient().getId()); StringValue scn = StringValue.valueOf(conn.getScope().getName()); rcm.setScope(scn.toString()); long roomId = scn.toLong(Long.MIN_VALUE); if (Long.MIN_VALUE != roomId) { rcm.setRoomId(roomId); } else if (!"hibernate".equals(scn.toString())) { return rejectClient(); } rcm.setUserport(conn.getRemotePort()); rcm.setUserip(conn.getRemoteAddress()); rcm.setSwfurl(swfURL); rcm.setTcUrl(tcUrl); rcm.setNativeSsl(Boolean.TRUE.equals(connParams.get(NATIVE_SSL_PARAM))); rcm.setPublicSID(uid); rcm.setSecurityCode(securityCode); rcm = sessionManager.add(rcm, null); if (rcm == null) { log.warn("Failed to create Client on room connect"); return false; } SessionVariablesUtil.initClient(conn.getClient(), rcm.getPublicSID()); //TODO add similar code for other connections, merge with above block if (map.containsKey("screenClient")) { //TODO add check for room rights String parentSid = parentClient.getPublicSID(); rcm.setRoomId(Long.valueOf(conn.getScope().getName())); rcm.setScreenClient(true); SessionVariablesUtil.setIsScreenClient(conn.getClient()); rcm.setUserId(parentClient.getUserId()); Long userId = rcm.getUserId(); SessionVariablesUtil.setUserId(conn.getClient(), userId); rcm.setStreamPublishName(parentSid); User u = null; if (userId != null) { long _uid = userId.longValue(); u = userDao.get(_uid < 0 ? -_uid : _uid); } if (u != null) { rcm.setUsername(u.getLogin()); rcm.setFirstname(u.getFirstname()); rcm.setLastname(u.getLastname()); } log.debug("publishName :: " + rcm.getStreamPublishName()); sessionManager.updateClientByStreamId(streamId, rcm, false, null); } // Log the User conferenceLogDao.add(ConferenceLog.Type.clientConnect, rcm.getUserId(), streamId, null, rcm.getUserip(), rcm.getScope()); return true; }
From source file:org.apache.openmeetings.web.app.WebSession.java
License:Apache License
public void checkHashes(StringValue secure, StringValue invitation) { try {/*from ww w . j a v a 2 s. c o m*/ if (!secure.isEmpty()) { if (isSignedIn()) { invalidate(); } if (signIn(secure.toString(), false)) { //TODO markUsed } else { //TODO redirect to error } } if (!invitation.isEmpty()) { if (isSignedIn()) { invalidate(); } i = getBean(InvitationDao.class).getByHash(invitation.toString(), false, false); if (i.isAllowEntry()) { Set<Right> rights = new HashSet<>(); //TODO markUsed if (i.getRoom() != null) { rights.add(Right.Room); roomId = i.getRoom().getId(); } else if (i.getAppointment() != null && i.getAppointment().getRoom() != null) { rights.add(Right.Room); roomId = i.getAppointment().getRoom().getId(); } else if (i.getRecording() != null) { recordingId = i.getRecording().getId(); } setUser(i.getInvitee(), rights); } } } catch (Exception e) { //no-op, will continue to sign-in page } }
From source file:org.apache.openmeetings.web.pages.auth.SignInPage.java
License:Apache License
public SignInPage(PageParameters p) { super();//from ww w .ja va 2 s . c o m StringValue oauthid = p.get("oauthid"); if (!oauthid.isEmpty()) { // oauth2 login try { long serverId = oauthid.toLong(-1); OAuthServer server = getBean(OAuth2Dao.class).get(serverId); log.debug("OAuthServer=" + server); if (server == null) { log.warn("OAuth server id=" + serverId + " not found"); return; } if (p.get("code").toString() != null) { // got code String code = p.get("code").toString(); log.debug("OAuth response code=" + code); AuthInfo authInfo = getToken(code, server); if (authInfo == null) return; log.debug("OAuthInfo=" + authInfo); Map<String, String> authParams = getAuthParams(authInfo.accessToken, code, server); if (authParams != null) { loginViaOAuth2(authParams, serverId); } } else { // redirect to get code String redirectUrl = prepareUrlParams(server.getRequestKeyUrl(), server.getClientId(), null, null, getRedirectUri(server, this), null); log.debug("redirectUrl=" + redirectUrl); throw new RedirectToUrlException(redirectUrl); } } catch (IOException e) { log.error("OAuth2 login error", e); } catch (NoSuchAlgorithmException e) { log.error("OAuth2 login error", e); } } //will try to login directly using parameters sent by POST IRequestParameters pp = RequestCycle.get().getRequest().getPostParameters(); StringValue login = pp.getParameterValue("login"), password = pp.getParameterValue("password"); if (!login.isEmpty() && !password.isEmpty()) { if (WebSession.get().signIn(login.toString(), password.toString(), Type.user, null)) { setResponsePage(Application.get().getHomePage()); } else { log.error("Failed to login using POST parameters passed"); } } RegisterDialog r = new RegisterDialog("register"); ForgetPasswordDialog f = new ForgetPasswordDialog("forget"); d = new SignInDialog("signin"); d.setRegisterDialog(r); d.setForgetPasswordDialog(f); r.setSignInDialog(d); f.setSignInDialog(d); m = new KickMessageDialog("kick"); add(d.setVisible(!WebSession.get().isKickedByAdmin()), r.setVisible(allowRegister()), f, m.setVisible(WebSession.get().isKickedByAdmin())); }
From source file:org.apache.openmeetings.web.pages.BasePage.java
License:Apache License
protected OmUrlFragment getUrlFragment(IRequestParameters params) { for (AreaKeys key : AreaKeys.values()) { StringValue type = params.getParameterValue(key.name()); if (!type.isEmpty()) { return new OmUrlFragment(key, type.toString()); }/*from ww w. jav a 2 s . c om*/ } return null; }
From source file:org.apache.openmeetings.web.pages.HashPage.java
License:Apache License
public HashPage(PageParameters p) { StringValue secure = p.get(SECURE_HASH); if (secure.isEmpty()) { secure = p.get(HASH);//from ww w . j av a2s. co m } StringValue invitation = p.get(INVITATION_HASH); WebSession ws = WebSession.get(); ws.checkHashes(secure, invitation); recContainer.setVisible(false); add(new EmptyPanel(PANEL_MAIN).setVisible(false)); if (!invitation.isEmpty()) { Invitation i = ws.getInvitation(); if (i == null) { errorKey = "535"; } else if (!i.isAllowEntry()) { errorKey = Valid.OneTime == i.getValid() ? "534" : "1271"; } else { Recording rec = i.getRecording(); if (rec != null) { vi.setVisible(!i.isPasswordProtected()); vp.setVisible(!i.isPasswordProtected()); if (!i.isPasswordProtected()) { vi.update(null, rec); vp.update(null, rec); } recContainer.setVisible(true); error = false; } Room r = i.getRoom(); if (r != null) { createRoom(p, r.getId()); } } } else if (!secure.isEmpty()) { Long recId = getRecordingId(), roomId = ws.getRoomId(); if (recId == null && roomId == null) { errorKey = "1599"; } else if (recId != null) { recContainer.setVisible(true); Recording rec = getBean(RecordingDao.class).get(recId); vi.update(null, rec); vp.update(null, rec); error = false; } else { createRoom(p, roomId); } } StringValue swf = p.get(SWF); if (!swf.isEmpty() && (SWF_TYPE_NETWORK.equals(swf.toString()) || SWF_TYPE_SETTINGS.equals(swf.toString()))) { createRoom(p, null); } add(recContainer.add(vi.setShowShare(false).setOutputMarkupPlaceholderTag(true), vp.setOutputMarkupPlaceholderTag(true), new InvitationPasswordDialog("i-pass", this))); }